From f31293797273c34b65dbaefc41763b80969669c6 Mon Sep 17 00:00:00 2001 From: Mihir Patel Date: Tue, 30 Apr 2024 14:52:29 -0400 Subject: [PATCH 1/3] deprecate and bump version --- composer/_version.py | 2 +- composer/models/huggingface.py | 12 ------------ docker/README.md | 4 ++-- docker/build_matrix.yaml | 12 ++++++------ docker/generate_build_matrix.py | 2 +- 5 files changed, 10 insertions(+), 22 deletions(-) diff --git a/composer/_version.py b/composer/_version.py index c78074d7f4..e2fe7dc153 100644 --- a/composer/_version.py +++ b/composer/_version.py @@ -3,4 +3,4 @@ """The Composer Version.""" -__version__ = '0.22.0.dev0' +__version__ = '0.23.0.dev0' diff --git a/composer/models/huggingface.py b/composer/models/huggingface.py index 9a84cda5c7..ef0e89d93a 100644 --- a/composer/models/huggingface.py +++ b/composer/models/huggingface.py @@ -510,18 +510,6 @@ def eval_forward(self, batch, outputs: Optional[Any] = None): 'Generation eval cannot be used without providing a tokenizer to the model constructor.', ) - if 'generation_length' in batch: - warnings.warn( - VersionedDeprecationWarning( - '`generation_length` has been deprecated in favor of passing `max_new_tokens` directly into `generation_kwargs`.', - remove_version='0.22.0', - ), - ) - if 'generation_kwargs' in batch: - batch['generation_kwargs']['max_new_tokens'] = batch['generation_length'] - else: - batch['generation_kwargs'] = {'max_new_tokens': batch['generation_length']} - self.labels = batch.pop('labels') generation = self.generate( batch['input_ids'], diff --git a/docker/README.md b/docker/README.md index 67a2cee382..67df3a5689 100644 --- a/docker/README.md +++ b/docker/README.md @@ -15,8 +15,8 @@ all dependencies for both NLP and Vision models. They are built on top of the | Composer Version | CUDA Support | Docker Tag | |--------------------|----------------|----------------------------------------------------------------| -| 0.21.3 | Yes | `mosaicml/composer:latest`, `mosaicml/composer:0.21.3` | -| 0.21.3 | No | `mosaicml/composer:latest_cpu`, `mosaicml/composer:0.21.3_cpu` | +| 0.22.0 | Yes | `mosaicml/composer:latest`, `mosaicml/composer:0.22.0` | +| 0.22.0 | No | `mosaicml/composer:latest_cpu`, `mosaicml/composer:0.22.0_cpu` | **Note**: For a lightweight installation, we recommended using a [MosaicML PyTorch Image](#pytorch-images) and manually diff --git a/docker/build_matrix.yaml b/docker/build_matrix.yaml index 14fbfd297b..f133abab6d 100644 --- a/docker/build_matrix.yaml +++ b/docker/build_matrix.yaml @@ -205,9 +205,9 @@ TORCHVISION_VERSION: 0.16.2 - AWS_OFI_NCCL_VERSION: '' BASE_IMAGE: nvidia/cuda:12.1.1-cudnn8-devel-ubuntu20.04 - COMPOSER_INSTALL_COMMAND: mosaicml[all]==0.21.3 + COMPOSER_INSTALL_COMMAND: mosaicml[all]==0.22.0 CUDA_VERSION: 12.1.1 - IMAGE_NAME: composer-0-21-3 + IMAGE_NAME: composer-0-22-0 MOFED_VERSION: 5.5-1.0.3.2 NVIDIA_REQUIRE_CUDA_OVERRIDE: cuda>=12.1 brand=tesla,driver>=450,driver<451 brand=tesla,driver>=470,driver<471 brand=unknown,driver>=470,driver<471 brand=nvidia,driver>=470,driver<471 brand=nvidiartx,driver>=470,driver<471 @@ -228,15 +228,15 @@ PYTORCH_NIGHTLY_VERSION: '' PYTORCH_VERSION: 2.2.1 TAGS: - - mosaicml/composer:0.21.3 + - mosaicml/composer:0.22.0 - mosaicml/composer:latest TARGET: composer_stage TORCHVISION_VERSION: 0.17.1 - AWS_OFI_NCCL_VERSION: '' BASE_IMAGE: ubuntu:20.04 - COMPOSER_INSTALL_COMMAND: mosaicml[all]==0.21.3 + COMPOSER_INSTALL_COMMAND: mosaicml[all]==0.22.0 CUDA_VERSION: '' - IMAGE_NAME: composer-0-21-3-cpu + IMAGE_NAME: composer-0-22-0-cpu MOFED_VERSION: 5.5-1.0.3.2 NVIDIA_REQUIRE_CUDA_OVERRIDE: '' PYTHON_VERSION: '3.10' @@ -244,7 +244,7 @@ PYTORCH_NIGHTLY_VERSION: '' PYTORCH_VERSION: 2.2.1 TAGS: - - mosaicml/composer:0.21.3_cpu + - mosaicml/composer:0.22.0_cpu - mosaicml/composer:latest_cpu TARGET: composer_stage TORCHVISION_VERSION: 0.17.1 diff --git a/docker/generate_build_matrix.py b/docker/generate_build_matrix.py index 82a6e9861c..c8cec98d25 100644 --- a/docker/generate_build_matrix.py +++ b/docker/generate_build_matrix.py @@ -231,7 +231,7 @@ def _main(): composer_entries = [] # The `GIT_COMMIT` is a placeholder and Jenkins will substitute it with the actual git commit for the `composer_staging` images - composer_versions = ['0.21.3'] # Only build images for the latest composer version + composer_versions = ['0.22.0'] # Only build images for the latest composer version composer_python_versions = [PRODUCTION_PYTHON_VERSION] # just build composer against the latest for product in itertools.product(composer_python_versions, composer_versions, cuda_options): From ba7c76258f69310eb47f3830703bdc75e7653551 Mon Sep 17 00:00:00 2001 From: Mihir Patel Date: Tue, 30 Apr 2024 15:00:23 -0400 Subject: [PATCH 2/3] lint --- composer/models/huggingface.py | 1 - 1 file changed, 1 deletion(-) diff --git a/composer/models/huggingface.py b/composer/models/huggingface.py index ef0e89d93a..8aa36dfea4 100644 --- a/composer/models/huggingface.py +++ b/composer/models/huggingface.py @@ -24,7 +24,6 @@ from composer.devices import DeviceCPU from composer.models.base import ComposerModel from composer.utils import MissingConditionalImportError, dist, get_file, import_object, is_model_fsdp, safe_torch_load -from composer.utils.warnings import VersionedDeprecationWarning try: from peft import PeftModel, get_peft_model From 461e424686db9b230b7e8a7669c491094dd2df13 Mon Sep 17 00:00:00 2001 From: Mihir Patel Date: Tue, 30 Apr 2024 15:23:48 -0400 Subject: [PATCH 3/3] remove deprecatio test --- tests/models/test_hf_model.py | 20 -------------------- 1 file changed, 20 deletions(-) diff --git a/tests/models/test_hf_model.py b/tests/models/test_hf_model.py index de2b7c94f4..8625286c73 100644 --- a/tests/models/test_hf_model.py +++ b/tests/models/test_hf_model.py @@ -1327,26 +1327,6 @@ def test_eval_forward_generate(device, world_size, hf_model, hf_tokenizer, use_f assert all(isinstance(decoded_generation, str) for decoded_generation in generation2) -def test_eval_forward_generate_adjust_generation_length(tiny_gpt2_model, tiny_gpt2_tokenizer): - model = HuggingFaceModel(tiny_gpt2_model, tokenizer=tiny_gpt2_tokenizer, use_logits=True) - input_dict = tiny_gpt2_tokenizer(['hello', 'goodbyes'], return_tensors='pt', padding=True) - - input_dict['mode'] = 'generate' - input_dict['generation_kwargs'] = {} - input_dict['generation_length'] = 5 - input_dict['labels'] = [['answer1'], ['answer2']] - with pytest.warns(DeprecationWarning): - generation1 = model.eval_forward(input_dict, None) - - input_dict['generation_length'] = 3 - input_dict['labels'] = [['answer1'], ['answer2']] - generation2 = model.eval_forward(input_dict, None) - - assert len(generation1) == len(generation2) == 2 - assert all(isinstance(decoded_generation, str) for decoded_generation in generation1) - assert all(isinstance(decoded_generation, str) for decoded_generation in generation2) - - @pytest.mark.parametrize('peft_type', ['LORA', 'loRa']) @pytest.mark.parametrize('task_type', ['CAUSAL_LM', 'causal_lm']) def test_peft_init(peft_type: str, task_type: str, tiny_gpt2_model, gpt2_peft_config):