Instructions to use The-Adnan-Syed/Stress_Classifier_BERT with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use The-Adnan-Syed/Stress_Classifier_BERT with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-classification", model="The-Adnan-Syed/Stress_Classifier_BERT")# pip install -U transformers accelerate # Load model directly from transformers import AutoTokenizer, AutoModelForSequenceClassification tokenizer = AutoTokenizer.from_pretrained("The-Adnan-Syed/Stress_Classifier_BERT") model = AutoModelForSequenceClassification.from_pretrained("The-Adnan-Syed/Stress_Classifier_BERT", device_map="auto") - Notebooks
- Google Colab
- Kaggle
|
Download README.md from The-Adnan-Syed/Stress_Classifier_BERT: direct link, hf CLI and curl.
- Browser
- Download file 1.09 kB
-
https://huggingface.co/The-Adnan-Syed/Stress_Classifier_BERT/resolve/main/README.md
- Command line
-
hf download hf://The-Adnan-Syed/Stress_Classifier_BERT/README.md
-
curl -L -o README.md https://huggingface.co/The-Adnan-Syed/Stress_Classifier_BERT/resolve/main/README.md
1.09 kB
| license: unknown | |
| datasets: | |
| - The-Adnan-Syed/Reddit-Stress-Classification | |
| pipeline_tag: text-classification | |
| ## How to Use | |
| Here is an example of how to use this model to get predictions and convert them back to labels: | |
| ```python | |
| import tensorflow as tf | |
| from transformers import TFAutoModelForSequenceClassification, AutoTokenizer | |
| import joblib | |
| # Load the model and tokenizer | |
| model = TFAutoModelForSequenceClassification.from_pretrained("NeuEraAI/Stress_Classifier_BERT") | |
| tokenizer = AutoTokenizer.from_pretrained("NeuEraAI/Stress_Classifier_BERT") | |
| # Load your label encoder | |
| label_encoder = joblib.load("label_encoder.joblib") | |
| def decode_predictions(predictions): | |
| # Extract predicted indices (assuming predictions is a list of dicts with 'label' keys) | |
| predicted_indices = [int(pred['label'].split('_')[-1]) for pred in predictions] | |
| # Decode the indices to original labels | |
| decoded_labels = label_encoder.inverse_transform(predicted_indices) | |
| return decoded_labels | |
| # Example usage | |
| text = "Your example input text here." | |
| decode_predictions(model.predict(text)) |