许可证: mit
数据集:
- allura-org/Celeste-Filtered
- allura-org/neon-41k
- EVA-UNIT-01/Lilith-v0.2
语言:
- en
基础模型:
- THUDM/GLM-4-32B-0414
库名称: transformers
图片由 CalamitousFelicitousness 提供
GLM-4-32B-0414 Neon v2
基于 GLM-4-32B-0414 的角色扮演微调版本。表现优秀,个性鲜明,风格多样,偶尔有些古怪。相当聪明,但有时会装傻以回避问题,顺其自然即可。文笔优美,既不像 Claude 也不像 Gemini。偶尔会出现结构重复,但现代大语言模型都这样,所以 ¯\(ツ)/¯。似乎偏好 JSON 格式的系统提示。
模型由 Auri 训练。
训练笔记
模型在包含 7700 万 tokens 的合成角色扮演和短篇故事生成数据集上训练了一个 epoch。训练耗时约 28 小时,使用由 OwenArli 慷慨提供的 4 块 RTX 3090 工作站。训练配置采用了一些合理的默认值,QLoRA 结合 CCE 和序列并行技术,使得 16k 上下文能在 96GB 显存下运行。整体训练比 9B 版本更顺畅。但仍存在 NaN 评估/损失的问题,原因尚不明确。
特别感谢 ArliAI 提供算力并协作完成此次训练!
格式
模型遵循 GLM4 指令格式,与其基础模型完全一致。后端可能无法自动添加 BOS token,需手动添加。Jinja 模板适用于聊天补全。
[gMASK]<sop><|system|>
{系统提示}<|user|>
{用户输入}<|assistant|>
推荐采样器
无需特殊设置,经典参数即可。
温度 - 1
Min-P - 0.1
重复惩罚 - 1.03
SillyTavern 示例导入文件(使用 Steelskull 的 Shingane-v1 系统提示)
在 KoboldCPP 及其他后端运行
要正确运行 GGUFs,需使用最新版 KoboldCPP,并在 CLI 命令中添加 --overridekv glm4.rope.dimension_count=int:64
,或在 GUI 的 overridekv 框中输入 glm4.rope.dimension_count=int:64
(位于 Tokens 标签页最底部)。
感谢 DaringDuck 和 tofumagnate 提供的修复方法。
若要在 vLLM 上运行此模型,需从 git 仓库源码构建,完整 GLM4 支持尚未发布。 vLLM >=0.8.5 版本应可直接运行。
ExLLaMAv2 目前对 GLM-4-32B 的支持不如 9B 完善。EXL3 理论上可行,但未经测试。
最新版 llama.cpp 服务器也应支持直接运行 GGUFs。
特别致谢
再次衷心感谢 OwenArli 提供算力并协助调参!
感谢 Artus 为模型预发布展示提供免费推理服务!
感谢 BeaverAI 社区成员的反馈与优化建议!
训练配置
查看 Axolotl 配置
base_model: /home/owen/models/GLM-4-32B-0414
strict: false
model_type: AutoModelForCausalLM
plugins:
- axolotl.integrations.liger.LigerPlugin
- axolotl.integrations.cut_cross_entropy.CutCrossEntropyPlugin
liger_rope: false
liger_rms_norm: false
liger_glu_activation: false
liger_fused_linear_cross_entropy: false
cut_cross_entropy: true
output_dir: ./GLM-32B-Neon-v2
hub_model_id: AuriAetherwiing/GLM-32B-Neon-v2-LoRA
hf_use_auth_token: true
hub_strategy: "all_checkpoints"
wandb_project: allura-org
wandb_entity:
wandb_name: GLM-32B-Neon-v2
group_by_length: false
datasets:
- path: ./Neon/neon.jsonl
type: chat_template
field_messages: conversations
message_field_role: from
message_field_content: value
train_on_eos: all
- path: ./Neon/S2.jsonl
type: chat_template
field_messages: conversations
message_field_role: from
message_field_content: value
train_on_eos: all
- path: ./Neon/SystemChat_subset_filtered_sharegpt_utf8fix.jsonl
type: chat_template
field_messages: conversations
message_field_role: from
message_field_content: value
train_on_eos: all
dataset_prepared_path: ./lora_last_run_prepared
chat_template: jinja
chat_template_jinja: |
[gMASK]<sop>{%- for msg in messages %}{%- if msg.role == 'system' %}<|system|>
{{ msg.content }}{%- elif msg.role == 'user' %}<|user|>
{{ msg.content }}{%- elif msg.role == 'assistant' %}<|assistant|>
{{ msg.content }}{%- endif %}{%- endfor %}{% if add_generation_prompt %}<|assistant|>{% endif %}
val_set_size: 0.005
evals_per_epoch: 8
eval_table_size:
eval_max_new_tokens: 128
sequence_len: 16384
save_safetensors: true
saves_per_epoch: 4
logging_steps: 1
bf16: auto
fp16:
tf32: false
load_in_8bit: false
load_in_4bit: true
peft_use_rslora: false
peft_use_dora: false
adapter: qlora
lora_model_dir:
lora_r: 64
lora_alpha: 64
lora_dropout: 0.1
lora_target_linear: true
lora_fan_in_fan_out:
lora_target_modules:
num_epochs: 1
weight_decay: 0.01
max_grad_norm: 1.0
warmup_ratio: 0.05
learning_rate: 1e-5
lr_scheduler: rex
optimizer: adamw_torch
gradient_accumulation_steps: 32
micro_batch_size: 1
eval_batch_size: 1
pad_to_sequence_len: true
sample_packing: true
eval_sample_packing: false
flash_attention: true
xformers_attention:
gradient_checkpointing:
gradient_checkpointing_kwargs:
use_reentrant: false
sequence_parallel_degree: 4
heads_k_stride: 1
ring_attn_func:
fsdp:
- full_shard
- auto_wrap
fsdp_config:
fsdp_limit_all_gathers: true
fsdp_sync_module_states: true
fsdp_offload_params: false
fsdp_use_orig_params: false
fsdp_cpu_ram_efficient_loading: true
fsdp_auto_wrap_policy: TRANSFORMER_BASED_WRAP
fsdp_transformer_layer_cls_to_wrap: Glm4DecoderLayer
fsdp_state_dict_type: FULL_STATE_DICT
fsdp_sharding_strategy: FULL_SHARD
fsdp_activation_checkpointing: true