Downloads · 30 days
3
8% of all-time downloads
fyangmie/session3-practice-huggingface-cicd
session3-practice-huggingface-cicd is a machine learning model from fyangmie. Use it for the machine learning task on the model card, and read the license before you ship it in a product.
This project trains a neural network sentiment classifier using TF-IDF features and a PyTorch feedforward neural network.
Downloads · 30 days
3
8% of all-time downloads
All-time downloads
37
Public
Repo size
2.7 MB
Likes
0
Public
Click a slice to open those files.
.pt2.6 MB · 93%
From the Hugging Face model README
This project trains a neural network sentiment classifier using TF-IDF features and a PyTorch feedforward neural network.
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
The committed training dataset is:
data/imdb_balanced_10k.csvIt 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.csvThe training script automatically detects common text columns (review, text, sentence, comment) and label columns (sentiment, label, target).
The model uses TF-IDF features as input to a PyTorch multilayer perceptron for positive vs. negative sentiment prediction.
Run training locally with:
python train.py
Training saves these artifacts in model/:
model.ptvectorizer.pklconfig.jsonmetrics.jsonRun inference from the command line with:
python predict.py "This movie is amazing!"
Every push to main or master triggers GitHub Actions to train the model and upload artifacts to Hugging Face Hub.
The workflow:
python train.pyHF_TOKENhttps://huggingface.co/fyangmie/session3-practice-huggingface-cicd
Submit the following: