tahamajs commited on
Commit
832fb63
·
verified ·
1 Parent(s): 1ec7ab6

Update Readme

Browse files
Files changed (1) hide show
  1. README.md +80 -41
README.md CHANGED
@@ -1,62 +1,101 @@
 
1
  ---
2
- base_model: meta-llama/Llama-3.2-3B-Instruct
3
- library_name: peft
4
- model_name: results
 
5
  tags:
6
- - base_model:adapter:meta-llama/Llama-3.2-3B-Instruct
7
- - lora
8
- - sft
9
- - transformers
10
- - trl
11
- licence: license
12
  pipeline_tag: text-generation
 
 
 
13
  ---
 
 
 
14
 
15
- # Model Card for results
16
 
17
- This model is a fine-tuned version of [meta-llama/Llama-3.2-3B-Instruct](https://huggingface.co/meta-llama/Llama-3.2-3B-Instruct).
18
- It has been trained using [TRL](https://github.com/huggingface/trl).
19
 
20
- ## Quick start
 
 
21
 
22
  ```python
23
- from transformers import pipeline
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
24
 
25
- question = "If you had a time machine, but could only go to the past or the future once and never return, which would you choose and why?"
26
- generator = pipeline("text-generation", model="tahamajs/results", device="cuda")
27
- output = generator([{"role": "user", "content": question}], max_new_tokens=128, return_full_text=False)[0]
28
- print(output["generated_text"])
 
 
 
 
 
 
 
 
 
29
  ```
30
 
31
- ## Training procedure
 
 
32
 
33
-
 
 
 
 
 
34
 
 
35
 
36
- This model was trained with SFT.
37
 
38
- ### Framework versions
 
 
 
 
 
 
 
 
 
 
39
 
40
- - PEFT 0.17.0
41
- - TRL: 0.21.0
42
- - Transformers: 4.55.0
43
- - Pytorch: 2.6.0+cu124
44
- - Datasets: 4.0.0
45
- - Tokenizers: 0.21.4
46
 
47
- ## Citations
48
 
 
 
 
49
 
 
50
 
51
- Cite TRL as:
52
-
53
- ```bibtex
54
- @misc{vonwerra2022trl,
55
- title = {{TRL: Transformer Reinforcement Learning}},
56
- author = {Leandro von Werra and Younes Belkada and Lewis Tunstall and Edward Beeching and Tristan Thrush and Nathan Lambert and Shengyi Huang and Kashif Rasul and Quentin Gallou{\'e}dec},
57
- year = 2020,
58
- journal = {GitHub repository},
59
- publisher = {GitHub},
60
- howpublished = {\url{https://github.com/huggingface/trl}}
61
- }
62
- ```
 
1
+
2
  ---
3
+ # Model Card metadata: https://huggingface.co/docs/hub/model-cards#model-card-metadata
4
+ license: apache-2.0
5
+ language:
6
+ - en
7
  tags:
8
+ - llm
9
+ - fine-tune
10
+ - qlora
11
+ - llama
12
+ - bitcoin
13
+ - finance
14
  pipeline_tag: text-generation
15
+ base_model: meta-llama/Llama-3.2-3B-Instruct
16
+ datasets:
17
+ - tahamajs/bitcoin-llm-finetuning-dataset
18
  ---
19
+ ```
20
+
21
+ ### 📋 Overview
22
 
23
+ This model, `llama-3.2-3b-instruct-bitcoin-analyst_best`, is a fine-tuned version of the **Llama-3.2-3B-Instruct** large language model. It has been specialized for the domain of **Bitcoin analysis and cryptocurrency**. The goal of this fine-tuning was to enhance the model's ability to provide detailed, accurate, and contextually relevant information about Bitcoin, blockchain technology, market trends, and related topics, acting as a virtual Bitcoin analyst.
24
 
25
+ The fine-tuning was performed using **QLoRA** on the `tahamajs/bitcoin-llm-finetuning-dataset` dataset.
 
26
 
27
+ ### 🚀 Usage
28
+
29
+ You can easily use this model with the `transformers` library. The fine-tuned weights are stored as a PEFT adapter.
30
 
31
  ```python
32
+ import torch
33
+ from peft import PeftModel
34
+ from transformers import AutoModelForCausalLM, AutoTokenizer
35
+
36
+ # Load the base model
37
+ base_model_id = "meta-llama/Llama-3.2-3B-Instruct"
38
+ tokenizer = AutoTokenizer.from_pretrained(base_model_id)
39
+ base_model = AutoModelForCausalLM.from_pretrained(
40
+ base_model_id,
41
+ device_map="auto",
42
+ torch_dtype=torch.bfloat16,
43
+ )
44
+
45
+ # Load the fine-tuned adapter
46
+ peft_model_id = "tahamajs/llama-3.2-3b-instruct-bitcoin-analyst_best"
47
+ model = PeftModel.from_pretrained(base_model, peft_model_id)
48
 
49
+ # Example inference
50
+ prompt = "What are the key differences between Bitcoin and Ethereum?"
51
+ messages = [
52
+ {"role": "user", "content": prompt}
53
+ ]
54
+ input_ids = tokenizer.apply_chat_template(
55
+ messages,
56
+ add_generation_prompt=True,
57
+ return_tensors="pt"
58
+ ).to(model.device)
59
+
60
+ outputs = model.generate(input_ids=input_ids, max_new_tokens=256)
61
+ print(tokenizer.decode(outputs[0], skip_special_tokens=True))
62
  ```
63
 
64
+ ### 💻 Training Details
65
+
66
+ This section provides an overview of the fine-tuning process.
67
 
68
+ * **Base Model:** `meta-llama/Llama-3.2-3B-Instruct`
69
+ * **Dataset:** `tahamajs/bitcoin-llm-finetuning-dataset`
70
+ * **Fine-Tuning Method:** QLoRA (Quantized Low-Rank Adaptation)
71
+ * **Training Framework:** `trl.SFTTrainer`
72
+ * **Hardware:** [E.g., NVIDIA RTX 4070, 16GB VRAM]
73
+ * **Software Stack:** PyTorch, Transformers, TRL, PEFT, BitsAndBytes
74
 
75
+ #### ⚙️ Hyperparameters
76
 
77
+ The following hyperparameters were used for fine-tuning:
78
 
79
+ | Hyperparameter | Value |
80
+ | :-------------------------- | :------------------------- |
81
+ | `num_train_epochs` | 1 |
82
+ | `per_device_train_batch_size` | 1 |
83
+ | `gradient_accumulation_steps` | 2 |
84
+ | `learning_rate` | 2e-4 |
85
+ | `optim` | `paged_adamw_32bit` |
86
+ | `bf16` | `True` |
87
+ | `max_grad_norm` | 0.3 |
88
+ | `r` (LoRA rank) | 16 |
89
+ | `lora_alpha` | 16 |
90
 
91
+ ### ⚠️ Limitations and Biases
 
 
 
 
 
92
 
93
+ As a model fine-tuned on a specific dataset, it may have the following limitations:
94
 
95
+ * **Domain Specificity:** The model's knowledge is primarily focused on Bitcoin and cryptocurrency. It may perform less effectively on general knowledge tasks.
96
+ * **Data Cutoff:** The model's knowledge is limited to the data it was trained on. It may not be aware of events, market changes, or new developments that occurred after the dataset's creation.
97
+ * **Potential Biases:** The model's responses may reflect biases present in the training data.
98
 
99
+ ### 📜 License
100
 
101
+ This model is licensed under the Apache 2.0 license, inherited from its base model.