Update README.md
Browse files
README.md
CHANGED
|
@@ -6,17 +6,95 @@ tags:
|
|
| 6 |
- unsloth
|
| 7 |
- mistral
|
| 8 |
- trl
|
|
|
|
|
|
|
|
|
|
| 9 |
license: apache-2.0
|
| 10 |
language:
|
| 11 |
- en
|
| 12 |
---
|
| 13 |
|
| 14 |
-
#
|
| 15 |
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
- **Finetuned from model :** unsloth/mistral-7b-instruct-v0.3-bnb-4bit
|
| 19 |
|
| 20 |
-
|
| 21 |
|
| 22 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 6 |
- unsloth
|
| 7 |
- mistral
|
| 8 |
- trl
|
| 9 |
+
- finance
|
| 10 |
+
- crypto
|
| 11 |
+
- lora
|
| 12 |
license: apache-2.0
|
| 13 |
language:
|
| 14 |
- en
|
| 15 |
---
|
| 16 |
|
| 17 |
+
# 🪙 CoinReason-7B (Proof of Concept)
|
| 18 |
|
| 19 |
+
**⚠️ Prototype Warning:**
|
| 20 |
+
This adapter was trained on a synthetic "Gold Standard" prototype dataset to demonstrate an **End-to-End MLOps Pipeline**. It is intended to showcase the *fine-tuning architecture* (Unsloth, QLoRA, Hugging Face integration) rather than to provide financial advice. It may overfit to specific training examples.
|
|
|
|
| 21 |
|
| 22 |
+
## Model Overview
|
| 23 |
|
| 24 |
+
**CoinReason-7B** is a specialized Low-Rank Adapter (LoRA) for the Mistral-7B Large Language Model. It is designed to analyze cryptocurrency social media text and output structured financial reasoning.
|
| 25 |
+
|
| 26 |
+
Unlike standard sentiment models that output simple "Positive/Negative" labels, CoinReason attempts to generate:
|
| 27 |
+
|
| 28 |
+
1. **Sentiment:** (Bullish/Bearish)
|
| 29 |
+
2. **Explanation:** The logical reasoning behind the sentiment.
|
| 30 |
+
3. **Market Implication:** A short-term predictive outlook for price action.
|
| 31 |
+
|
| 32 |
+
## Technical Specifications
|
| 33 |
+
|
| 34 |
+
* **Base Model:** [unsloth/mistral-7b-instruct-v0.3-bnb-4bit](https://huggingface.co/unsloth/mistral-7b-instruct-v0.3-bnb-4bit)
|
| 35 |
+
* **Fine-Tuning Technique:** QLoRA (Quantized Low-Rank Adaptation)
|
| 36 |
+
* **Quantization:** 4-bit (NF4) for efficient inference on edge hardware (T4 GPUs)
|
| 37 |
+
* **Framework:** [Unsloth](https://github.com/unslothai/unsloth) (2x faster training) + Hugging Face Transformers
|
| 38 |
+
|
| 39 |
+
## How to Use
|
| 40 |
+
|
| 41 |
+
You can load this model using the `unsloth` library for fast inference.
|
| 42 |
+
```python
|
| 43 |
+
from unsloth import FastLanguageModel
|
| 44 |
+
|
| 45 |
+
# 1. Load the model and adapters
|
| 46 |
+
model, tokenizer = FastLanguageModel.from_pretrained(
|
| 47 |
+
"sarfras/coinreason-7b-lora",
|
| 48 |
+
max_seq_length = 2048,
|
| 49 |
+
dtype = None,
|
| 50 |
+
load_in_4bit = True,
|
| 51 |
+
)
|
| 52 |
+
FastLanguageModel.for_inference(model)
|
| 53 |
+
|
| 54 |
+
# 2. Define the prompt format
|
| 55 |
+
tweet = "Bitcoin volume is dying and we are stuck at resistance. I think we go down."
|
| 56 |
+
|
| 57 |
+
prompt = f"""<s>[INST] Analyze the following Bitcoin market text for sentiment and short-horizon implication.
|
| 58 |
+
|
| 59 |
+
Text: {tweet}
|
| 60 |
+
|
| 61 |
+
Provide output in this exact format:
|
| 62 |
+
Sentiment: [Bullish/Bearish]
|
| 63 |
+
Explanation: [reasoning]
|
| 64 |
+
Market Implication: [brief BTC price direction outlook][/INST]"""
|
| 65 |
+
|
| 66 |
+
# 3. Generate
|
| 67 |
+
inputs = tokenizer([prompt], return_tensors = "pt").to("cuda")
|
| 68 |
+
outputs = model.generate(**inputs, max_new_tokens = 128, use_cache = True)
|
| 69 |
+
print(tokenizer.batch_decode(outputs, skip_special_tokens=True)[0])
|
| 70 |
+
```
|
| 71 |
+
|
| 72 |
+
## Training Details
|
| 73 |
+
|
| 74 |
+
* **Dataset:** Synthetic Financial Reasoning Dataset (Prototype v1)
|
| 75 |
+
* **Objective:** Instruction Fine-Tuning (SFT)
|
| 76 |
+
* **LoRA Rank (r):** 16
|
| 77 |
+
* **LoRA Alpha:** 16
|
| 78 |
+
* **Optimizer:** AdamW 8-bit
|
| 79 |
+
|
| 80 |
+
## Example Output
|
| 81 |
+
|
| 82 |
+
**Input:**
|
| 83 |
+
*"Whales are dumping BTC heavily on Binance, price dropping fast below support."*
|
| 84 |
+
|
| 85 |
+
**Model Prediction:**
|
| 86 |
+
> **Sentiment:** Bearish
|
| 87 |
+
>
|
| 88 |
+
> **Explanation:** Large inflows of BTC to exchanges (Whale movement) typically signal an intent to sell, increasing sell-side pressure.
|
| 89 |
+
>
|
| 90 |
+
> **Market Implication:** Price likely to test the $60k support; a breakdown could trigger a flush to lower levels.
|
| 91 |
+
|
| 92 |
+
---
|
| 93 |
+
|
| 94 |
+
## Disclaimer
|
| 95 |
+
|
| 96 |
+
This model is a **proof of concept** and should **NOT** be used for actual financial decision-making. Always conduct your own research and consult with qualified financial advisors before making investment decisions.
|
| 97 |
+
|
| 98 |
+
---
|
| 99 |
+
|
| 100 |
+
*Created by Sarfras as part of an End-to-End LLM Engineering Portfolio.*
|