Skip to content

How can I load pretrained model? #34

@dlwlgus53

Description

@dlwlgus53

After I download the pretrained model, I fond'config.json, weights.th and vocabulary folder. However,

tokenizer = BertModel.from_pretrained('bert-base-uncased')
model = BertModel.from_pretrained("bert-base-uncased")
device = torch.device(f'cuda:{args.gpu_number}' if torch.cuda.is_available() else 'cpu')
torch.cuda.set_device(device) # change allocation of current GPU

print("\n\nuse trained model")
model.load_state_dict(torch.load('weights.th',map_location='cuda:0'))
print("no error!")

this doesn't work. How can I load pre-trained model??

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions