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 input_ids always on cpu issue #270

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

apsonawane
Copy link
Contributor

Currently when running this command:
lemonade -i microsoft/Phi-3.5-mini-instruct huggingface-load --device cuda accuracy-mmlu --ntrain 5 --tests management
it fails since the device we are setting to cuda and the input_ids are on cpu so both mmlu and humaneval test fails with error:

Error during model generation: Expected all tensors to be on the same device, but found at least two devices, cuda:0 and cpu! (when checking argument for argument index in method wrapper_CUDA__index_select)

This PR adds the fix which puts the tensors based on the device specified

Signed-off-by: Akshay Sonawane <[email protected]>
@@ -198,7 +200,9 @@ def _evaluate_model(
expected = dataset[task_id]["canonical_solution"]

# Generate completion
input_ids = tokenizer(prompt, return_tensors="pt").input_ids
input_ids = tokenizer(prompt, return_tensors="pt").input_ids.to(
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this change going to break the OGA tools? I don't know if OGA's input_ids support the .to() method or not.

We should add a test that loads an OGA model and passes it to humaneval (opened issue #271).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh I am not sure, need to test

Copy link
Collaborator

@jeremyfowers jeremyfowers Jan 18, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just opened PR #272 which adds a test for OGA that invokes humaneval: https://github.com/onnx/turnkeyml/actions/runs/12839092461/workflow?pr=272

You can try that if you want to make sure OGA will still work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants