How se00n00/sequence_classification_from_scratch works
This repository combines a from-scratch Transformer sequence-classification project with a deployed binary review-sentiment API and Angular client. The main user flow is entering review text or selecting a spreadsheet column, sending reviews to the API, and displaying positive/negative scores and a chart. Separately, the documented model-development workflow trains for tweet emotion classification and fine-tunes for Amazon review sentiment. API and frontend wiring is supported by sampled source; training and fine-tuning capabilities are documented in the README, but their notebook internals were not inspected.
Main entry points: home.component.ts Home analysis · get_sentiment.py Prediction API · trainer.ipynb Tweet training · Basic_Sequence_classification.py Sequence classifier
Components 25
Web client
- Home analysis
Sentiment_Analyzer/src/app/home/home.component.ts - Input mode
Sentiment_Analyzer/src/app/input-type.service.ts - App shell
Sentiment_Analyzer/src/app/app.ts - Page routes
Sentiment_Analyzer/src/app/app.routes.ts - Not-found page
Sentiment_Analyzer/src/app/wild-page/wild-page.component.ts - Spreadsheet parsing
Sentiment_Analyzer/src/app/home/home.component.ts - Scores and chart
Sentiment_Analyzer/src/app/home/home.component.ts
Sentiment API
- Prediction API
API/get_sentiment.py - Review request
API/get_sentiment.py - Text tokenizer
API/get_sentiment.py - ONNX inference
API/get_sentiment.py - ONNX model
API/sequence_classifier.onnx
Classifier model
- Sequence classifier
Architectures/Basic_Sequence_classification.py - Token embeddings
layers/embedding.py - Transformer encoder
layers/encoderlayer.py - Self-attention
layers/attention.py - Feed-forward
layers/feedforward.py
Model development
- Tweet training
trainer.ipynb - Review fine-tuning
fine_tune.ipynb - Tweet emotion data
- Amazon review data
- PyTorch checkpoint
best_model.pt - Experiment tracking
wandb
Other components
- User
- API consumer
Connections 27
- User → Home analysis: enters text
- User → Spreadsheet parsing: selects file
- Home analysis → Input mode: toggles mode
- Home analysis → Spreadsheet parsing: reads workbook
- Home analysis → Prediction API: posts reviews
- Prediction API → Review request: validates input
- Review request → Text tokenizer: tokenizes text
- Review request → ONNX inference: runs inference
- ONNX inference → ONNX model: loads model
- Prediction API → Home analysis: returns scores
- Home analysis → Scores and chart: updates results
- App shell → Prediction API: checks health
- App shell → Page routes: hosts routes
- Page routes → Home analysis: routes home
- Page routes → Not-found page: routes fallback
- Sequence classifier → Token embeddings: embeds tokens
- Sequence classifier → Transformer encoder: encodes sequence
- Transformer encoder → Self-attention: applies attention
- Transformer encoder → Feed-forward: transforms features
- Tweet training → Tweet emotion data: trains on
- Tweet training → Sequence classifier: trains model
- Tweet training → PyTorch checkpoint: saves weights
- Tweet training → Experiment tracking: logs runs
- Review fine-tuning → Amazon review data: fine-tunes on
- Review fine-tuning → Sequence classifier: fine-tunes model
- Review fine-tuning → PyTorch checkpoint: saves weights
- API consumer → Prediction API: calls endpoints