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

generate.py cur_ids = torch.cat([cur_ids, torch.ones((1,1)).long().to(device) * next_token_id], dim = 1) name 'device' is not defined #12

Open
xsyzka opened this issue Mar 8, 2022 · 4 comments

Comments

@xsyzka
Copy link

xsyzka commented Mar 8, 2022

NameError: name 'device' is not defined ?How can I solve it, thank you

@BucketHeadP65
Copy link

BucketHeadP65 commented Jul 6, 2022

@xsyzka Welp it might be too late:
The root cause of the error is that the variable device is not defined :P . But even if you define it you might encounter the following issues:

  1. To use the pre-trained model that @prakhar21 provides you need an older version of transformers (2.8.0) which i managed to run only with cpu.
  2. You can use newer version of transformers and train your own model. Then you can make the following changes:

fix

@xsyzka
Copy link
Author

xsyzka commented Jul 7, 2022

Thank you very much for your advice!

@xsyzka
Copy link
Author

xsyzka commented Jul 7, 2022

@xsyzka好吧,可能为时已晚:错误的根本原因是设备未:P定义。但是,即使您定义了它,也可能会遇到以下问题:

  1. 要使用@prakhar21使用的预训练模型,您需要一个旧版本的转换器,我设法仅使用cpu运行
  2. 您可以使用较新版本的转换器并训练自己的模型。然后,您可以进行以下更改:

修复

Thank you very much for your advice!

@BucketHeadP65
Copy link

Thank you very much for your advice!

You are welcome!

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