Comments (10)
- inputs里面不需要加
Human:
或者Assistant:
前缀,直接提问即可 - 7B的模型 要么greedy search要么beam search 不要加温度系数也不要采样,如果你想要多样性的回答可以用beam search取top-3
- 从你的例子来看主要有两个问题,事实性问题和无法停止,目前这两个问题在LLaMA系列里都很常见,即使是英文模型,后续可以在13B模型上试试
from pandallm.
好的感谢up主回答~
我把温度系数和采样删除试试
from pandallm.
另外你这个去除输入部分的代码不太对 len(inputs) + len(line)
把line算了两遍?
你直接把inputs从batch decode的结果里replace掉不行吗
outputs = [seq.replace(self.tokenizer.decode(input_ids[i], skip_special_tokens=True), "")
for i, seq in enumerate(rets)]
from pandallm.
这个是因为返回把前面的的iput也加进去了,我临时做得切片输出 比如你输入来首李白的诗句,然后他就会把李白的诗句也在输出的最前面输出出来
from pandallm.
我知道啊 因为这是decoder-only 我的意思是你去掉输入时候的切片为什么用rets[len(inputs) + len(line):]
而不是 rets[len(inputs):]
from pandallm.
我知道啊 因为这是decoder-only 我的意思是你去掉输入时候的切片为什么用
rets[len(inputs) + len(line):]
而不是rets[len(inputs):]
我试试哈,懂up主的意思了~
from pandallm.
我知道啊 因为这是decoder-only 我的意思是你去掉输入时候的切片为什么用
rets[len(inputs) + len(line):]
而不是rets[len(inputs):]
因为 那个line 也带了~
from pandallm.
我知道啊 因为这是decoder-only 我的意思是你去掉输入时候的切片为什么用
rets[len(inputs) + len(line):]
而不是rets[len(inputs):]
就是 有两段不需要的长度字符输出,一个是inputs的内容,一个是line的内容
from pandallm.
Reopen this if need further help.
from pandallm.
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()
还是不理想
from pandallm.
Related Issues (20)
- 感觉模型比原始的LlaMa模型大了很多,是什么原因 HOT 1
- 推理超参数 HOT 1
- 预训练和微调阶段使用的是全量微调还是lora? HOT 1
- 词表没扩充过是吗?还是32,000吧? HOT 1
- linly预训练阶段和panda类似,指令微调阶段使用了500万条,为什么效果比panda差? HOT 1
- 请问有使用的examples吗 HOT 1
- 权重转换脚本不支持来自 Facebook 的原版权重 HOT 2
- 请问如何在COIG数据集上继续训练 HOT 8
- 如何将COIG数据集处理为instruction tuning的格式 HOT 1
- 单卡A100训练7B模型OOM HOT 12
- 商用7b模型,直接进行推理说话毫无逻辑,难道不是开箱即用的嘛? HOT 4
- 能否提供一下模型量化的方法?其他在mac上进行推理测试 HOT 1
- 如果要重新训练panda,请问数据集应该以什么结构存储呢 HOT 5
- 由于训练数据的预处理存在不确定性,请问可以进一步分享处理代码吗 HOT 2
- 关于推理的问题 HOT 5
- RuntimeError: The size of tensor a (32000) must match the size of tensor b (32001) at non-singleton dimension 0 HOT 2
- Removed.
- Panda-LLaMA2-13B的模型链接不对吧? HOT 3
- 在线体验需要访问密码?
- 在线体验 pandallm.ai/,该链接无法打开
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pandallm.