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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
library_name: peft
|
3 |
+
base_model: mistralai/Mistral-7B-v0.1
|
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 |
+
🦙_W + 🗽_{ΔLoRA} = 🗽_W \\
|
22 |
+
🦙_W - 🗽_{ΔLoRA} = 🦙_W
|
23 |
+
$$
|
24 |
+
|
25 |
+
|
26 |
+
<!--![image/png](https://cdn-uploads.huggingface.co/production/uploads/648b0f4fd8fe693f51de98d2/aerBANxBtCya732NdBiw0.png)-->
|
27 |
+
<!-- $$
|
28 |
+
W_{Llama3} + ΔLoRA_{Hermes} = W_{Hermes} \\
|
29 |
+
W_{Hermes} - ΔLoRA_{Hermes} = W_{Llama3}
|
30 |
+
$$
|
31 |
+
-->
|
32 |
+
<!--
|
33 |
+
$$ W_{mistral} + LoRA_{zephyr} = W_{zephyr} $$
|
34 |
+
```
|
35 |
+
typeof/zephyr-7b-beta-lora + mistralai/Mistral-7B-v0.1
|
36 |
+
= HuggingFaceH4/zephyr-7b-beta
|
37 |
+
````
|
38 |
+
|
39 |
+
### Model Description
|
40 |
+
|
41 |
+
- **Developed by:** [More Information Needed]
|
42 |
+
- **Funded by [optional]:** [More Information Needed]
|
43 |
+
- **Shared by [optional]:** [More Information Needed]
|
44 |
+
- **Model type:** [More Information Needed]
|
45 |
+
- **Language(s) (NLP):** [More Information Needed]
|
46 |
+
- **License:** [More Information Needed]
|
47 |
+
- **Finetuned from model [optional]:** [More Information Needed]
|
48 |
+
|
49 |
+
|
50 |
+
### Model Sources [optional]
|
51 |
+
|
52 |
+
- **Repository:** [More Information Needed]
|
53 |
+
- **Paper [optional]:** [More Information Needed]
|
54 |
+
- **Demo [optional]:** [More Information Needed]
|
55 |
+
|
56 |
+
## Uses
|
57 |
+
|
58 |
+
### Direct Use
|
59 |
+
|
60 |
+
[More Information Needed]
|
61 |
+
|
62 |
+
### Downstream Use [optional]
|
63 |
+
|
64 |
+
[More Information Needed]
|
65 |
+
|
66 |
+
### Out-of-Scope Use
|
67 |
+
|
68 |
+
[More Information Needed]
|
69 |
+
|
70 |
+
## Bias, Risks, and Limitations
|
71 |
+
|
72 |
+
[More Information Needed]
|
73 |
+
|
74 |
+
### Recommendations
|
75 |
+
|
76 |
+
Users (both direct and downstream) should be made aware of the risks, biases and limitations of the model. More information needed for further recommendations.
|
77 |
+
-->
|
78 |
+
|
79 |
+
## How to Get Started with the Model
|
80 |
+
|
81 |
+
Use the code below to get started with the model.
|
82 |
+
|
83 |
+
```python
|
84 |
+
# pip install transformers peft
|
85 |
+
|
86 |
+
import torch
|
87 |
+
from transformers import pipeline, AutoModelForCausalLM, AutoTokenizer
|
88 |
+
|
89 |
+
model_id = "meta-llama/Meta-Llama-3-8B"
|
90 |
+
peft_model_id = "typeof/Hermes-2-Pro-Llama-3-8B-delta-lora"
|
91 |
+
|
92 |
+
tokenizer = AutoTokenizer.from_pretrained(model_id)
|
93 |
+
model = AutoModelForCausalLM.from_pretrained(model_id)
|
94 |
+
model.load_adapter(peft_model_id)
|
95 |
+
|
96 |
+
pipe = pipeline("text-generation", model=model, tokenizer=tokenizer)
|
97 |
+
|
98 |
+
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.
|
99 |
+
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:
|
100 |
+
<tool_call>
|
101 |
+
{"arguments": <args-dict>, "name": <function-name>}
|
102 |
+
</tool_call>"""
|
103 |
+
|
104 |
+
messages = [
|
105 |
+
{"role": "system", "content": system_prompt},
|
106 |
+
{"role": "user", "content": "Fetch the stock fundamentals data for Tesla (TSLA)"},
|
107 |
+
]
|
108 |
+
prompt = pipe.tokenizer.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)
|
109 |
+
outputs = pipe(prompt, max_new_tokens=256, do_sample=True, temperature=0.7, top_k=50, top_p=0.95)
|
110 |
+
print(outputs[0]["generated_text"])
|
111 |
+
```
|
112 |
+
```
|
113 |
+
<|im_start|>assistant
|
114 |
+
<tool_call>
|
115 |
+
{"arguments": {"symbol": "TSLA"}, "name": "get_stock_fundamentals"}
|
116 |
+
</tool_call><|im_end|>
|
117 |
+
```
|
118 |
+
... call tool and pass back prompt like so...
|
119 |
+
```
|
120 |
+
<|im_start|>tool
|
121 |
+
<tool_response>
|
122 |
+
{"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}}
|
123 |
+
</tool_response>
|
124 |
+
<|im_end|>
|
125 |
+
```
|
126 |
+
```
|
127 |
+
<|im_start|>assistant
|
128 |
+
The stock fundamentals data for Tesla (TSLA) are as follows:
|
129 |
+
- **Symbol**: TSLA
|
130 |
+
- **Company Name**: Tesla, Inc.
|
131 |
+
- **Sector**: Consumer Cyclical
|
132 |
+
- **Industry**: Auto Manufacturers
|
133 |
+
- **Market Capitalization**: $566,160,130,480
|
134 |
+
- **Forward Price-to-Earnings Ratio (PE Ratio)**: 42.73
|
135 |
+
- **Price-to-Book Ratio (PB Ratio)**: 9.04
|
136 |
+
- **Dividend Yield**: N/A
|
137 |
+
- **Trailing Earnings Per Share (EPS)**: $4.3
|
138 |
+
- **Beta Value of the Stock**: 2.42
|
139 |
+
- **52-Week High Price of the Stock**: $299.29
|
140 |
+
- **52-Week Low Price of the Stock**: $152.37
|
141 |
+
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|>
|
142 |
+
```
|
143 |
+
|
144 |
+
<!--
|
145 |
+
|
146 |
+
## Training Details
|
147 |
+
|
148 |
+
### Training Data
|
149 |
+
|
150 |
+
|
151 |
+
[More Information Needed]
|
152 |
+
|
153 |
+
### Training Procedure
|
154 |
+
|
155 |
+
|
156 |
+
#### Preprocessing [optional]
|
157 |
+
|
158 |
+
[More Information Needed]
|
159 |
+
|
160 |
+
|
161 |
+
#### Training Hyperparameters
|
162 |
+
|
163 |
+
#### Speeds, Sizes, Times [optional]
|
164 |
+
|
165 |
+
|
166 |
+
[More Information Needed]
|
167 |
+
|
168 |
+
## Evaluation
|
169 |
+
|
170 |
+
|
171 |
+
### Testing Data, Factors & Metrics
|
172 |
+
|
173 |
+
#### Testing Data
|
174 |
+
|
175 |
+
|
176 |
+
[More Information Needed]
|
177 |
+
|
178 |
+
#### Factors
|
179 |
+
|
180 |
+
|
181 |
+
[More Information Needed]
|
182 |
+
|
183 |
+
#### Metrics
|
184 |
+
|
185 |
+
|
186 |
+
[More Information Needed]
|
187 |
+
|
188 |
+
### Results
|
189 |
+
|
190 |
+
[More Information Needed]
|
191 |
+
|
192 |
+
#### Summary
|
193 |
+
|
194 |
+
## Model Examination [optional]
|
195 |
+
|
196 |
+
[More Information Needed]
|
197 |
+
|
198 |
+
## Technical Specifications [optional]
|
199 |
+
|
200 |
+
### Model Architecture and Objective
|
201 |
+
|
202 |
+
[More Information Needed]
|
203 |
+
|
204 |
+
### Compute Infrastructure
|
205 |
+
|
206 |
+
[More Information Needed]
|
207 |
+
|
208 |
+
#### Hardware
|
209 |
+
|
210 |
+
[More Information Needed]
|
211 |
+
|
212 |
+
#### Software
|
213 |
+
|
214 |
+
[More Information Needed]
|
215 |
+
|
216 |
+
## Citation [optional]
|
217 |
+
|
218 |
+
**BibTeX:**
|
219 |
+
|
220 |
+
[More Information Needed]
|
221 |
+
|
222 |
+
**APA:**
|
223 |
+
|
224 |
+
[More Information Needed]
|
225 |
+
|
226 |
+
## Glossary [optional]
|
227 |
+
|
228 |
+
[More Information Needed]
|
229 |
+
|
230 |
+
## More Information
|
231 |
+
|
232 |
+
[More Information Needed]
|
233 |
+
|
234 |
+
## Model Card Authors [optional]
|
235 |
+
|
236 |
+
[More Information Needed]
|
237 |
+
|
238 |
+
## Model Card Contact
|
239 |
+
|
240 |
+
[More Information Needed]
|
241 |
+
|
242 |
+
## Training procedure
|
243 |
+
|
244 |
+
The following `bitsandbytes` quantization config was used during training:
|
245 |
+
- quant_method: bitsandbytes
|
246 |
+
- load_in_4bit: True
|
247 |
+
- bnb_4bit_quant_type: nf4
|
248 |
+
- bnb_4bit_use_double_quant: True
|
249 |
+
|
250 |
+
### Framework versions
|
251 |
+
|
252 |
+
- PEFT 0.6.3.dev0
|
253 |
+
|
254 |
+
-->
|
255 |
+
#### Summary
|
256 |
+
|
257 |
+
[LoRA](https://arxiv.org/abs/2305.14314)
|
258 |
+
[QLoRA](https://arxiv.org/abs/2106.09685)
|