nlp-uoregon / trankit

Trankit is a Light-Weight Transformer-based Python Toolkit for Multilingual Natural Language Processing
Apache License 2.0
724 stars 99 forks source link

Can we load model with transformer library? #10

Closed ithieund closed 3 years ago

ithieund commented 3 years ago

Hi @minhvannguyen , Can I load the model using this coding style? `import torch from transformers import AutoModel, AutoTokenizer

model = AutoModel.from_pretrained("trankit") tokenizer = AutoTokenizer.from_pretrained("trankit", use_fast=False)`

Thank you.

minhhdvn commented 3 years ago

Hi @ithieund, Thanks for asking. Trankit is not a language model like multilingual BERT or XLM-Roberta, so it's not possible to use the library in your suggested way. If you want to use an adapter-based transformer encoder, we suggest you looking at the Base_Model class in this file, where you can find how to combine a pretrained transformer with a set of adapter weights. Please let me know if that answers your question. Thanks

ithieund commented 3 years ago

Hi @minhvannguyen , Thank you for your quick response. I'll try that.