Skip to content

Commit 5aaf2dd

Browse files
committed
Use CPU if CUDA is not available (#18)
As it's reasonable, isn't it?
1 parent 55c1be5 commit 5aaf2dd

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

.github/workflows/compile.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,8 @@ jobs:
3838
run: |
3939
export MODEL_PATH=checkpoints/stories15M/stories15M.pt
4040
export MODEL_REPO=stories15M
41-
python generate.py --checkpoint_path ${MODEL_PATH} --temperature 0 --device cpu | tee output_eager
42-
python generate.py --compile --checkpoint_path ${MODEL_PATH} --temperature 0 --device cpu | tee output_compiled
41+
python generate.py --checkpoint_path ${MODEL_PATH} --temperature 0 | tee output_eager
42+
python generate.py --compile --checkpoint_path ${MODEL_PATH} --temperature 0 | tee output_compiled
4343
python aoti_export.py --checkpoint_path ${MODEL_PATH} --output_path ./${MODEL_REPO}.so
4444
python generate.py --checkpoint_path ${MODEL_PATH} --temperature 0 --dso ./${MODEL_REPO}.so | tee output_aoti
4545
# echo "******************************************"

generate.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -558,7 +558,7 @@ def cli():
558558
default=None,
559559
help="Draft checkpoint path.",
560560
)
561-
parser.add_argument("--device", type=str, default="cuda", help="Device to use")
561+
parser.add_argument("--device", type=str, default="cuda" if torch.cuda.is_available() else "cpu", help="Device to use")
562562
parser.add_argument(
563563
"--dso_path",
564564
type=Path,

0 commit comments

Comments
 (0)