Skip to content

Commit

Permalink
fix eval device
Browse files Browse the repository at this point in the history
  • Loading branch information
awaelchli committed Apr 23, 2024
1 parent bd8cec9 commit 973a65a
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
3 changes: 3 additions & 0 deletions litgpt/eval/evaluate.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,9 @@ def convert_and_evaluate(
)
return

if device is None:
device = "cuda" if torch.cuda.is_available() else "cpu"

checkpoint_dir = Path(checkpoint_dir)

if out_dir is None:
Expand Down
2 changes: 1 addition & 1 deletion tests/test_evaluate.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ def test_evaluate_script(tmp_path, monkeypatch):
fn_kwargs = dict(
checkpoint_dir=tmp_path,
out_dir=tmp_path / "out_dir",
device="cpu",
device=None,
dtype=torch.float32,
limit=5,
tasks="mathqa"
Expand Down

0 comments on commit 973a65a

Please sign in to comment.