Comments (5)
又用Facico提供的测试脚本测试,脚本内容如下:
import sys
import torch
from peft import PeftModel
import transformers
from transformers import LlamaTokenizer, LlamaForCausalLM
#tokenizer = LlamaTokenizer.from_pretrained("../LLM_pretrained_model/decapoda-research/llama-7b-hf")
#BASE_MODEL = "../LLM_pretrained_model/decapoda-research/llama-7b-hf"
tokenizer = LlamaTokenizer.from_pretrained("../FastChat_lm-sys_20230630/conv_models/7B")
BASE_MODEL = "../FastChat_lm-sys_20230630/conv_models/7B"
model = LlamaForCausalLM.from_pretrained(
BASE_MODEL,
load_in_8bit=True,
torch_dtype=torch.float16,
device_map="auto",
)
model.eval()
inputs = "Hello, Where is the capital of the United States?" #"你好,美国的首都在哪里?"
input_ids = tokenizer(inputs, return_tensors="pt")['input_ids']
print(input_ids)
input_ids = input_ids.to('cuda')
generation_output = model.generate(
input_ids=input_ids,
max_new_tokens=256,
)
print(generation_output)
print(tokenizer.decode(generation_output[0]))
model = PeftModel.from_pretrained(
model,
"../LLM_pretrained_model/Facico/Chinese-Vicuna-lora-7b-chatv1",
torch_dtype=torch.float16,
device_map={'': 0}
)
inputs = "你好,**的首都在哪里?" #"你好,美国的首都在哪里?"
inputs = "告诉我肚子疼吃什么药?"
input_ids = tokenizer(inputs, return_tensors="pt")['input_ids']
print(input_ids)
input_ids = input_ids.to('cuda')
generation_output = model.generate(
input_ids=input_ids,
max_new_tokens=256,
)
print(generation_output)
print(tokenizer.decode(generation_output[0]))
输出如下:
tensor([[ 1, 15043, 29892, 6804, 338, 278, 7483, 310, 278, 3303,
3900, 29973]])
tensor([[ 1, 15043, 29892, 6804, 338, 278, 7483, 310, 278, 3303,
3900, 29973, 13, 1576, 7483, 310, 278, 3303, 3900, 338,
7660, 29892, 360, 29889, 29907, 29889, 13, 1576, 7483, 310,
278, 3303, 3900, 338, 7660, 29892, 360, 29889, 29907, 29889,
13, 1576, 7483, 310, 278, 3303, 3900, 338, 7660, 29892,
360, 29889, 29907, 29889, 13, 1576, 7483, 310, 278, 3303,
3900, 338, 7660, 29892, 360, 29889, 29907, 29889, 13, 1576,
7483, 310, 278, 3303, 3900, 338, 7660, 29892, 360, 29889,
29907, 29889, 13, 1576, 7483, 310, 278, 3303, 3900, 338,
7660, 29892, 360, 29889, 29907, 29889, 13, 1576, 7483, 310,
278, 3303, 3900, 338, 7660, 29892, 360, 29889, 29907, 29889,
13, 1576, 7483, 310, 278, 3303, 3900, 338, 7660, 29892,
360, 29889, 29907, 29889, 13, 1576, 7483, 310, 278, 3303,
3900, 338, 7660, 29892, 360, 29889, 29907, 29889, 13, 1576,
7483, 310, 278, 3303, 3900, 338, 7660, 29892, 360, 29889,
29907, 29889, 13, 1576, 7483, 310, 278, 3303, 3900, 338,
7660, 29892, 360, 29889, 29907, 29889, 13, 1576, 7483, 310,
278, 3303, 3900, 338, 7660, 29892, 360, 29889, 29907, 29889,
13, 1576, 7483, 310, 278, 3303, 3900, 338, 7660, 29892,
360, 29889, 29907, 29889, 13, 1576, 7483, 310, 278, 3303,
3900, 338, 7660, 29892, 360, 29889, 29907, 29889, 13, 1576,
7483, 310, 278, 3303, 3900, 338, 7660, 29892, 360, 29889,
29907, 29889, 13, 1576, 7483, 310, 278, 3303, 3900, 338,
7660, 29892, 360, 29889, 29907, 29889, 13, 1576, 7483, 310,
278, 3303, 3900, 338, 7660, 29892, 360, 29889, 29907, 29889,
13, 1576, 7483, 310, 278, 3303, 3900, 338, 7660, 29892,
360, 29889, 29907, 29889, 13, 1576, 7483, 310]],
device='cuda:0')
Hello, Where is the capital of the United States?
The capital of the United States is Washington, D.C.
The capital of the United States is Washington, D.C.
The capital of the United States is Washington, D.C.
The capital of the United States is Washington, D.C.
The capital of the United States is Washington, D.C.
The capital of the United States is Washington, D.C.
The capital of the United States is Washington, D.C.
The capital of the United States is Washington, D.C.
The capital of the United States is Washington, D.C.
The capital of the United States is Washington, D.C.
The capital of the United States is Washington, D.C.
The capital of the United States is Washington, D.C.
The capital of the United States is Washington, D.C.
The capital of the United States is Washington, D.C.
The capital of the United States is Washington, D.C.
The capital of the United States is Washington, D.C.
The capital of the United States is Washington, D.C.
The capital of the United States is Washington, D.C.
The capital of
tensor([[ 1, 29871, 31785, 235, 178, 140, 30672, 235, 133, 157,
30319, 234, 153, 191, 232, 147, 134, 231, 190, 131,
31882, 235, 144, 178, 30882]])
tensor([[ 1, 29871, 31785, 235, 178, 140, 30672, 235, 133, 157,
30319, 234, 153, 191, 232, 147, 134, 231, 190, 131,
31882, 235, 144, 178, 30882, 13, 235, 133, 157, 30319,
234, 153, 191, 30392, 30287, 31893, 31190, 235, 170, 132,
30210, 234, 153, 191, 234, 154, 158, 30214, 30682, 30815,
30392, 31272, 30909, 232, 147, 187, 232, 179, 232, 146,
154, 231, 191, 167, 30330, 232, 145, 142, 31074, 31391,
31149, 31221, 30667, 31570, 31674, 31558, 30210, 30267, 30651, 30557,
30392, 30287, 31959, 30682, 30815, 30417, 31931, 30909, 234, 191,
150, 31201, 235, 133, 157, 30319, 234, 153, 191, 30210,
235, 144, 178, 30383, 13, 29896, 29889, 29871, 233, 141,
154, 233, 179, 170, 30705, 235, 144, 178, 13, 233,
141, 154, 233, 179, 170, 30705, 235, 144, 178, 30682,
30651, 232, 187, 177, 31931, 234, 191, 150, 31201, 235,
133, 157, 30319, 234, 153, 191, 30214, 31570, 30573, 232,
177, 134, 30682, 30651, 232, 138, 233, 184, 233, 141,
233, 179, 170, 30705, 30834, 30210, 233, 178, 158, 232,
158, 30214, 232, 138, 233, 184, 233, 141, 233, 179,
170, 30705, 30834, 30210, 233, 178, 158, 232, 158, 30214,
232, 138, 233, 184, 233, 141, 233, 179, 170, 30705,
30834, 30210, 233, 178, 158, 232, 158, 30214, 232, 138,
233, 184, 233, 141, 233, 179, 170, 30705, 30834, 30210,
233, 178, 158, 232, 158, 30214, 232, 138, 233, 184,
233, 141, 233, 179, 170, 30705, 30834, 30210, 233, 178,
158, 232, 158, 30214, 232, 138, 233, 184, 233, 141,
233, 179, 170, 30705, 30834, 30210, 233, 178, 158, 232,
158, 30214, 232, 138, 233, 184, 233, 141, 233, 179,
170, 30705, 30834, 30210, 233, 178, 158, 232, 158, 30214,
232]], device='cuda:0')
告诉我肚子疼吃什么药?
肚子疼是一种常见的疼痛,可能是由于吸��受伤、压力或其他原因引起的。以下是一些可能有助于缓解肚子疼的药:
- 抗氧化药
抗氧化药可以帮助缓解肚子疼,因为它可以������氧化物的毛��,������氧化物的毛��,������氧化物的毛��,������氧化物的毛��,������氧化物的毛��,������氧化物的毛��,������氧化物的毛��,�
可以看到,英文正常的,但是中文会出现很多乱码。
运行在1080ti上,有如下一个警告:
lib/python3.9/site-packages/bitsandbytes/cuda_setup/main.py:149: UserWarning: WARNING: Compute capability < 7.5 detected! Only slow 8-bit matmul is supported for your GPU!
warn(msg)
会不会是精度不够导致的问题?
from chinese-vicuna.
我这个跑英文没有问题,不会出现乱码。跑中文,经常会出现乱码。
我用的库版本:transformers==4.30.2, tokenizers==0.13.3, sentencepiece==0.1.99
大佬们知道是什么原因吗?给指点一下,多谢了。
from chinese-vicuna.
很可能是python第3方包的版本问题,可以参考 https://github.com/Facico/Chinese-Vicuna/blob/master/docs/problems.md @NewEricWang
from chinese-vicuna.
Thanks a lot! @Gzj369
from chinese-vicuna.
from chinese-vicuna.
Related Issues (20)
- 有办法改成分类任务么,用LlamaForSequenceClassification模型类加载
- transformers和pydantic问题 HOT 1
- 是因为梯度为0吗?
- 多卡finetune_chat时报mat1 and mat2 shapes cannot be multiplied (1024x2 and 1x11008) HOT 2
- 请问多个lora模型怎么合并?
- 请问llama7b_4bit_128g的input shape是多少呢 HOT 1
- 运行chat_7B.sh聊两句话out of memory
- 多卡训练 bash scripts/finetune.sh报错 HOT 1
- 这几个不同路径下的模型是否有区别?
- 运行generate脚本之后,在页面提问,很久没有产生回答,后台无报错 HOT 2
- OSError: Not enough disk space. Needed: Unknown size (download: Unknown size, generated: Unknown size, post-processed: Unknown size)
- 从belle+guanaco数据集中抽取前5000条样本训练lora,效果不好
- deepspeed跑模型相关问题
- 使用finetune.sh来指令微调llama-33b,出现ZeroDivisionError: integer division or modulo by zero错误 HOT 2
- 可以提供一下huggingface上的Chinese-Vicuna/llama7b_4bit_128g模型的config.json和tokenizer么?
- 官方colab安裝套件失效
- 如果更改數據集格式,要如何更改代碼
- 可以更新一下requirements吗? HOT 1
- 关于中断训练继续训练。 HOT 16
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 chinese-vicuna.