-
Notifications
You must be signed in to change notification settings - Fork 91
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
输出不理想~ #12
Comments
|
好的感谢up主回答~ |
另外你这个去除输入部分的代码不太对 你直接把inputs从batch decode的结果里replace掉不行吗
|
这个是因为返回把前面的的iput也加进去了,我临时做得切片输出 比如你输入来首李白的诗句,然后他就会把李白的诗句也在输出的最前面输出出来 |
我知道啊 因为这是decoder-only 我的意思是你去掉输入时候的切片为什么用 |
我试试哈,懂up主的意思了~ |
因为 那个line 也带了~ |
就是 有两段不需要的长度字符输出,一个是inputs的内容,一个是line的内容 |
Reopen this if need further help. |
import torch
import sys
from transformers import AutoTokenizer, AutoModelForCausalLM, LlamaForCausalLM
import os
from accelerate import infer_auto_device_map
model_path = "/root/vicuna-7b"
model = LlamaForCausalLM.from_pretrained(
model_path, device_map='auto', low_cpu_mem_usage=True)
tokenizer = AutoTokenizer.from_pretrained(model_path)
print('Human:')
line = input().strip()
while line:
batch = tokenizer(line, return_tensors="pt")
print('\n\nAssistant:' + tokenizer.decode(model.generate(batch["input_ids"].cuda(
), do_sample=True, top_k=50, max_length=100, top_p=0.95, temperature=1.0)[0]))
print("\n------------------------------------------------\nHuman:")
line = input().strip() 还是不理想 |
这是我写的调用脚本
这是我把原始7b模型权重转换以后的llama-7b-hf
这是我将llam-7b-hf和你的https://huggingface.co/chitanda/llama-panda-zh-7b-delta差异模型合并以后的vicuna
这是结果,输出不理想
The text was updated successfully, but these errors were encountered: