Downloads · 30 days
8
4% of all-time downloads
mhrtrk/xlm-roberta-xl-german-skill-classifier
xlm-roberta-xl-german-skill-classifier is a text classification model from mhrtrk. Use it when you need a label for a piece of text. It is set up for transformers.
- Developed by: Mahir Yilmaz TURK - Funded by Anonymous Client - Model type: XLM-Roberta-XL - Language(s) (NLP): German - Finetuned from model XLM-Roberta-XL
Downloads · 30 days
8
4% of all-time downloads
All-time downloads
207
Public
Parameters
3.5B
14 GB on disk
Likes
0
Public
Click a slice to open those files.
.safetensors13.9 GB · 100%
From the Hugging Face model README
This model is fine tuned with the intention to classify a given German Task/Skill name into one of the 5 classes:
<code>label_names = ["cognitive", "administrative", "social", "manual", "digital"]</code>
import torch
import numpy as np
from transformers import AutoTokenizer, AutoModelForSequenceClassification, AutoConfig
MODEL_NAME = "mhrtrk/xlm-roberta-xl-german-skill-classifier"
label_names = ["cognitive", "administrative", "social", "manual", "digital"]
MAX_LENGTH = 128
config = AutoConfig.from_pretrained(
MODEL_NAME,
num_labels=len(label_names),
problem_type="multi_label_classification",
)
tokenizer = AutoTokenizer.from_pretrained(MODEL_NAME)
model = AutoModelForSequenceClassification.from_pretrained(MODEL_NAME, config=config)
def predict(text):
inputs = tokenizer(
text,
truncation=True,
padding="max_length",
max_length=MAX_LENGTH,
return_tensors="pt"
)
outputs = model(**inputs)
logits = outputs.logits
probs = torch.sigmoid(logits)
preds = (probs > 0.5).numpy().astype(int)
predicted_labels = [label for label, flag in zip(label_names, preds[0]) if flag == 1]
return predicted_labels, probs.detach().numpy()
example_text = "d) Kraftübertragungssysteme, insbesondere Schaltgetriebe,\nAutomatikgetriebe und Allradsysteme, instand\nsetzen"
predicted_labels, probabilities = predict(example_text)
print("Predicted Labels:", predicted_labels)
print("Probabilities:", probabilities)
Mahir Yilmaz TURK