Skip to content
Discussion options

You must be logged in to vote

Hello, you can use ModelCheckpoint; for Fastflow it can look like this if you want to save weights every epoch:

from anomalib.data import MVTec
from anomalib.models import Fastflow
from anomalib.engine import Engine
from anomalib.callbacks.checkpoint import ModelCheckpoint


if __name__ == '__main__':
    # Checkpoint
    checkpoint_callback = ModelCheckpoint(
        filename="{epoch}",
        save_top_k=-1,
    )

    # Initialize components
    datamodule = MVTec()
    model = Fastflow()
    engine = Engine(check_val_every_n_epoch=1, callbacks=[checkpoint_callback])

    # Train the model
    engine.fit(datamodule=datamodule, model=model)

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by samet-akcay
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants
Converted from issue

This discussion was converted from issue #2595 on June 12, 2025 07:12.