Skip to content

Commit

Permalink
trl env report all cuda devices (#2216)
Browse files Browse the repository at this point in the history
  • Loading branch information
qgallouedec authored Oct 11, 2024
1 parent 6004e03 commit 5375d71
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion trl/commands/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,9 @@


def print_env():
if torch.cuda.is_available():
devices = [torch.cuda.get_device_name(i) for i in range(torch.cuda.device_count())]

accelerate_config = accelerate_config_str = "not found"

# Get the default from the config file.
Expand All @@ -56,7 +59,7 @@ def print_env():
"Platform": platform.platform(),
"Python version": platform.python_version(),
"PyTorch version": version("torch"),
"CUDA device": torch.cuda.get_device_name() if torch.cuda.is_available() else "not available",
"CUDA device(s)": ", ".join(devices) if torch.cuda.is_available() else "not available",
"Transformers version": version("transformers"),
"Accelerate version": version("accelerate"),
"Accelerate config": accelerate_config_str,
Expand Down

0 comments on commit 5375d71

Please sign in to comment.