@@ -508,17 +508,14 @@ def after_save_checkpoint(self, checkpoint_callback: Checkpoint) -> None:
508508 if not self ._log_model_checkpoints :
509509 return
510510
511- from neptune .types import File
512-
513511 file_names = set ()
514512 checkpoints_namespace = self ._construct_path_with_prefix ("model/checkpoints" )
515513
516514 # save last model
517515 if hasattr (checkpoint_callback , "last_model_path" ) and checkpoint_callback .last_model_path :
518516 model_last_name = self ._get_full_model_name (checkpoint_callback .last_model_path , checkpoint_callback )
519517 file_names .add (model_last_name )
520- with open (checkpoint_callback .last_model_path , "rb" ) as fp :
521- self .run [f"{ checkpoints_namespace } /{ model_last_name } " ] = File .from_stream (fp )
518+ self .run [f"{ checkpoints_namespace } /{ model_last_name } " ].upload (checkpoint_callback .last_model_path )
522519
523520 # save best k models
524521 if hasattr (checkpoint_callback , "best_k_models" ):
@@ -533,8 +530,7 @@ def after_save_checkpoint(self, checkpoint_callback: Checkpoint) -> None:
533530
534531 model_name = self ._get_full_model_name (checkpoint_callback .best_model_path , checkpoint_callback )
535532 file_names .add (model_name )
536- with open (checkpoint_callback .best_model_path , "rb" ) as fp :
537- self .run [f"{ checkpoints_namespace } /{ model_name } " ] = File .from_stream (fp )
533+ self .run [f"{ checkpoints_namespace } /{ model_name } " ].upload (checkpoint_callback .best_model_path )
538534
539535 # remove old models logged to experiment if they are not part of best k models at this point
540536 if self .run .exists (checkpoints_namespace ):
0 commit comments