Upload README.md with huggingface_hub
Browse files
README.md
CHANGED
|
@@ -1,3 +1,64 @@
|
|
| 1 |
-
---
|
| 2 |
-
|
| 3 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
language: en
|
| 3 |
+
tags:
|
| 4 |
+
- finance
|
| 5 |
+
- language-model
|
| 6 |
+
- transformer
|
| 7 |
+
- financial-advisor
|
| 8 |
+
license: mit
|
| 9 |
+
---
|
| 10 |
+
|
| 11 |
+
# Financial Language Model
|
| 12 |
+
|
| 13 |
+
Custom-trained Transformer for financial text generation.
|
| 14 |
+
|
| 15 |
+
## Model Details
|
| 16 |
+
|
| 17 |
+
- **Architecture:** 6-layer Transformer
|
| 18 |
+
- **Parameters:** ~12M
|
| 19 |
+
- **Vocabulary:** 20,000 words
|
| 20 |
+
- **Training Data:** 1 GB balanced financial corpus (168M words)
|
| 21 |
+
- **Validation Loss:** 4.01
|
| 22 |
+
- **Modern Content:** 87%
|
| 23 |
+
|
| 24 |
+
## Training Data Composition
|
| 25 |
+
|
| 26 |
+
- Financial news (2015-2024): 750 MB (87%)
|
| 27 |
+
- Classical economics: 35 MB (4%)
|
| 28 |
+
- Wikipedia/Academic: 15 MB (2%)
|
| 29 |
+
|
| 30 |
+
## Usage
|
| 31 |
+
```python
|
| 32 |
+
from huggingface_hub import hf_hub_download
|
| 33 |
+
import torch
|
| 34 |
+
import pickle
|
| 35 |
+
|
| 36 |
+
# Download files
|
| 37 |
+
model_path = hf_hub_download(repo_id="Nikilesh9/financial-language-model", filename="transformer_1gb_balanced_best.pth")
|
| 38 |
+
dataset_path = hf_hub_download(repo_id="Nikilesh9/financial-language-model", filename="mega_word_dataset.pkl")
|
| 39 |
+
|
| 40 |
+
# Load dataset
|
| 41 |
+
with open(dataset_path, 'rb') as f:
|
| 42 |
+
dataset = pickle.load(f)
|
| 43 |
+
|
| 44 |
+
# Load model
|
| 45 |
+
checkpoint = torch.load(model_path, map_location='cpu')
|
| 46 |
+
# ... create and load model ...
|
| 47 |
+
```
|
| 48 |
+
|
| 49 |
+
## Files
|
| 50 |
+
|
| 51 |
+
- `transformer_1gb_balanced_best.pth` - Model checkpoint (50 MB)
|
| 52 |
+
- `mega_word_dataset.pkl` - Preprocessed dataset (2.2 GB)
|
| 53 |
+
|
| 54 |
+
## Training Details
|
| 55 |
+
|
| 56 |
+
- Hardware: Google Colab TPU v2
|
| 57 |
+
- Training Time: 7.5 hours
|
| 58 |
+
- Epochs: 30
|
| 59 |
+
- Batch Size: 512
|
| 60 |
+
- Learning Rate: 0.0003 (adaptive)
|
| 61 |
+
|
| 62 |
+
## Project
|
| 63 |
+
|
| 64 |
+
Full project: https://github.com/Nikilesh9/language-model-evolution
|