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.ptvectorizer.pklconfig.jsonmetrics.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:
- Installs dependencies
- Runs
python train.py - Saves model artifacts
- Uploads artifacts to Hugging Face using
HF_TOKEN
Hugging Face Hub
https://huggingface.co/fyangmie/session3-practice-huggingface-cicd
Final Submission
Submit the following:
- GitHub Repository: https://github.com/fyangmie/session3-practice-huggingface-cicd
- Hugging Face Repository: https://huggingface.co/fyangmie/session3-practice-huggingface-cicd
- Downloads last month
- 3