@@ -264,7 +264,19 @@ async def _load_model_with_optimizations(self, model_id: str):
264264 # Log model loading start
265265 logger .info (f"Starting download and loading of model: { model_id } " )
266266 print (f"\n { Fore .GREEN } Downloading model: { model_id } { Style .RESET_ALL } " )
267- print (f"{ Fore .CYAN } This may take a while depending on your internet speed...{ Style .RESET_ALL } \n " )
267+ print (f"{ Fore .CYAN } This may take a while depending on your internet speed...{ Style .RESET_ALL } " )
268+ # Add an empty line to separate from HuggingFace progress bars
269+ print ("" )
270+
271+ # Set a flag to indicate we're downloading a model
272+ # This will help our logger know to let HuggingFace's progress bars through
273+ try :
274+ # Access the module's global variable
275+ import locallab .utils .progress
276+ locallab .utils .progress .is_downloading = True
277+ except :
278+ # Fallback if import fails
279+ pass
268280
269281 # Load tokenizer first
270282 logger .info (f"Loading tokenizer for { model_id } ..." )
@@ -281,7 +293,19 @@ async def _load_model_with_optimizations(self, model_id: str):
281293 token = hf_token if hf_token else None ,
282294 ** quant_config
283295 )
284- print (f"\n { Fore .GREEN } Model { model_id } downloaded successfully!{ Style .RESET_ALL } " )
296+ # Reset the downloading flag
297+ try :
298+ # Access the module's global variable
299+ import locallab .utils .progress
300+ locallab .utils .progress .is_downloading = False
301+ except :
302+ # Fallback if import fails
303+ pass
304+
305+ # Add an empty line and a clear success message
306+ print (f"\n { Fore .GREEN } ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━{ Style .RESET_ALL } " )
307+ print (f"{ Fore .GREEN } ✅ Model { model_id } downloaded successfully!{ Style .RESET_ALL } " )
308+ print (f"{ Fore .GREEN } ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━{ Style .RESET_ALL } " )
285309 logger .info (f"Model weights loaded successfully" )
286310
287311 # Apply additional optimizations
@@ -1045,7 +1069,18 @@ async def load_custom_model(self, model_name: str, fallback_model: Optional[str]
10451069 # Load tokenizer first
10461070 logger .info (f"Loading tokenizer for custom model { model_name } ..." )
10471071 print (f"\n { Fore .GREEN } Downloading custom model: { model_name } { Style .RESET_ALL } " )
1048- print (f"{ Fore .CYAN } This may take a while depending on your internet speed...{ Style .RESET_ALL } \n " )
1072+ print (f"{ Fore .CYAN } This may take a while depending on your internet speed...{ Style .RESET_ALL } " )
1073+ # Add an empty line to separate from HuggingFace progress bars
1074+ print ("" )
1075+
1076+ # Set a flag to indicate we're downloading a model
1077+ try :
1078+ # Access the module's global variable
1079+ import locallab .utils .progress
1080+ locallab .utils .progress .is_downloading = True
1081+ except :
1082+ # Fallback if import fails
1083+ pass
10491084
10501085 self .tokenizer = AutoTokenizer .from_pretrained (model_name )
10511086 logger .info (f"Tokenizer loaded successfully" )
@@ -1058,7 +1093,19 @@ async def load_custom_model(self, model_name: str, fallback_model: Optional[str]
10581093 device_map = "auto" ,
10591094 quantization_config = quant_config
10601095 )
1061- print (f"\n { Fore .GREEN } Custom model { model_name } downloaded successfully!{ Style .RESET_ALL } " )
1096+ # Reset the downloading flag
1097+ try :
1098+ # Access the module's global variable
1099+ import locallab .utils .progress
1100+ locallab .utils .progress .is_downloading = False
1101+ except :
1102+ # Fallback if import fails
1103+ pass
1104+
1105+ # Add an empty line and a clear success message
1106+ print (f"\n { Fore .GREEN } ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━{ Style .RESET_ALL } " )
1107+ print (f"{ Fore .GREEN } ✅ Custom model { model_name } downloaded successfully!{ Style .RESET_ALL } " )
1108+ print (f"{ Fore .GREEN } ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━{ Style .RESET_ALL } " )
10621109 logger .info (f"Model weights loaded successfully" )
10631110
10641111 self .model = self ._apply_optimizations (self .model )
0 commit comments