Views
No views yet
hf_bat_token/
├─ model.safetensors # Trained model weights
├─ tokenizer.json # Tokenizer configuration
├─ tokenizer_config.json # Tokenizer config for HF
├─ vocab.txt # Tokenizer vocabulary
├─ config.json # Model architecture configuration
├─ special_tokens_map.json # Special token mapping
├─ training_args.bin # Hugging Face Trainer arguments
├─ README.md # This file
└─ LICENSE # License (optional)1pip install transformers datasets torch
2pip install huggingface_hub1from transformers import AutoTokenizer, AutoModelForTokenClassification
2import torch
3
4# Replace 'username/BAT-Token-Classifier' with your HF repo path
5tokenizer = AutoTokenizer.from_pretrained("username/BAT-Token-Classifier")
6model = AutoModelForTokenClassification.from_pretrained("username/BAT-Token-Classifier")
7model.eval()
8
9# Example input
10text = "The judge ruled in favor of the plaintiff despite previous biases."
11tokens = tokenizer(text, return_tensors="pt", is_split_into_words=False)
12outputs = model(**tokens)
13
14# Predicted token labels
15predictions = torch.argmax(outputs.logits, dim=-1)
16print(predictions)bert-base-uncasedDataCollatorForTokenClassification from Hugging Facetrain_bat_token_classifier.py handles:data/token_labels/Trainer APIoutputs/bat_token_classifier/