Merge branch 'feat/qlora-training'

This commit is contained in:
Salvatore Rossitto 2026-03-12 19:04:25 +01:00
commit 7dfcaace50
2 changed files with 6 additions and 4 deletions

View File

@ -42,10 +42,10 @@ def read_gguf(path):
pos = f.tell()
align = 32
data_start = (pos + align - 1) & ~(align - 1)
print(f"\nFile: {path}")
print(f"Tensors: {n_tensors}")
for name, dims, dtype, offset in tensors[:10]: # first 10
if dtype != 0: # only F32 (type 0)
print(f" {name}: dims={dims} type={dtype} (non-F32, skipping norm)")

View File

@ -34,7 +34,6 @@ Python → C++ stdin:
import argparse
import logging
import math
import os
import re
import subprocess
import sys
@ -99,6 +98,7 @@ def read_ipc(proc: subprocess.Popen, timeout: float = 120.0) -> Optional[Tuple[s
Returns None on EOF.
Raises TimeoutError if nothing arrives within `timeout` seconds.
"""
assert proc.stdout is not None
deadline = time.monotonic() + timeout
while True:
remaining = deadline - time.monotonic()
@ -120,6 +120,7 @@ def read_ipc(proc: subprocess.Popen, timeout: float = 120.0) -> Optional[Tuple[s
def write_cmd(proc: subprocess.Popen, cmd: str):
"""Write one command line to the subprocess stdin."""
assert proc.stdin is not None
try:
proc.stdin.write(cmd + "\n")
proc.stdin.flush()
@ -268,7 +269,8 @@ def run_grpo(args: argparse.Namespace):
raise
finally:
try:
proc.stdin.close()
if proc.stdin is not None:
proc.stdin.close()
except Exception:
pass
rc = proc.wait(timeout=30)