"torchvision/transforms/_functional_pil.py" did not exist on "e2bb6baac0618c6bdf86860ab8f1aac2b2ed7133"
Commit 72cbb62c authored by chenpangpang's avatar chenpangpang
Browse files

feat: 初始提交

parents
Pipeline #1987 failed with stages
in 0 seconds
.idea
chenyh
---
title: ChatGLM 6B
emoji: 🏃
colorFrom: indigo
colorTo: pink
sdk: gradio
sdk_version: 3.21.0
app_file: app.py
pinned: false
license: mit
---
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
from transformers import AutoModel, AutoTokenizer
import gradio as gr
tokenizer = AutoTokenizer.from_pretrained("THUDM/chatglm-6b", trust_remote_code=True)
model = AutoModel.from_pretrained("THUDM/chatglm-6b", trust_remote_code=True).half().cuda()
model = model.eval()
def predict(input, history=None):
if history is None:
history = []
response, history = model.chat(tokenizer, input, history)
return history, history
with gr.Blocks() as demo:
gr.Markdown('''## ChatGLM-6B - unofficial demo
Unnoficial demo of the [ChatGLM-6B](https://github.com/THUDM/ChatGLM-6B/blob/main/README_en.md) model, trained on 1T tokens of English and Chinese
''')
state = gr.State([])
chatbot = gr.Chatbot([], elem_id="chatbot").style(height=400)
with gr.Row():
with gr.Column(scale=4):
txt = gr.Textbox(show_label=False, placeholder="Enter text and press enter").style(container=False)
with gr.Column(scale=1):
button = gr.Button("Generate")
txt.submit(predict, [txt, state], [chatbot, state])
button.click(predict, [txt, state], [chatbot, state])
demo.queue().launch()
\ No newline at end of file
cpm_kernels
icetk
\ No newline at end of file
FROM image.sourcefind.cn:5000/dcu/admin/base/jupyterlab-pytorch:2.3.0-ubuntu22.04-dtk24.04.2-py3.10-devel as base
ARG IMAGE=chatglm-6b
ARG IMAGE_UPPER=ChatGLM-6B
ARG BRANCH=dcu
RUN cd /root && git clone -b $BRANCH http://developer.hpccube.com/codes/chenpangpang/$IMAGE.git
WORKDIR /root/$IMAGE/$IMAGE_UPPER
RUN pip install -r requirements.txt
#########
# Prod #
#########
FROM image.sourcefind.cn:5000/dcu/admin/base/jupyterlab-pytorch:2.3.0-ubuntu22.04-dtk24.04.2-py3.10-devel
ARG IMAGE=chatglm-6b
ARG IMAGE_UPPER=ChatGLM-6B
COPY chenyh/$IMAGE/frpc_linux_amd64_v* /opt/conda/lib/python3.10/site-packages/gradio/
RUN chmod +x /opt/conda/lib/python3.10/site-packages/gradio/frpc_linux_amd64_v*
COPY chenyh/$IMAGE/ /root/$IMAGE_UPPER/
COPY --from=base /opt/conda/lib/python3.10/site-packages /opt/conda/lib/python3.10/site-packages
COPY --from=base /root/$IMAGE/$IMAGE_UPPER /root/$IMAGE_UPPER
COPY --from=base /root/$IMAGE/启动器.ipynb /root/$IMAGE/start.sh /root/
COPY --from=base /root/$IMAGE/assets/ /root/assets/
# pip install huggingface-cli
import os
import requests
import json
os.environ['HF_ENDPOINT'] = 'https://hf-mirror.com'
model_list = [
"THUDM/chatglm-6b"
]
for model_path in model_list:
os.system(f"huggingface-cli download --resume-download {model_path} --local-dir ./{model_path} --local-dir-use-symlinks False")
#!/bin/bash
cd /root/ChatGLM-6B
python app.py
{
"cells": [
{
"cell_type": "markdown",
"id": "e5c5a211-2ccd-4341-af10-ac546484b91f",
"metadata": {
"tags": []
},
"source": [
"## 项目介绍\n",
"- 原项目地址:https://huggingface.co/spaces/multimodalart/ChatGLM-6B\n",
"- 一款聊天机器人,ChatGLM的非官方实现。\n",
"## 运行资源\n",
"- 项目在异构加速卡AI,dtk24.04.2上适配。\n",
"## 使用说明\n",
"- 启动和重启 Notebook 点上方工具栏中的「重启并运行所有单元格」。出现如下内容就算成功了:\n",
" - `Running on local URL: http://0.0.0.0:7860`\n",
" - `Running on public URL: https://xxxxxxxxxxxxxxx.gradio.live`\n",
"- 通过以下方式开启页面:\n",
" - 控制台打开「自定义服务」了,访问自定义服务端口号设置为7860\n",
" - 直接打开显示的公开链接`public URL`\n"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "53a96614-e2d2-4710-a82b-0d5ca9cb9872",
"metadata": {
"tags": []
},
"outputs": [],
"source": [
"# 启动\n",
"!sh start.sh"
]
},
{
"cell_type": "markdown",
"source": [
"---\n",
"**扫码关注公众号,获取更多资讯**<br>\n",
"<div align=center>\n",
"<img src=\"assets/二维码.jpeg\" width = 20% />\n",
"</div>\n"
],
"metadata": {
"collapsed": false
},
"id": "2f54158c2967bc25"
},
{
"cell_type": "code",
"outputs": [],
"source": [],
"metadata": {
"collapsed": false
},
"id": "6dc59fbbcf222b6b",
"execution_count": null
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3 (ipykernel)",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.10.13"
}
},
"nbformat": 4,
"nbformat_minor": 5
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment