单节点8xA800跑起来HuggingFace DeepSeek V2踩坑

0x0. 背景

尝试跑起来HuggingFace上release的DeepSeek V2,踩了几个坑,这里给出解决的方法。HuggingFace提供的开源DeepSeek V2 repo链接为:https://huggingface.co/deepseek-ai/DeepSeek-V2

0x1. 报错1: KeyError: ‘sdpa’

这个问题社区也有人反馈了。https://huggingface.co/deepseek-ai/DeepSeek-V2/discussions/3

在这里插入图片描述

解决方法很简单,在工程里面的config.json最后加一句"_attn_implementation": "flash_attention_2"即可:

在这里插入图片描述

0x2. 报错2: 初始化阶段卡死

已经给accelerate提了一个pr解决这个问题。https://github.com/huggingface/accelerate/pull/2756

背景

当我尝试使用 transformers 库进行 deepseek-v2 模型推理时:

import torch
from transformers import AutoTokenizer, AutoModelForCausalLM, GenerationConfig

model_name = "deepseek-ai/DeepSeek-V2"
tokenizer = AutoTokenizer.from_pretrained(model_name, trust_remote_code=True)
# `max_memory` should be set based on your devices
max_memory = {
   i: "75GB" for i in range(
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值