From 1bc3476a46d8d8e6bf7f2cb17570c2b7a26eafd0 Mon Sep 17 00:00:00 2001 From: Pierre-Louis <78484833+PierreLouisLetoquart@users.noreply.github.com> Date: Mon, 3 Mar 2025 09:12:33 -0500 Subject: [PATCH] chore(lora): Add real-time log buffering fix for nohup execution (#1311) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * chore(lora): Add real-time log buffering fix for nohup execution Disable Python stdout buffering to ensure logs appear in nohup.out in real-time instead of only after script completion. * chore(lora): remove python 3.7+ check * chore(lora): running pre-commit hook --------- Co-authored-by: Pierre-Louis Létoquart --- lora/lora.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lora/lora.py b/lora/lora.py index 723e783d..6f91ccca 100644 --- a/lora/lora.py +++ b/lora/lora.py @@ -3,6 +3,7 @@ import argparse import json import math +import sys import time from pathlib import Path @@ -14,6 +15,9 @@ import utils as lora_utils from mlx.utils import tree_flatten from models import LoRALinear +# Disable output buffering to see print statements in real-time +sys.stdout.reconfigure(line_buffering=True) + def build_parser(): parser = argparse.ArgumentParser(description="LoRA or QLoRA finetuning.")