Skip to content

Latest commit

 

History

History
27 lines (23 loc) · 1010 Bytes

HuggingFace生态兼容.md

File metadata and controls

27 lines (23 loc) · 1010 Bytes

HuggingFace生态兼容

默认我们会使用ModelScope中的模型和数据集进行微调和推理。但是考虑到海外用户更熟悉HuggingFace生态,这里对其进行兼容。

你需要设置环境变量USE_HF=1,支持的HuggingFace模型和数据集可以参考支持的模型和数据集,部分数据集只支持在ModelScope环境下使用。

以下是对qwen1.5-7b-chat的推理脚本:

# Experimental Environment: A10, 3090, V100
USE_HF=1 CUDA_VISIBLE_DEVICES=0 swift infer --model_type qwen1half-7b-chat

微调脚本:

# Experimental Environment: 2 * A100
# GPU Memory Requirement: 2 * 30GB
USE_HF=1 \
NPROC_PER_NODE=2 \
CUDA_VISIBLE_DEVICES=0,1 \
swift sft \
    --model_type qwen1half-7b-chat \
    --dataset blossom-math-zh \
    --num_train_epochs 5 \
    --sft_type lora \
    --output_dir output \

微调后推理与部署等内容参考其他文档.