DeepCoder-14B-Preview 安装指南
要使用 DeepCoder-14B-Preview,需要按照以下步骤配置环境:
ハードウェア要件
- 推荐使用 NVIDIA H100 或至少 24GB 显存的显卡
- 也可以使用 CPU 运行,但速度会慢很多
软件环境准备
- Python 3.10の環境を作る:
conda create -n deepcoder python=3.10 -y
- 環境を活性化させる:
conda activate deepcoder
- 依存ライブラリをインストールする:
pip install transformers torch huggingface_hub vllm
モデルダウンロード
- 访问 Hugging Face 官方页面:https://huggingface.co/agentica-org/DeepCoder-14B-Preview
- 在”Files and versions”中找到模型文件
- downloadコマンドを使う:
huggingface-cli download agentica-org/DeepCoder-14B-Preview --local-dir ./DeepCoder-14B
モデルローディング
使用以下 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)
この答えは記事から得たものである。DeepCoder-14B-Preview:コード生成に優れたオープンソースモデルについて