Sentence-transformers: Using HuggingFace Models

Created on 30 Apr 2020  路  4Comments  路  Source: UKPLab/sentence-transformers

Is it possible to use models that have been uploaded to the huggingface s3 bucket?

Most helpful comment

Yes, you can pass to the models.Transformer() any huggingface pre-trained model, including the models from the s3 bucket:
https://huggingface.co/models

transformer_model = models.Transformer('allenai/scibert_scivocab_uncased')

This would download and use this model:
https://huggingface.co/allenai/scibert_scivocab_uncased

All 4 comments

Yes, you can pass to the models.Transformer() any huggingface pre-trained model, including the models from the s3 bucket:
https://huggingface.co/models

transformer_model = models.Transformer('allenai/scibert_scivocab_uncased')

This would download and use this model:
https://huggingface.co/allenai/scibert_scivocab_uncased

Is it possible to put a model that I've pretrained with the training_nli script onto the huggingface bucket? I know there are technically multiple models in the output of script.

Hi @lagatorc
You would need to upload the 0_Transformer (or 0_BERT / 0_RoBERTa) model to the huggingface bucket.

Than you can use this model via:

word_embedding_model = models.Transformer('huggingfaceUser/modelname')
pooling_model = models.Pooling(word_embedding_model.get_word_embedding_dimension())
model = SentenceTransformer(modules=[word_embedding_model, pooling_model])

Best
Nils

Thank you. That answers all my questions

Was this page helpful?
0 / 5 - 0 ratings

Related issues

alejandrojcastaneira picture alejandrojcastaneira  路  5Comments

aclifton314 picture aclifton314  路  3Comments

AnandIyer98 picture AnandIyer98  路  6Comments

RuskinManku picture RuskinManku  路  5Comments

naserahmadi picture naserahmadi  路  3Comments