Views
No views yet
1from transformers import AutoTokenizer, AutoModelForTokenClassification
2
3# Load the model and tokenizer
4tokenizer = AutoTokenizer.from_pretrained("your-username/your-model-name", trust_remote_code=True)
5model = AutoModelForTokenClassification.from_pretrained("your-username/your-model-name", trust_remote_code=True)
6
7# Use for inference
8inputs = tokenizer(["Your text here"], return_tensors="pt", is_split_into_words=False)
9outputs = model(**inputs)
10predictions = outputs.logits.argmax(dim=-1)trust_remote_code=True when loading the model.