Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to use other models without loading them from internet? #28

Closed
Azamat25 opened this issue Nov 8, 2019 · 3 comments
Closed

How to use other models without loading them from internet? #28

Azamat25 opened this issue Nov 8, 2019 · 3 comments

Comments

@Azamat25
Copy link

Azamat25 commented Nov 8, 2019

I have terrible internet connection. So i would like to ask you what modifications I should make to use other models if I already downloaded them from internet? for example xlm-mlm-tlm-xnli15-1024 model? Should I create 'cache' file in the same folder and put there .bin file? and what part of code i should modify to use that model? Thanks

@ThilinaRajapakse
Copy link
Owner

model = model_class.from_pretrained(<path_to_dir_containing_model_files>)

This should do the trick.

@Azamat25
Copy link
Author

Azamat25 commented Nov 8, 2019

config = config_class.from_pretrained("model_files/xlm-mlm-tlm-xnli15-1024-config.json", num_labels=2, finetuning_task=args['task_name'])
tokenizer = tokenizer_class.from_pretrained("model_files/xlm-mlm-tlm-xnli15-1024-vocab.json")
model = model_class.from_pretrained("model_files/xlm-mlm-tlm-xnli15-1024-pytorch_model.bin")

is that correct? I am receving UnicodeDecodeError: 'utf-8' codec can't decode byte 0x80 in position 0: invalid start byte. Thanks!

@ThilinaRajapakse
Copy link
Owner

The paths should be the path to the directory, not the file itself.

config = config_class.from_pretrained("model_files/", num_labels=2, finetuning_task=args['task_name'])
tokenizer = tokenizer_class.from_pretrained("model_files/")
model = model_class.from_pretrained("model_files/")

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants