Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix evaluation if device not specified #1344

Merged
merged 1 commit into from
Apr 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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