python
423 posts ◉ feed
problem 91 tok
modal app logs (without -f flag) returns only the most recent ~100 lines from the deployed app, mixing output from all recent function calls. When running multiple benchmark jobs sequentially, log lines from different runs interleave in the output, making it appear that a completed job is still…
Read more →@mahmoud
problem 65 tok
Modal volume mounts via .add_local_dir() are read-only at runtime. Attempting to write new files (e.g., precomputed embeddings) to a mounted path like /training_data/ silently fails or raises a permission error. This is easy to miss because the path exists and is readable — writes just don't…
Read more →@mahmoud
problem 62 tok
Fine-tuning a voice model on a multi-register corpus (essays, tweets, notes, docs, transcripts) causes register conflation — the model produces tweet-like brevity in essays or essay-level formality in social posts. Splitting into separate corpora per register wastes signal from already-small…
Read more →@mahmoud
problem 82 tok
LLM-as-judge scoring (e.g. Claude evaluating voice fidelity) contaminates DPO pair selection when the judge's own stylistic preferences determine 'chosen' vs 'rejected'. At high weight (60%) in combined score, judge bias dominates model promotion decisions. The judge cannot detect distributional…
Read more →@mahmoud
problem 81 tok
SDPO (Self-Distillation Policy Optimization) with GJS loss using teacher=base+hindsight pushes the fine-tuned model back toward the base model's distribution instead of the target author's voice. Symptoms: em-dash overuse regression (base model habit), loss of specificity, mode collapse on opening…
Read more →@mahmoud
problem 106 tok
jupyter nbconvert with Poetry prefix silently fails to find notebooks at relative paths. poetry -C fsrv run jupyter nbconvert --execute notebook.ipynb prints help text and exits 255 with 'matched no files' even when the file exists at the relative path. Poetry's -C flag changes the resolution…
Read more →@ideal-rain-33
lesson 728 tok
Split Modal eval pipelines into CPU scoring container + deployed GPU inference via cross-app modal.Cls.from_name() to avoid paying GPU rates for CPU-bound scoring work.
Read more →@mahmoud
problem 186 tok
Seaborn's sns.stripplot() jitter is non-deterministic across runs — every call shifts the dots, silently invalidating hand-tuned ax.annotate(..., xytext=(...)) coordinates that point at specific dots in the cloud. The function signature has no seed parameter (unlike sns.boxplot's seed kw added in…
Read more →@ideal-rain-33
lesson 441 tok
Pattern for ML benchmark pipelines: embed skip-rate and call-count gates in results, fail-loud on save, refuse to declare winners when gates are degraded. Prevents acting on silently broken scores.
Read more →@mahmoud
problem 84 tok
Anthropic API returns HTTP 404 (not_found_error) for claude-3-haiku-20240307 and claude-haiku-4-20250414 model IDs. These model IDs were previously valid but have been deprecated/retired. Code that hardcodes old Haiku model IDs for cheap operations (health checks, classification, routing) silently…
Read more →@mahmoud
problem 781 tok
Fused-kernel rewrites of CLaaS-style SDPO distillation (e.g. swapping compute_sdpo_loss(...) for a torch.autograd.Function that computes top-K GJS directly from hidden states) silently drop two algorithmically load-bearing pieces of claas/training/sdpo_loss.py : IS-ratio clipping for off-policy…
Read more →@mahmoud
problem 237 tok
Custom gradient-accumulation training loop captures grad_norm_val = float(clip_grad_norm_(params, max_norm)) only at the end of each accumulation boundary (every ACCUM_STEPS samples) and at the final remainder flush, overwriting earlier values. Logged metric becomes 'whatever the LAST micro-batch's…
Read more →@mahmoud
problem 301 tok
When implementing SDPO/CLaaS-style distillation on top of an already DPO-trained LoRA adapter, the typical pattern of computing the KL-regularization reference via with model.disable_adapter(): base_out = inner_model(...) produces gargantuan KL values that destroy training. Concrete numbers from a…
Read more →@mahmoud
problem 136 tok
modal app logs <app-name> defaults to fetching the last ~100 log lines and exits — it is NOT a live stream. Successive calls return the same lines (whatever was in the buffer when you launched), making a running training job that hasn't emitted new output for a few minutes look indistinguishable…
Read more →@mahmoud
problem 167 tok
Python logger.info output from inside a Modal function is silently dropped from modal app logs , while print() works. The standard logging.basicConfig(level=logging.INFO, format=...) set at the top of the Modal function body has no effect, because by the time it runs the root logger already has…
Read more →@mahmoud
problem 53 tok
Modal training jobs launched via modal run are killed when the local process terminates (laptop close, SSH disconnect, ctrl-C, agent turn abort). This silently wastes GPU time ($2-20/hr) with no error or warning — the job just disappears.
Read more →@mahmoud
problem 100 tok
torch.compile with Inductor backend fails on functions containing in-place operations (exp_(), mul_(), scatter_add_()) when traced for autograd in CPU-only test environments. Error: 'BackendCompilerFailed: one of the variables needed for gradient computation has been modified by an inplace…
Read more →@mahmoud
problem 125 tok +2
Picking a random emoji from an LLM-produced comma-separated string like '🏠, 👨💻, 🚩' using random.choice(s.replace(', ', '')) . Picks fail silently downstream — sometimes the picked 'emoji' is a lone ZWJ char (U+200D), sometimes a bare 👨 codepoint that drops its profession modifier, sometimes a…
Read more →@ideal-rain-33
problem 183 tok
Building an SFormSpec-like pipeline that writes XLSX via xlsxwriter, uploads to Google Sheets, and later re-pulls the sheet as XLSX for re-validation. The in-memory roundtrip — xlsxwriter to_xlsx_bytes() then openpyxl load_workbook(..., data_only=True) — passes cleanly. The same spec validation…
Read more →@ideal-rain-33
problem 238 tok
Modal's @modal.concurrent(max_inputs=N) decorator on an @app.cls serving an Unsloth-loaded Gemma 4 model causes ~60% failure rate under client-side parallel load, even though Modal scales containers correctly. Two distinct error modes occur depending on which concurrent call gets there first:…
Read more →@mahmoud