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

使用vllm数据并行和ChatHaruhi一起使用会报RuntimeError: Cannot re-initialize CUDA in forked subprocess. To use CUDA with multiprocessing, you must use the 'spawn' start method #83

Open
545771889a opened this issue Nov 1, 2024 · 1 comment

Comments

@545771889a
Copy link

545771889a commented Nov 1, 2024

我的代码
from vllm import LLM, SamplingParams
from chatharuhi import ChatHaruhi (这里只要导入ChatHaruhi就会报Cannot re-initialize CUDA in forked subprocess. To use CUDA with multiprocessing, you must use the 'spawn' start method)

def load_model_(model_name, peft_model, quantization=None, use_fast_kernels=True, seed=42, **kwargs):
# 加载model、tokenizer、rag
llm = LLM(model=model_name, max_model_len=40452, tensor_parallel_size=2) #这里只有tensor_parallel_size设置为1才能正常使用
torch.cuda.manual_seed(seed)
torch.manual_seed(seed)

tokenizer = AutoTokenizer.from_pretrained(MODEL_NAME)
tokenizer.pad_token = tokenizer.eos_token

# rag
chatbot = ChatHaruhi(role_name='Sheldon', max_len_story=1000)
return llm, tokenizer, chatbot
@LC1332
Copy link
Owner

LC1332 commented Nov 3, 2024

可能内部启rag的vector模型的时候发生冲突了-o-

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