Downloads · 30 days
3.6K
25% of all-time downloads
IlyaGusev/ru-word-stress-transformer
ru-word-stress-transformer is a token classification model from IlyaGusev. Use it when you need labels on individual words, such as names. It is set up for transformers. The card lists the license as apache-2.0.
Transformer encoder for predicting word stress in Russian.
Downloads · 30 days
3.6K
25% of all-time downloads
All-time downloads
14.3K
Public
Repo size
32.2 MB
Likes
5
Public
Click a slice to open those files.
.bin12.8 MB · 100%
From the Hugging Face model README
Transformer encoder for predicting word stress in Russian.
from transformers import AutoTokenizer, AutoModelForTokenClassification, pipeline
model_name = "IlyaGusev/ru-word-stress-transformer"
tokenizer = AutoTokenizer.from_pretrained(
model_name,
trust_remote_code=True,
revision="bae83dd"
)
model = AutoModelForTokenClassification.from_pretrained(model_name)
pipe = pipeline(
"token-classification",
model=model,
tokenizer=tokenizer,
device=-1,
aggregation_strategy="none",
ignore_labels=("NO",)
)
text = "щеколда"
print(text)
index = pipe(text)[0]["index"]
print(text[:index] + "'" + text[index:])
Colab: link