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
相关推荐
爱写代码的小朋友18 小时前
人工智能驱动下个性化学习路径的构建与实践研究——以K12数学学科为例
人工智能·学习
宝贝儿好20 小时前
【强化学习实战】第十一章:Gymnasium库的介绍和使用(1)、出租车游戏代码详解(Sarsa & Q learning)
人工智能·python·深度学习·算法·游戏·机器学习
绝世这天下1 天前
【在 DGX Spark 上运行 vLLM-Omni 用于 Qwen3-TTS(语音设计,语音克隆)】
人工智能
陈大鱼头1 天前
[译]费尽心思来保障 OpenClaw ?那跟直接用 GPT 有什么区别?
人工智能
Fleshy数模1 天前
玩转OpenCV:视频椒盐噪声处理与图像形态学操作实战
人工智能·opencv·音视频
幂律智能1 天前
Agent × 流程引擎融合架构:从静态流程到智能流程编排
人工智能·架构·agent
无垠的广袤1 天前
ChatECNU 大语言模型与 PicoClaw 部署
人工智能·语言模型·自然语言处理·嵌入式·树莓派
爱淋雨的男人1 天前
自动驾驶感知相关算法
人工智能·算法·自动驾驶
互联网科技看点1 天前
AI算力爆发叠加数据资产风口,铂拉锐科技布局去中心化数字生态
人工智能·科技·去中心化
如若1231 天前
flash-attn 安装失败?从报错到成功的完整排雷指南(CUDA 12.8 + PyTorch 2.7)
人工智能·pytorch·python