Downloads · 30 days
6
1% of all-time downloads
UmerKhan261/Fine-Tuned_BERT_German_Text_Classification
Fine-Tuned_BERT_German_Text_Classification is a text classification model from UmerKhan261. Use it when you need a label for a piece of text. It is set up for transformers. The card lists the license as mit.
Imagine you have a BERT model – the superhero of natural language understanding – but this one speaks German! We took the powerful "bert-base-german-cased" model and gave it a special mission: classify German text. Af…
Downloads · 30 days
6
1% of all-time downloads
All-time downloads
487
Public
Repo size
1.3 GB
Likes
1
Public
Click a slice to open those files.
.h5437 MB · 50%
From the Hugging Face model README
Imagine you have a BERT model – the superhero of natural language understanding – but this one speaks German! We took the powerful "bert-base-german-cased" model and gave it a special mission: classify German text. After intense training, it's ready to help you tackle tasks like sentiment analysis, content categorization, or even semantic search in the German language. It is trained on 160K article summaries performs well on semantic search and text classification. I plan on to further fine tune this model with a much larger dataset approximately going to 511K article summaries.
How to Use It: Let's see how you can unleash this German-speaking superhero on your data:
Install Hugging Face Transformers: First, make sure you have the Hugging Face Transformers library installed. You can do this with pip:
bash Copy code pip install transformers Load the Fine-Tuned Model: To use this fine-tuned BERT model, load it with the Transformers library:
python Copy code from transformers import TFBertForSequenceClassification, BertTokenizer
model = TFBertForSequenceClassification.from_pretrained("path/to/your/model/directory") tokenizer = BertTokenizer.from_pretrained("bert-base-german-cased") Prepare Your Text: You can perform text classification with this model. Tokenize your text using the tokenizer:
text = "Deine Textnachricht hier" # Your German text
Get Predictions: Predict the label or class for your text: inputs = tokenizer(text, padding='max_length', truncation=True, max_length=128, return_tensors='tf', return_attention_mask=True)
with tf.device('/GPU:0'): # Specify the GPU device outputs = model(inputs) The predicted_class will give you the predicted label for your text.
Semantic Search: For semantic search, you can create embeddings for a list of text and calculate the similarity between your query text and the documents, as discussed earlier. The model can help you find similar content with ease.
That's it! Your fine-tuned BERT model is now your ally for handling various text-based tasks in the German language. Whether it's text classification or semantic search, this model is ready to assist you on your NLP adventures.
Feel free to reach out if you have questions or need assistance in using this model to accomplish your German language processing tasks. Viel Erfolg! (Good luck!)