model usage

#1
by bikesnmz - opened
This comment has been hidden
bikesnmz changed discussion status to closed

Can you share a sample code on how to use the model? When I try to load the model with AutoModelForTokenClassification.from_pretrained I get an error.

bikesnmz changed discussion status to open
Aykut Koç Lab org

Of course. Here is a sample code for the usage of the model. I also updated the model card to add the same sample code.

from transformers import AutoModelForSequenceClassification, AutoTokenizer
bert_model = "KocLab-Bilkent/BERTurk-Legal"
model = AutoModelForSequenceClassification.from_pretrained(bert_model, output_hidden_states=True)
tokenizer = AutoTokenizer.from_pretrained(bert_model)
tokens = tokenizer("Örnek metin") # a dummy text is provided as input
output = model(tokens) 
docEmbeddings = output.hidden_states[-1]

Sign up or log in to comment