fast-bert icon indicating copy to clipboard operation
fast-bert copied to clipboard

How to load model.safetensors using fast_bert using python3.*

Open pratikchhapolika opened this issue 1 year ago • 1 comments

I have trained a model using latest transformers package 4.37.2 and it saves the model as model.safetensors.

I am using from fast_bert.prediction import BertClassificationPredictor to load the model in production. But it's giving the error as

OSError: Error no file named ['pytorch_model.bin', 'tf_model.h5', 'model.ckpt.index'] found in directory  or `from_tf` set to False 

Does BertClassificationPredictor allow us to load model.safetensors. If yes, how can we do this?

predictor = BertClassificationPredictor(model_path=self.model_path,
                                                     label_path=self.label_path,
                                                     multi_label=False,
                                                     model_type='roberta',
                                                     do_lower_case=True)

@kaushaltrivedi

pratikchhapolika avatar Feb 29 '24 05:02 pratikchhapolika

Please update transformers to 4.45 above

sdy623 avatar Oct 30 '24 07:10 sdy623