@@ -508,17 +508,14 @@ def after_save_checkpoint(self, checkpoint_callback: Checkpoint) -> None:
508
508
if not self ._log_model_checkpoints :
509
509
return
510
510
511
- from neptune .types import File
512
-
513
511
file_names = set ()
514
512
checkpoints_namespace = self ._construct_path_with_prefix ("model/checkpoints" )
515
513
516
514
# save last model
517
515
if hasattr (checkpoint_callback , "last_model_path" ) and checkpoint_callback .last_model_path :
518
516
model_last_name = self ._get_full_model_name (checkpoint_callback .last_model_path , checkpoint_callback )
519
517
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 )
522
519
523
520
# save best k models
524
521
if hasattr (checkpoint_callback , "best_k_models" ):
@@ -533,8 +530,7 @@ def after_save_checkpoint(self, checkpoint_callback: Checkpoint) -> None:
533
530
534
531
model_name = self ._get_full_model_name (checkpoint_callback .best_model_path , checkpoint_callback )
535
532
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 )
538
534
539
535
# remove old models logged to experiment if they are not part of best k models at this point
540
536
if self .run .exists (checkpoints_namespace ):
0 commit comments