Hi all,
Im new to Pytorch.
I’m trying to load someone’s saved Pytorch model.
The downloaded folder has the below contents:
config.json
pytorch_model.bin
special_tokens_map.json
tokenizer_config.json
training_args.bin
vocab.txt
I understand that a model can be loaded as such (from PyTorch documentation):
model = TheModelClass(*args, **kwargs)
model.load_state_dict(torch.load(PATH))
model.eval()
but how can I make use of the files in the output directory to do this?
I have tried
model = torch.load(‘pytorch_model.bin’)
This doesnt load the model but a dictionary thus, the eval(), predict() does not work.
model.eval()
Traceback (most recent call last):
File “”, line 1, in
AttributeError: ‘collections.OrderedDict’ object has no attribute ‘eval’