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
相关推荐
MetaEnchanter7 小时前
水排序小游戏:打开就能玩,卡关不用先看广告
人工智能·ai·百万工具
LaughingZhu7 小时前
Product Hunt 每日热榜 | 2026-09-15
人工智能·深度学习·神经网络·搜索引擎·百度
xsd202411187 小时前
猪只行为实时AI监测:计算机视觉驱动的进食/休息/活动/社交/嗅探/走动六维行为识别与健康预警
人工智能
棣廷7 小时前
初识深度学习——学习率调度与权重衰减
人工智能·深度学习
vibecoding777 小时前
企业买国产模型怎么选(2026 年 9 月):先看备案,再算峰谷价、分档价与积分价,最后决定要不要多家并用
人工智能·大模型
AIGCmagic社区7 小时前
腾讯混元 AuK 技术报告拆读:1.5B 统一语音生成与编辑,蒸馏后 4 步无 CFG 提速 4.5 倍
人工智能·算法·aigc·ai多模态
Allen_LVyingbo8 小时前
医疗人工智能项目全生命周期管理系统:监管知识建模、工程实现与实证评估(下)
大数据·数据库·人工智能·python·自然语言处理·自动化
Forerror20268 小时前
MAI Gateway(魔芋企业级AI网关)从零讲起:大模型网关解决什么问题?小白也能看懂
人工智能·maigateway·finapi·企业级ai网关·大模型财务管控·企业级大模型治理网关
志栋智能8 小时前
超自动化巡检如何生成“有灵魂”的运维报告?
大数据·运维·人工智能·架构·自动化
千里码aicood8 小时前
pyqt基于pytorch的人脸交换系统设计(opencv)
人工智能·pyqt