CoolFace
Modelpublic

Rasooli26/parsbert-persian-sentiment-3class_Fine-Tuned

sourceHugging Faceupdated 8mo agoView on Hugging Face
0likes14downloads
Model Card

<!-- This model card has been generated automatically according to the information Keras had access to. You should probably proofread and complete it, then remove this comment. -->

parsbert-persian-sentiment-3class_Fine-Tuned

This model is a fine-tuned version of HooshvareLab/bert-base-parsbert-uncased on an unknown dataset. It achieves the following results on the evaluation set:

Model description

More information needed

Intended uses & limitations

More information needed

Training and evaluation data

More information needed

Training procedure

Training hyperparameters

The following hyperparameters were used during training:

  • —optimizer: Nadam
  • —learning_rate=1e-3
  • —training_precision: float32

Training results

  • —Accuracy: 0.8914
  • —Precision: 0.8922
  • —Recall: 0.8914
  • —F1 Score: 0.8911

Framework versions

  • —Transformers 4.57.6
  • —TensorFlow 2.19.0
  • —Datasets 4.0.0
  • —Tokenizers 0.22.2

Usage (TensorFlow)

#python from transformers import AutoTokenizer, TFAutoModelForSequenceClassification import tensorflow as tf

MODELID = "Rasooli26/parsbert-persian-sentiment-3classFine-Tuned"

tokenizer = AutoTokenizer.frompretrained(MODELID, usefast=False) model = TFAutoModelForSequenceClassification.frompretrained(MODEL_ID)

def predict(text: str): inputs = tokenizer( text, returntensors="tf", truncation=True, padding=True, maxlength=128 ) probs = tf.nn.softmax(model(**inputs).logits, axis=-1) predid = int(tf.argmax(probs, axis=-1).numpy()[0]) return model.config.id2label[predid], probs.numpy()

label, probs = predict("این محصول بسیار عالی است") print(label, probs)

Optional: add PyTorch usage (only if you want)

Because your repo was originally TF-based, PyTorch users may need from_tf=True unless you also uploaded PyTorch weights:

md
## Usage (PyTorch)

from transformers import AutoTokenizer, AutoModelForSequenceClassification import torch import torch.nn.functional as F

MODELID = "Rasooli26/parsbert-persian-sentiment-3classFine-Tuned"

tokenizer = AutoTokenizer.frompretrained(MODELID, usefast=False) model = AutoModelForSequenceClassification.frompretrained(MODELID, fromtf=True) model.eval()

inputs = tokenizer("این محصول بسیار عالی است", returntensors="pt", truncation=True, padding=True, maxlength=128)

with torch.no_grad(): probs = F.softmax(model(**inputs).logits, dim=-1)

predid = int(torch.argmax(probs, dim=-1).item()) print(model.config.id2label[predid], probs.tolist())