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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
library_name: peft
|
3 |
+
base_model: meta-llama/Meta-Llama-3-8B
|
4 |
+
language:
|
5 |
+
- en
|
6 |
+
pipeline_tag: text-generation
|
7 |
+
widget:
|
8 |
+
- text: "How many helicopters can a human eat in one sitting?"
|
9 |
+
tags:
|
10 |
+
- Δ
|
11 |
+
- LoRA
|
12 |
+
---
|
13 |
+
|
14 |
+
<!--
|
15 |
+
# Model Card for Model ID
|
16 |
+
-->
|
17 |
+
|
18 |
+
## Model Details
|
19 |
+
|
20 |
+
$$
|
21 |
+
🗽_{ΔLoRA} = \Delta_{(🦙_W, 🗽_W)}
|
22 |
+
$$
|
23 |
+
|
24 |
+
$$
|
25 |
+
🦙_W + 🗽_{ΔLoRA} = 🗽_W \\
|
26 |
+
🦙_W - 🗽_{ΔLoRA} = 🦙_W
|
27 |
+
$$
|
28 |
+
|
29 |
+
|
30 |
+
<!--![image/png](https://cdn-uploads.huggingface.co/production/uploads/648b0f4fd8fe693f51de98d2/aerBANxBtCya732NdBiw0.png)-->
|
31 |
+
<!-- $$
|
32 |
+
W_{Llama3} + ΔLoRA_{Hermes} = W_{Hermes} \\
|
33 |
+
W_{Hermes} - ΔLoRA_{Hermes} = W_{Llama3}
|
34 |
+
$$
|
35 |
+
-->
|
36 |
+
<!--
|
37 |
+
$$ W_{mistral} + LoRA_{zephyr} = W_{zephyr} $$
|
38 |
+
```
|
39 |
+
typeof/zephyr-7b-beta-lora + mistralai/Mistral-7B-v0.1
|
40 |
+
= HuggingFaceH4/zephyr-7b-beta
|
41 |
+
````
|
42 |
+
|
43 |
+
### Model Description
|
44 |
+
|
45 |
+
- **Developed by:** [More Information Needed]
|
46 |
+
- **Funded by [optional]:** [More Information Needed]
|
47 |
+
- **Shared by [optional]:** [More Information Needed]
|
48 |
+
- **Model type:** [More Information Needed]
|
49 |
+
- **Language(s) (NLP):** [More Information Needed]
|
50 |
+
- **License:** [More Information Needed]
|
51 |
+
- **Finetuned from model [optional]:** [More Information Needed]
|
52 |
+
|
53 |
+
|
54 |
+
### Model Sources [optional]
|
55 |
+
|
56 |
+
- **Repository:** [More Information Needed]
|
57 |
+
- **Paper [optional]:** [More Information Needed]
|
58 |
+
- **Demo [optional]:** [More Information Needed]
|
59 |
+
|
60 |
+
## Uses
|
61 |
+
|
62 |
+
### Direct Use
|
63 |
+
|
64 |
+
[More Information Needed]
|
65 |
+
|
66 |
+
### Downstream Use [optional]
|
67 |
+
|
68 |
+
[More Information Needed]
|
69 |
+
|
70 |
+
### Out-of-Scope Use
|
71 |
+
|
72 |
+
[More Information Needed]
|
73 |
+
|
74 |
+
## Bias, Risks, and Limitations
|
75 |
+
|
76 |
+
[More Information Needed]
|
77 |
+
|
78 |
+
### Recommendations
|
79 |
+
|
80 |
+
Users (both direct and downstream) should be made aware of the risks, biases and limitations of the model. More information needed for further recommendations.
|
81 |
+
-->
|
82 |
+
|
83 |
+
## How to Get Started with the Model
|
84 |
+
|
85 |
+
Use the code below to get started with the model.
|
86 |
+
|
87 |
+
```python
|
88 |
+
# pip install transformers peft
|
89 |
+
|
90 |
+
import torch
|
91 |
+
from transformers import pipeline, AutoModelForCausalLM, AutoTokenizer
|
92 |
+
|
93 |
+
model_id = "meta-llama/Meta-Llama-3-8B"
|
94 |
+
peft_model_id = "typeof/Hermes-2-Theta-Llama-3-8B-delta-lora"
|
95 |
+
|
96 |
+
tokenizer = AutoTokenizer.from_pretrained(model_id)
|
97 |
+
model = AutoModelForCausalLM.from_pretrained(model_id)
|
98 |
+
model.load_adapter(peft_model_id)
|
99 |
+
|
100 |
+
pipe = pipeline("text-generation", model=model, tokenizer=tokenizer)
|
101 |
+
|
102 |
+
system_prompt = """You are a function calling AI model. You are provided with function signatures within <tools></tools> XML tags. You may call one or more functions to assist with the user query. Don't make assumptions about what values to plug into functions.
|
103 |
+
Here are the available tools: <tools> {"type": "function", "function": {"name": "get_stock_fundamentals", "description": "get_stock_fundamentals(symbol: str) -> dict - Get fundamental data for a given stock symbol using yfinance API.\\n\\n Args:\\n symbol (str): The stock symbol.\\n\\n Returns:\\n dict: A dictionary containing fundamental data.\\n Keys:\\n - \'symbol\': The stock symbol.\\n - \'company_name\': The long name of the company.\\n - \'sector\': The sector to which the company belongs.\\n - \'industry\': The industry to which the company belongs.\\n - \'market_cap\': The market capitalization of the company.\\n - \'pe_ratio\': The forward price-to-earnings ratio.\\n - \'pb_ratio\': The price-to-book ratio.\\n - \'dividend_yield\': The dividend yield.\\n - \'eps\': The trailing earnings per share.\\n - \'beta\': The beta value of the stock.\\n - \'52_week_high\': The 52-week high price of the stock.\\n - \'52_week_low\': The 52-week low price of the stock.", "parameters": {"type": "object", "properties": {"symbol": {"type": "string"}}, "required": ["symbol"]}}} </tools> Use the following pydantic model json schema for each tool call you will make: {"properties": {"arguments": {"title": "Arguments", "type": "object"}, "name": {"title": "Name", "type": "string"}}, "required": ["arguments", "name"], "title": "FunctionCall", "type": "object"} For each function call return a json object with function name and arguments within <tool_call></tool_call> XML tags as follows:
|
104 |
+
<tool_call>
|
105 |
+
{"arguments": <args-dict>, "name": <function-name>}
|
106 |
+
</tool_call>"""
|
107 |
+
|
108 |
+
messages = [
|
109 |
+
{"role": "system", "content": system_prompt},
|
110 |
+
{"role": "user", "content": "Fetch the stock fundamentals data for Tesla (TSLA)"},
|
111 |
+
]
|
112 |
+
prompt = pipe.tokenizer.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)
|
113 |
+
outputs = pipe(prompt, max_new_tokens=256, do_sample=True, temperature=0.7, top_k=50, top_p=0.95)
|
114 |
+
print(outputs[0]["generated_text"])
|
115 |
+
```
|
116 |
+
```
|
117 |
+
<|im_start|>assistant
|
118 |
+
<tool_call>
|
119 |
+
{"arguments": {"symbol": "TSLA"}, "name": "get_stock_fundamentals"}
|
120 |
+
</tool_call><|im_end|>
|
121 |
+
```
|
122 |
+
... call tool and pass back prompt like so...
|
123 |
+
```
|
124 |
+
<|im_start|>tool
|
125 |
+
<tool_response>
|
126 |
+
{"name": "get_stock_fundamentals", "content": {'symbol': 'TSLA', 'company_name': 'Tesla, Inc.', 'sector': 'Consumer Cyclical', 'industry': 'Auto Manufacturers', 'market_cap': 611384164352, 'pe_ratio': 49.604652, 'pb_ratio': 9.762013, 'dividend_yield': None, 'eps': 4.3, 'beta': 2.427, '52_week_high': 299.29, '52_week_low': 152.37}}
|
127 |
+
</tool_response>
|
128 |
+
<|im_end|>
|
129 |
+
```
|
130 |
+
```
|
131 |
+
<|im_start|>assistant
|
132 |
+
The stock fundamentals data for Tesla (TSLA) are as follows:
|
133 |
+
- **Symbol**: TSLA
|
134 |
+
- **Company Name**: Tesla, Inc.
|
135 |
+
- **Sector**: Consumer Cyclical
|
136 |
+
- **Industry**: Auto Manufacturers
|
137 |
+
- **Market Capitalization**: $566,160,130,480
|
138 |
+
- **Forward Price-to-Earnings Ratio (PE Ratio)**: 42.73
|
139 |
+
- **Price-to-Book Ratio (PB Ratio)**: 9.04
|
140 |
+
- **Dividend Yield**: N/A
|
141 |
+
- **Trailing Earnings Per Share (EPS)**: $4.3
|
142 |
+
- **Beta Value of the Stock**: 2.42
|
143 |
+
- **52-Week High Price of the Stock**: $299.29
|
144 |
+
- **52-Week Low Price of the Stock**: $152.37
|
145 |
+
This information provides a snapshot of Tesla's financial position and performance based on the fundamental data obtained from the yfinance API. It shows that Tesla has a substantial market capitalization and a relatively high P/E and P/B ratio compared to other stocks in its industry. The company does not pay a dividend at the moment, which is reflected by a 'Dividend Yield' of 'None'. The Beta value indicates that Tesla's stock has a moderate level of volatility relative to the market. The 52-week high and low prices give an idea of the stock's range over the past year. This data can be useful when assessing investment opportunities and making investment decisions.<|im_end|>
|
146 |
+
```
|
147 |
+
|
148 |
+
<!--
|
149 |
+
|
150 |
+
## Training Details
|
151 |
+
|
152 |
+
### Training Data
|
153 |
+
|
154 |
+
|
155 |
+
[More Information Needed]
|
156 |
+
|
157 |
+
### Training Procedure
|
158 |
+
|
159 |
+
|
160 |
+
#### Preprocessing [optional]
|
161 |
+
|
162 |
+
[More Information Needed]
|
163 |
+
|
164 |
+
|
165 |
+
#### Training Hyperparameters
|
166 |
+
|
167 |
+
#### Speeds, Sizes, Times [optional]
|
168 |
+
|
169 |
+
|
170 |
+
[More Information Needed]
|
171 |
+
|
172 |
+
## Evaluation
|
173 |
+
|
174 |
+
|
175 |
+
### Testing Data, Factors & Metrics
|
176 |
+
|
177 |
+
#### Testing Data
|
178 |
+
|
179 |
+
|
180 |
+
[More Information Needed]
|
181 |
+
|
182 |
+
#### Factors
|
183 |
+
|
184 |
+
|
185 |
+
[More Information Needed]
|
186 |
+
|
187 |
+
#### Metrics
|
188 |
+
|
189 |
+
|
190 |
+
[More Information Needed]
|
191 |
+
|
192 |
+
### Results
|
193 |
+
|
194 |
+
[More Information Needed]
|
195 |
+
|
196 |
+
#### Summary
|
197 |
+
|
198 |
+
## Model Examination [optional]
|
199 |
+
|
200 |
+
[More Information Needed]
|
201 |
+
|
202 |
+
## Technical Specifications [optional]
|
203 |
+
|
204 |
+
### Model Architecture and Objective
|
205 |
+
|
206 |
+
[More Information Needed]
|
207 |
+
|
208 |
+
### Compute Infrastructure
|
209 |
+
|
210 |
+
[More Information Needed]
|
211 |
+
|
212 |
+
#### Hardware
|
213 |
+
|
214 |
+
[More Information Needed]
|
215 |
+
|
216 |
+
#### Software
|
217 |
+
|
218 |
+
[More Information Needed]
|
219 |
+
|
220 |
+
## Citation [optional]
|
221 |
+
|
222 |
+
**BibTeX:**
|
223 |
+
|
224 |
+
[More Information Needed]
|
225 |
+
|
226 |
+
**APA:**
|
227 |
+
|
228 |
+
[More Information Needed]
|
229 |
+
|
230 |
+
## Glossary [optional]
|
231 |
+
|
232 |
+
[More Information Needed]
|
233 |
+
|
234 |
+
## More Information
|
235 |
+
|
236 |
+
[More Information Needed]
|
237 |
+
|
238 |
+
## Model Card Authors [optional]
|
239 |
+
|
240 |
+
[More Information Needed]
|
241 |
+
|
242 |
+
## Model Card Contact
|
243 |
+
|
244 |
+
[More Information Needed]
|
245 |
+
|
246 |
+
## Training procedure
|
247 |
+
|
248 |
+
The following `bitsandbytes` quantization config was used during training:
|
249 |
+
- quant_method: bitsandbytes
|
250 |
+
- load_in_4bit: True
|
251 |
+
- bnb_4bit_quant_type: nf4
|
252 |
+
- bnb_4bit_use_double_quant: True
|
253 |
+
|
254 |
+
### Framework versions
|
255 |
+
|
256 |
+
- PEFT 0.6.3.dev0
|
257 |
+
|
258 |
+
-->
|
259 |
+
#### Summary
|
260 |
+
|
261 |
+
[LoRA](https://arxiv.org/abs/2305.14314)
|
262 |
+
[QLoRA](https://arxiv.org/abs/2106.09685)
|