mirror of
https://github.com/huggingface/accelerate.git
synced 2025-11-16 23:40:42 +08:00
Compare commits
3 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 1a63f7dff2 | |||
| 4352d3d359 | |||
| 02dca638ac |
2
setup.py
2
setup.py
@ -32,7 +32,7 @@ extras["sagemaker"] = [
|
||||
|
||||
setup(
|
||||
name="accelerate",
|
||||
version="0.17.0.dev0",
|
||||
version="0.17.0",
|
||||
description="Accelerate",
|
||||
long_description=open("README.md", "r", encoding="utf-8").read(),
|
||||
long_description_content_type="text/markdown",
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
__version__ = "0.17.0.dev0"
|
||||
__version__ = "0.17.0"
|
||||
|
||||
from .accelerator import Accelerator
|
||||
from .big_modeling import (
|
||||
|
||||
@ -99,6 +99,9 @@ class BaseConfig:
|
||||
config_dict["mixed_precision"] = "fp16" if ("fp16" in config_dict and config_dict["fp16"]) else None
|
||||
if "fp16" in config_dict: # Convert the config to the new format.
|
||||
del config_dict["fp16"]
|
||||
if "dynamo_backend" in config_dict: # Convert the config to the new format.
|
||||
dynamo_backend = config_dict.pop("dynamo_backend")
|
||||
config_dict["dynamo_config"] = {} if dynamo_backend == "NO" else {"dynamo_backend": dynamo_backend}
|
||||
if "use_cpu" not in config_dict:
|
||||
config_dict["use_cpu"] = False
|
||||
return cls(**config_dict)
|
||||
@ -120,6 +123,9 @@ class BaseConfig:
|
||||
config_dict["mixed_precision"] = "fp16" if ("fp16" in config_dict and config_dict["fp16"]) else None
|
||||
if "fp16" in config_dict: # Convert the config to the new format.
|
||||
del config_dict["fp16"]
|
||||
if "dynamo_backend" in config_dict: # Convert the config to the new format.
|
||||
dynamo_backend = config_dict.pop("dynamo_backend")
|
||||
config_dict["dynamo_config"] = {} if dynamo_backend == "NO" else {"dynamo_backend": dynamo_backend}
|
||||
if "use_cpu" not in config_dict:
|
||||
config_dict["use_cpu"] = False
|
||||
return cls(**config_dict)
|
||||
|
||||
@ -45,10 +45,12 @@ def test_command_parser(subparsers=None):
|
||||
def test_command(args):
|
||||
script_name = os.path.sep.join(__file__.split(os.path.sep)[:-2] + ["test_utils", "scripts", "test_script.py"])
|
||||
|
||||
test_args = f"""
|
||||
--config_file={args.config_file} {script_name}
|
||||
""".split()
|
||||
cmd = ["accelerate-launch"] + test_args
|
||||
if args.config_file is None:
|
||||
test_args = script_name
|
||||
else:
|
||||
test_args = f"--config_file={args.config_file} {script_name}"
|
||||
|
||||
cmd = ["accelerate-launch"] + test_args.split()
|
||||
result = execute_subprocess_async(cmd, env=os.environ.copy())
|
||||
if result.returncode == 0:
|
||||
print("Test is a success! You are ready for your distributed training!")
|
||||
|
||||
Reference in New Issue
Block a user