网上学习资料一大堆,但如果学到的知识不成体系,遇到问题时只是浅尝辄止,不再深入研究,那么很难做到真正的技术提升。
一个人可以走的很快,但一群人才能走的更远!不论你是正从事IT行业的老鸟或是对IT行业感兴趣的新人,都欢迎加入我们的的圈子(技术交流、学习资源、职场吐槽、大厂内推、面试辅导),让我们一起学习成长!
2.环境
2.1 服务器
# 1.查询操作系统版本
cat /etc/os-release
# 查询结果
NAME="openEuler"
VERSION="22.03 (LTS-SP1)"
ID="openEuler"
VERSION\_ID="22.03"
PRETTY\_NAME="openEuler 22.03 (LTS-SP1)"
ANSI\_COLOR="0;31"
2.2 运行环境
也可以使用Anaconda
或Docker
构建运行环境:
# 2.查询python版本
python -V
# 查询结果
Python 3.9.18
# 3.组件版本
torch==2.1.2
gpt4all==2.2.1.post1
transformers==4.32.1
3.调用
3.1 代码
from gpt4all import GPT4All
model = GPT4All("orca-mini-3b-gguf2-q4\_0.gguf")
output = model.generate("The capital of France is ", max_tokens=3)
print(output)
实际使用代码:
from gpt4all import GPT4All
def get\_answer\_form\_model(request):
# 参数
req = json.loads(request.body.decode())
model_name = req['model']
max_tokens = req['max\_tokens']
question_text = req['question']
# 调用
model = GPT4All(model_name=model_name, model_path="/a\_model", allow_download=False)
output = model.generate(question_text, max_tokens=max_tokens)
print(output)
return HttpResponse(output)
3.2 测试
{
"model": "orca-mini-3b-gguf2-q4\_0.gguf",
"max\_tokens": 30,
"question": "The capital of France is "
}
100% Paris.
I hope that helps!
一些离谱的回答:
{
"model": "baichuan2-7b-chat.Q3\_K\_L.gguf",
"max\_tokens": 1200,
![img](https://img-blog.csdnimg.cn/img_convert/107a1666674a0a0642eeaf9ad9d516c7.png)
![img](https://img-blog.csdnimg.cn/img_convert/33a4ac3f179828440e185c72f8021db7.png)
![img](https://img-blog.csdnimg.cn/img_convert/e525e0f55dc7f36309e5c744df862dc2.png)
**既有适合小白学习的零基础资料,也有适合3年以上经验的小伙伴深入学习提升的进阶课程,涵盖了95%以上软件测试知识点,真正体系化!**
**由于文件比较多,这里只是将部分目录截图出来,全套包含大厂面经、学习笔记、源码讲义、实战项目、大纲路线、讲解视频,并且后续会持续更新**
**[需要这份系统化的资料的朋友,可以戳这里获取](https://bbs.csdn.net/topics/618608311)**
只是将部分目录截图出来,全套包含大厂面经、学习笔记、源码讲义、实战项目、大纲路线、讲解视频,并且后续会持续更新**
**[需要这份系统化的资料的朋友,可以戳这里获取](https://bbs.csdn.net/topics/618608311)**