From 975a64002acf2a2b1de2c6abd19fe61df30925d7 Mon Sep 17 00:00:00 2001 From: Eugene Khvedchenya Date: Thu, 23 Nov 2023 11:11:14 +0200 Subject: [PATCH] New SG version to reflect bugfixes in DG (#1657) * Update version * Postpone removal of deprecated classes from 3.5.0 to 4.0.0 * Change removed_at version to 3.6.0 * Revert * Revert --- .../PTQ_and_QAT_for_classification.ipynb | 2 +- notebooks/dataloader_adapter.ipynb | 2 +- ...ection_how_to_connect_custom_dataset.ipynb | 2 +- ...edge_distillation_for_classification.ipynb | 2 +- notebooks/quickstart_segmentation.ipynb | 2 +- .../segmentation_connect_custom_dataset.ipynb | 2 +- .../transfer_learning_classification.ipynb | 2 +- ...nsfer_learning_semantic_segmentation.ipynb | 2 +- .../what_are_recipes_and_how_to_use.ipynb | 2 +- .../yolo_nas_pose_eval_with_pycocotools.ipynb | 2 +- src/super_gradients/__init__.py | 2 +- .../examples/model_export/models_export.ipynb | 2 +- .../model_export/models_export_pose.ipynb | 2 +- .../label_smoothing_cross_entropy_loss.py | 2 +- .../training/models/__init__.py | 8 +++---- .../training/utils/callbacks/callbacks.py | 21 +++++++++---------- .../utils/distributed_training_utils.py | 12 +++++------ 17 files changed, 34 insertions(+), 35 deletions(-) diff --git a/notebooks/PTQ_and_QAT_for_classification.ipynb b/notebooks/PTQ_and_QAT_for_classification.ipynb index fed0a95224..a29eec3aa3 100644 --- a/notebooks/PTQ_and_QAT_for_classification.ipynb +++ b/notebooks/PTQ_and_QAT_for_classification.ipynb @@ -61,7 +61,7 @@ }, "outputs": [], "source": [ - "!pip -qq install super-gradients==3.4.1 pytorch-quantization==2.1.2 --extra-index-url https://pypi.ngc.nvidia.com" + "!pip -qq install super-gradients==3.5.0 pytorch-quantization==2.1.2 --extra-index-url https://pypi.ngc.nvidia.com" ] }, { diff --git a/notebooks/dataloader_adapter.ipynb b/notebooks/dataloader_adapter.ipynb index 5c1b3ad525..d7e11acd62 100644 --- a/notebooks/dataloader_adapter.ipynb +++ b/notebooks/dataloader_adapter.ipynb @@ -51,7 +51,7 @@ { "cell_type": "code", "source": [ - "!pip install -q super-gradients==3.4.1" + "!pip install -q super-gradients==3.5.0" ], "metadata": { "id": "0puCRQGZSP8r", diff --git a/notebooks/detection_how_to_connect_custom_dataset.ipynb b/notebooks/detection_how_to_connect_custom_dataset.ipynb index f95fedf165..23cab24666 100644 --- a/notebooks/detection_how_to_connect_custom_dataset.ipynb +++ b/notebooks/detection_how_to_connect_custom_dataset.ipynb @@ -90,7 +90,7 @@ }, "outputs": [], "source": [ - "! pip install -q super_gradients==3.4.1" + "! pip install -q super_gradients==3.5.0" ] }, { diff --git a/notebooks/how_to_use_knowledge_distillation_for_classification.ipynb b/notebooks/how_to_use_knowledge_distillation_for_classification.ipynb index 1f2a9ccdd4..bbefb0cf11 100644 --- a/notebooks/how_to_use_knowledge_distillation_for_classification.ipynb +++ b/notebooks/how_to_use_knowledge_distillation_for_classification.ipynb @@ -34,7 +34,7 @@ }, "outputs": [], "source": [ - "!pip install -qq super_gradients==3.4.1" + "!pip install -qq super_gradients==3.5.0" ] }, { diff --git a/notebooks/quickstart_segmentation.ipynb b/notebooks/quickstart_segmentation.ipynb index 04386d76ab..c2aee04871 100644 --- a/notebooks/quickstart_segmentation.ipynb +++ b/notebooks/quickstart_segmentation.ipynb @@ -55,7 +55,7 @@ }, "outputs": [], "source": [ - "! pip install -qq super-gradients==3.4.1" + "! pip install -qq super-gradients==3.5.0" ] }, { diff --git a/notebooks/segmentation_connect_custom_dataset.ipynb b/notebooks/segmentation_connect_custom_dataset.ipynb index 8cce51322c..8cd7a96cd0 100644 --- a/notebooks/segmentation_connect_custom_dataset.ipynb +++ b/notebooks/segmentation_connect_custom_dataset.ipynb @@ -141,7 +141,7 @@ } ], "source": [ - "! pip install -qq super-gradients==3.4.1" + "! pip install -qq super-gradients==3.5.0" ] }, { diff --git a/notebooks/transfer_learning_classification.ipynb b/notebooks/transfer_learning_classification.ipynb index 7ffaf02f6c..7a2442e765 100644 --- a/notebooks/transfer_learning_classification.ipynb +++ b/notebooks/transfer_learning_classification.ipynb @@ -59,7 +59,7 @@ } ], "source": [ - "! pip install -qq super-gradients==3.4.1" + "! pip install -qq super-gradients==3.5.0" ] }, { diff --git a/notebooks/transfer_learning_semantic_segmentation.ipynb b/notebooks/transfer_learning_semantic_segmentation.ipynb index 87480d3679..cac34f8256 100644 --- a/notebooks/transfer_learning_semantic_segmentation.ipynb +++ b/notebooks/transfer_learning_semantic_segmentation.ipynb @@ -149,7 +149,7 @@ } ], "source": [ - "! pip install -qq super-gradients==3.4.1" + "! pip install -qq super-gradients==3.5.0" ] }, { diff --git a/notebooks/what_are_recipes_and_how_to_use.ipynb b/notebooks/what_are_recipes_and_how_to_use.ipynb index 73ff2c77f1..d9c319d123 100644 --- a/notebooks/what_are_recipes_and_how_to_use.ipynb +++ b/notebooks/what_are_recipes_and_how_to_use.ipynb @@ -41,7 +41,7 @@ { "cell_type": "code", "source": [ - "!pip install -q super-gradients==3.4.1" + "!pip install -q super-gradients==3.5.0" ], "metadata": { "id": "8uZM-4va5Rpu", diff --git a/notebooks/yolo_nas_pose_eval_with_pycocotools.ipynb b/notebooks/yolo_nas_pose_eval_with_pycocotools.ipynb index 4ff8dbd9cb..5eb8b556da 100644 --- a/notebooks/yolo_nas_pose_eval_with_pycocotools.ipynb +++ b/notebooks/yolo_nas_pose_eval_with_pycocotools.ipynb @@ -36,7 +36,7 @@ "execution_count": null, "outputs": [], "source": [ - "!pip install -qq super_gradients==3.4.1" + "!pip install -qq super_gradients==3.5.0" ], "metadata": { "collapsed": false diff --git a/src/super_gradients/__init__.py b/src/super_gradients/__init__.py index 06522510a3..ba58091606 100755 --- a/src/super_gradients/__init__.py +++ b/src/super_gradients/__init__.py @@ -1,4 +1,4 @@ -__version__ = "3.4.1" +__version__ = "3.5.0" from super_gradients.common import init_trainer, is_distributed, object_names from super_gradients.training import losses, utils, datasets_utils, DataAugmentation, Trainer, KDTrainer, QATTrainer diff --git a/src/super_gradients/examples/model_export/models_export.ipynb b/src/super_gradients/examples/model_export/models_export.ipynb index d8c4d92e4b..9e22a49118 100644 --- a/src/super_gradients/examples/model_export/models_export.ipynb +++ b/src/super_gradients/examples/model_export/models_export.ipynb @@ -49,7 +49,7 @@ "execution_count": null, "outputs": [], "source": [ - "!pip install -qq super_gradients==3.4.1" + "!pip install -qq super_gradients==3.5.0" ], "metadata": { "collapsed": false diff --git a/src/super_gradients/examples/model_export/models_export_pose.ipynb b/src/super_gradients/examples/model_export/models_export_pose.ipynb index 28f251af43..0b6b37063d 100644 --- a/src/super_gradients/examples/model_export/models_export_pose.ipynb +++ b/src/super_gradients/examples/model_export/models_export_pose.ipynb @@ -58,7 +58,7 @@ "execution_count": 24, "outputs": [], "source": [ - "!pip install -qq super-gradients==3.4.1" + "!pip install -qq super-gradients==3.5.0" ], "metadata": { "collapsed": false, diff --git a/src/super_gradients/training/losses/label_smoothing_cross_entropy_loss.py b/src/super_gradients/training/losses/label_smoothing_cross_entropy_loss.py index 5f98505ffe..7be4eb5b86 100755 --- a/src/super_gradients/training/losses/label_smoothing_cross_entropy_loss.py +++ b/src/super_gradients/training/losses/label_smoothing_cross_entropy_loss.py @@ -112,7 +112,7 @@ def forward(self, input, target, smooth_dist=None): return loss, loss.unsqueeze(0).detach() -@deprecated(deprecated_since="3.2.1", removed_from="3.5.0", target=CrossEntropyLoss) +@deprecated(deprecated_since="3.2.1", removed_from="3.6.0", target=CrossEntropyLoss) @register_loss("LabelSmoothingCrossEntropyLoss") class LabelSmoothingCrossEntropyLoss(CrossEntropyLoss): ... diff --git a/src/super_gradients/training/models/__init__.py b/src/super_gradients/training/models/__init__.py index 1fbb7d1df2..8ed889231e 100755 --- a/src/super_gradients/training/models/__init__.py +++ b/src/super_gradients/training/models/__init__.py @@ -135,7 +135,7 @@ from super_gradients.training.utils import make_divisible as _make_divisible_current_version, HpmStruct as CurrVersionHpmStruct -@deprecated(deprecated_since="3.1.0", removed_from="3.5.0", target=_make_divisible_current_version) +@deprecated(deprecated_since="3.1.0", removed_from="3.6.0", target=_make_divisible_current_version) def make_divisible(x: int, divisor: int, ceil: bool = True) -> int: """ Returns x evenly divisible by divisor. @@ -144,17 +144,17 @@ def make_divisible(x: int, divisor: int, ceil: bool = True) -> int: return _make_divisible_current_version(x=x, divisor=divisor, ceil=ceil) -@deprecated(deprecated_since="3.1.0", removed_from="3.5.0", target=BasicResNetBlock, reason="This block was renamed to BasicResNetBlock for better clarity.") +@deprecated(deprecated_since="3.1.0", removed_from="3.6.0", target=BasicResNetBlock, reason="This block was renamed to BasicResNetBlock for better clarity.") class BasicBlock(BasicResNetBlock): ... -@deprecated(deprecated_since="3.1.0", removed_from="3.5.0", target=NewBottleneck, reason="This block was renamed to BasicResNetBlock for better clarity.") +@deprecated(deprecated_since="3.1.0", removed_from="3.6.0", target=NewBottleneck, reason="This block was renamed to BasicResNetBlock for better clarity.") class Bottleneck(NewBottleneck): ... -@deprecated(deprecated_since="3.1.0", removed_from="3.5.0", target=CurrVersionHpmStruct) +@deprecated(deprecated_since="3.1.0", removed_from="3.6.0", target=CurrVersionHpmStruct) class HpmStruct(CurrVersionHpmStruct): ... diff --git a/src/super_gradients/training/utils/callbacks/callbacks.py b/src/super_gradients/training/utils/callbacks/callbacks.py index 4d91b75cda..407efd7150 100644 --- a/src/super_gradients/training/utils/callbacks/callbacks.py +++ b/src/super_gradients/training/utils/callbacks/callbacks.py @@ -315,17 +315,17 @@ def is_lr_scheduling_enabled(self, context): return self.training_params.lr_warmup_epochs > 0 and self.training_params.lr_warmup_epochs >= context.epoch -@deprecated(deprecated_since="3.2.1", removed_from="3.5.0", target=LinearEpochLRWarmup) +@deprecated(deprecated_since="3.2.1", removed_from="3.6.0", target=LinearEpochLRWarmup) class EpochStepWarmupLRCallback(LinearEpochLRWarmup): ... -@deprecated(deprecated_since="3.2.1", removed_from="3.5.0", target=LinearEpochLRWarmup) +@deprecated(deprecated_since="3.2.1", removed_from="3.6.0", target=LinearEpochLRWarmup) class LinearLRWarmup(LinearEpochLRWarmup): ... -@deprecated(deprecated_since="3.2.1", removed_from="3.5.0", target=LinearEpochLRWarmup) +@deprecated(deprecated_since="3.2.1", removed_from="3.6.0", target=LinearEpochLRWarmup) class LinearStepWarmupLRCallback(LinearEpochLRWarmup): ... @@ -407,7 +407,7 @@ def update_lr(self, optimizer, epoch, batch_idx=None): param_group["lr"] = self.lr[param_group["name"]] -@deprecated(deprecated_since="3.2.1", removed_from="3.5.0", target=LinearBatchLRWarmup) +@deprecated(deprecated_since="3.2.1", removed_from="3.6.0", target=LinearBatchLRWarmup) class BatchStepLinearWarmupLRCallback(LinearBatchLRWarmup): ... @@ -444,7 +444,7 @@ def is_lr_scheduling_enabled(self, context): return self.training_params.lr_warmup_epochs <= context.epoch -@deprecated(deprecated_since="3.2.1", removed_from="3.5.0", target=StepLRScheduler) +@deprecated(deprecated_since="3.2.1", removed_from="3.6.0", target=StepLRScheduler) class StepLRCallback(StepLRScheduler): ... @@ -471,7 +471,7 @@ def is_lr_scheduling_enabled(self, context): return self.training_params.lr_warmup_epochs <= context.epoch < post_warmup_epochs -@deprecated(deprecated_since="3.2.1", removed_from="3.5.0", target=ExponentialLRScheduler) +@deprecated(deprecated_since="3.2.1", removed_from="3.6.0", target=ExponentialLRScheduler) class ExponentialLRCallback(ExponentialLRScheduler): ... @@ -500,7 +500,7 @@ def is_lr_scheduling_enabled(self, context): return self.training_params.lr_warmup_epochs <= context.epoch < post_warmup_epochs -@deprecated(deprecated_since="3.2.1", removed_from="3.5.0", target=PolyLRScheduler) +@deprecated(deprecated_since="3.2.1", removed_from="3.6.0", target=PolyLRScheduler) class PolyLRCallback(PolyLRScheduler): ... @@ -543,7 +543,7 @@ def compute_learning_rate(cls, step: Union[float, np.ndarray], total_steps: floa return lr * (1 - final_lr_ratio) + (initial_lr * final_lr_ratio) -@deprecated(deprecated_since="3.2.1", removed_from="3.5.0", target=CosineLRScheduler) +@deprecated(deprecated_since="3.2.1", removed_from="3.6.0", target=CosineLRScheduler) class CosineLRCallback(CosineLRScheduler): ... @@ -554,7 +554,7 @@ class FunctionLRScheduler(LRCallbackBase): Hard coded rate scheduling for user defined lr scheduling function. """ - @deprecated(deprecated_since="3.2.0", removed_from="3.5.0", reason="This callback is deprecated and will be removed in future versions.") + @deprecated(deprecated_since="3.2.0", removed_from="3.6.0", reason="This callback is deprecated and will be removed in future versions.") def __init__(self, max_epochs, lr_schedule_function, **kwargs): super().__init__(Phase.TRAIN_BATCH_STEP, **kwargs) assert callable(lr_schedule_function), "self.lr_function must be callable" @@ -579,7 +579,7 @@ def perform_scheduling(self, context): self.update_lr(context.optimizer, context.epoch, context.batch_idx) -@deprecated(deprecated_since="3.2.1", removed_from="3.5.0", target=FunctionLRScheduler) +@deprecated(deprecated_since="3.2.1", removed_from="3.6.0", target=FunctionLRScheduler) class FunctionLRCallback(FunctionLRScheduler): ... @@ -1232,7 +1232,6 @@ def _on_batch_end(self, context: PhaseContext) -> None: self.metric.reset() else: - # FOR LOSS VALUES, GET THE RIGHT COMPONENT, DERIVE IT ON THE FIRST PASS loss_tuple = context.loss_log_items if self._first_call: diff --git a/src/super_gradients/training/utils/distributed_training_utils.py b/src/super_gradients/training/utils/distributed_training_utils.py index 2887be03c4..43ff8e4169 100755 --- a/src/super_gradients/training/utils/distributed_training_utils.py +++ b/src/super_gradients/training/utils/distributed_training_utils.py @@ -154,7 +154,7 @@ def compute_precise_bn_stats(model: nn.Module, loader: torch.utils.data.DataLoad bn.momentum = momentums[i] -@deprecated(deprecated_since="3.2.1", removed_from="3.5.0", target=_get_local_rank) +@deprecated(deprecated_since="3.2.1", removed_from="3.6.0", target=_get_local_rank) def get_local_rank(): """ Returns the local rank if running in DDP, and 0 otherwise @@ -163,12 +163,12 @@ def get_local_rank(): return _get_local_rank() -@deprecated(deprecated_since="3.2.1", removed_from="3.5.0", target=_is_ddp_subprocess) +@deprecated(deprecated_since="3.2.1", removed_from="3.6.0", target=_is_ddp_subprocess) def is_ddp_subprocess(): return _is_ddp_subprocess() -@deprecated(deprecated_since="3.2.1", removed_from="3.5.0", target=_get_world_size) +@deprecated(deprecated_since="3.2.1", removed_from="3.6.0", target=_get_world_size) def get_world_size() -> int: """ Returns the world size if running in DDP, and 1 otherwise @@ -177,17 +177,17 @@ def get_world_size() -> int: return _get_world_size() -@deprecated(deprecated_since="3.2.1", removed_from="3.5.0", target=_get_device_ids) +@deprecated(deprecated_since="3.2.1", removed_from="3.6.0", target=_get_device_ids) def get_device_ids() -> List[int]: return _get_device_ids() -@deprecated(deprecated_since="3.2.1", removed_from="3.5.0", target=_count_used_devices) +@deprecated(deprecated_since="3.2.1", removed_from="3.6.0", target=_count_used_devices) def count_used_devices() -> int: return _count_used_devices() -@deprecated(deprecated_since="3.2.1", removed_from="3.5.0", target=_require_ddp_setup) +@deprecated(deprecated_since="3.2.1", removed_from="3.6.0", target=_require_ddp_setup) def require_ddp_setup() -> bool: return _require_ddp_setup()