Skip to content

Commit 27c3f5d

Browse files
kmbandyclaude
andcommitted
chore(MAD-223): force unbuffered prints in calibrate_ml8.py
Python's stdout is block-buffered when not attached to a TTY (e.g. nohup'd to a file, run under timeout, etc), which hides per-layer progress on long runs. Override print with flush=True so live tail -f works during multi-hour calibrations. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
1 parent e11e754 commit 27c3f5d

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

scripts/calibration/calibrate_ml8.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,13 +38,17 @@
3838
from __future__ import annotations
3939

4040
import argparse
41+
import functools
4142
import json
4243
import math
4344
import os
4445
import sys
4546
import time
4647
from pathlib import Path
4748

49+
# Force unbuffered prints so live `tail -f` works on long runs piped to file.
50+
print = functools.partial(print, flush=True) # noqa: A001 (deliberate shadow)
51+
4852
import torch
4953
from torch import nn
5054
from transformers import AutoModelForCausalLM, AutoTokenizer

0 commit comments

Comments
 (0)