deberta-v3-large-clause-metaphor
7
1
license:apache-2.0
by
tommyleo2077
Other
OTHER
New
7 downloads
Early-stage
Edge AI:
Mobile
Laptop
Server
Unknown
Mobile
Laptop
Server
Quick Summary
AI model with specialized capabilities.
Code Examples
Usage examplepythontransformers
from transformers import AutoTokenizer, AutoModelForTokenClassification
import torch
model_path = "your-org/deberta-v3-large-clause-metaphor" # or local path
tokenizer = AutoTokenizer.from_pretrained(model_path)
model = AutoModelForTokenClassification.from_pretrained(model_path)
words = ["The", "government", "attacked", "the", "proposal", "."]
inputs = tokenizer(
[words],
is_split_into_words=True,
return_tensors="pt",
truncation=True,
max_length=192,
)
word_ids = inputs.word_ids(batch_index=0)
with torch.no_grad():
logits = model(**inputs).logits
preds = logits.argmax(dim=-1)[0].tolist()
# Map subwords back to words (first subword per word)
word_predictions = {}
for i, wid in enumerate(word_ids):
if wid is not None and wid not in word_predictions:
word_predictions[wid] = 1 if preds[i] == 1 else 0
for i, w in enumerate(words):
label = "metaphor" if word_predictions.get(i, 0) == 1 else "non_metaphor"
print(f"{w}\t{label}")Deploy This Model
Production-ready deployment in minutes
Together.ai
Instant API access to this model
Production-ready inference API. Start free, scale to millions.
Try Free APIReplicate
One-click model deployment
Run models in the cloud with simple API. No DevOps required.
Deploy NowDisclosure: We may earn a commission from these partners. This helps keep LLMYourWay free.