shibing624 / MedicalGPT

MedicalGPT: Training Your Own Medical GPT Model with ChatGPT Training Pipeline. 训练医疗大模型,实现了包括增量预训练(PT)、有监督微调(SFT)、RLHF、DPO、ORPO。
Apache License 2.0
2.94k stars 452 forks source link

推理不适用指定的卡 #292

Closed nuoma closed 6 months ago

nuoma commented 6 months ago

推理的时候,使用的是CPU,并没有使用指定的2卡,这个问题在train阶段是没有的,很奇怪 ··· CUDA_VISIBLE_DEVICES=2 python inference.py \ --model_type baichuan \ --base_model ./outputs/20231221_exp1_stg1_merged \ --tokenizer_path ./outputs/20231221_exp1_stg1_merged \ --template_name baichuan2 \ --gpus 2 \ --interactive ···

torch版本2.1.2+cu121 transformers 4.33.0 transformers-stream-generator 0.0.4

nvcc --version nvcc: NVIDIA (R) Cuda compiler driver Copyright (c) 2005-2023 NVIDIA Corporation Built on Tue_Jul_11_02:20:44_PDT_2023 Cuda compilation tools, release 12.2, V12.2.128 Build cuda_12.2.r12.2/compiler.33053471_0

nvidia-smi Fri Dec 22 13:30:08 2023 +-----------------------------------------------------------------------------+ | NVIDIA-SMI 525.147.05 Driver Version: 525.147.05 CUDA Version: 12.0

nuoma commented 6 months ago

根据作者的指示,不要换行,就解决了。依然感到非常神奇。 CUDA_VISIBLE_DEVICES=6 python inference.py --model_type baichuan --base_model ./outputs/20231221_exp1_stg1_merged --tokenizer_path ./outputs/20231221_exp1_stg1_merged --template_name baichuan2 --gpus 6 --interactive

lljpwrs commented 5 months ago

不是,是你如果直接按回车的话,那就相当于两行就是两个命令了,你去敲一下 linux 系统的命令行就知道了,要想换行的话,你在每一行加上一个『\』反斜杠就行了,这就是告诉 linux 系统这两行其实是连着的,就是这样:

CUDA_VISIBLE_DEVICES=2 python inference.py \ --model_type baichuan \ --base_model ./outputs/20231221_exp1_stg1_merged

这样就行了