Spaces:
Sleeping
Sleeping
Commit History
-
fix(docker): install musl so prebuilt llama-cpp-python wheel loads on Debian
c4d88c8 -
fix(docker): use prebuilt llama-cpp-python wheel, skip C++ compilation
49fc0d4 -
fix(docker): MAKEFLAGS=-j1 to prevent OOMKilled during llama-cpp-python compile
95ee03a -
fix(docker): add build-essential for llama-cpp-python compilationβ
Prebuilt wheel not available for this platform; compile from source with BLAS/Metal/CUDA disabled to minimise build time. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>dfba029 -
fix(docker): use prebuilt llama-cpp-python CPU wheel, skip source compileβ
Compiling from source takes 15+ min. The prebuilt wheel installs in seconds. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>6523a67 -
fix: add blog.md at repo root for hackathon submission URLβ
Judges access https://huggingface.co/spaces/lebiraja/customer-support-env/blob/main/blog.md Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>c391101 -
feat: wire trained GGUF model (customer-support-grpo-v5) into inferenceβ
- serve_inference.py: rewrite to use llama-cpp-python + GGUF Q4_K_M Downloads lebiraja/customer-support-grpo-v5-gguf/model-q4_k_m.gguf at startup - requirements.txt: add llama-cpp-python>=0.3.0 - Dockerfile: add build-essential/cmake for llama-cpp compilation; set LOCAL_INFERENCE_URL + AGENT_MODEL_URL + GGUF_REPO/FILE env vars - start.sh: launch serve_inference.py on :8001 alongside FastAPI/Next.js - server/app.py: default AGENT_MODEL_URL to localhost:8001 - blog.md: real training story β 150 steps, L40S, 5 curriculum stages, best score 0.9528, model links, reward curve narrative - README.md: add trained model section, update results table, add HF links Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>601a10d -
fix(plots): serve images via GitHub raw URLs, restore results/ for originβ
- TrainingPlots: switch next/image β img, use GH raw URLs - Restore results/*.png to git for GitHub raw URL serving - Exclude PNGs from frontend/public/ (not needed locally) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>59a84d0 -
fix(assets): move plot PNGs to frontend/public, remove binary files from results/β
HF Spaces rejects binary blobs; serve plots via Next.js public dir instead. Track PNGs with git-lfs via .gitattributes. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>c028464 -
fix(docker): remove --prefer-offline from npm ci to install all lockfile packagesβ
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>8903745 -
feat(frontend): minimal blog redesign β 6 sections, fixed tables, cleaner layoutβ
Sections removed: StatsBar, PainSection, ChallengesBento, TrainingPipeline, PullQuote x2, TestimonialMarquee/ConversationFlow Sections kept & rebuilt: - Hero: clean white, typography-first, no background image, 4 stat cards - ArchitectureSection: compact 3-col agent cards + emoji flow strip - ResultsTable: real numbers from blog.md (NIM 70B vs 8B+GRPO), +3 callout stats - TrainingPlots: 3-col grid, tighter captions - Deep Dive: bg-slate-50 for visual separation - CTA + Footer: unchanged Table overflow fix: MdxComponents AnimatedTable now uses min-w-full inside overflow-x-auto wrapper β no more column clipping in Deep Dive Added img renderer so inline markdown images display properly Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>381f34c -
feat(frontend): white theme, remove carousel, add training plots, fix conversation flowβ
- globals.css: full light theme (#fff bg, dark text, light .glass, indigo gradient-text) - layout.tsx: bg-white text-slate-900 - All components: dark slate/950 β white/slate-50, accent colors darkened one stop - BlogNav: white/90 backdrop, border-slate-200, indigo-50 active state - Hero: white gradient bg, subtle image, light metric cards with shadow - StatsBar: white/95 sticky bar, slate-200 dividers - PainSection, ArchitectureSection, ChallengesBento, TrainingPipeline: light theme - ResultsTable: white background, slate-200 borders, fixed table structure with proper contrast - TestimonialMarquee β ConversationFlow: replaced scrolling marquee with a proper threaded multi-turn conversation showing L1βL2βL3 escalation with Hinglish trigger, DB query indicator, supervisor review step, and GRPO reward breakdown - ArchitectureSection: improved flow diagram with colored boxes per role and L2 review note - TrainingPlots (NEW): 6-card grid showing all Colab output plots with captions and β¦3766a5b -
docs: correct 30β40 steps, add precise Colab metrics to README + blogβ
Colab run: baseline 0.136 β best eval 0.152 (+8%), 40 steps, 0.6% invalid. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>dae2c42 -
fix(readme): update plot URLs to main branch after mergeβ
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>74edbfa -
fix(readme): use GitHub raw URLs for plots (HF Space blocks binary files)
81e1851 -
feat: add training plots, update Colab link, embed results in README + blogβ
- Add 6 training dashboard plots to results/ (reward, loss, LR, invalid rate, eval scores, before/after) - Update Colab link to latest fixed notebook throughout README and blog - Embed plots in README with captions under new Training Curves section - Add Training Curves section to blog.md with all 6 plots and L40S results Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>b953f00 -
blog half done
6050055 -
Merge pull request #14 from lebiraja/feat/blogβ
the forntend is redesigined and the blog is updated254bfaf -
the forntend is redesigined and the blog is updated
05145d9 -
Merge pull request #13 from lebiraja/feat/refactorβ
lebi rajaFeat/refactorda86951 -
fix(colab): 3 bugs β prompt KeyError, responseβrespond normalize, max_length warningβ
- Escape JSON examples in prompts {{...}} so .format() doesn't misparse them - Add _NORMALIZE map in parse_action: "response"β"respond", "request_information"β"request_info", etc. - Clear model.generation_config.max_length after load to silence the max_new_tokens warning Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>2fb5092 -
feat(colab): v5 notebook β 6-panel dashboard + HF Space + all v5 fixesβ
- 6-panel matplotlib dashboard: reward curve, loss, LR cosine schedule, invalid rate (fill_between + 90% collapse threshold), eval score history, before/after bar chart - Full v5 action parser: _preprocess_json() comment stripping + control char escaping, _repair_truncated_json() fallback - FALLBACK-PENALIZED rollouts (reward overridden to invalid_penalty) - HF Space health check + ENV_URL config cell with placeholder token shell - Qwen2.5-1.5B model for Colab demo (fits T4 VRAM) - Tracks 6 metrics per step: reward, loss, LR, invalid_rate, eval_steps, eval_scores Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>83e9dfe -
feat(colab): v5 notebook β HF Space URL, full parser, FALLBACK-PENALIZED, early stopping
48204ac -
fix(space): serve Next.js frontend via nginx reverse proxyβ
Root Dockerfile now installs Node.js, builds Next.js standalone, and runs nginx on :7860 to route API paths (reset/step/health/etc) to FastAPI on :8080 and everything else to Next.js on :3000. NEXT_PUBLIC_API_URL="" so frontend calls relative URLs that nginx routes correctly. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>283e065 -
Merge pull request #12 from lebiraja/feat/refactorβ
lebi rajaFeat/refactorbf96c5e -
fix(config): update to v5 repo names
98ecade -
fix(train): v5 β JSON preprocessor + dual-token for friend's accountβ
- action_parser: add _preprocess_json() to fix two v4 error patterns: literal control chars inside JSON strings (Invalid control character) and Python # comments after field values (Expecting ',' delimiter) - submit_training_job: dual-token support β HF_TOKEN (yours) for cloning Space + pushing model inside job; SUBMIT_TOKEN (friend's) for billing via run_job(); TOTAL_STEPS=150, TIMEOUT=10h (~$11 on l40sx1) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>c9d0dd5 -
fix(prompt): v4 β add explicit JSON examples for all action typesβ
The OUTPUT FORMAT template only showed {"message": "..."} examples, so the model used "message" field even for query_user_profile/query_order_details (which require "email" and "order_id" respectively). Added concrete JSON examples for all 6 action types with clear field name warnings. This was the dominant failure mode in v3: 25-50% invalid rate from `action_type 'query_user_profile' requires non-empty 'email'`. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>a81014e -
fix(train): v3 β fix fallback rewards, token budget, steps capβ
- rollout_collector: FALLBACK steps now penalized (override reward_value to invalid_penalty) so model learns bad JSON format = negative reward - config: max_new_tokens 96β128 (more headroom for complete JSON output), invalid_penalty -0.5β-0.2 (softer, more stable GRPO advantages) - start_training.sh: TOTAL_STEPS default 3500β300 (safety cap vs $17.30 budget) - submit_training_job.py: TOTAL_STEPS 500β300, SKIP_SFT 0β1 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>1f9c4f6
-
fix(train): v3 β repair truncated JSON + earlier evals + fix GGUF pathβ
- action_parser: add _repair_truncated_json() β if model outputs JSON missing closing }, count unmatched quotes and append "} to recover. Prevents the v2 collapse pattern where model learned good behaviors but forgot to close braces. - config: eval_interval 50β20, ckpt_interval 50β20 β first best-checkpoint save at step 20 instead of step 50 (v2 best phase was steps 20-30, never captured) - export_gguf: fix Unsloth output path β Unsloth saves to {model}_gguf/ dir, not to the out_dir argument. Now finds the generated file via glob and moves it. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>1624ad5 -
fix(train): v2 β fix collapse root causes + best-ckpt tracking + GGUF exportβ
- config: kl_coef 0.04β0.1, max_new_tokens 96, ckpt_interval 50, step/terminal weights 0.50/0.50, total_steps 500 - action_parser: greedy regex to capture full JSON (was non-greedy, stopped at first }) - run_train: early stopping on 5 consecutive collapsed log intervals; best checkpoint saved to checkpoints/best/ with best_score.txt - model_utils: save_checkpoint accepts optional tag= for named checkpoint dirs - start_training: pick best/ checkpoint first (not always "final"); remove --no_wandb; add Step 8.5 GGUF Q4_K_M export + push to separate HF repo - export_gguf: new module β loads merged model, saves GGUF Q4_K_M, pushes with README (ollama + llama-cpp-python compatible) - submit_training_job: SKIP_SFT=0, TOTAL_STEPS=500, HF_REPO=v2, HF_REPO_GGUF separate repo, pass GGUF_EXPORT env to job Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>cacac63 -
fix(train): switch to l40sx1 β better availability, 300 steps fits $24 budgetβ
A100 queue was stuck 35+ min. L40S at $1.80/hr: 300 steps Γ 120s = 10h Γ $1.80 = $18 + $1.35 overhead = ~$19.35 β $4.70 margin Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>7e08e16 -
Merge pull request #11 from lebiraja/feat/refactorβ
lebi rajaFeat/refactor0fdc44a -
fix(train): reduce steps to 250 β guaranteed to complete within $24.05β
Worst-case A100 timing (120s/step): 250Γ120s=8.3hΓ$2.50=$20.75+overhead=$22.63 Leaves $1.42 margin β ensures merge+push runs even if steps are slow. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>ae63ecb -
fix(train): reduce total_steps 400β350 to fit $24.05 budgetβ
350 steps Γ 80s Γ $2.50/hr + overhead β $21.50 β leaves $2.55 margin Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>0fcf0ce -
feat(train): switch to a100-large, reduce steps/tokens to fit $24 budgetβ
- Hardware: h200 ($5/hr) β a100-large ($2.50/hr) - total_steps: 1000 β 400 (env HTTP calls are bottleneck, not GPU) - max_new_tokens: 96 β 64 (faster generation, agent responses fit) - timeout: 6h β 12h (safety buffer for A100 pace) - Expected: ~9h Γ $2.50 = ~$22.50 β fits within $24.38 budget Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>612091c -
feat(logging): full visibility into every training stepβ
run_train.py: - Print [COLLECT] start with episode count + task - Print [COLLECT] done with timing, valid/total, min/mean/max rewards - Print each invalid episode's reason - Print [LOSS] before and after computation with value + timing - Print [STEP] after every optimizer step with total wall time rollout_collector.py: - Generation errors always printed (was verbose-only) - Parse failures always printed with the raw output snippet - Fallback action usage always printed - env step() errors always printed - Episode completion printed with step count, final_score, per-step rewards grpo_trainer.py: - Each skipped step prints exactly why: missing IDs, empty shape, short log-probs, or requires_grad=False β no more silent drops Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>bc021f1 -
perf(train): optimise for H200 budget β 1000 steps in ~5h for $26β
Key changes: - grad_accum: 2 β 1 (2Γ speedup: one rollout pass per gradient step) - max_new_tokens: 128 β 96 (25% faster generation, still plenty for responses) - total_steps: 5000 β 1000 (matches what H200 can deliver in budget) - log_interval: 10 β 5, eval_interval: 100 β 50, ckpt_interval: 200 β 100 (tighter feedback loop given fewer total steps) - recovery_window: 200 β 100 (proportional to new total_steps) - Default hardware: a100-large β h200 (H200 has 5.5Γ the memory bandwidth of L40S β 4.8 TB/s vs 864 GB/s β giving ~4Γ speedup on generation) - Default timeout: 15h β 6h (1000 steps fits in ~5h on H200) - Default TOTAL_STEPS: 3500 β 1000 Expected: ~15s/step on H200 β 1000 steps in ~4.2h β ~$21 of $26.82 budget Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>53da7fc -
fix(train): also clone log_probs to escape inference_mode contextβ
log_probs is computed via compute_log_probs_from_ids() while torch.inference_mode() is active (same for_inference context as completion_ids). Clone it before returning so all three stored tensors are regular autograd-compatible tensors. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>91d2531 -
Merge pull request #10 from lebiraja/feat/refactorβ
lebi rajaFeat/refactor8ae03da -
fix(train): clone prompt/completion tensors after inference_mode generationβ
FastLanguageModel.for_inference() internally uses torch.inference_mode(), which marks all tensors created during model.generate() as inference tensors. These cannot be saved for backward (PyTorch raises RuntimeError). Fix: .clone() the returned prompt_ids and completion_ids immediately so they become normal autograd-compatible tensors before being stored in StepRecord and later consumed by grpo_loss. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>4361e09 -
fix(train): add for_inference/for_training toggles + set lora_dropout=0β
Root cause of 100% GRPO skip rate: Unsloth fast-patches non-LoRA layers with inference-only kernels that break gradient tracking. When grpo_loss calls model(input_ids=...) with requires_grad=True, the patched kernels return tensors with requires_grad=False, so every step fails the `not cur_lp.requires_grad` check and gets counted as empty. Fix: - Call FastLanguageModel.for_inference(model) before rollout collection - Call FastLanguageModel.for_training(model) before grpo_loss and after eval - Set lora_dropout=0.0 so Unsloth can patch LoRA matrices too (with 0.05 dropout, 0 QKV/O/MLP layers were patched β now all 32 get patched) - Log the first 5 exceptions from _seq_log_prob_ids instead of swallowing Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>857a489 -
fix(train): tokenize-free log-prob recompute + switch default model to Llama 3.1β
Root cause of the 75-84% GRPO skip rate (across both Qwen3 and Qwen2.5): compute_log_probs was re-tokenizing prompt+completion as a single string and trusting that the prompt portion would tokenize to the same length it had when tokenized alone. BPE tokenizers can merge tokens at the prompt/completion boundary (e.g. "\n{" β one token), shifting prompt_len past the joint sequence length and yielding empty comp_ids. Result: length-1 fallback tensor with no gradient, step gets discarded. The fix carries token IDs through the pipeline instead of round-tripping through strings: - model_generate now returns (text, prompt_ids, completion_ids, log_probs) instead of (text, log_probs). The IDs are the *exact* sequences from model.generate β no string decode/re-encode. - compute_log_probs_from_ids replaces compute_log_probs. It concatenates prompt_ids + completion_ids and forwards through the model. The output length is guaranteed to equal len(completion_ids), end of story. β¦44e77e2 -
feat(jobs): default model to Qwen2.5-7B-Instruct, expose TRAIN_MODEL/TOTAL_STEPSβ
Qwen3-8B with thinking-mode wastes 90%+ of generated tokens on <think> blocks even with enable_thinking=False (likely a tokenizer template boundary issue). Result: empty completions, 75%+ skipped GRPO steps, no learning signal. Switch default to unsloth/Qwen2.5-7B-Instruct-bnb-4bit: - No thinking mode confusion - Already instruction-tuned to follow JSON prompts - Same 7B size, same VRAM/speed on L40S - Should produce valid actions from step 1 β real reward variance β meaningful GRPO advantages β actual learning Override via TRAIN_MODEL env var. TOTAL_STEPS also exposed (default 3500). Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>1001ade -
Merge pull request #9 from lebiraja/feat/refactorβ
lebi rajaFeat/refactorbac172c -
fix(train): skip degenerate log-prob recomputes + cap default at 3500 stepsβ
Two changes: 1. grpo_trainer.skip degenerate steps. The 'cur=1 old=35' warning meant compute_log_probs returned the empty-completion fallback (length 1, no grad) but we still folded it into the loss. Now we skip such steps entirely and track the skip rate. If >30% of steps are skipped, print a periodic diagnostic β this signals the model is emitting only <think> blocks and SFT warmstart is needed. 2. start_training.sh: default --total_steps to 3500 (was hardcoded 5000 in train/config.py). Lets the L40S run fit comfortably in ~11h vs ~16h budget. Override via TOTAL_STEPS env var. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>93de525 -
fix(train): allow gradients through compute_log_probs for current policyβ
GRPO loss needs the policy model's log-probs to retain grad_fn so that loss.backward() can update LoRA weights. compute_log_probs unconditionally wrapped the forward pass in torch.no_grad(), so cur_lp had no grad and backward() would have raised: RuntimeError: element 0 of tensors does not require grad and does not have a grad_fn This bug never surfaced before because earlier runs crashed on path / .to(device) issues before reaching the first gradient step. Add requires_grad parameter to compute_log_probs and _seq_log_prob. Default False (rollout, ref model). grpo_trainer passes True for cur_lp. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>005f4e5 -
fix(train): drop .to(device) calls on bnb 4-bit models β Unsloth places them alreadyβ
Job 69ecb96d crashed with: ValueError: .to is not supported for 8-bit bitsandbytes models. Please use the model as it is, since the model has already been set to the correct devices and casted to the correct dtype. Unsloth's FastLanguageModel.from_pretrained loads the model directly onto the GPU. The explicit .to(device) calls were a no-op on full-precision models but error out on quantized ones. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>0529ea0 -
fix(jobs): authenticate git clone with HF_TOKEN β Spaces require auth even when publicβ
Previous job failed at clone step: fatal: could not read Username for 'https://huggingface.co' Embed token in clone URL so non-interactive git can auth. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>3afcbda -
fix(training): correct sft_warmstart arg + ensure log dir exists before redirectβ
- start_training.sh: --out β --out_dir for sft_warmstart (argparse rejected --out) - submit_training_job.py: mkdir /workspace/logs BEFORE uvicorn redirects to it - submit_training_job.py: default SKIP_SFT=1 (SFT needs NVIDIA_API_KEY_1 to generate real gold data; without it, falls back to identical strings which is poisonous SFT data) - submit_training_job.py: pass NVIDIA_API_KEY_1 secret + SPACE_REPO env so enabling SFT actually works - submit_training_job.py: extend env health check window to 120s Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>426f155