Segment Anything model fine-tuning use in a pipeline

Hi,
I have finetuned the facebook/sam-vit-base on my own dataset based on the example in Jupyter Notebook for fine-tuning.
But If I try to use it in the mask-generation pipeline I receive an error:

OSError: Can’t load the configuration of ‘./model/sam_model.pth’. If you were trying to load it from ‘Models - Hugging Face’, make sure you don’t have a local directory with the same name. Otherwise, make sure ./model/sam_model.pth’ is the correct path to a directory containing a config.json file

how can I save the config.json from SamModel.from_pretrained(‘facebook/sam-vit-base’) with the trained weight?

Can you explain that please.

Thank you