Instructions to use KocLab-Bilkent/BERTurk-Legal with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use KocLab-Bilkent/BERTurk-Legal with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("fill-mask", model="KocLab-Bilkent/BERTurk-Legal")# Load model directly from transformers import AutoTokenizer, AutoModelForMaskedLM tokenizer = AutoTokenizer.from_pretrained("KocLab-Bilkent/BERTurk-Legal") model = AutoModelForMaskedLM.from_pretrained("KocLab-Bilkent/BERTurk-Legal") - Inference
- Notebooks
- Google Colab
- Kaggle
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
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]