-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
auto detect which model to run (#36)
* auto detect which model to run * fix model name * remove max_samples * fix bash script * chore: max tokens --------- Co-authored-by: Justus Mattern <[email protected]>
- Loading branch information
1 parent
8a539ea
commit 0fba3ac
Showing
5 changed files
with
61 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
name_model = "deepseek-ai/DeepSeek-R1-Distill-Llama-70B" | ||
num_gpus = 8 | ||
sample_per_file = 512 | ||
temperature = 0.6 # 0.6 is the value from the R1 model card for evaluation | ||
top_p = 0.95 # 0.95 is the value from the R1 model card for evaluation | ||
|
||
[data] | ||
batch_size = 512 | ||
path = "justus27/test-vcu,justus27/test-vfc,justus27/test-jdg,justus27/test-vfm" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
#!/bin/bash | ||
|
||
# Save the original stdout to FD 3 | ||
exec 3>&1 | ||
|
||
# Capture both stdout and stderr while also printing to terminal | ||
output=$(uv run python src/genesys/auto_detect_model_config.py 2>&1 | tee /dev/fd/3) | ||
exit_code=${PIPESTATUS[0]} | ||
|
||
if [ $exit_code -ne 0 ]; then | ||
echo "Error: $output" | ||
exit $exit_code | ||
fi | ||
|
||
model_name=$output | ||
echo "The model to run is: $model_name" | ||
uv run python src/genesys/generate.py @ configs/"$model_name".toml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
import torch | ||
import sys | ||
|
||
|
||
def get_model_name(device_name: str) -> str: | ||
"""find out which model we can run""" | ||
if "A100" in device_name: | ||
return "llama70b" | ||
elif "H100" in device_name: | ||
# data from https://www.nvidia.com/en-us/data-center/h100/ | ||
# NOTE: Specifications are one-half lower without sparsity. | ||
if "NVL" in device_name: | ||
return "llama70b" | ||
elif "PCIe" in device_name: | ||
return "llama70b" | ||
else: # for H100 SXM and other variants | ||
return "llama70b" | ||
elif "H200" in device_name: | ||
return "deepseek_r1" | ||
else: # for other GPU types, assume A100 | ||
return "llama70b" | ||
|
||
if __name__ == "__main__": | ||
try: | ||
device_info_torch = torch.cuda.get_device_name(torch.device("cuda:0")) | ||
run_model_name = get_model_name(device_info_torch) | ||
print(run_model_name) | ||
except Exception as e: | ||
print(f"Error: {str(e)}", file=sys.stderr) | ||
sys.exit(1) |