longkeyy查看中文加速指南
支持NVIDIA CUDA、华为Ascend NPU、AMD ROCm等多硬件后端的模型训练与推理Docker镜像,提供Web UI和OpenAI兼容API访问。
下载次数: 0状态:社区镜像维护者:longkeyy仓库类型:镜像最近更新:
🐳 LlamaFactory Docker Image Usage Guide
longkeyy/llamafactory is a versatile Docker image supporting multiple hardware backends for model training and inference, including NVIDIA CUDA, Huawei Ascend NPU, and AMD ROCm. It offers both Web UI and OpenAI-compatible API access.
🔖 Available Tags and Environments
| Tag | Backend | Description | Recommended For |
|---|---|---|---|
cuda, latest | NVIDIA CUDA | Standard version for NVIDIA GPUs | Machines with CUDA GPUs |
npu | Ascend NPU | Built for Huawei Ascend NPUs | Ascend 310/910 setups |
rocm | AMD ROCm | Compatible with AMD ROCm GPUs | Machines with AMD GPUs |
Note:
latestalways points to the latestcudaimage.
🚀 Quick Start
CUDA Version (NVIDIA GPU)
bashdocker run -it --gpus all \ --shm-size 16g \ --ipc host \ -p 7860:7860 -p 8000:8000 \ -v $PWD/hf_cache:/root/.cache/huggingface \ -v $PWD/ms_cache:/root/.cache/modelscope \ -v $PWD/om_cache:/root/.cache/openmind \ -v $PWD/data:/app/data \ -v $PWD/output:/app/output \ --restart unless-stopped \ longkeyy/llamafactory:cuda-0.9.2
NPU Version (Huawei Ascend)
Make sure the necessary Ascend drivers and devices are mounted.
bashdocker run -it \ --shm-size 16g \ --ipc host \ --device /dev/davinci0 \ --device /dev/davinci_manager \ --device /dev/devmm_svm \ --device /dev/hisi_hdc \ -v /usr/local/dcmi:/usr/local/dcmi \ -v /usr/local/bin/npu-smi:/usr/local/bin/npu-smi \ -v /usr/local/Ascend/driver:/usr/local/Ascend/driver \ -v /etc/ascend_install.info:/etc/ascend_install.info \ -v $PWD/hf_cache:/root/.cache/huggingface \ -v $PWD/ms_cache:/root/.cache/modelscope \ -v $PWD/om_cache:/root/.cache/openmind \ -v $PWD/data:/app/data \ -v $PWD/output:/app/output \ -p 7860:7860 -p 8000:8000 \ longkeyy/llamafactory:npu-0.9.2
ROCm Version (AMD GPU)
bashdocker run -it \ --shm-size 16g \ --ipc host \ --device /dev/kfd \ --device /dev/dri \ -v $PWD/hf_cache:/root/.cache/huggingface \ -v $PWD/ms_cache:/root/.cache/modelscope \ -v $PWD/om_cache:/root/.cache/openmind \ -v $PWD/data:/app/data \ -v $PWD/output:/app/output \ -v $PWD/saves:/app/saves \ -p 7860:7860 -p 8000:8000 \ --restart unless-stopped \ longkeyy/llamafactory:rocm-0.9.2
📄 Docker Compose Setup
docker-compose.yml (Multi-backend)
yamlversion: '3.8' services: llamafactory-cuda: image: longkeyy/llamafactory:cuda-0.9.2 container_name: llamafactory-cuda ports: - "7860:7860" - "8000:8000" volumes: - ./hf_cache:/root/.cache/huggingface - ./ms_cache:/root/.cache/modelscope - ./om_cache:/root/.cache/openmind - ./data:/app/data - ./output:/app/output deploy: resources: reservations: devices: - driver: nvidia count: all capabilities: [gpu] shm_size: "16gb" ipc: host tty: true restart: unless-stopped profiles: ["cuda"] llamafactory-npu: image: longkeyy/llamafactory:npu-0.9.2 container_name: llamafactory-npu ports: - "7860:7860" - "8000:8000" volumes: - ./hf_cache:/root/.cache/huggingface - ./ms_cache:/root/.cache/modelscope - ./om_cache:/root/.cache/openmind - ./data:/app/data - ./output:/app/output - /usr/local/dcmi:/usr/local/dcmi - /usr/local/bin/npu-smi:/usr/local/bin/npu-smi - /usr/local/Ascend/driver:/usr/local/Ascend/driver - /etc/ascend_install.info:/etc/ascend_install.info devices: - /dev/davinci0 - /dev/davinci_manager - /dev/devmm_svm - /dev/hisi_hdc shm_size: "16gb" ipc: host tty: true stdin_open: true restart: unless-stopped profiles: ["npu"] llamafactory-rocm: image: longkeyy/llamafactory:rocm-0.9.2 container_name: llamafactory-rocm ports: - "7860:7860" - "8000:8000" volumes: - ./hf_cache:/root/.cache/huggingface - ./ms_cache:/root/.cache/modelscope - ./om_cache:/root/.cache/openmind - ./data:/app/data - ./output:/app/output - ./saves:/app/saves devices: - /dev/kfd:/dev/kfd - /dev/dri:/dev/dri shm_size: "16gb" ipc: host tty: true stdin_open: true restart: unless-stopped profiles: ["rocm"]
Run with a Specific Backend
bash# CUDA docker compose --profile cuda up -d # NPU docker compose --profile npu up -d # ROCm docker compose --profile rocm up -d
📁 Mounted Volumes
| Host Path | Container Path | Description |
|---|---|---|
./hf_cache | /root/.cache/huggingface | HuggingFace model cache |
./ms_cache | /root/.cache/modelscope | ModelScope model cache |
./om_cache | /root/.cache/openmind | OpenMind cache |
./data | /app/data | Dataset directory |
./output | /app/output | Output directory |
./saves (ROCm only) | /app/saves | Model save directory |
🌐 Access Points
- Web UI: http://localhost:7860
- API Endpoint: http://localhost:8000
✅ Best Practices
- Use
--restart unless-stoppedfor service resilience. - Images include
llamafactory-cli webuias the default command. - Extend builds with optional components via Dockerfile
ARGs if needed.
📦 Image Size Overview
| Tag | Size |
|---|---|
cuda | ~42.9 GB |
npu | ~34.6 GB |
rocm | ~76.6 GB |
Happy experimenting with LlamaFactory! 🦙
更多相关 Docker 镜像与资源
以下是 longkeyy/llamafactory 相关的常用 Docker 镜像,适用于 不同场景 等不同场景:
镜像拉取方式
您可以使用以下命令拉取该镜像。请将 <标签> 替换为具体的标签版本。如需查看所有可用标签版本,请访问 标签列表页面。
轩辕镜像加速拉取命令点我查看更多 llamafactory 镜像标签
docker pull docker.xuanyuan.run/longkeyy/llamafactory:<标签>
DockerHub 原生拉取命令
docker pull longkeyy/llamafactory:<标签>
用户好评
来自真实用户的反馈,见证轩辕镜像的优质服务