Skip to content
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions tests/trainer/test_trainer.py
Original file line number Diff line number Diff line change
Expand Up @@ -5370,17 +5370,21 @@ def hp_name(trial):
if is_torchao_available():
import torchao

has_torchao_optim = version.parse(importlib.metadata.version("torchao")) >= version.parse("0.11.0")
AdamW4bitModule = torchao.optim.AdamW4bit if has_torchao_optim else torchao.prototype.low_bit_optim.AdamW4bit
AdamW8bitModule = torchao.optim.AdamW8bit if has_torchao_optim else torchao.prototype.low_bit_optim.AdamW8bit

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just fix the import, we will always use the latest version of torchao

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@SunMarc , done, pls take a look, thx

optim_test_params.append(
(
OptimizerNames.ADAMW_TORCH_4BIT,
torchao.prototype.low_bit_optim.AdamW4bit,
AdamW4bitModule,
default_adam_kwargs,
)
)
optim_test_params.append(
(
TrainingArguments(optim=OptimizerNames.ADAMW_TORCH_8BIT, output_dir="None"),
torchao.prototype.low_bit_optim.AdamW8bit,
AdamW8bitModule,
default_adam_kwargs,
)
)
Expand Down