Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

reorg of test scripts and minor changes to tests #602

Merged
Merged
Show file tree
Hide file tree
Changes from all 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
2 changes: 1 addition & 1 deletion src/accelerate/utils/dataclasses.py
Original file line number Diff line number Diff line change
Expand Up @@ -383,7 +383,7 @@ def deepspeed_config_process(self, prefix="", mismatches=None, config=None, must
def set_mixed_precision(self, mixed_precision):
ds_config = self.deepspeed_config
if mixed_precision == "fp16" and "fp16" not in ds_config and "bf16" not in ds_config:
ds_config.update({"fp16": {"enabled": True}})
ds_config.update({"fp16": {"enabled": True, "auto_cast": True}})
elif mixed_precision == "bf16" and "fp16" not in ds_config and "bf16" not in ds_config:
ds_config.update({"bf16": {"enabled": True}})

Expand Down
8 changes: 5 additions & 3 deletions tests/deepspeed/test_deepspeed.py
Original file line number Diff line number Diff line change
Expand Up @@ -594,7 +594,9 @@ def test_autofill_dsconfig(self):

def test_basic_run(self):
mod_file = inspect.getfile(accelerate.test_utils)
test_file_path = os.path.sep.join(mod_file.split(os.path.sep)[:-1] + ["scripts", "test_performance.py"])
test_file_path = os.path.sep.join(
mod_file.split(os.path.sep)[:-1] + ["scripts", "external_deps", "test_performance.py"]
)
with tempfile.TemporaryDirectory() as dirpath:
cmd = [
"accelerate",
Expand Down Expand Up @@ -634,7 +636,7 @@ def setUp(self):

self.stages = [1, 2, 3]
self.zero3_offload_config = False
self.performance_lower_bound = 0.83
self.performance_lower_bound = 0.82
self.peak_memory_usage_upper_bound = {
"multi_gpu_fp16": 3200,
"deepspeed_stage_1_fp16": 1600,
Expand All @@ -646,7 +648,7 @@ def setUp(self):
self.n_val = 160

mod_file = inspect.getfile(accelerate.test_utils)
self.test_scripts_folder = os.path.sep.join(mod_file.split(os.path.sep)[:-1] + ["scripts"])
self.test_scripts_folder = os.path.sep.join(mod_file.split(os.path.sep)[:-1] + ["scripts", "external_deps"])

def test_performance(self):
self.test_file_path = os.path.join(self.test_scripts_folder, "test_performance.py")
Expand Down
4 changes: 2 additions & 2 deletions tests/fsdp/test_fsdp.py
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ def test_cpu_offload(self):
class FSDPIntegrationTest(TempDirTestCase):
def setUp(self):
super().setUp()
self.performance_lower_bound = 0.83
self.performance_lower_bound = 0.82
self.performance_configs = [
"fsdp_shard_grad_op_transformer_based_wrap",
"fsdp_full_shard_transformer_based_wrap",
Expand All @@ -197,7 +197,7 @@ def setUp(self):
self.n_val = 160

mod_file = inspect.getfile(accelerate.test_utils)
self.test_scripts_folder = os.path.sep.join(mod_file.split(os.path.sep)[:-1] + ["scripts"])
self.test_scripts_folder = os.path.sep.join(mod_file.split(os.path.sep)[:-1] + ["scripts", "external_deps"])

def test_performance(self):
self.test_file_path = os.path.join(self.test_scripts_folder, "test_performance.py")
Expand Down