DeepCoder-14B-Preview 安装指南
要使用 DeepCoder-14B-Preview,需要按照以下步骤配置环境:
hardware requirement
- 推荐使用 NVIDIA H100 或至少 24GB 显存的显卡
- 也可以使用 CPU 运行,但速度会慢很多
软件环境准备
- Create a Python 3.10 environment:
conda create -n deepcoder python=3.10 -y
- Activate the environment:
conda activate deepcoder
- Install dependent libraries:
pip install transformers torch huggingface_hub vllm
Model Download
- 访问 Hugging Face 官方页面:https://huggingface.co/agentica-org/DeepCoder-14B-Preview
- 在”Files and versions”中找到模型文件
- Use the command download:
huggingface-cli download agentica-org/DeepCoder-14B-Preview --local-dir ./DeepCoder-14B
Model loading
使用以下 Python 代码加载模型:
from transformers import AutoModelForCausalLM, AutoTokenizer
model_path = "./DeepCoder-14B"
model = AutoModelForCausalLM.from_pretrained(model_path, torch_dtype="auto", device_map="auto")
tokenizer = AutoTokenizer.from_pretrained(model_path)
This answer comes from the articleDeepCoder-14B-Preview: an open source model that specializes in code generationThe