GithubHelp home page GithubHelp logo

comfyui-glm3prompt's Introduction

Comfyui-GLM3Prompt

参考来源:https://www.bilibili.com/read/cv27685652/

使用说明

使用ChatGLM3-6B进行对话,支持连续对话

1. 安装环境

pip install protobuf transformers==4.30.2 cpm_kernels torch>=2.0 gradio mdtex2html sentencepiece accelerate

可能因为系统问题,无法安装成功(安装成功最后会有success),建议一个个安装,如果因为>=无法安装成功,建议尝试一下改成==

2. 下载代码

GLM3Prompt.py 放入 /comfyui/custom_nodes

3. 下载模型

Model Seq Length Download
ChatGLM3-6B 8k HuggingFace | ModelScope
ChatGLM3-6B-Base 8k HuggingFace | ModelScope
ChatGLM3-6B-32K 32k HuggingFace | ModelScope

网盘地址:链接:https://pan.baidu.com/s/1p5j0gQu3Jw_xgdY_UkHtjA?pwd=ljsz 提取码:ljsz

4. 修改存放模型地址(绝对路径)

将红圈部分改为模型的绝对路径,参考/root/ComfyUI/models/chatglm3-6b根据自己实际情况填写

image

注意:默认从 Hugging Face Hub拉取模型

5. 修改模型调用方式(可选)

image

  1. 标准:模型以 FP16 精度加载,运行上述代码需要大概 13GB 显存

    self.model = AutoModel.from_pretrained(self.model_path, trust_remote_code=True, device='cuda')
    
  2. 如果你的 GPU 显存有限,可以尝试以量化方式加载模型(代码默认使用)

    self.model = AutoModel.from_pretrained(self.model_path, trust_remote_code=True).quantize(4).cuda()
    
  3. 其他参考官方文档(mac、多卡、cpu)

    https://github.com/THUDM/ChatGLM3/tree/main#%E4%BD%8E%E6%88%90%E6%9C%AC%E9%83%A8%E7%BD%B2

image-20231117214413053

效率基于3080ti

首次加载模型需要20s左右,不同长度的提示词模型效率不同,越长的提示词需要的时间不同。量化模型大约使用4g显存。默认开启即调用模型后释放显存,若提示词有修改重新调用模型。关闭后则模型一直缓存在显存中,有上下文功能,且多次调整提示词速度更快 image

image

image

comfyui-glm3prompt's People

Contributors

lin1031 avatar

Stargazers

 avatar BMGD avatar  avatar  avatar  avatar WSRY avatar  avatar  avatar  avatar YuchengZhan avatar  avatar 42lux avatar  avatar

Watchers

 avatar

Forkers

liweidiy

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.