Skip to content

Commit

Permalink
fix: The logic of matching the device_id is wrong.
Browse files Browse the repository at this point in the history
  • Loading branch information
xixihahaliu committed May 13, 2024
1 parent 239f761 commit 37c4894
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -140,12 +140,17 @@ echo "model_size=$model_size"

update_or_append_to_env "MODEL_SIZE" "$model_size"

# 检查device_id是否合法
if ! [[ $device_id =~ ^[0-9]+(?:,[0-9]+)*$ ]]; then
echo "Invalid device IDs. Please enter IDs in the format '0,1,2'."
## 检查device_id是否合法,必须满足以下条件:
# 1. 以逗号分隔的多个数字
# 2. 每个数字必须是0或正整数
# 3. 不能有重复的数字
if ! [[ $device_id =~ ^([0-9]+,)*[0-9]+$ ]]; then
echo "Invalid device_id. Please enter a comma-separated list of integers like '0' or '0,1'."
exit 1
fi



gpu_id1=0
gpu_id2=0

Expand Down

0 comments on commit 37c4894

Please sign in to comment.