# Intel MPI and MVAPICH both use the same arg names
return mpi_app, "-f", "-n", "-ppn", ""
def setup_fp8_env(args: argparse.Namespace, current_env: Dict[str, str]):
"""
Setup the FP8 environment variables.
"""
prefix = "ACCELERATE_"
for arg in vars(args):
if arg.startswith("fp8_"):
value = getattr(args, arg)
if value is not None:
if arg == "fp8_override_linear_precision":
values = value.strip("()").split(",")
current_env[prefix + "FP8_OVERRIDE_FPROP"] = values[0].strip()
current_env[prefix + "FP8_OVERRIDE_DGRAD"] = values[1].strip()
current_env[prefix + "FP8_OVERRIDE_WGRAD"] = values[2].strip()
else:
current_env[f"{prefix}{arg.upper()}"] = str(getattr(args, arg))
return current_env
current_env["MASTER_ADDR"] = args.main_process_ip if args.main_process_ip is not None else "127.0.0.1"
current_env["MASTER_PORT"] = str(args.main_process_port) if args.main_process_port is not None else "29500"
try:
mixed_precision = PrecisionType(args.mixed_precision.lower())
except ValueError:
raise ValueError(
f"Unknown mixed_precision mode: {args.mixed_precision.lower()}. Choose between {PrecisionType.list()}."
)
current_env["ACCELERATE_MIXED_PRECISION"] = str(mixed_precision)
if args.mixed_precision.lower() == "fp8":
if not is_fp8_available():
raise RuntimeError(
"FP8 is not available on this machine. Please ensure that either Transformer Engine or MSAMP is installed."
)
current_env = setup_fp8_env(args, current_env)
try:
dynamo_backend = DynamoBackend(args.dynamo_backend.upper())
except ValueError:
There is a possibility that there is a bug in the way CLI handles fp8-related arguments…
Unless you have a GPU that supports fp8 natively, such as 4090, you probably won’t reach the code, so you won’t have a problem.
The error itself will disappear if you lower the version of accelerate, as it probably occurred at the time of the following commit.
committed 02:31PM - 10 Feb 25 UTC
* works for fp8 with deepspeed
* Add tests
---------
Co-authored-by: [[… -z $EMAIL ]] && read -e -p "Enter your email (for git configuration): " EMAIL <muellerzr@gmail.com>