We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
这个代码 model.generate(tokenizer(prompt, return_tensors='pt').input_ids.cuda(), max_new_tokens=4096, streamer=streamer) 确实可以显示答复的内容,但是能否提供一个流返回的代码样例?类似下面的代码: for respond in model.generate(tokenizer(prompt, return_tensors='pt').input_ids.cuda(), max_new_tokens=4096, streamer=streamer) : print(respond,end="", flush=True) 上面代码是运行不正确的。请各位老大给一个正确的食用方式。谢谢!
The text was updated successfully, but these errors were encountered:
steamer本身就是流返回,这部分可以看一眼transformers库的用法
Sorry, something went wrong.
我知道,它只是model.generate执行后,结果直接流打印在屏幕中,为什么不是直接model.generate的返回值,而是打印在屏幕?如果获得流的返回?因为我想将流发送到其他程序处理。我利用多线程的方式读取streamer,但是这个有点复杂。还有其他方法吗?
No branches or pull requests
这个代码 model.generate(tokenizer(prompt, return_tensors='pt').input_ids.cuda(), max_new_tokens=4096, streamer=streamer) 确实可以显示答复的内容,但是能否提供一个流返回的代码样例?类似下面的代码:
for respond in model.generate(tokenizer(prompt, return_tensors='pt').input_ids.cuda(), max_new_tokens=4096, streamer=streamer) :
print(respond,end="", flush=True)
上面代码是运行不正确的。请各位老大给一个正确的食用方式。谢谢!
The text was updated successfully, but these errors were encountered: