shibing624 / textgen

TextGen: Implementation of Text Generation models, include LLaMA, BLOOM, GPT2, BART, T5, SongNet and so on. 文本生成模型,实现了包括LLaMA,ChatGLM,BLOOM,GPT2,Seq2Seq,BART,T5,UDA等模型的训练和预测,开箱即用。
Apache License 2.0
937 stars 109 forks source link

torch.load()希望能够增加map_location #47

Open PolarisRisingWar opened 1 year ago

PolarisRisingWar commented 1 year ago

Is your feature request related to a problem? Please describe.

我遇到的问题是在textgen/gpt/gpt_model.py第359行,因为我保存的设备(双卡)和加载的设备(单卡)不同,我改成adapters_weights = torch.load(checkpoint_name,map_location="cpu")后能够正常运行

Describe the solution you'd like

我的建议是开放一个可以输入设备的接口,或者直接就放CPU上算了

Describe alternatives you've considered

A clear and concise description of any alternative solutions or features you've considered.

Additional Information

Other things you want the developers to know.

shibing624 commented 1 year ago

为啥不用 CUDA_VISIBLE_DEVICES=0, cpu就写CUDA_VISIBLE_DEVICES=-1

PolarisRisingWar commented 1 year ago

不是,比如说我之前保存到卡1上了,我现在设置CUDA_VISIBLE_DEVICES=0了,如果不设置map_location的话,它还是会默认调用到卡1上,但是我现在就没有卡1了,就会报错

shibing624 commented 1 year ago

get, fixed.

stale[bot] commented 11 months ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.(由于长期不活动,机器人自动关闭此问题,如果需要欢迎提问)