Instructions to use SASIOVERLXRD123/momo-emotion-models with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use SASIOVERLXRD123/momo-emotion-models with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-classification", model="SASIOVERLXRD123/momo-emotion-models")# pip install -U transformers accelerate # Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("SASIOVERLXRD123/momo-emotion-models", device_map="auto") - Notebooks
- Google Colab
- Kaggle
MOMO Chinese Emotion Classification Models
Trained model artifacts used by MOMO 2.0.2, a Chinese emotion classification application developed for the IERG4320 / IEMS5726A Data Science in Practice project. The application connects text classification with emotion visualization and a local diary.
This repository contains two classifiers and their associated evaluation and calibration files. It is an artifact repository, not a standalone application or an automatically deployed inference service. The application and training source are supplied separately with the course project.
Models and labels
- TF-IDF + Logistic Regression: character 1β3-gram features, at most 50,000 features, minimum document frequency 2, sublinear term frequency, and balanced class weights. The selected regularization parameter is C = 4.
- Fine-tuned RoBERTa Tiny: initialized from uer/roberta-tiny-wwm-chinese-cluecorpussmall, revision
6a4e70f3f8bcc2a64ce655e92ceeebb10ad1cafa. The saved architecture isBertForSequenceClassification, with 2 encoder layers, hidden size 128, 2 attention heads, and 7 output classes.
Labels: happiness, like, sadness, anger, fear, disgust, and surprise. There is no neutral class. Always read the class order from the loaded model: the two models use different output orders.
MOMO's automatic mode chooses the candidate with the highest saved validation Macro-F1 when the engine initializes, subject to its dependency checks. With these records, it selects TF-IDF + Logistic Regression. It does not combine the two models' predictions or train another model.
Repository contents
README.md
SHA256SUMS.txt
models/
baseline.joblib
metrics.json
calibration.json
projection.json
transformer/
config.json
model.safetensors
metrics.json
tokenizer.json
tokenizer_config.json
special_tokens_map.json
vocab.txt
provenance/
data_source_manifest.json
requirements-lock.txt
requirements-transformer-lock.txt
baseline.joblibcontains the fitted TF-IDF vectorizer and logistic regression classifier in a scikit-learn pipeline.transformer/contains the fine-tuned weights, architecture configuration, tokenizer, and experiment record.- The two
metrics.jsonfiles contain saved evaluation results, class distributions, and confusion matrices. They also supply the validation scores used by automatic mode. calibration.jsoncontains per-model temperature scaling parameters, confidence thresholds, and artifact fingerprints. Keep it with the corresponding weights. MOMO checks the fingerprint and label order before applying calibration.projection.jsonsupports the application's feature-space visualization. It contains sample coordinates and labels, without the original text.provenance/preserves the data acquisition manifest and dependency lock files provided with the source. These are recorded environment specifications, not an independently re-created environment.SHA256SUMS.txtlists checksums of the other repository files.
Data and preprocessing
Data source: CLUEbenchmark/CLUEmotionAnalysis2020. The original train/validation/test split assignments were retained, followed by filtering. Retained sizes are 31,464 / 3,935 / 3,941 respectively.
Text normalization applies Unicode NFKC, replaces HTTP(S) links with ιΎζ₯ and matched user mentions with η¨ζ·, and collapses whitespace. No Chinese word segmentation or stop-word removal is applied before the baseline vectorizer.
Invalid samples and conflicting labels are removed. A normalized duplicate key is used to remove within-split and cross-split duplicates, with test > validation > train precedence. Conflict detection examines labels across all three splits. Consequently, the test data were involved in dataset cleaning; these results must not be described as evaluation on an entirely untouched official test set. Model and checkpoint selection use validation scores, not test scores.
Both models use class-weighted training to address imbalance. The Transformer uses its pretrained tokenizer, truncation to 128 tokens, and dynamic batch padding.
Recorded training and evaluation
The baseline compares C = 1 and C = 4 using validation Macro-F1. The Transformer run uses seed 42, 3 epochs, batch size 64, learning rate 5e-5, AdamW with weight decay 0.01, weighted cross-entropy, gradient clipping at 1.0, and CPU execution with 4 threads. The best checkpoint is selected by validation Macro-F1 (epoch 3).
| Model | Best validation Macro-F1 | Test accuracy | Test Macro-F1 |
|---|---|---|---|
| TF-IDF + Logistic Regression | 0.4343 | 0.5179 | 0.4387 |
| Fine-tuned RoBERTa Tiny | 0.3699 | 0.4306 | 0.3698 |
Scores are on this project's cleaned dataset, not directly comparable with results on the unfiltered official split. Macro-F1 is the unweighted average of the seven class-specific F1 scores.
The supplied probability calibration uses a fixed, stratified split of the validation data into 1,967 fitting and 1,968 diagnostic/threshold-selection examples. Validation data were already used for model selection, so calibration diagnostics are not an independent final estimate. Positive temperature scaling preserves the top-ranked class.
These are previously saved experiment results. Preparing this release did not rerun training or inference. File hashes were checked against calibration fingerprints, saved records were compared with the source package, and test accuracy/Macro-F1 were recomputed from the saved confusion matrices. This does not independently reproduce the training experiment.
Restore the models for MOMO
Download the complete models/ directory and place it directly inside the MOMO source project root, alongside app/ and scripts/. Preserve all relative paths.
Alternatively, install huggingface_hub and run the following, replacing PATH_TO_MOMO_SOURCE_PROJECT with your local MOMO source project directory:
from huggingface_hub import snapshot_download
snapshot_download(
repo_id="SASIOVERLXRD123/momo-emotion-models",
local_dir=r"PATH_TO_MOMO_SOURCE_PROJECT",
allow_patterns=["models/*"],
)
Use the setup and launch instructions supplied with the application source. The recorded dependency files are under provenance/; the Transformer lock file references the adjacent base lock file. Installing the Hugging Face download client alone does not install the application's inference dependencies.
This repository deliberately preserves MOMO's models/transformer/ subdirectory. Loading the repository root directly as a standard Transformers checkpoint is not the intended usage.
Optional local loading
After restoring the files and installing the corresponding model dependencies:
import joblib
from transformers import AutoTokenizer, AutoModelForSequenceClassification
baseline = joblib.load("models/baseline.joblib")
tokenizer = AutoTokenizer.from_pretrained(
"models/transformer", local_files_only=True
)
transformer = AutoModelForSequenceClassification.from_pretrained(
"models/transformer", local_files_only=True
).eval()
Load joblib artifacts only from a trusted source. For behavior matching MOMO, use its EmotionEngine, which applies the project's normalization, recorded token limit, temperature scaling, and uncertainty rules. Loading the models alone does not apply these application-level steps.
Intended use and limitations
Intended for course evaluation, reproducibility, and exploratory Chinese text emotion classification. Predictions are imperfect and depend on the training distribution. Sarcasm, mixed emotions, short inputs, neutral statements, and unfamiliar language may be misclassified. Class scores are not validated measures of emotional intensity or a person's psychological condition. The models are not medical or mental-health diagnostic tools.
The source package did not contain trained weights; this release copies the weights and companion files from the extracted MOMO 2.0.2 application package. No corpus files, diary entries, account credentials, installer, or bundled runtime are included.
Attribution and licensing information
- Training corpus: CLUEbenchmark/CLUEmotionAnalysis2020.
- Pretrained Transformer: UER RoBERTa Tiny Chinese.
The supplied data source manifest records that the upstream corpus does not clearly specify a separate dataset license. This release does not assign a new license to the corpus or upstream pretrained model. No project-specific license was supplied for these trained artifacts; no MIT or Apache license is asserted here.