ohanvi's picture
Update model card
08bf2f8 verified
---
language: en
license: apache-2.0
tags:
- text-classification
- finance
- trading
- distilbert
datasets:
- custom
metrics:
- accuracy
- f1
---
# πŸ“Š Ohanvi Fix-Trade Signal Classifier
A tiny DistilBERT model fine-tuned to classify market news headlines and analysis snippets
into three trade signals: **BUY**, **SELL**, or **HOLD**.
## Model Description
- **Base model**: `distilbert-base-uncased` (67M parameters)
- **Task**: 3-class text classification (trade signal detection)
- **Labels**: `BUY (0)` | `SELL (1)` | `HOLD (2)`
- **Training data**: 150 hand-crafted trade signal examples (50 per class)
- **Training time**: ~20-30 seconds on Apple Silicon (MPS)
## Usage
```python
from transformers import pipeline
pipe = pipeline("text-classification", model="ohanvi/ohanvi-fix-trade-model", top_k=None)
result = pipe("Strong earnings beat, revenue up 25%, guidance raised.")
print(result)
# [{'label': 'BUY', 'score': 0.92}, {'label': 'HOLD', 'score': 0.05}, {'label': 'SELL', 'score': 0.03}]
```
## Live Demo
Try it in your browser: [Gradio Space](https://huggingface.co/spaces/ohanvi/ohanvi-fix-trade-model-demo)
## Training Details
| Hyperparameter | Value |
|---|---|
| Base model | distilbert-base-uncased |
| Epochs | 5 |
| Batch size | 8 |
| Learning rate | 3e-4 |
| Max sequence length | 64 |
| Training samples | 120 |
| Eval samples | 30 |
## Limitations
⚠️ This is a **demonstration model** trained on a very small dataset.
Do **not** use it for real trading or financial decisions.
## Project Structure
```
ohanvi-fix-trade-model/
β”œβ”€β”€ train.py # Fine-tune the model (runs in ~30 sec)
β”œβ”€β”€ inference.py # Run predictions locally
β”œβ”€β”€ app.py # Gradio demo (deployed to HF Spaces)
β”œβ”€β”€ push_to_hub.py # Upload model + Space to Hugging Face
β”œβ”€β”€ config.py # Central config (loads from .env)
β”œβ”€β”€ requirements.txt # Python dependencies
β”œβ”€β”€ .env.example # Template for secrets
└── README.md # This file
```
## Quick Start
```bash
# 1. Install dependencies
pip install -r requirements.txt
# 2. Copy and fill in your credentials
cp .env.example .env
# 3. Train the model (~30 sec)
python train.py
# 4. Test locally
python inference.py --demo
# 5. Push to Hugging Face Hub
python push_to_hub.py
```