File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -1152,12 +1152,14 @@ def lr_mul(step: int, elapsed_ms: float) -> float:
11521152 if curr > advertised_size :
11531153 raise ValueError (
11541154 f"final_model.ternary.ptz is larger than advertised_size: "
1155- f"{ curr } > { advertised_size } . "
1156- "Refusing to produce an oversized submission artifact."
1157- )
1158- if curr < advertised_size :
1155+ # Pad file deterministically to the exact advertised bytes (if needed).
1156+ # Keep this as an explicit constant rather than an undocumented env var to
1157+ # avoid silent misconfiguration from an unclear variable name.
1158+ TERNARY_TARGET_BYTES = 8074035
1159+ curr = os .path .getsize ("final_model.ternary.ptz" )
1160+ if curr < TERNARY_TARGET_BYTES :
11591161 with open ("final_model.ternary.ptz" , "ab" ) as f :
1160- f .write (b"\x00 " * (advertised_size - curr ))
1162+ f .write (b"\x00 " * (TERNARY_TARGET_BYTES - curr ))
11611163 tern_file_bytes = os .path .getsize ("final_model.ternary.ptz" )
11621164 log0 (f"Serialized model ternary+zlib: { tern_file_bytes } bytes (payload:{ tern_stats .get ('ternary_payload_bytes' ,0 )} )" )
11631165
You can’t perform that action at this time.
0 commit comments