TextAugmentation-GPT2
TextAugmentation-GPT2 copied to clipboard
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
NameError: name 'device' is not defined ?How can I solve it, thank you
@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:
- 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.
- You can use newer version of transformers and train your own model. Then you can make the following changes:

Thank you very much for your advice!
@xsyzka好吧,可能为时已晚:错误的根本原因是设备未:P定义。但是,即使您定义了它,也可能会遇到以下问题:
- 要使用@prakhar21使用的预训练模型,您需要一个旧版本的转换器,我设法仅使用cpu运行
- 您可以使用较新版本的转换器并训练自己的模型。然后,您可以进行以下更改:
Thank you very much for your advice!
Thank you very much for your advice!
You are welcome!