Comments (3)
当前没有使用vllm和你设置的超参数去尝试,关于API部署可以尝试按以下文档中的方案不会重复:https://github.com/CrazyBoyM/llama3-Chinese-chat/tree/main/deploy/API
代码:
import uvicorn
import torch
from transformers import pipeline, AutoTokenizer
from fastapi import FastAPI, Request
app = FastAPI()
@app.post("/")
async def create_item(request: Request):
global pipe
data = await request.json()
prompt = data.get('prompt')
print(prompt)
messages = [
{
"role": "system",
"content": "你是一个超级智者,名字叫shareAI-llama3,拥有优秀的问题解答能力。",
},
{"role": "user", "content": prompt}
]
response = pipe(messages)
# breakpoint()
print(response)
answer = {
"response": response[-1]["content"],
"status": 200,
}
return answer
if __name__ == '__main__':
model_name_or_path = '/openbayes/home/baicai003/Llama3-Chinese-instruct-DPO-beta0___5'
# 这里的模型路径替换为你本地的完整模型存储路径 (一般从huggingface或者modelscope上下载到)
tokenizer = AutoTokenizer.from_pretrained(model_name_or_path, use_fast=False)
pipe = pipeline(
"conversational",
model_name_or_path,
torch_dtype=torch.float16,
device_map="auto",
max_new_tokens=512,
do_sample=True,
top_p=0.9,
temperature=0.6,
repetition_penalty=1.1,
eos_token_id=tokenizer.encode('<|eot_id|>')[0]
)
# 如果是base+sft模型需要替换<|eot_id|>为<|end_of_text|>,因为llama3 base模型里没有训练<|eot_id|>这个token
uvicorn.run(app, host='0.0.0.0', port=9009) # 这里的端口替换为你实际想要监听的端口
from llama3-chinese-chat.
可以尝试设置一下repetition_penalty系数
from llama3-chinese-chat.
好的,谢谢~
from llama3-chinese-chat.
Related Issues (20)
- 能把微调的代码也开源吗? HOT 1
- 网页部署shareAI的V2版后为什么是gpt3.5? HOT 1
- 坐等一个涩涩版,🤓 HOT 3
- 1048k长度来啦
- llama3-8x8b-MoE-Base/Instruct 初始权重和模型文件已发布 HOT 1
- 大佬,为什么我调试出来回复的速度非常慢呢? HOT 3
- 感觉不太行,输出像是一堆乱码? HOT 5
- DPO训练问题 HOT 6
- 问了几个弱智吧的问题,感觉白微调了 HOT 2
- DPO问题 HOT 3
- Yi-1.5-9B-chat能出个16k上下文的吗?
- 您好,看你的发布的项目挺厉害的,我有一个疑惑的地方希望能帮我解答一下,我微调了一个llama3我该如果去测评他呢? HOT 1
- Llama3-Chinese_v2版本回答很奇怪 HOT 2
- 请问有没有针对情感分析任务的模型? HOT 3
- 你这个训完,中文效果还略低于 llama3-instruct ? HOT 2
- 你好,想问一下,怎么把你提供的语言模型,和一些视觉模型例如CLIP ViT-L/14,自己合并成多模态的大模型,请问有这方面的教程吗 HOT 1
- 您好,我如何检验模型的上下文长度呢 HOT 2
- 你好,请问在哪才能获得你30B版本的模型? HOT 2
- Infer result with line number is incorrect
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 llama3-chinese-chat.