swift-微调补充

1,安装nvitop

nvitop 可以实时看显卡占用占用情况

复制代码
pip install nvitop

nvitop -m auto

2,NewGELUActivation, PytorchGELUTanh, GELUActivation ImportError: cannot import name 'PytorchGELUTanh' from 'transformers.activations' (/mnt/workspace/ft_new/ft_qwen/lib/python3.11/site-packages/transformers/activations.py)

直接修改源码

bash 复制代码
vim /mnt/workspace/ft_new/ft_qwen/lib/python3.11/site-packages/awq/quantize/scale.py

找到第 12 行的导入代码:

python 复制代码
# 原错误代码
from transformers.activations import NewGELUActivation, PytorchGELUTanh, GELUActivation

修改为

python 复制代码
# 新代码(移除PytorchGELUTanh,用原生GELU替代)
import torch
import torch.nn as nn
# 定义兼容类
class PytorchGELUTanh(nn.Module):
    def forward(self, x):
        return torch.nn.functional.gelu(x, approximate='tanh')
# 给awq用的别名(兼容原代码逻辑)
NewGELUActivation = PytorchGELUTanh
GELUActivation = PytorchGELUTanh

3.ValueError: To serve at least one request with the models's max seq len (262144), (36.0 GiB KV cache is needed, which is larger than the available KV cache memory (12.16 GiB). Based on the available memory, the estimated maximum model length is 88544. Try increasing `gpu_memory_utilization` or decreasing `max_model_len` when initializing the engine.

注意需要加上下面参数进行部署

bash 复制代码
--vllm_max_model_len 70000

4,模型导出并上传魔搭社区

bash 复制代码
 swift export \
    --model output/v3-20260218-164346/checkpoint-75-merged \
    --push_to_hub true \
    --hub_model_id 'a80C51/llm-wayne-qwen3-4b-think-2507' \
    --hub_token 'ms-43994f9b-8b99-4fc6-852f-1f7d44513e16' \
    --use_hf false
相关推荐
circuitsosk30 分钟前
NL2SQL在工业级场景下的精度优化:Schema Linking + 动态Few-shot实战
人工智能·python·sql·大模型·nl2sql
9000AI33 分钟前
9000AI如何工业化生产流量?高质量规模生产与矩阵化饱和覆盖
人工智能
字节数据平台2 小时前
iDA:从 ChatBI 到专业数据分析助手的演进之路
大数据·人工智能·机器学习·数据分析
warpdrivelabs2 小时前
Codex 开源 harness 全面了解
开发语言·人工智能
mit6.8242 小时前
微软如何交付企业级Agent
人工智能
Mininglamp_27182 小时前
明略科技携手海康机器人亮相世界机器人大会,以“Agent+具身“联合进入商业机器人场景
人工智能·科技·机器人·开源·agent·ai agent
2401_894915532 小时前
GEO 优化源码全解析:从搜索引擎到 AI 引擎的底层改写逻辑
java·服务器·前端·数据库·人工智能·分布式·搜索引擎
MobotStone3 小时前
从“听得懂”到“干得了”:工业大模型落地工厂的三层进化路线
人工智能
wangruofeng4 小时前
GLM-5.3-Flash 发布:追平 Opus 4.8 的智力,1/40 的价格,跑在国产芯片上
人工智能·aigc·chatglm (智谱)
皮皮虾❀6 小时前
钉钉AI服务商×教育行业:AI现代产业学院共建一体化实战——从“高校AI教学缺平台”到“校企共建AI产业学院培养数字化人才
人工智能·钉钉