YAML Metadata Warning:empty or missing yaml metadata in repo card

Check out the documentation for more information.

IMDB Sentiment Neural Network with GitHub CI/CD

This project trains a neural network sentiment classifier using TF-IDF features and a PyTorch feedforward neural network.

Project Structure

session3-practice-huggingface-cicd/
β”œβ”€β”€ data/
β”‚   β”œβ”€β”€ README.md
β”‚   └── imdb_balanced_10k.csv
β”œβ”€β”€ model/
β”‚   └── .gitkeep
β”œβ”€β”€ .github/
β”‚   └── workflows/
β”‚       └── train-and-upload.yml
β”œβ”€β”€ train.py
β”œβ”€β”€ predict.py
β”œβ”€β”€ upload_to_hf.py
β”œβ”€β”€ requirements.txt
β”œβ”€β”€ README.md
└── .gitignore

Dataset

The committed training dataset is:

  • data/imdb_balanced_10k.csv

It contains 10,000 balanced IMDB movie reviews sampled from the Stanford Large Movie Review Dataset:

https://ai.stanford.edu/~amaas/data/sentiment/

The training script also supports this fallback file name:

  • data/imdb_top_500.csv

The training script automatically detects common text columns (review, text, sentence, comment) and label columns (sentiment, label, target).

Model

  • TF-IDF vectorizer
  • Feedforward neural network
  • Binary sentiment classification

The model uses TF-IDF features as input to a PyTorch multilayer perceptron for positive vs. negative sentiment prediction.

Training

Run training locally with:

python train.py

Training saves these artifacts in model/:

  • model.pt
  • vectorizer.pkl
  • config.json
  • metrics.json

Prediction

Run inference from the command line with:

python predict.py "This movie is amazing!"

CI/CD

Every push to main or master triggers GitHub Actions to train the model and upload artifacts to Hugging Face Hub.

The workflow:

  1. Installs dependencies
  2. Runs python train.py
  3. Saves model artifacts
  4. Uploads artifacts to Hugging Face using HF_TOKEN

Hugging Face Hub

https://huggingface.co/fyangmie/session3-practice-huggingface-cicd

Final Submission

Submit the following:

Downloads last month
3
Inference Providers NEW
This model isn't deployed by any Inference Provider. πŸ™‹ Ask for provider support