Views
No views yet
1cd Zenith/V1-Tenstorrent-Blackhole-p300/28B
2pip install -r requirements.txt1# Full fine-tuning (requires p300 with all 64 cores)
2python train.py \
3 --base_model Jackrong/Qwen3.5-27B-Claude-4.6-Opus-Reasoning-Distilled \
4 --train_data ./data/train.json \
5 --epochs 2 \
6 --batch_size 2 \
7 --gradient_accumulation_steps 16 \
8 --learning_rate 1e-5 \
9 --tensor_parallel_size 8 \
10 --pipeline_parallel_size 4 \
11 --use_noc_optimization \
12 --use_ring_attention \
13 --max_seq_length 32768 \
14 --mixed_precision bf16
15
16# LoRA fine-tuning (recommended)
17python train.py \
18 --base_model Jackrong/Qwen3.5-27B-Claude-4.6-Opus-Reasoning-Distilled \
19 --train_data ./data/train.json \
20 --use_lora \
21 --lora_r 16 \
22 --lora_alpha 32 \
23 --epochs 3 \
24 --batch_size 4 \
25 --gradient_accumulation_steps 8 \
26 --learning_rate 1e-4 \
27 --use_ring_attention \
28 --max_seq_length 327681# Interactive mode with reasoning focus
2python inference.py --checkpoint ./outputs/checkpoint-final
3
4# Single prompt with long context
5python inference.py \
6 --checkpoint ./outputs/checkpoint-final \
7 --prompt "Analyze the following 10K text and extract key insights..." \
8 --max_new_tokens 2048 \
9 --temperature 0.551# Build model
2ollama create zenith-28b-p300 -f Modelfile
3
4# Run with reasoning focus
5ollama run zenith-28b-p300 "Solve: A train travels at 60 mph for 2.5 hours. How far does it go? Show your reasoning."
6
7# Long context example
8ollama run zenith-28b-p300 "Summarize the key points from this document: [paste 30K text]"1from configs.zenith_config import get_28b_p300_config
2
3config = get_28b_p300_config()
4print(config)hidden_size: 3072num_layers: 36num_heads: 24num_experts: 8 (configurable, set 0 for dense)moe_top_k: 2max_seq_len: 32768use_ring_attention: Truering_attention_chunk_size: 8192ring_attention_overlap: 20481config.num_experts = 8
2config.moe_top_k = 2
3config.moe_load_balancing_weight = 0.01
4config.moe_capacity_factor = 1.0
5config.moe_router_learning_rate = 1e-31config.use_eq_adapter = True
2config.eq_adapter_hidden_size = 64
3config.eq_loss_weight = 0.05
4config.emotion_loss_weight = 0.05
5config.frustration_loss_weight = 0.051from data.openthoughts_processor import OpenThoughtsProcessor, OpenThoughtsConfig
2
3ot_config = OpenThoughtsConfig(
4 dataset_name="open-thoughts/OpenThoughts3-1.2M",
5 streaming=True,
6 max_seq_length=32768,
7 quality_filtering=True,
8 curriculum_learning=True,
9 augmentation=False, # Disabled for reasoning tasks
10 tokenizer=tokenizer
11)
12processor = OpenThoughtsProcessor(ot_config)1config.use_ring_attention = True
2config.ring_attention_chunk_size = 8192 # 8K chunks
3config.ring_attention_overlap = 2048 # 2K overlap for continuity1# Set environment variables for distributed training
2export MASTER_ADDR=localhost
3export MASTER_PORT=29500
4export WORLD_SIZE=2 # 2 chips
5
6# Run training with torchrun
7torchrun --nproc_per_node=2 --nnodes=1 train.py ...1--mixed_precision bf16 # Best for Ampere+ (p300)
2# or
3--mixed_precision fp16 # For older GPUs--gradient_checkpointing # Reduces memory by ~60%1# Run test suite
2python test_model.py
3
4# Includes:
5# - Model creation
6# - Forward pass
7# - p300 optimizations
8# - MoE configuration
9# - Ring attention
10# - EQ adapter
11# - Generation
12# - Gradient flow1python -m evaluation.benchmark \
2 --model_path ./outputs/checkpoint-final \
3 --benchmarks humaneval mbpp gsm8k math truthfulqa \
4 --output_dir ./eval_results1from evaluation.eval_datasets import load_benchmark
2from evaluation.metrics import compute_metrics
3
4# Load reasoning benchmark
5test_data = load_benchmark("gsm8k")
6
7# Generate predictions
8predictions = []
9for sample in test_data:
10 prompt = f"Question: {sample['question']}\nLet's think step by step.\nAnswer:"
11 response = generate(model, tokenizer, prompt, max_new_tokens=512)
12 predictions.append(response)
13
14# Evaluate
15metrics = compute_metrics(predictions, test_data, task="gsm8k")
16print(f"Accuracy: {metrics['accuracy']:.2%}")--max_seq_length appropriate for your task--use_noc_optimization for chip-to-chip comms--batch_size to 1--gradient_accumulation_steps--use_qlora for 4-bit quantization--max_seq_length (try 16384 instead of 32768)--gradient_checkpointing--use_curriculum)--use_quality_filter)--max_seq_length is divisible by --ring_chunk_size--ring_overlap if memory is tight1@misc{zenith-28b-p300-2025,
2 title={Zenith-28B-p300: A Tenstorrent-Optimized Reasoning Model with Ring Attention},
3 author={Zenith Project},
4 year={2025},
5 publisher={Zenith Project}
6}README.mdFINETUNE_GUIDE.mdconfigs/zenith_config.py