启动ChatGPT+ChatGLM
This commit is contained in:
		
							parent
							
								
									d40fa20ce8
								
							
						
					
					
						commit
						613be5509b
					
				@ -1,6 +1,6 @@
 | 
				
			|||||||
# How to build | 如何构建: docker build -t gpt-academic --network=host  -f Dockerfile+ChatGLM .
 | 
					# How to build | 如何构建: docker build -t gpt-academic --network=host  -f Dockerfile+ChatGLM .
 | 
				
			||||||
# How to run | 如何运行 (1) 直接运行: docker run --rm -it --net=host gpt-academic
 | 
					# How to run | 如何运行 (1) 直接运行: docker run --rm -it --net=host --gpus=all gpt-academic
 | 
				
			||||||
# How to run | 如何运行 (2) 我想运行之前进容器做一些调整: docker run --rm -it --net=host --gpu=all gpt-academic bash
 | 
					# How to run | 如何运行 (2) 我想运行之前进容器做一些调整: docker run --rm -it --net=host --gpus=all gpt-academic bash
 | 
				
			||||||
 
 | 
					 
 | 
				
			||||||
# 从NVIDIA源,从而支持显卡运损(检查宿主的nvidia-smi中的cuda版本必须>=11.3)
 | 
					# 从NVIDIA源,从而支持显卡运损(检查宿主的nvidia-smi中的cuda版本必须>=11.3)
 | 
				
			||||||
FROM nvidia/cuda:11.3.1-runtime-ubuntu20.04
 | 
					FROM nvidia/cuda:11.3.1-runtime-ubuntu20.04
 | 
				
			||||||
@ -30,18 +30,21 @@ RUN $useProxyNetwork python3 -m pip install -r requirements.txt
 | 
				
			|||||||
RUN $useProxyNetwork python3 -m pip install -r request_llm/requirements_chatglm.txt
 | 
					RUN $useProxyNetwork python3 -m pip install -r request_llm/requirements_chatglm.txt
 | 
				
			||||||
RUN $useProxyNetwork python3 -m pip install torch --extra-index-url https://download.pytorch.org/whl/cu113
 | 
					RUN $useProxyNetwork python3 -m pip install torch --extra-index-url https://download.pytorch.org/whl/cu113
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# 为chatgpt-academic配置代理和API-KEY (非必要 可选步骤)
 | 
					 | 
				
			||||||
RUN echo ' \n\
 | 
					 | 
				
			||||||
API_KEY = "sk-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" \n\
 | 
					 | 
				
			||||||
USE_PROXY = True \n\
 | 
					 | 
				
			||||||
proxies = { "http": "socks5h://localhost:10880", "https": "socks5h://localhost:10880", } ' >> config_private.py
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
# 预热CHATGLM参数(非必要 可选步骤)
 | 
					# 预热CHATGLM参数(非必要 可选步骤)
 | 
				
			||||||
RUN echo ' \n\
 | 
					RUN echo ' \n\
 | 
				
			||||||
from transformers import AutoModel, AutoTokenizer \n\
 | 
					from transformers import AutoModel, AutoTokenizer \n\
 | 
				
			||||||
chatglm_tokenizer = AutoTokenizer.from_pretrained("THUDM/chatglm-6b", trust_remote_code=True) \n\
 | 
					chatglm_tokenizer = AutoTokenizer.from_pretrained("THUDM/chatglm-6b", trust_remote_code=True) \n\
 | 
				
			||||||
chatglm_model = AutoModel.from_pretrained("THUDM/chatglm-6b", trust_remote_code=True).float() ' >> warm_up_chatglm.py
 | 
					chatglm_model = AutoModel.from_pretrained("THUDM/chatglm-6b", trust_remote_code=True).float() ' >> warm_up_chatglm.py
 | 
				
			||||||
RUN python3 -u warm_up_chatglm.py
 | 
					RUN python3 -u warm_up_chatglm.py
 | 
				
			||||||
 | 
					RUN $useProxyNetwork git pull
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# 为chatgpt-academic配置代理和API-KEY (非必要 可选步骤)
 | 
				
			||||||
 | 
					RUN echo ' \n\
 | 
				
			||||||
 | 
					API_KEY = "sk-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" \n\
 | 
				
			||||||
 | 
					USE_PROXY = True \n\
 | 
				
			||||||
 | 
					LLM_MODEL = "chatglm" \n\
 | 
				
			||||||
 | 
					LOCAL_MODEL_DEVICE = "cuda" \n\
 | 
				
			||||||
 | 
					proxies = { "http": "socks5h://localhost:10880", "https": "socks5h://localhost:10880", } ' >> config_private.py
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# 启动
 | 
					# 启动
 | 
				
			||||||
CMD ["python3", "-u", "main.py"]
 | 
					CMD ["python3", "-u", "main.py"]
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user