赞
踩
建议创建一个新的虚拟环境,避免安装依赖冲突,
conda下载:
https://docs.conda.io/en/latest/miniconda.html
conda安装:
https://zhuanlan.zhihu.com/p/591091259
或者使用venv
使用参考:https://vra.github.io/2021/01/03/venv-intro/
其他后续可能需要的依赖:
pip install langchain
pip install tqdm
pip install openai
pip install javascript
pip install chromadb
pip install guardrails-ai
pip insatll jupyter
pip install torch torchvision torchaudio
编辑器可以随意,不过最好装下jupyter插件,或者直接下载jupyter,jupyter notebook方便调试。
账户注册网上可以找到,这里就不说了。不过要使用api的话就需要充值,充值需要国外xy卡,可以参考以下链接:
https://savokiss.com/tech/chatgpt-api-open.html
https://savokiss.com/tech/gpt-plus-onekey.html
pay后就可以生成api key:
https://platform.openai.com/account/api-keys
如果注册和充值麻烦,可以直接从银河录像局买现成的:
https://nf.video/
chatgpt
https://chat.openai.com/?model=text-davinci-002-render-sha
openai文档:
https://platform.openai.com/docs/guides/gpt/completions-api中文文档:
https://openai.xiniushu.com/
例子:
import openai
openai.api_key = "sk-xxx" # 替换为你自己的key
completion = openai.ChatCompletion.create(
model="gpt-3.5-turbo",
messages=[
{"role": "system", "content": "You are a helpful assistant."},
{"role": "user", "content": "Who won the world series in 2020?"},
{"role": "assistant", "content": "The Los Angeles Dodgers won the World Series in 2020."},
{"role": "user", "content": "Where was it played?"}
]
)
print(completion.choices[0].message)
import openai
openai.api_key = "sk-xxx" # 替换为你自己的key
response = openai.Completion.create(
model="text-davinci-003",
prompt="Write a tagline for an ice cream shop."
)
print(response)
https://lilianweng.github.io/posts/2023-03-15-prompt-engineering/#instruction-prompting
https://lslfd0slxc.feishu.cn/docx/Nqm9dX81hotVYUxFQuxcVR82n2g
https://www.promptingguide.ai/zh
https://mp.weixin.qq.com/s/MCsFoisMd6pB9wdhlQtd6Q
Given below is XML that describes the information to extract from this document and the tags to extract it │ │ into. │ │ │ │ <output> │ │ <list name="tasks"> │ │ <object name="task"> │ │ <string name="type" description="任务类型"/> │ │ <string name="content" description="任务内容"/> │ │ </object> │ │ </list> │ │ <integer name="logic" description="1:与 2:或" format="valid-choices: choices=[1, 2]"/> │ │ </output> │ │ │ │ │ │ ONLY return a valid JSON object (no other text is necessary), where the key of the field in JSON is the `name` │ │ attribute of the corresponding XML, and the value is of the type specified by the corresponding XML's tag. The │ │ JSON MUST conform to the XML format, including any types and format requests e.g. requests for lists, objects │ │ and specific types. Be correct and concise. │ │ │ │ Here are examples of simple (XML, JSON) pairs that show the expected behavior: │ │ - `<string name='foo' format='two-words lower-case' />` => `{'foo': 'example one'}` │ │ - `<list name='bar'><string format='upper-case' /></list>` => `{"bar": ['STRING ONE', 'STRING TWO', etc.]}` │ │ - `<object name='baz'><string name="foo" format="capitalize two-words" /><integer name="index" │ │ format="1-indexed" /></object>` => `{'baz': {'foo': 'Some String', 'index': 1}}` │ │ │ │ │ │ │ │ Json Output:
lainchain地址:
https://github.com/langchain-ai/langchain
langchain文档:
https://python.langchain.com/docs/modules/agents/
中文文档:
https://www.langchain.com.cn/modules/chains/generic/sequential_chains
其他文档:
https://juejin.cn/post/7217759646881742903
https://lilianweng.github.io/posts/2023-06-23-agent/
rail
https://shreyar.github.io/guardrails/rail/
chroma(embedding database)
https://docs.trychroma.com/
Voyager,应用在我的世界
https://github.com/MineDojo/Voyager/
https://voyager.minedojo.org/
开源的大模型有很多,这里只介绍chatglm6b,链接:
https://github.com/THUDM/ChatGLM2-6B
https://github.com/THUDM/ChatGLM-6B
https://huggingface.co/THUDM/chatglm-6b
https://cloud.tsinghua.edu.cn/d/fb9f16d6dc8f482596c2/?p=%2F&mode=grid
部署教程:
https://zhuanlan.zhihu.com/p/617644321?utm_id=0
微调:
https://github.com/lich99/ChatGLM-finetune-LoRA
https://blog.csdn.net/bmfire/article/details/131064677
https://github.com/THUDM/ChatGLM-6B/tree/main/ptuning
本地部署glm加上langchain
https://github.com/chatchat-space/langchain-ChatGLM
https://courses.d2l.ai/zh-v2/
https://space.bilibili.com/1567748478/channel/seriesdetail?sid=358497
https://learn.deeplearning.ai/
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。