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

View File

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