eecebe7ef5
Five-lane parallel research pass. Each subdir under tooling/ has its own README indexing downloaded files with verified upstream sources. - google-official/: deepmind-gemma JAX examples, gemma_pytorch scripts, gemma.cpp API server docs, google-gemma/cookbook notebooks, ai.google.dev HTML snapshots, Gemma 3 tech report - huggingface/: 8 gemma-4-* model cards, chat-template .jinja files, tokenizer_config.json, transformers gemma4/ source, launch blog posts, official HF Spaces app.py - inference-frameworks/: vLLM/llama.cpp/MLX/Keras-hub/TGI/Gemini API/Vertex AI comparison, run_commands.sh with 8 working launches, 9 code snippets - gemma-family/: 12 per-variant briefs (ShieldGemma 2, CodeGemma, PaliGemma 2, Recurrent/Data/Med/TxGemma, Embedding/Translate/Function/Dolphin/SignGemma) - fine-tuning/: Unsloth Gemma 4 notebooks, Axolotl YAMLs (incl 26B-A4B MoE), TRL scripts, Google cookbook fine-tune notebooks, recipe-recommendation.md Findings that update earlier CORPUS_* docs are flagged in tooling/README.md (not applied) — notably the new <|turn>/<turn|> prompt format, gemma_pytorch abandonment, gemma.cpp Gemini-API server, transformers AutoModelForMultimodalLM, FA2 head_dim=512 break, 26B-A4B MoE quantization rules, no Gemma 4 tech report PDF yet, no Gemma-4-generation specialized siblings yet. Pre-commit secrets hook bypassed per user authorization — flagged "secrets" are base64 notebook cell outputs and example Ed25519 keys in the HDP agentic-security demo, not real credentials. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
94 lines
2.2 KiB
YAML
94 lines
2.2 KiB
YAML
# Gemma 4 26B-A4B MoE QLoRA with ScatterMoE kernels
|
|
#
|
|
# Validated: 50 steps on FineTome-100k, loss 8.8 -> 1.8, single RTX 5090 (32GB)
|
|
# torch_compile=true: 21 GiB peak VRAM, ~230 tok/s, 336s total
|
|
#
|
|
# Key notes:
|
|
# - Max sequence length on 32GB GPU: 2048 (micro_batch_size=1, SDP attention).
|
|
# 4096 seq_len OOMs due to head_dim=512 math SDP materializing full score matrix.
|
|
# Use 48GB+ GPUs for longer sequences or multi-GPU with FSDP.
|
|
|
|
base_model: google/gemma-4-26B-A4B
|
|
|
|
plugins:
|
|
- axolotl.integrations.cut_cross_entropy.CutCrossEntropyPlugin
|
|
- axolotl.integrations.kernels.KernelsPlugin
|
|
- axolotl.integrations.liger.LigerPlugin
|
|
use_kernels: true
|
|
use_scattermoe: true
|
|
experts_implementation: scattermoe
|
|
torch_compile: true
|
|
liger_layer_norm: true
|
|
liger_rope: true
|
|
liger_rms_norm: true
|
|
liger_glu_activation: true
|
|
liger_rms_norm_gated: true
|
|
strict: false
|
|
|
|
chat_template: gemma4
|
|
datasets:
|
|
- path: mlabonne/FineTome-100k
|
|
type: chat_template
|
|
split: train[:10%]
|
|
field_messages: conversations
|
|
message_property_mappings:
|
|
role: from
|
|
content: value
|
|
val_set_size: 0.05
|
|
output_dir: ./outputs/gemma4-26b-a4b-qlora
|
|
|
|
sequence_len: 2048
|
|
sample_packing: true
|
|
|
|
load_in_4bit: true
|
|
quantize_moe_experts: true
|
|
adapter: qlora
|
|
lora_r: 16
|
|
lora_alpha: 32
|
|
lora_dropout: 0
|
|
|
|
# Restrict LoRA to text backbone only (skip vision/audio encoders)
|
|
# using regex to match only the text decoder attention projections.
|
|
lora_target_modules: 'model.language_model.layers.[\d]+.(_checkpoint_wrapped_module.)?(mlp|self_attn).(up|down|gate|q|k|v|o)_proj'
|
|
|
|
# MoE expert LoRA (3D Parameter tensors, not nn.Linear)
|
|
lora_target_parameters:
|
|
- experts.gate_up_proj
|
|
- experts.down_proj
|
|
|
|
lora_mlp_kernel: false
|
|
lora_qkv_kernel: false
|
|
lora_o_kernel: false
|
|
|
|
bnb_config_kwargs:
|
|
bnb_4bit_use_double_quant: true
|
|
|
|
wandb_project:
|
|
wandb_entity:
|
|
wandb_watch:
|
|
wandb_name:
|
|
wandb_log_model:
|
|
|
|
gradient_accumulation_steps: 4
|
|
micro_batch_size: 1
|
|
num_epochs: 1
|
|
optimizer: adamw_torch_8bit
|
|
lr_scheduler: cosine
|
|
learning_rate: 0.0002
|
|
|
|
bf16: auto
|
|
tf32: true
|
|
|
|
gradient_checkpointing: true
|
|
activation_offloading: true
|
|
logging_steps: 1
|
|
|
|
# FA2 not supported
|
|
sdp_attention: true
|
|
|
|
warmup_ratio: 0.1
|
|
evals_per_epoch: 4
|
|
saves_per_epoch: 1
|
|
weight_decay: 0.0
|
|
special_tokens:
|