{"language": "Python", "id": 94, "repo_owner": "mosaicml", "repo_name": "composer", "head_branch": "composer_lora", "workflow_name": "Code Quality Checks", "workflow_filename": "code-quality.yaml", "workflow_path": ".github/workflows/code-quality.yaml", "contributor": "dakinggg", "sha_fail": "4b7e4724b2f92741fb094421ebfa60be5bfb18d9", "sha_success": "09346e7f3367ae17409d2a153ec02db1869e09e0", "workflow": "name: Code Quality Checks\non:\n push:\n branches:\n - dev\n - main\n - release/**\n pull_request:\n workflow_call:\n workflow_dispatch:\n# Cancel old runs when a new commit is pushed to the same branch if not on main or dev\nconcurrency:\n group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}\n cancel-in-progress: ${{ github.ref != 'refs/heads/main' && github.ref != 'refs/heads/dev' }}\ndefaults:\n run:\n working-directory: .\njobs:\n code-quality:\n runs-on: ubuntu-20.04\n timeout-minutes: 10\n strategy:\n matrix:\n python_version:\n - \"3.8\"\n - \"3.9\"\n - \"3.10\"\n pip_deps:\n - \"[dev]\"\n steps:\n - uses: actions/checkout@v3\n - uses: actions/setup-python@v4\n with:\n python-version: ${{ matrix.python_version }}\n - name: Setup\n run: |\n set -ex\n python -m pip install --upgrade 'pip<23' wheel\n python -m pip install --upgrade .${{ matrix.pip_deps }}\n - name: Run checks\n run: |\n pre-commit run --all-files\n", "logs": [{"step_name": "code-quality (3.8, [dev])/5_Run checks.txt", "log": "##[group]Run pre-commit run --all-files\n\u001b[36;1mpre-commit run --all-files\u001b[0m\nshell: /usr/bin/bash -e {0}\nenv:\n pythonLocation: /opt/hostedtoolcache/Python/3.8.18/x64\n PKG_CONFIG_PATH: /opt/hostedtoolcache/Python/3.8.18/x64/lib/pkgconfig\n Python_ROOT_DIR: /opt/hostedtoolcache/Python/3.8.18/x64\n Python2_ROOT_DIR: /opt/hostedtoolcache/Python/3.8.18/x64\n Python3_ROOT_DIR: /opt/hostedtoolcache/Python/3.8.18/x64\n LD_LIBRARY_PATH: /opt/hostedtoolcache/Python/3.8.18/x64/lib\n##[endgroup]\n[INFO] Initializing environment for https://github.com/astral-sh/ruff-pre-commit.\n[INFO] Initializing environment for https://github.com/google/yapf.\n[INFO] Initializing environment for https://github.com/google/yapf:toml.\n[INFO] Initializing environment for https://github.com/pycqa/isort.\n[INFO] Initializing environment for https://github.com/PyCQA/pydocstyle.\n[INFO] Initializing environment for https://github.com/PyCQA/pydocstyle:toml.\n[INFO] Initializing environment for https://github.com/pre-commit/pre-commit-hooks.\n[INFO] Initializing environment for https://github.com/Lucas-C/pre-commit-hooks.\n[INFO] Initializing environment for https://github.com/kynan/nbstripout.\n[INFO] Initializing environment for local:pyright@1.1.256.\n[INFO] Initializing environment for https://github.com/trufflesecurity/trufflehog.git.\n[INFO] Installing environment for https://github.com/astral-sh/ruff-pre-commit.\n[INFO] Once installed this environment will be reused.\n[INFO] This may take a few minutes...\n[INFO] Installing environment for https://github.com/google/yapf.\n[INFO] Once installed this environment will be reused.\n[INFO] This may take a few minutes...\n[INFO] Installing environment for https://github.com/pycqa/isort.\n[INFO] Once installed this environment will be reused.\n[INFO] This may take a few minutes...\n[INFO] Installing environment for https://github.com/PyCQA/pydocstyle.\n[INFO] Once installed this environment will be reused.\n[INFO] This may take a few minutes...\n[INFO] Installing environment for https://github.com/pre-commit/pre-commit-hooks.\n[INFO] Once installed this environment will be reused.\n[INFO] This may take a few minutes...\n[INFO] Installing environment for https://github.com/Lucas-C/pre-commit-hooks.\n[INFO] Once installed this environment will be reused.\n[INFO] This may take a few minutes...\n[INFO] Installing environment for https://github.com/kynan/nbstripout.\n[INFO] Once installed this environment will be reused.\n[INFO] This may take a few minutes...\n[INFO] Installing environment for local.\n[INFO] Once installed this environment will be reused.\n[INFO] This may take a few minutes...\n[INFO] Installing environment for https://github.com/trufflesecurity/trufflehog.git.\n[INFO] Once installed this environment will be reused.\n[INFO] This may take a few minutes...\nruff.....................................................................Passed\nyapf.....................................................................Failed\n- hook id: yapf\n- files were modified by this hook\n\nReformatting composer/datasets/imagenet.py\nReformatting tests/loggers/test_cometml_logger.py\nReformatting tests/algorithms/test_gradient_clipping.py\nReformatting tests/fixtures/__init__.py\nReformatting composer/callbacks/runtime_estimator.py\nReformatting composer/__init__.py\nReformatting composer/trainer/mosaic_fsdp.py\nReformatting composer/models/efficientnetb0/__init__.py\nReformatting composer/callbacks/export_for_inference.py\nReformatting composer/algorithms/cutmix/__init__.py\nReformatting composer/profiler/profiler_action.py\nReformatting tests/datasets/test_mnist.py\nReformatting composer/utils/inference.py\nReformatting tests/trainer/test_predict.py\nReformatting composer/algorithms/randaugment/__init__.py\nReformatting tests/test_notebooks.py\nReformatting composer/algorithms/alibi/__init__.py\nReformatting composer/models/tasks/__init__.py\nReformatting composer/utils/object_store/gcs_object_store.py\nReformatting composer/models/unet/unet.py\nReformatting composer/utils/object_store/object_store.py\nReformatting composer/loggers/remote_uploader_downloader.py\nReformatting composer/utils/eval_client/local_eval_client.py\nReformatting composer/devices/__init__.py\nReformatting tests/utils/test_file_helpers.py\nReformatting composer/algorithms/ema/__init__.py\nReformatting tests/algorithms/test_cutmix.py\nReformatting tests/fixtures/autouse_fixtures.py\nReformatting composer/_version.py\nReformatting composer/core/time.py\nReformatting tests/common/models.py\nReformatting composer/utils/device.py\nReformatting tests/test_passes.py\nReformatting tests/datasets/test_synthetic_data.py\nReformatting tests/utils/__init__.py\nReformatting composer/trainer/__init__.py\nReformatting tests/utils/test_module_surgery.py\nReformatting composer/models/unet/__init__.py\nReformatting tests/callbacks/test_inference.py\nReformatting composer/loggers/wandb_logger.py\nReformatting composer/algorithms/alibi/attention_surgery_functions/_bert.py\nReformatting tests/algorithms/test_channels_last.py\nReformatting tests/common/__init__.py\nReformatting tests/test_split_batch.py\nReformatting composer/algorithms/factorize/factorize_core.py\nReformatting composer/utils/string_enum.py\nReformatting composer/profiler/profiler_schedule.py\nReformatting tests/models/test_bert.py\nReformatting tests/algorithms/test_blurpool_layers.py\nReformatting composer/devices/device_gpu.py\nReformatting docs/source/doctest_cleanup.py\nReformatting composer/datasets/utils.py\nReformatting docs/source/tables/utils.py\nReformatting composer/cli/launcher.py\nReformatting tests/utils/test_dist.py\nReformatting composer/loggers/mosaicml_logger.py\nReformatting composer/profiler/system_profiler.py\nReformatting composer/optim/scheduler.py\nReformatting composer/callbacks/threshold_stopper.py\nReformatting tests/models/test_hf_model.py\nReformatting tests/utils/eval_client/__init__.py\nReformatting composer/core/data_spec.py\nReformatting composer/models/timm/model.py\nReformatting composer/utils/module_surgery.py\nReformatting composer/models/efficientnetb0/efficientnets.py\nReformatting composer/datasets/in_context_learning_evaluation.py\nReformatting tests/callbacks/test_optimizer_monitor.py\nReformatting composer/callbacks/health_checker.py\nReformatting composer/core/__init__.py\nReformatting composer/loggers/progress_bar_logger.py\nReformatting composer/models/gpt2/__init__.py\nReformatting composer/algorithms/gated_linear_units/__init__.py\nReformatting composer/models/bert/__init__.py\nReformatting tests/algorithms/test_factorize_core.py\nReformatting composer/models/resnet_cifar/__init__.py\nReformatting tests/test_precision.py\nReformatting composer/algorithms/randaugment/randaugment.py\nReformatting composer/algorithms/mixup/mixup.py\nReformatting composer/algorithms/stochastic_depth/stochastic_layers.py\nReformatting composer/devices/device_mps.py\nReformatting composer/utils/object_store/mlflow_object_store.py\nReformatting composer/core/callback.py\nReformatting composer/cli/__init__.py\nReformatting composer/utils/eval_client/lambda_eval_client.py\nReformatting composer/models/resnet_cifar/model.py\nReformatting tests/optim/__init__.py\nReformatting composer/utils/auto_log_hparams.py\nReformatting tests/utils/object_store/test_integration_gs_object_store.py\nReformatting composer/algorithms/factorize/factorize.py\nReformatting tests/callbacks/test_mlperf_callback.py\nReformatting composer/callbacks/activation_monitor.py\nReformatting composer/core/engine.py\nReformatting tests/test_engine.py\nReformatting composer/models/classify_mnist/__init__.py\nReformatting tests/utils/eval_client/test_mcli_eval_client.py\nReformatting tests/utils/test_retrying.py\nReformatting tests/utils/object_store/test_uc_object_store.py\nReformatting composer/algorithms/squeeze_excite/squeeze_excite.py\nReformatting tests/profiler/test_json_trace_handler.py\nReformatting composer/models/base.py\nReformatting tests/callbacks/test_callbacks.py\nReformatting tests/models/test_composer_model.py\nReformatting composer/algorithms/warnings.py\nReformatting tests/trainer/test_fsdp_checkpoint.py\nReformatting tests/loggers/test_progress_bar_logger.py\nReformatting composer/metrics/metrics.py\nReformatting composer/loggers/mlflow_logger.py\nReformatting docs/source/conf.py\nReformatting composer/algorithms/mixup/__init__.py\nReformatting composer/models/unet/model.py\nReformatting composer/models/resnet/__init__.py\nReformatting composer/trainer/dist_strategy.py\nReformatting composer/functional/__init__.py\nReformatting composer/utils/misc.py\nReformatting composer/algorithms/cutout/__init__.py\nReformatting tests/datasets/test_ffcv_utils.py\nReformatting tests/algorithms/test_low_precision_groupnorm.py\nReformatting composer/algorithms/cutout/cutout.py\nReformatting tests/loggers/test_mlflow_logger.py\nReformatting tests/common/markers.py\nReformatting tests/trainer/test_checkpoint.py\nReformatting tests/utils/test_autolog_hparams.py\nReformatting tests/test_time.py\nReformatting composer/algorithms/low_precision_layernorm/__init__.py\nReformatting composer/utils/object_store/uc_object_store.py\nReformatting composer/utils/eval_client/__init__.py\nReformatting composer/algorithms/stochastic_depth/stochastic_depth.py\nReformatting tests/utils/test_dynamic_import.py\nReformatting composer/algorithms/layer_freezing/layer_freezing.py\nReformatting tests/utils/object_store/test_gs_object_store.py\nReformatting docs/source/tables/update_alg_tables.py\nReformatting tests/utils/test_batch_helpers.py\nReformatting composer/trainer/_deepspeed.py\nReformatting composer/utils/reproducibility.py\nReformatting composer/loggers/logger_destination.py\nReformatting tests/callbacks/test_threshold_stopper.py\nReformatting tests/algorithms/test_squeeze_excite.py\nReformatting composer/loggers/tensorboard_logger.py\nReformatting tests/trainer/test_trainer_eval.py\nReformatting tests/loggers/test_file_logger.py\nReformatting tests/utils/object_store/test_s3_object_store.py\nReformatting tests/algorithms/test_selective_backprop.py\nReformatting tests/datasets/test_cifar.py\nReformatting composer/algorithms/weight_standardization/weight_standardization.py\nReformatting composer/callbacks/memory_monitor.py\nReformatting composer/utils/batch_helpers.py\nReformatting tests/metrics/test_current_metrics.py\nReformatting composer/core/evaluator.py\nReformatting composer/algorithms/blurpool/blurpool_layers.py\nReformatting composer/core/types.py\nReformatting composer/algorithms/gyro_dropout/__init__.py\nReformatting tests/trainer/test_scale_schedule.py\nReformatting composer/models/deeplabv3/model.py\nReformatting composer/algorithms/gated_linear_units/gated_linear_unit_layers.py\nReformatting composer/algorithms/augmix/__init__.py\nReformatting composer/algorithms/channels_last/channels_last.py\nReformatting composer/models/unet/_layers.py\nReformatting composer/utils/__init__.py\nReformatting composer/core/state.py\nReformatting composer/algorithms/seq_length_warmup/__init__.py\nReformatting docs/source/tables/generate_cost_graphs.py\nReformatting composer/algorithms/label_smoothing/label_smoothing.py\nReformatting tests/utils/object_store/test_libcloud_object_store.py\nReformatting composer/algorithms/alibi/alibi.py\nReformatting composer/algorithms/progressive_resizing/__init__.py\nReformatting tests/models/test_gpt2.py\nReformatting tests/__init__.py\nReformatting tests/loggers/test_mosaicml_logger.py\nReformatting tests/metrics/__init__.py\nReformatting tests/test_smoketest.py\nReformatting composer/datasets/brats.py\nReformatting composer/algorithms/low_precision_groupnorm/low_precision_groupnorm.py\nReformatting tests/trainer/test_ddp_sync_strategy.py\nReformatting tests/trainer/test_trainer.py\nReformatting composer/profiler/torch_profiler.py\nReformatting composer/utils/object_store/sftp_object_store.py\nReformatting composer/algorithms/selective_backprop/__init__.py\nReformatting composer/algorithms/low_precision_layernorm/low_precision_layernorm.py\nReformatting tests/callbacks/test_memory_monitor.py\nReformatting tests/datasets/test_add_dataset_transform.py\nReformatting composer/algorithms/weight_standardization/__init__.py\nReformatting composer/algorithms/ghost_batchnorm/__init__.py\nReformatting composer/loggers/console_logger.py\nReformatting tests/test_docs.py\nReformatting tests/algorithms/test_alibi.py\nReformatting composer/__main__.py\nReformatting docker/pillow_stub/setup.py\nReformatting composer/models/resnet_cifar/resnets.py\nReformatting composer/datasets/c4.py\nReformatting tests/loggers/test_wandb_logger.py\nReformatting composer/algorithms/no_op_model/no_op_model.py\nReformatting tests/algorithms/test_torch_export.py\nReformatting tests/common/state.py\nReformatting composer/models/initializers.py\nReformatting composer/models/gpt2/model.py\nReformatting tests/metrics/test_miou.py\nReformatting tests/metrics/test_map.py\nReformatting docs/source/tables/__init__.py\nReformatting tests/test_state.py\nReformatting composer/loss/loss.py\nReformatting composer/callbacks/generate.py\nReformatting tests/metrics/metric_setter_callback.py\nReformatting composer/algorithms/channels_last/__init__.py\nReformatting composer/utils/retrying.py\nReformatting composer/algorithms/stochastic_depth/__init__.py\nReformatting composer/core/algorithm.py\nReformatting composer/models/vit_small_patch16/__init__.py\nReformatting tests/optim/test_scheduler.py\nReformatting composer/models/efficientnetb0/model.py\nReformatting composer/models/__init__.py\nReformatting composer/algorithms/factorize/__init__.py\nReformatting composer/callbacks/lr_monitor.py\nReformatting composer/loggers/__init__.py\nReformatting composer/callbacks/__init__.py\nReformatting composer/callbacks/image_visualizer.py\nReformatting composer/utils/eval_client/mosaicml_lambda_eval_client.py\nReformatting tests/test_simple_nlp.py\nReformatting tests/utils/eval_client/test_local_eval_client.py\nReformatting composer/metrics/nlp.py\nReformatting tests/trainer/test_fsdp_param_groups.py\nReformatting tests/algorithms/test_stochastic_depth.py\nReformatting composer/utils/fx_utils.py\nReformatting composer/algorithms/squeeze_excite/__init__.py\nReformatting examples/profiler_demo.py\nReformatting tests/algorithms/test_progressive_resizing.py\nReformatting tests/callbacks/test_runtime_estimator.py\nReformatting composer/loss/__init__.py\nReformatting tests/common/events.py\nReformatting composer/algorithms/gyro_dropout/gyro_dropout.py\nReformatting tests/callbacks/test_nan_monitor.py\nReformatting composer/models/timm/__init__.py\nReformatting composer/algorithms/utils/augmentation_common.py\nReformatting composer/profiler/__init__.py\nReformatting composer/utils/eval_client/eval_client.py\nReformatting composer/utils/object_store/s3_object_store.py\nReformatting tests/datasets/__init__.py\nReformatting composer/models/bert/model.py\nReformatting tests/algorithms/test_colout.py\nReformatting composer/utils/dist.py\nReformatting composer/loggers/cometml_logger.py\nReformatting composer/utils/object_store/oci_object_store.py\nReformatting composer/algorithms/no_op_model/__init__.py\nReformatting tests/trainer/__init__.py\nReformatting docs/source/tables/update_model_tables.py\nReformatting composer/utils/import_helpers.py\nReformatting tests/datasets/test_segmentation_transforms.py\nReformatting tests/loggers/__init__.py\nReformatting tests/algorithms/test_ghost_batchnorm.py\nReformatting tests/test_device.py\nReformatting composer/utils/file_helpers.py\nReformatting tests/loggers/test_slack_logger.py\nReformatting composer/devices/device.py\nReformatting composer/algorithms/__init__.py\nReformatting composer/callbacks/speed_monitor.py\nReformatting tests/algorithms/test_required_on_load.py\nReformatting composer/utils/object_store/libcloud_object_store.py\nReformatting tests/datasets/test_in_context_learning_datasets.py\nReformatting tests/callbacks/__init__.py\nReformatting tests/callbacks/test_system_metrics_monitor.py\nReformatting tests/test_cli.py\nReformatting tests/algorithms/test_low_precision_layernorm.py\nReformatting setup.py\nReformatting composer/metrics/__init__.py\nReformatting composer/callbacks/mlperf.py\nReformatting composer/loggers/logger.py\nReformatting composer/algorithms/alibi/attention_surgery_functions/__init__.py\nReformatting tests/callbacks/test_loggers_across_callbacks.py\nReformatting composer/algorithms/swa/swa.py\nReformatting tests/utils/test_iter_helpers.py\nReformatting examples/custom_models.py\nReformatting tests/trainer/test_dataspec.py\nReformatting tests/metrics/test_nlp_metrics.py\nReformatting examples/segmentation/train_deeplabv3_ade20k.py\nReformatting tests/algorithms/test_weight_standardization.py\nReformatting examples/imagenet/train_resnet_imagenet1k.py\nReformatting composer/algorithms/progressive_resizing/progressive_resizing.py\nReformatting docker/generate_build_matrix.py\nReformatting composer/datasets/__init__.py\nReformatting composer/algorithms/cutmix/cutmix.py\nReformatting tests/utils/test_inference.py\nReformatting composer/devices/device_cpu.py\nReformatting composer/core/serializable.py\nReformatting tests/utils/object_store/test_mlflow_object_store.py\nReformatting composer/callbacks/early_stopper.py\nReformatting tests/common/compare.py\nReformatting composer/callbacks/optimizer_monitor.py\nReformatting tests/algorithms/test_factorize_algorithm.py\nReformatting composer/algorithms/sam/__init__.py\nReformatting docs/source/doctest_fixtures.py\nReformatting composer/loss/utils.py\nReformatting composer/profiler/trace_handler.py\nReformatting tests/algorithms/__init__.py\nReformatting tests/callbacks/test_health_checker.py\nReformatting composer/trainer/_scaler.py\nReformatting tests/algorithms/algorithm_settings.py\nReformatting composer/devices/device_tpu.py\nReformatting composer/models/deeplabv3/__init__.py\nReformatting tests/algorithms/test_blurpool.py\nReformatting tests/algorithms/test_layer_freezing.py\nReformatting tests/algorithms/test_augmentations_functional.py\nReformatting composer/algorithms/augmix/augmix.py\nReformatting composer/profiler/json_trace_handler.py\nReformatting tests/fixtures/fixtures.py\nReformatting tests/callbacks/test_early_stopper.py\nReformatting composer/algorithms/blurpool/__init__.py\nReformatting composer/profiler/utils.py\nReformatting composer/algorithms/selective_backprop/selective_backprop.py\nReformatting composer/datasets/lm_dataset.py\nReformatting composer/callbacks/checkpoint_saver.py\nReformatting tests/utils/object_store/object_store_settings.py\nReformatting composer/algorithms/alibi/attention_surgery_functions/utils.py\nReformatting tests/callbacks/test_speed_monitor.py\nReformatting tests/models/test_mmdet_model.py\nReformatting composer/algorithms/gradient_clipping/gradient_clipping.py\nReformatting .github/mcli/mcli_pytest.py\nReformatting tests/algorithms/test_algorithms_train.py\nReformatting composer/datasets/ade20k.py\nReformatting composer/algorithms/colout/colout.py\nReformatting composer/models/mmdetection.py\nReformatting composer/algorithms/ghost_batchnorm/ghost_batchnorm.py\nReformatting composer/loggers/file_logger.py\nReformatting composer/algorithms/label_smoothing/__init__.py\nReformatting tests/datasets/test_dataset_utils.py\nReformatting composer/algorithms/utils/__init__.py\nReformatting tests/algorithms/test_label_smoothing.py\nReformatting composer/datasets/synthetic.py\nReformatting tests/loggers/test_in_memory_logger.py\nReformatting composer/models/efficientnetb0/_layers.py\nReformatting composer/algorithms/utils/augmentation_primitives.py\nReformatting tests/algorithms/test_cutout.py\nReformatting tests/loggers/test_console_logger.py\nReformatting tests/utils/object_store/__init__.py\nReformatting composer/algorithms/gradient_clipping/__init__.py\nReformatting tests/utils/eval_client/test_lambda_eval_client.py\nReformatting tests/callbacks/test_image_visualizer.py\nReformatting tests/algorithms/test_mixup.py\nReformatting composer/utils/object_store/__init__.py\nReformatting composer/profiler/marker.py\nReformatting tests/conftest.py\nReformatting composer/cli/__main__.py\nReformatting tests/utils/object_store/test_oci_object_store.py\nReformatting tests/algorithms/test_gated_linear_units.py\nReformatting composer/callbacks/system_metrics_monitor.py\nReformatting composer/algorithms/blurpool/blurpool.py\nReformatting tests/models/test_efficientnet.py\nReformatting tests/callbacks/test_generate.py\nReformatting tests/utils/test_fx_utils.py\nReformatting composer/loggers/in_memory_logger.py\nReformatting .github/bin/gen_docker_matrix.py\nReformatting tests/algorithms/test_sam.py\nReformatting composer/optim/decoupled_weight_decay.py\nReformatting composer/core/event.py\nReformatting tests/algorithms/test_seq_length_warmup.py\nReformatting composer/algorithms/ema/ema.py\nReformatting tests/utils/object_store/test_object_store.py\nReformatting composer/models/tasks/classification.py\nReformatting composer/algorithms/layer_freezing/__init__.py\nReformatting composer/core/passes.py\nReformatting composer/utils/iter_helpers.py\nReformatting tests/test_events.py\nReformatting examples/checkpoint_with_wandb.py\nReformatting composer/models/resnet/model.py\nReformatting composer/core/precision.py\nReformatting docs/source/tables/update_methods_overview.py\nReformatting tests/callbacks/test_activation_monitor.py\nReformatting tests/trainer/test_ddp.py\nReformatting composer/callbacks/utils.py\nReformatting tests/algorithms/test_ema.py\nReformatting tests/profiler/test_profiler.py\nReformatting composer/algorithms/sam/sam.py\nReformatting tests/trainer/test_fsdp.py\nReformatting composer/models/classify_mnist/model.py\nReformatting composer/algorithms/seq_length_warmup/seq_length_warmup.py\nReformatting composer/datasets/cifar.py\nReformatting composer/trainer/mosaic_fsdp_utils.py\nReformatting tests/callbacks/callback_settings.py\nReformatting composer/trainer/_scale_schedule.py\nReformatting tests/test_full_nlp.py\nReformatting composer/algorithms/factorize/factorize_modules.py\nReformatting composer/models/vit_small_patch16/model.py\nReformatting composer/devices/device_hpu.py\nReformatting examples/gyro_dropout_example.py\nReformatting composer/algorithms/low_precision_groupnorm/__init__.py\nReformatting composer/utils/checkpoint.py\nReformatting tests/common/datasets.py\nReformatting composer/algorithms/swa/__init__.py\nReformatting tests/algorithms/test_algorithm_resumption.py\nReformatting tests/utils/test_string_enum.py\nReformatting tests/algorithms/test_factorized_modules.py\nReformatting tests/algorithms/algorithm_test_template.py\nReformatting composer/datasets/mnist.py\nReformatting composer/models/huggingface.py\nReformatting composer/callbacks/free_outputs.py\nReformatting tests/test_loss.py\nReformatting composer/algorithms/colout/__init__.py\nReformatting composer/metrics/map.py\nReformatting composer/utils/collect_env.py\nReformatting composer/profiler/profiler.py\nReformatting tests/test_docker.py\nReformatting tests/loggers/test_remote_uploader_downloader.py\nReformatting tests/algorithms/test_gyro_dropout.py\nReformatting tests/datasets/test_streaming_datasets_train.py\nReformatting composer/algorithms/gated_linear_units/gated_linear_units.py\nReformatting composer/datasets/ffcv_utils.py\nReformatting composer/callbacks/nan_monitor.py\nReformatting scripts/ffcv/create_ffcv_datasets.py\nReformatting composer/algorithms/alibi/attention_surgery_functions/_gpt2.py\nReformatting tests/profiler/__init__.py\nReformatting composer/loggers/slack_logger.py\nReformatting composer/optim/__init__.py\nReformatting tests/loggers/test_logger.py\nReformatting composer/trainer/meta_safe_apply.py\nReformatting composer/profiler/json_trace_merger.py\nReformatting composer/trainer/trainer.py\n\nisort....................................................................Passed\npydocstyle...............................................................Passed\ncheck for added large files..............................................Passed\ncheck python ast.........................................................Passed\ncheck builtin type constructor use.......................................Passed\ncheck for case conflicts.................................................Passed\ncheck docstring is first.................................................Passed\ncheck that executables have shebangs.....................................Passed\ncheck json...............................................................Passed\ncheck that scripts with shebangs are executable..........................Passed\npretty format json.......................................................Passed\ncheck for merge conflicts................................................Passed\ncheck for broken symlinks................................................Passed\ncheck toml...............................................................Passed\ncheck vcs permalinks.....................................................Passed\ncheck xml................................................................Passed\ncheck yaml...............................................................Passed\ndebug statements (python)................................................Passed\ndetect destroyed symlinks................................................Passed\nfix double quoted strings................................................Passed\nfix end of files.........................................................Passed\nfix utf-8 byte order marker..............................................Passed\nmixed line ending........................................................Passed\ntrim trailing whitespace.................................................Passed\nInsert license in comments...............................................Passed\nnbstripout...............................................................Passed\npyright..................................................................Passed\nsecret scan..............................................................Passed\n##[error]Process completed with exit code 1.\n"}], "diff": "diff --git a/composer/models/huggingface.py b/composer/models/huggingface.py\nindex 2498c5f3..d7fb0404 100644\n--- a/composer/models/huggingface.py\n+++ b/composer/models/huggingface.py\n@@ -169,13 +169,13 @@ class HuggingFaceModel(ComposerModel):\n def state_dict(self, *args, **kwargs) -> Dict[str, Any]:\n \"\"\"Returns the state dict of the model.\"\"\"\n full_state_dict = super().state_dict(*args, **kwargs)\n- \n+\n if self.peft_filter_state_dict_trainable:\n- full_state_dict = filter_state_dict_peft(full_state_dict, self.model.peft_config[self.model.active_adapter], False)\n+ full_state_dict = filter_state_dict_peft(full_state_dict, self.model.peft_config[self.model.active_adapter],\n+ False)\n \n return full_state_dict\n \n-\n @staticmethod\n def load_huggingface_tokenizer_from_saved_state(\n hf_state: Dict[str, Any],\n@@ -803,7 +803,10 @@ def write_huggingface_pretrained_from_composer_checkpoint(\n else:\n torch.save(weights_state_dict, Path(output_folder) / 'pytorch_model.bin')\n \n-def filter_state_dict_peft(state_dict: Dict[str, Any], peft_config: 'PeftConfig', remove_adapter_names: bool = True) -> Dict[str, Any]:\n+\n+def filter_state_dict_peft(state_dict: Dict[str, Any],\n+ peft_config: 'PeftConfig',\n+ remove_adapter_names: bool = True) -> Dict[str, Any]:\n # Filtering copied from https://github.com/huggingface/peft/blob/4186c9b104644fd247a4cc0dc2dfc1ede4665204/src/peft/utils/save_and_load.py#L68C1-L86C116\n bias = peft_config.bias\n if bias == 'none':\n@@ -821,7 +824,7 @@ def filter_state_dict_peft(state_dict: Dict[str, Any], peft_config: 'PeftConfig'\n else:\n raise NotImplementedError\n to_return = {k: v for k, v in to_return.items() if (('lora_' in k and 'default' in k) or ('bias' in k))}\n- \n+\n if remove_adapter_names:\n to_return = {k.replace(f'.default', ''): v for k, v in to_return.items()}\n- return to_return\n\\ No newline at end of file\n+ return to_return\ndiff --git a/tests/models/test_hf_model.py b/tests/models/test_hf_model.py\nindex d7b7081d..0cf13fb3 100644\n--- a/tests/models/test_hf_model.py\n+++ b/tests/models/test_hf_model.py\n@@ -1223,6 +1223,7 @@ def test_peft_init_not_installed(tiny_gpt2_model, gpt2_peft_config):\n from composer.models import HuggingFaceModel\n _ = HuggingFaceModel(tiny_gpt2_model, peft_config=gpt2_peft_config)\n \n+\n @pytest.mark.parametrize('just_lora', [True, False])\n def test_peft_trains_and_loads(tiny_gpt2_model, tiny_gpt2_tokenizer, gpt2_peft_config, tmp_path, just_lora):\n pytest.importorskip('peft')\n@@ -1283,6 +1284,7 @@ def test_peft_metadata(tiny_gpt2_model, tiny_gpt2_tokenizer, gpt2_peft_config):\n \n assert loaded_peft_config == gpt2_peft_config\n \n+\n @pytest.mark.parametrize('just_lora', [True, False])\n def test_peft_write_hf_from_composer(tiny_gpt2_model, tiny_gpt2_tokenizer, gpt2_peft_config, tmp_path, just_lora):\n peft = pytest.importorskip('peft')\n@@ -1369,11 +1371,14 @@ def test_peft_fsdp_trains(tiny_gpt2_model, tiny_gpt2_tokenizer, gpt2_peft_config\n for p1, p2 in zip(trainer.state.model.parameters(), load_trainer.state.model.parameters()):\n torch.testing.assert_close(p1, p2)\n \n+\n def test_filtered_state_dict(tiny_gpt2_model, tiny_gpt2_tokenizer, gpt2_peft_config, tmp_path):\n pytest.importorskip('peft')\n \n- hf_model = HuggingFaceModel(tiny_gpt2_model, tokenizer=tiny_gpt2_tokenizer, peft_config=gpt2_peft_config, peft_filter_state_dict_trainable=True)\n+ hf_model = HuggingFaceModel(tiny_gpt2_model,\n+ tokenizer=tiny_gpt2_tokenizer,\n+ peft_config=gpt2_peft_config,\n+ peft_filter_state_dict_trainable=True)\n state_dict = hf_model.state_dict()\n \n assert len(state_dict.keys()) == 4\n-\n", "difficulty": 2, "changed_files": ["composer/models/huggingface.py", "tests/models/test_hf_model.py"], "commit_link": "https://github.com/mosaicml/composer/tree/4b7e4724b2f92741fb094421ebfa60be5bfb18d9"}