INNER CODE UNIT · TypeScript

_save_checkpoint

theaniketgiri/create-llm · src/python-callback-templates.ts:129

    def _save_checkpoint(
        self,
        trainer: Any,
        step: int,
        loss: float,
        is_best: bool = False,
        is_final: bool = False
    ):
        """Save a checkpoint"""
        # Determine checkpoint name
        if is_final:
            checkpoint_name = 'checkpoint-final.pt'
        elif is_best:
            checkpoint_name = 'checkpoint-best.pt'
        else:
            checkpoint_name = f'checkpoint-{step}.pt'
        
        checkpoint_path = self.checkpoint_dir / checkpoint_name

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…