Repository: mosaicml/composer (branch: composer_lora)
Commit date: 2024-01-09T10:29:06Z

Workflow file: .github/workflows/code-quality.yaml (Code Quality Checks)
name: Code Quality Checks
on:
  push:
    branches:
      - dev
      - main
      - release/**
  pull_request:
  workflow_call:
  workflow_dispatch:
# Cancel old runs when a new commit is pushed to the same branch if not on main or dev
concurrency:
  group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
  cancel-in-progress: ${{ github.ref != 'refs/heads/main' && github.ref != 'refs/heads/dev' }}
defaults:
  run:
    working-directory: .
jobs:
  code-quality:
    runs-on: ubuntu-20.04
    services:
      pypi_wayback:
        image: ghcr.io/waleko/pypi-wayback
        ports:
          - 8629:8080
    timeout-minutes: 10
    strategy:
      matrix:
        python_version:
          - "3.8"
          - "3.9"
          - "3.10"
        pip_deps:
          - "[dev]"
    steps:
      - uses: actions/checkout@v3
      - uses: actions/setup-python@v4
        with:
          python-version: ${{ matrix.python_version }}
      - name: Setup
        run: |
          set -ex
          python -m pip install --upgrade 'pip<23' wheel
          python -m pip install --upgrade .${{ matrix.pip_deps }}
      - name: Run checks
        run: |
          pre-commit run --all-files

env:
  PIP_INDEX_URL: http://localhost:8629/2024-01-09
  UV_INDEX_URL: http://localhost:8629/2024-01-09


Failed build logs:
step_name: code-quality (3.8, [dev])/5_Run checks.txt
log: ##[group]Run pre-commit run --all-files
[36;1mpre-commit run --all-files[0m
shell: /usr/bin/bash -e {0}
env:
  pythonLocation: /opt/hostedtoolcache/Python/3.8.18/x64
  PKG_CONFIG_PATH: /opt/hostedtoolcache/Python/3.8.18/x64/lib/pkgconfig
  Python_ROOT_DIR: /opt/hostedtoolcache/Python/3.8.18/x64
  Python2_ROOT_DIR: /opt/hostedtoolcache/Python/3.8.18/x64
  Python3_ROOT_DIR: /opt/hostedtoolcache/Python/3.8.18/x64
  LD_LIBRARY_PATH: /opt/hostedtoolcache/Python/3.8.18/x64/lib
##[endgroup]
[INFO] Initializing environment for https://github.com/astral-sh/ruff-pre-commit.
[INFO] Initializing environment for https://github.com/google/yapf.
[INFO] Initializing environment for https://github.com/google/yapf:toml.
[INFO] Initializing environment for https://github.com/pycqa/isort.
[INFO] Initializing environment for https://github.com/PyCQA/pydocstyle.
[INFO] Initializing environment for https://github.com/PyCQA/pydocstyle:toml.
[INFO] Initializing environment for https://github.com/pre-commit/pre-commit-hooks.
[INFO] Initializing environment for https://github.com/Lucas-C/pre-commit-hooks.
[INFO] Initializing environment for https://github.com/kynan/nbstripout.
[INFO] Initializing environment for local:pyright@1.1.256.
[INFO] Initializing environment for https://github.com/trufflesecurity/trufflehog.git.
[INFO] Installing environment for https://github.com/astral-sh/ruff-pre-commit.
[INFO] Once installed this environment will be reused.
[INFO] This may take a few minutes...
[INFO] Installing environment for https://github.com/google/yapf.
[INFO] Once installed this environment will be reused.
[INFO] This may take a few minutes...
[INFO] Installing environment for https://github.com/pycqa/isort.
[INFO] Once installed this environment will be reused.
[INFO] This may take a few minutes...
[INFO] Installing environment for https://github.com/PyCQA/pydocstyle.
[INFO] Once installed this environment will be reused.
[INFO] This may take a few minutes...
[INFO] Installing environment for https://github.com/pre-commit/pre-commit-hooks.
[INFO] Once installed this environment will be reused.
[INFO] This may take a few minutes...
[INFO] Installing environment for https://github.com/Lucas-C/pre-commit-hooks.
[INFO] Once installed this environment will be reused.
[INFO] This may take a few minutes...
[INFO] Installing environment for https://github.com/kynan/nbstripout.
[INFO] Once installed this environment will be reused.
[INFO] This may take a few minutes...
[INFO] Installing environment for local.
[INFO] Once installed this environment will be reused.
[INFO] This may take a few minutes...
[INFO] Installing environment for https://github.com/trufflesecurity/trufflehog.git.
[INFO] Once installed this environment will be reused.
[INFO] This may take a few minutes...
ruff.....................................................................Passed
yapf.....................................................................Failed
- hook id: yapf
- files were modified by this hook

Reformatting composer/datasets/imagenet.py
Reformatting tests/loggers/test_cometml_logger.py
Reformatting tests/algorithms/test_gradient_clipping.py
Reformatting tests/fixtures/__init__.py
Reformatting composer/callbacks/runtime_estimator.py
Reformatting composer/__init__.py
Reformatting composer/trainer/mosaic_fsdp.py
Reformatting composer/models/efficientnetb0/__init__.py
Reformatting composer/callbacks/export_for_inference.py
Reformatting composer/algorithms/cutmix/__init__.py
Reformatting composer/profiler/profiler_action.py
Reformatting tests/datasets/test_mnist.py
Reformatting composer/utils/inference.py
Reformatting tests/trainer/test_predict.py
Reformatting composer/algorithms/randaugment/__init__.py
Reformatting tests/test_notebooks.py
Reformatting composer/algorithms/alibi/__init__.py
Reformatting composer/models/tasks/__init__.py
Reformatting composer/utils/object_store/gcs_object_store.py
Reformatting composer/models/unet/unet.py
Reformatting composer/utils/object_store/object_store.py
Reformatting composer/loggers/remote_uploader_downloader.py
Reformatting composer/utils/eval_client/local_eval_client.py
Reformatting composer/devices/__init__.py
Reformatting tests/utils/test_file_helpers.py
Reformatting composer/algorithms/ema/__init__.py
Reformatting tests/algorithms/test_cutmix.py
Reformatting tests/fixtures/autouse_fixtures.py
Reformatting composer/_version.py
Reformatting composer/core/time.py
Reformatting tests/common/models.py
Reformatting composer/utils/device.py
Reformatting tests/test_passes.py
Reformatting tests/datasets/test_synthetic_data.py
Reformatting tests/utils/__init__.py
Reformatting composer/trainer/__init__.py
Reformatting tests/utils/test_module_surgery.py
Reformatting composer/models/unet/__init__.py
Reformatting tests/callbacks/test_inference.py
Reformatting composer/loggers/wandb_logger.py
Reformatting composer/algorithms/alibi/attention_surgery_functions/_bert.py
Reformatting tests/algorithms/test_channels_last.py
Reformatting tests/common/__init__.py
Reformatting tests/test_split_batch.py
Reformatting composer/algorithms/factorize/factorize_core.py
Reformatting composer/utils/string_enum.py
Reformatting composer/profiler/profiler_schedule.py
Reformatting tests/models/test_bert.py
Reformatting tests/algorithms/test_blurpool_layers.py
Reformatting composer/devices/device_gpu.py
Reformatting docs/source/doctest_cleanup.py
Reformatting composer/datasets/utils.py
Reformatting docs/source/tables/utils.py
Reformatting composer/cli/launcher.py
Reformatting tests/utils/test_dist.py
Reformatting composer/loggers/mosaicml_logger.py
Reformatting composer/profiler/system_profiler.py
Reformatting composer/optim/scheduler.py
Reformatting composer/callbacks/threshold_stopper.py
Reformatting tests/models/test_hf_model.py
Reformatting tests/utils/eval_client/__init__.py
Reformatting composer/core/data_spec.py
Reformatting composer/models/timm/model.py
Reformatting composer/utils/module_surgery.py
Reformatting composer/models/efficientnetb0/efficientnets.py
Reformatting composer/datasets/in_context_learning_evaluation.py
Reformatting tests/callbacks/test_optimizer_monitor.py
Reformatting composer/callbacks/health_checker.py
Reformatting composer/core/__init__.py
Reformatting composer/loggers/progress_bar_logger.py
Reformatting composer/models/gpt2/__init__.py
Reformatting composer/algorithms/gated_linear_units/__init__.py
Reformatting composer/models/bert/__init__.py
Reformatting tests/algorithms/test_factorize_core.py
Reformatting composer/models/resnet_cifar/__init__.py
Reformatting tests/test_precision.py
Reformatting composer/algorithms/randaugment/randaugment.py
Reformatting composer/algorithms/mixup/mixup.py
Reformatting composer/algorithms/stochastic_depth/stochastic_layers.py
Reformatting composer/devices/device_mps.py
Reformatting composer/utils/object_store/mlflow_object_store.py
Reformatting composer/core/callback.py
Reformatting composer/cli/__init__.py
Reformatting composer/utils/eval_client/lambda_eval_client.py
Reformatting composer/models/resnet_cifar/model.py
Reformatting tests/optim/__init__.py
Reformatting composer/utils/auto_log_hparams.py
Reformatting tests/utils/object_store/test_integration_gs_object_store.py
Reformatting composer/algorithms/factorize/factorize.py
Reformatting tests/callbacks/test_mlperf_callback.py
Reformatting composer/callbacks/activation_monitor.py
Reformatting composer/core/engine.py
Reformatting tests/test_engine.py
Reformatting composer/models/classify_mnist/__init__.py
Reformatting tests/utils/eval_client/test_mcli_eval_client.py
Reformatting tests/utils/test_retrying.py
Reformatting tests/utils/object_store/test_uc_object_store.py
Reformatting composer/algorithms/squeeze_excite/squeeze_excite.py
Reformatting tests/profiler/test_json_trace_handler.py
Reformatting composer/models/base.py
Reformatting tests/callbacks/test_callbacks.py
Reformatting tests/models/test_composer_model.py
Reformatting composer/algorithms/warnings.py
Reformatting tests/trainer/test_fsdp_checkpoint.py
Reformatting tests/loggers/test_progress_bar_logger.py
Reformatting composer/metrics/metrics.py
Reformatting composer/loggers/mlflow_logger.py
Reformatting docs/source/conf.py
Reformatting composer/algorithms/mixup/__init__.py
Reformatting composer/models/unet/model.py
Reformatting composer/models/resnet/__init__.py
Reformatting composer/trainer/dist_strategy.py
Reformatting composer/functional/__init__.py
Reformatting composer/utils/misc.py
Reformatting composer/algorithms/cutout/__init__.py
Reformatting tests/datasets/test_ffcv_utils.py
Reformatting tests/algorithms/test_low_precision_groupnorm.py
Reformatting composer/algorithms/cutout/cutout.py
Reformatting tests/loggers/test_mlflow_logger.py
Reformatting tests/common/markers.py
Reformatting tests/trainer/test_checkpoint.py
Reformatting tests/utils/test_autolog_hparams.py
Reformatting tests/test_time.py
Reformatting composer/algorithms/low_precision_layernorm/__init__.py
Reformatting composer/utils/object_store/uc_object_store.py
Reformatting composer/utils/eval_client/__init__.py
Reformatting composer/algorithms/stochastic_depth/stochastic_depth.py
Reformatting tests/utils/test_dynamic_import.py
Reformatting composer/algorithms/layer_freezing/layer_freezing.py
Reformatting tests/utils/object_store/test_gs_object_store.py
Reformatting docs/source/tables/update_alg_tables.py
Reformatting tests/utils/test_batch_helpers.py
Reformatting composer/trainer/_deepspeed.py
Reformatting composer/utils/reproducibility.py
Reformatting composer/loggers/logger_destination.py
Reformatting tests/callbacks/test_threshold_stopper.py
Reformatting tests/algorithms/test_squeeze_excite.py
Reformatting composer/loggers/tensorboard_logger.py
Reformatting tests/trainer/test_trainer_eval.py
Reformatting tests/loggers/test_file_logger.py
Reformatting tests/utils/object_store/test_s3_object_store.py
Reformatting tests/algorithms/test_selective_backprop.py
Reformatting tests/datasets/test_cifar.py
Reformatting composer/algorithms/weight_standardization/weight_standardization.py
Reformatting composer/callbacks/memory_monitor.py
Reformatting composer/utils/batch_helpers.py
Reformatting tests/metrics/test_current_metrics.py
Reformatting composer/core/evaluator.py
Reformatting composer/algorithms/blurpool/blurpool_layers.py
Reformatting composer/core/types.py
Reformatting composer/algorithms/gyro_dropout/__init__.py
Reformatting tests/trainer/test_scale_schedule.py
Reformatting composer/models/deeplabv3/model.py
Reformatting composer/algorithms/gated_linear_units/gated_linear_unit_layers.py
Reformatting composer/algorithms/augmix/__init__.py
Reformatting composer/algorithms/channels_last/channels_last.py
Reformatting composer/models/unet/_layers.py
Reformatting composer/utils/__init__.py
Reformatting composer/core/state.py
Reformatting composer/algorithms/seq_length_warmup/__init__.py
Reformatting docs/source/tables/generate_cost_graphs.py
Reformatting composer/algorithms/label_smoothing/label_smoothing.py
Reformatting tests/utils/object_store/test_libcloud_object_store.py
Reformatting composer/algorithms/alibi/alibi.py
Reformatting composer/algorithms/progressive_resizing/__init__.py
Reformatting tests/models/test_gpt2.py
Reformatting tests/__init__.py
Reformatting tests/loggers/test_mosaicml_logger.py
Reformatting tests/metrics/__init__.py
Reformatting tests/test_smoketest.py
Reformatting composer/datasets/brats.py
Reformatting composer/algorithms/low_precision_groupnorm/low_precision_groupnorm.py
Reformatting tests/trainer/test_ddp_sync_strategy.py
Reformatting tests/trainer/test_trainer.py
Reformatting composer/profiler/torch_profiler.py
Reformatting composer/utils/object_store/sftp_object_store.py
Reformatting composer/algorithms/selective_backprop/__init__.py
Reformatting composer/algorithms/low_precision_layernorm/low_precision_layernorm.py
Reformatting tests/callbacks/test_memory_monitor.py
Reformatting tests/datasets/test_add_dataset_transform.py
Reformatting composer/algorithms/weight_standardization/__init__.py
Reformatting composer/algorithms/ghost_batchnorm/__init__.py
Reformatting composer/loggers/console_logger.py
Reformatting tests/test_docs.py
Reformatting tests/algorithms/test_alibi.py
Reformatting composer/__main__.py
Reformatting docker/pillow_stub/setup.py
Reformatting composer/models/resnet_cifar/resnets.py
Reformatting composer/datasets/c4.py
Reformatting tests/loggers/test_wandb_logger.py
Reformatting composer/algorithms/no_op_model/no_op_model.py
Reformatting tests/algorithms/test_torch_export.py
Reformatting tests/common/state.py
Reformatting composer/models/initializers.py
Reformatting composer/models/gpt2/model.py
Reformatting tests/metrics/test_miou.py
Reformatting tests/metrics/test_map.py
Reformatting docs/source/tables/__init__.py
Reformatting tests/test_state.py
Reformatting composer/loss/loss.py
Reformatting composer/callbacks/generate.py
Reformatting tests/metrics/metric_setter_callback.py
Reformatting composer/algorithms/channels_last/__init__.py
Reformatting composer/utils/retrying.py
Reformatting composer/algorithms/stochastic_depth/__init__.py
Reformatting composer/core/algorithm.py
Reformatting composer/models/vit_small_patch16/__init__.py
Reformatting tests/optim/test_scheduler.py
Reformatting composer/models/efficientnetb0/model.py
Reformatting composer/models/__init__.py
Reformatting composer/algorithms/factorize/__init__.py
Reformatting composer/callbacks/lr_monitor.py
Reformatting composer/loggers/__init__.py
Reformatting composer/callbacks/__init__.py
Reformatting composer/callbacks/image_visualizer.py
Reformatting composer/utils/eval_client/mosaicml_lambda_eval_client.py
Reformatting tests/test_simple_nlp.py
Reformatting tests/utils/eval_client/test_local_eval_client.py
Reformatting composer/metrics/nlp.py
Reformatting tests/trainer/test_fsdp_param_groups.py
Reformatting tests/algorithms/test_stochastic_depth.py
Reformatting composer/utils/fx_utils.py
Reformatting composer/algorithms/squeeze_excite/__init__.py
Reformatting examples/profiler_demo.py
Reformatting tests/algorithms/test_progressive_resizing.py
Reformatting tests/callbacks/test_runtime_estimator.py
Reformatting composer/loss/__init__.py
Reformatting tests/common/events.py
Reformatting composer/algorithms/gyro_dropout/gyro_dropout.py
Reformatting tests/callbacks/test_nan_monitor.py
Reformatting composer/models/timm/__init__.py
Reformatting composer/algorithms/utils/augmentation_common.py
Reformatting composer/profiler/__init__.py
Reformatting composer/utils/eval_client/eval_client.py
Reformatting composer/utils/object_store/s3_object_store.py
Reformatting tests/datasets/__init__.py
Reformatting composer/models/bert/model.py
Reformatting tests/algorithms/test_colout.py
Reformatting composer/utils/dist.py
Reformatting composer/loggers/cometml_logger.py
Reformatting composer/utils/object_store/oci_object_store.py
Reformatting composer/algorithms/no_op_model/__init__.py
Reformatting tests/trainer/__init__.py
Reformatting docs/source/tables/update_model_tables.py
Reformatting composer/utils/import_helpers.py
Reformatting tests/datasets/test_segmentation_transforms.py
Reformatting tests/loggers/__init__.py
Reformatting tests/algorithms/test_ghost_batchnorm.py
Reformatting tests/test_device.py
Reformatting composer/utils/file_helpers.py
Reformatting tests/loggers/test_slack_logger.py
Reformatting composer/devices/device.py
Reformatting composer/algorithms/__init__.py
Reformatting composer/callbacks/speed_monitor.py
Reformatting tests/algorithms/test_required_on_load.py
Reformatting composer/utils/object_store/libcloud_object_store.py
Reformatting tests/datasets/test_in_context_learning_datasets.py
Reformatting tests/callbacks/__init__.py
Reformatting tests/callbacks/test_system_metrics_monitor.py
Reformatting tests/test_cli.py
Reformatting tests/algorithms/test_low_precision_layernorm.py
Reformatting setup.py
Reformatting composer/metrics/__init__.py
Reformatting composer/callbacks/mlperf.py
Reformatting composer/loggers/logger.py
Reformatting composer/algorithms/alibi/attention_surgery_functions/__init__.py
Reformatting tests/callbacks/test_loggers_across_callbacks.py
Reformatting composer/algorithms/swa/swa.py
Reformatting tests/utils/test_iter_helpers.py
Reformatting examples/custom_models.py
Reformatting tests/trainer/test_dataspec.py
Reformatting tests/metrics/test_nlp_metrics.py
Reformatting examples/segmentation/train_deeplabv3_ade20k.py
Reformatting tests/algorithms/test_weight_standardization.py
Reformatting examples/imagenet/train_resnet_imagenet1k.py
Reformatting composer/algorithms/progressive_resizing/progressive_resizing.py
Reformatting docker/generate_build_matrix.py
Reformatting composer/datasets/__init__.py
Reformatting composer/algorithms/cutmix/cutmix.py
Reformatting tests/utils/test_inference.py
Reformatting composer/devices/device_cpu.py
Reformatting composer/core/serializable.py
Reformatting tests/utils/object_store/test_mlflow_object_store.py
Reformatting composer/callbacks/early_stopper.py
Reformatting tests/common/compare.py
Reformatting composer/callbacks/optimizer_monitor.py
Reformatting tests/algorithms/test_factorize_algorithm.py
Reformatting composer/algorithms/sam/__init__.py
Reformatting docs/source/doctest_fixtures.py
Reformatting composer/loss/utils.py
Reformatting composer/profiler/trace_handler.py
Reformatting tests/algorithms/__init__.py
Reformatting tests/callbacks/test_health_checker.py
Reformatting composer/trainer/_scaler.py
Reformatting tests/algorithms/algorithm_settings.py
Reformatting composer/devices/device_tpu.py
Reformatting composer/models/deeplabv3/__init__.py
Reformatting tests/algorithms/test_blurpool.py
Reformatting tests/algorithms/test_layer_freezing.py
Reformatting tests/algorithms/test_augmentations_functional.py
Reformatting composer/algorithms/augmix/augmix.py
Reformatting composer/profiler/json_trace_handler.py
Reformatting tests/fixtures/fixtures.py
Reformatting tests/callbacks/test_early_stopper.py
Reformatting composer/algorithms/blurpool/__init__.py
Reformatting composer/profiler/utils.py
Reformatting composer/algorithms/selective_backprop/selective_backprop.py
Reformatting composer/datasets/lm_dataset.py
Reformatting composer/callbacks/checkpoint_saver.py
Reformatting tests/utils/object_store/object_store_settings.py
Reformatting composer/algorithms/alibi/attention_surgery_functions/utils.py
Reformatting tests/callbacks/test_speed_monitor.py
Reformatting tests/models/test_mmdet_model.py
Reformatting composer/algorithms/gradient_clipping/gradient_clipping.py
Reformatting .github/mcli/mcli_pytest.py
Reformatting tests/algorithms/test_algorithms_train.py
Reformatting composer/datasets/ade20k.py
Reformatting composer/algorithms/colout/colout.py
Reformatting composer/models/mmdetection.py
Reformatting composer/algorithms/ghost_batchnorm/ghost_batchnorm.py
Reformatting composer/loggers/file_logger.py
Reformatting composer/algorithms/label_smoothing/__init__.py
Reformatting tests/datasets/test_dataset_utils.py
Reformatting composer/algorithms/utils/__init__.py
Reformatting tests/algorithms/test_label_smoothing.py
Reformatting composer/datasets/synthetic.py
Reformatting tests/loggers/test_in_memory_logger.py
Reformatting composer/models/efficientnetb0/_layers.py
Reformatting composer/algorithms/utils/augmentation_primitives.py
Reformatting tests/algorithms/test_cutout.py
Reformatting tests/loggers/test_console_logger.py
Reformatting tests/utils/object_store/__init__.py
Reformatting composer/algorithms/gradient_clipping/__init__.py
Reformatting tests/utils/eval_client/test_lambda_eval_client.py
Reformatting tests/callbacks/test_image_visualizer.py
Reformatting tests/algorithms/test_mixup.py
Reformatting composer/utils/object_store/__init__.py
Reformatting composer/profiler/marker.py
Reformatting tests/conftest.py
Reformatting composer/cli/__main__.py
Reformatting tests/utils/object_store/test_oci_object_store.py
Reformatting tests/algorithms/test_gated_linear_units.py
Reformatting composer/callbacks/system_metrics_monitor.py
Reformatting composer/algorithms/blurpool/blurpool.py
Reformatting tests/models/test_efficientnet.py
Reformatting tests/callbacks/test_generate.py
Reformatting tests/utils/test_fx_utils.py
Reformatting composer/loggers/in_memory_logger.py
Reformatting .github/bin/gen_docker_matrix.py
Reformatting tests/algorithms/test_sam.py
Reformatting composer/optim/decoupled_weight_decay.py
Reformatting composer/core/event.py
Reformatting tests/algorithms/test_seq_length_warmup.py
Reformatting composer/algorithms/ema/ema.py
Reformatting tests/utils/object_store/test_object_store.py
Reformatting composer/models/tasks/classification.py
Reformatting composer/algorithms/layer_freezing/__init__.py
Reformatting composer/core/passes.py
Reformatting composer/utils/iter_helpers.py
Reformatting tests/test_events.py
Reformatting examples/checkpoint_with_wandb.py
Reformatting composer/models/resnet/model.py
Reformatting composer/core/precision.py
Reformatting docs/source/tables/update_methods_overview.py
Reformatting tests/callbacks/test_activation_monitor.py
Reformatting tests/trainer/test_ddp.py
Reformatting composer/callbacks/utils.py
Reformatting tests/algorithms/test_ema.py
Reformatting tests/profiler/test_profiler.py
Reformatting composer/algorithms/sam/sam.py
Reformatting tests/trainer/test_fsdp.py
Reformatting composer/models/classify_mnist/model.py
Reformatting composer/algorithms/seq_length_warmup/seq_length_warmup.py
Reformatting composer/datasets/cifar.py
Reformatting composer/trainer/mosaic_fsdp_utils.py
Reformatting tests/callbacks/callback_settings.py
Reformatting composer/trainer/_scale_schedule.py
Reformatting tests/test_full_nlp.py
Reformatting composer/algorithms/factorize/factorize_modules.py
Reformatting composer/models/vit_small_patch16/model.py
Reformatting composer/devices/device_hpu.py
Reformatting examples/gyro_dropout_example.py
Reformatting composer/algorithms/low_precision_groupnorm/__init__.py
Reformatting composer/utils/checkpoint.py
Reformatting tests/common/datasets.py
Reformatting composer/algorithms/swa/__init__.py
Reformatting tests/algorithms/test_algorithm_resumption.py
Reformatting tests/utils/test_string_enum.py
Reformatting tests/algorithms/test_factorized_modules.py
Reformatting tests/algorithms/algorithm_test_template.py
Reformatting composer/datasets/mnist.py
Reformatting composer/models/huggingface.py
Reformatting composer/callbacks/free_outputs.py
Reformatting tests/test_loss.py
Reformatting composer/algorithms/colout/__init__.py
Reformatting composer/metrics/map.py
Reformatting composer/utils/collect_env.py
Reformatting composer/profiler/profiler.py
Reformatting tests/test_docker.py
Reformatting tests/loggers/test_remote_uploader_downloader.py
Reformatting tests/algorithms/test_gyro_dropout.py
Reformatting tests/datasets/test_streaming_datasets_train.py
Reformatting composer/algorithms/gated_linear_units/gated_linear_units.py
Reformatting composer/datasets/ffcv_utils.py
Reformatting composer/callbacks/nan_monitor.py
Reformatting scripts/ffcv/create_ffcv_datasets.py
Reformatting composer/algorithms/alibi/attention_surgery_functions/_gpt2.py
Reformatting tests/profiler/__init__.py
Reformatting composer/loggers/slack_logger.py
Reformatting composer/optim/__init__.py
Reformatting tests/loggers/test_logger.py
Reformatting composer/trainer/meta_safe_apply.py
Reformatting composer/profiler/json_trace_merger.py
Reformatting composer/trainer/trainer.py

isort....................................................................Passed
pydocstyle...............................................................Passed
check for added large files..............................................Passed
check python ast.........................................................Passed
check builtin type constructor use.......................................Passed
check for case conflicts.................................................Passed
check docstring is first.................................................Passed
check that executables have shebangs.....................................Passed
check json...............................................................Passed
check that scripts with shebangs are executable..........................Passed
pretty format json.......................................................Passed
check for merge conflicts................................................Passed
check for broken symlinks................................................Passed
check toml...............................................................Passed
check vcs permalinks.....................................................Passed
check xml................................................................Passed
check yaml...............................................................Passed
debug statements (python)................................................Passed
detect destroyed symlinks................................................Passed
fix double quoted strings................................................Passed
fix end of files.........................................................Passed
fix utf-8 byte order marker..............................................Passed
mixed line ending........................................................Passed
trim trailing whitespace.................................................Passed
Insert license in comments...............................................Passed
nbstripout...............................................................Passed
pyright..................................................................Passed
secret scan..............................................................Passed
##[error]Process completed with exit code 1.


Changed files:
composer/models/huggingface.py
tests/models/test_hf_model.py

Fix diff:
diff --git a/composer/models/huggingface.py b/composer/models/huggingface.py
index 2498c5f3..d7fb0404 100644
--- a/composer/models/huggingface.py
+++ b/composer/models/huggingface.py
@@ -169,13 +169,13 @@ class HuggingFaceModel(ComposerModel):
     def state_dict(self, *args, **kwargs) -> Dict[str, Any]:
         """Returns the state dict of the model."""
         full_state_dict = super().state_dict(*args, **kwargs)
-        
+
         if self.peft_filter_state_dict_trainable:
-            full_state_dict = filter_state_dict_peft(full_state_dict, self.model.peft_config[self.model.active_adapter], False)
+            full_state_dict = filter_state_dict_peft(full_state_dict, self.model.peft_config[self.model.active_adapter],
+                                                     False)
 
         return full_state_dict
 
-
     @staticmethod
     def load_huggingface_tokenizer_from_saved_state(
             hf_state: Dict[str, Any],
@@ -803,7 +803,10 @@ def write_huggingface_pretrained_from_composer_checkpoint(
     else:
         torch.save(weights_state_dict, Path(output_folder) / 'pytorch_model.bin')
 
-def filter_state_dict_peft(state_dict: Dict[str, Any], peft_config: 'PeftConfig', remove_adapter_names: bool = True) -> Dict[str, Any]:
+
+def filter_state_dict_peft(state_dict: Dict[str, Any],
+                           peft_config: 'PeftConfig',
+                           remove_adapter_names: bool = True) -> Dict[str, Any]:
     # Filtering copied from https://github.com/huggingface/peft/blob/4186c9b104644fd247a4cc0dc2dfc1ede4665204/src/peft/utils/save_and_load.py#L68C1-L86C116
     bias = peft_config.bias
     if bias == 'none':
@@ -821,7 +824,7 @@ def filter_state_dict_peft(state_dict: Dict[str, Any], peft_config: 'PeftConfig'
     else:
         raise NotImplementedError
     to_return = {k: v for k, v in to_return.items() if (('lora_' in k and 'default' in k) or ('bias' in k))}
-    
+
     if remove_adapter_names:
         to_return = {k.replace(f'.default', ''): v for k, v in to_return.items()}
-    return to_return
\ No newline at end of file
+    return to_return
diff --git a/tests/models/test_hf_model.py b/tests/models/test_hf_model.py
index d7b7081d..0cf13fb3 100644
--- a/tests/models/test_hf_model.py
+++ b/tests/models/test_hf_model.py
@@ -1223,6 +1223,7 @@ def test_peft_init_not_installed(tiny_gpt2_model, gpt2_peft_config):
             from composer.models import HuggingFaceModel
             _ = HuggingFaceModel(tiny_gpt2_model, peft_config=gpt2_peft_config)
 
+
 @pytest.mark.parametrize('just_lora', [True, False])
 def test_peft_trains_and_loads(tiny_gpt2_model, tiny_gpt2_tokenizer, gpt2_peft_config, tmp_path, just_lora):
     pytest.importorskip('peft')
@@ -1283,6 +1284,7 @@ def test_peft_metadata(tiny_gpt2_model, tiny_gpt2_tokenizer, gpt2_peft_config):
 
     assert loaded_peft_config == gpt2_peft_config
 
+
 @pytest.mark.parametrize('just_lora', [True, False])
 def test_peft_write_hf_from_composer(tiny_gpt2_model, tiny_gpt2_tokenizer, gpt2_peft_config, tmp_path, just_lora):
     peft = pytest.importorskip('peft')
@@ -1369,11 +1371,14 @@ def test_peft_fsdp_trains(tiny_gpt2_model, tiny_gpt2_tokenizer, gpt2_peft_config
         for p1, p2 in zip(trainer.state.model.parameters(), load_trainer.state.model.parameters()):
             torch.testing.assert_close(p1, p2)
 
+
 def test_filtered_state_dict(tiny_gpt2_model, tiny_gpt2_tokenizer, gpt2_peft_config, tmp_path):
     pytest.importorskip('peft')
 
-    hf_model = HuggingFaceModel(tiny_gpt2_model, tokenizer=tiny_gpt2_tokenizer, peft_config=gpt2_peft_config, peft_filter_state_dict_trainable=True)
+    hf_model = HuggingFaceModel(tiny_gpt2_model,
+                                tokenizer=tiny_gpt2_tokenizer,
+                                peft_config=gpt2_peft_config,
+                                peft_filter_state_dict_trainable=True)
     state_dict = hf_model.state_dict()
 
     assert len(state_dict.keys()) == 4
-