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

Facing issue in generate.py #8

Open
SarangShaikh201 opened this issue Sep 2, 2020 · 1 comment
Open

Facing issue in generate.py #8

SarangShaikh201 opened this issue Sep 2, 2020 · 1 comment

Comments

@SarangShaikh201
Copy link


RuntimeError Traceback (most recent call last)
in
93 TOKENIZER, MODEL = load_models(MODEL_NAME)
94
---> 95 generate(TOKENIZER, MODEL, SENTENCES, LABEL, DEVICE)

in generate(tokenizer, model, sentences, label, device)
47
48 next_token_id = choose_from_top_k_top_n(softmax_logits.to('cpu').numpy()) #top-k-top-n sampling
---> 49 cur_ids = torch.cat([cur_ids, torch.ones((1,1)).long().to(device) * next_token_id], dim = 1)
50
51 if next_token_id in tokenizer.encode('<|endoftext|>'):

RuntimeError: All input tensors must be on the same device. Received cpu and cuda:0

@xsyzka
Copy link

xsyzka commented Mar 8, 2022

How did you solve it.thank you

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

No branches or pull requests

2 participants