tahamajs commited on
Commit
b471a20
·
verified ·
1 Parent(s): d7a2854

Create Readme

Browse files
Files changed (1) hide show
  1. README.md +111 -0
README.md ADDED
@@ -0,0 +1,111 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: llama3
3
+ language:
4
+ - en
5
+ library_name: transformers
6
+ tags:
7
+ - llama-3
8
+ - llama-3.2
9
+ - bitcoin
10
+ - finance
11
+ - instruction-following
12
+ - fine-tuning
13
+ - merged
14
+ base_model: meta-llama/Llama-3.2-3B-Instruct
15
+ datasets:
16
+ - tahamajs/bitcoin-llm-finetuning-dataset
17
+ ---
18
+
19
+ # Llama-3.2-3B Instruct - Advanced Bitcoin Analyst
20
+
21
+ This repository contains a highly specialized version of `meta-llama/Llama-3.2-3B-Instruct`, expertly fine-tuned to function as a **Bitcoin and cryptocurrency market analyst**. This model is the result of a "continuation training" process, where an already specialized model was further refined on a targeted dataset.
22
+
23
+ This model excels at understanding and responding to complex instructions related to blockchain technology, financial markets, and technical/fundamental analysis of cryptocurrencies.
24
+
25
+ ## 🧠 Training Procedure
26
+
27
+ The final model was created through a sophisticated multi-stage process designed to build upon and deepen existing knowledge.
28
+
29
+ ### Stage 1: Initial Specialization (Adapter Merge)
30
+ The process began with the base `meta-llama/Llama-3.2-3B-Instruct` model. This base was then merged with a previously fine-tuned, high-performing LoRA adapter to create an initial specialized model.
31
+ - **Initial Adapter:** `tahamajs/llama-3.2-3b-instruct-bitcoin-analyst-perfect`
32
+
33
+ ### Stage 2: Continued Fine-Tuning (New LoRA)
34
+ A new LoRA adapter was then trained on top of the already-merged model from Stage 1. This continuation training allowed the model to further refine its expertise using a specific dataset, improving its nuance and instruction-following on relevant topics.
35
+ - **Dataset:** `tahamajs/bitcoin-llm-finetuning-dataset`
36
+
37
+ ### Stage 3: Final Merge
38
+ The final step was to merge the newly trained adapter from Stage 2 into the model. This repository hosts this **fully merged, standalone model**, which contains the cumulative knowledge of the base model, the first specialized adapter, and the second round of continuation training.
39
+
40
+ ---
41
+
42
+ ## 📊 Training Details
43
+
44
+ ### Hyperparameters
45
+ The second stage of LoRA fine-tuning was performed with the following key hyperparameters:
46
+
47
+ | Parameter | Value |
48
+ | :--- | :--- |
49
+ | `learning_rate` | 1e-4 |
50
+ | `num_train_epochs` | 1 |
51
+ | `lora_r` | 16 |
52
+ | `lora_alpha` | 32 |
53
+ | `optimizer` | paged_adamw_32bit |
54
+ | `precision` | bf16 |
55
+
56
+ ### Training Loss
57
+ The training loss shows a clear downward trend, indicating that the model was successfully learning from the dataset. The process started with a loss of ~2.18 and converged to a loss in the ~1.4-1.6 range, demonstrating effective knowledge acquisition. The fluctuations are normal during training and reflect the varying difficulty of the data in each batch.
58
+
59
+ ![Training Loss](https://googleusercontent.com/file_content/0)
60
+
61
+ ---
62
+
63
+ ## 🚀 How to Use
64
+
65
+ This is a fully merged model and can be used directly with the `transformers` library. For best results, use the Llama 3 chat template to format your prompts.
66
+
67
+ ```python
68
+ import torch
69
+ from transformers import AutoModelForCausalLM, AutoTokenizer
70
+
71
+ # Use the ID of the repository where this model is hosted
72
+ model_id = "tahamajs/llama-3.2-3b-instruct-bitcoin-analyst-perfect_v2"
73
+
74
+ # Load the tokenizer and model
75
+ tokenizer = AutoTokenizer.from_pretrained(model_id)
76
+ model = AutoModelForCausalLM.from_pretrained(
77
+ model_id,
78
+ torch_dtype=torch.bfloat16,
79
+ device_map="auto",
80
+ )
81
+
82
+ # Use the Llama 3 chat template for instruction-following
83
+ messages = [
84
+ {"role": "user", "content": "Analyze the current sentiment around Bitcoin based on the concept of the Fear & Greed Index. What does a high 'Greed' value typically imply for the short-term market?"},
85
+ ]
86
+
87
+ # Apply the chat template and tokenize
88
+ input_ids = tokenizer.apply_chat_template(
89
+ messages,
90
+ add_generation_prompt=True,
91
+ return_tensors="pt"
92
+ ).to(model.device)
93
+
94
+ # Generate a response
95
+ outputs = model.generate(
96
+ input_ids,
97
+ max_new_tokens=512,
98
+ do_sample=True,
99
+ temperature=0.6,
100
+ top_p=0.9,
101
+ )
102
+
103
+ # Decode and print the output
104
+ response = outputs[0][input_ids.shape[-1]:]
105
+ print(tokenizer.decode(response, skip_special_tokens=True))
106
+ ````
107
+
108
+ ## Disclaimer
109
+
110
+ This model is provided for informational and educational purposes only. It is **not financial advice**. The outputs are generated by an AI and may contain errors or inaccuracies. Always perform your own due diligence and consult with a qualified financial professional before making any investment decisions.
111
+