alokabhishek
commited on
Commit
•
ffcad00
1
Parent(s):
90b2bd9
added a code snippet to explain how to use
Browse files
README.md
CHANGED
@@ -25,185 +25,82 @@ This repo contains 4-bit quantized (using bitsandbytes) model of Technology Inno
|
|
25 |
- bitsandbytes github repo: [bitsandbytes github repo](https://github.com/TimDettmers/bitsandbytes)
|
26 |
|
27 |
|
28 |
-
|
29 |
-
### Model Description
|
30 |
-
|
31 |
-
<!-- Provide a longer summary of what this model is. -->
|
32 |
-
|
33 |
-
This is the model card of a 🤗 transformers model that has been pushed on the Hub. This model card has been automatically generated.
|
34 |
-
|
35 |
-
- **Developed by:** [More Information Needed]
|
36 |
-
- **Funded by [optional]:** [More Information Needed]
|
37 |
-
- **Shared by [optional]:** [More Information Needed]
|
38 |
-
- **Model type:** [More Information Needed]
|
39 |
-
- **Language(s) (NLP):** [More Information Needed]
|
40 |
-
- **License:** [More Information Needed]
|
41 |
-
- **Finetuned from model [optional]:** [More Information Needed]
|
42 |
-
|
43 |
-
### Model Sources [optional]
|
44 |
-
|
45 |
-
<!-- Provide the basic links for the model. -->
|
46 |
-
|
47 |
-
- **Repository:** [More Information Needed]
|
48 |
-
- **Paper [optional]:** [More Information Needed]
|
49 |
-
- **Demo [optional]:** [More Information Needed]
|
50 |
-
|
51 |
-
## Uses
|
52 |
-
|
53 |
-
<!-- Address questions around how the model is intended to be used, including the foreseeable users of the model and those affected by the model. -->
|
54 |
-
|
55 |
-
### Direct Use
|
56 |
-
|
57 |
-
<!-- This section is for the model use without fine-tuning or plugging into a larger ecosystem/app. -->
|
58 |
-
|
59 |
-
[More Information Needed]
|
60 |
-
|
61 |
-
### Downstream Use [optional]
|
62 |
-
|
63 |
-
<!-- This section is for the model use when fine-tuned for a task, or when plugged into a larger ecosystem/app -->
|
64 |
-
|
65 |
-
[More Information Needed]
|
66 |
-
|
67 |
-
### Out-of-Scope Use
|
68 |
-
|
69 |
-
<!-- This section addresses misuse, malicious use, and uses that the model will not work well for. -->
|
70 |
-
|
71 |
-
[More Information Needed]
|
72 |
-
|
73 |
-
## Bias, Risks, and Limitations
|
74 |
-
|
75 |
-
<!-- This section is meant to convey both technical and sociotechnical limitations. -->
|
76 |
-
|
77 |
-
[More Information Needed]
|
78 |
-
|
79 |
-
### Recommendations
|
80 |
-
|
81 |
-
<!-- This section is meant to convey recommendations with respect to the bias, risk, and technical limitations. -->
|
82 |
-
|
83 |
-
Users (both direct and downstream) should be made aware of the risks, biases and limitations of the model. More information needed for further recommendations.
|
84 |
-
|
85 |
-
## How to Get Started with the Model
|
86 |
|
87 |
Use the code below to get started with the model.
|
88 |
|
89 |
-
[More Information Needed]
|
90 |
-
|
91 |
-
## Training Details
|
92 |
-
|
93 |
-
### Training Data
|
94 |
-
|
95 |
-
<!-- This should link to a Dataset Card, perhaps with a short stub of information on what the training data is all about as well as documentation related to data pre-processing or additional filtering. -->
|
96 |
-
|
97 |
-
[More Information Needed]
|
98 |
-
|
99 |
-
### Training Procedure
|
100 |
-
|
101 |
-
<!-- This relates heavily to the Technical Specifications. Content here should link to that section when it is relevant to the training procedure. -->
|
102 |
-
|
103 |
-
#### Preprocessing [optional]
|
104 |
-
|
105 |
-
[More Information Needed]
|
106 |
-
|
107 |
|
108 |
-
|
109 |
|
110 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
111 |
|
112 |
-
|
113 |
|
114 |
-
|
|
|
|
|
|
|
|
|
|
|
115 |
|
116 |
-
|
117 |
-
|
118 |
-
## Evaluation
|
119 |
-
|
120 |
-
<!-- This section describes the evaluation protocols and provides the results. -->
|
121 |
|
122 |
-
|
|
|
123 |
|
124 |
-
|
125 |
|
126 |
-
|
|
|
|
|
|
|
127 |
|
128 |
-
[More Information Needed]
|
129 |
-
|
130 |
-
#### Factors
|
131 |
|
132 |
-
|
133 |
|
134 |
-
|
135 |
|
136 |
-
|
137 |
|
138 |
-
|
139 |
|
140 |
-
|
141 |
-
|
142 |
-
### Results
|
143 |
-
|
144 |
-
[More Information Needed]
|
145 |
-
|
146 |
-
#### Summary
|
147 |
-
|
148 |
-
|
149 |
-
|
150 |
-
## Model Examination [optional]
|
151 |
-
|
152 |
-
<!-- Relevant interpretability work for the model goes here -->
|
153 |
-
|
154 |
-
[More Information Needed]
|
155 |
|
156 |
-
## Environmental Impact
|
157 |
|
158 |
-
|
159 |
-
|
160 |
-
Carbon emissions can be estimated using the [Machine Learning Impact calculator](https://mlco2.github.io/impact#compute) presented in [Lacoste et al. (2019)](https://arxiv.org/abs/1910.09700).
|
161 |
-
|
162 |
-
- **Hardware Type:** [More Information Needed]
|
163 |
-
- **Hours used:** [More Information Needed]
|
164 |
-
- **Cloud Provider:** [More Information Needed]
|
165 |
-
- **Compute Region:** [More Information Needed]
|
166 |
-
- **Carbon Emitted:** [More Information Needed]
|
167 |
-
|
168 |
-
## Technical Specifications [optional]
|
169 |
|
170 |
-
|
171 |
|
172 |
-
|
173 |
|
174 |
-
|
175 |
|
176 |
[More Information Needed]
|
177 |
|
178 |
-
|
179 |
-
|
180 |
-
[More Information Needed]
|
181 |
|
182 |
-
|
183 |
|
184 |
[More Information Needed]
|
185 |
|
186 |
-
|
187 |
-
|
188 |
-
<!-- If there is a paper or blog post introducing the model, the APA and Bibtex information for that should go in this section. -->
|
189 |
-
|
190 |
-
**BibTeX:**
|
191 |
-
|
192 |
-
[More Information Needed]
|
193 |
|
194 |
-
|
195 |
|
196 |
[More Information Needed]
|
197 |
|
198 |
-
##
|
199 |
|
200 |
-
<!--
|
201 |
|
202 |
[More Information Needed]
|
203 |
|
204 |
-
## More Information [optional]
|
205 |
-
|
206 |
-
[More Information Needed]
|
207 |
|
208 |
## Model Card Authors [optional]
|
209 |
|
|
|
25 |
- bitsandbytes github repo: [bitsandbytes github repo](https://github.com/TimDettmers/bitsandbytes)
|
26 |
|
27 |
|
28 |
+
# How to Get Started with the Model
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
29 |
|
30 |
Use the code below to get started with the model.
|
31 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
32 |
|
33 |
+
## How to run from Python code
|
34 |
|
35 |
+
#### First install the package
|
36 |
+
```shell
|
37 |
+
pip install -q -U bitsandbytes accelerate torch huggingface_hub
|
38 |
+
pip install -q -U git+https://github.com/huggingface/transformers.git # Install latest version of transformers
|
39 |
+
pip install -q -U git+https://github.com/huggingface/peft.git
|
40 |
+
pip install flash-attn --no-build-isolation
|
41 |
+
```
|
42 |
|
43 |
+
# Import
|
44 |
|
45 |
+
```python
|
46 |
+
import torch
|
47 |
+
import os
|
48 |
+
from torch import bfloat16
|
49 |
+
from transformers import AutoTokenizer, AutoModelForCausalLM, pipeline, BitsAndBytesConfig, LlamaForCausalLM
|
50 |
+
```
|
51 |
|
52 |
+
# Use a pipeline as a high-level helper
|
|
|
|
|
|
|
|
|
53 |
|
54 |
+
```python
|
55 |
+
model_id_falcon = "alokabhishek/falcon-7b-instruct-bnb-4bit"
|
56 |
|
57 |
+
tokenizer_falcon = AutoTokenizer.from_pretrained(model_id_falcon, use_fast=True)
|
58 |
|
59 |
+
model_falcon = AutoModelForCausalLM.from_pretrained(
|
60 |
+
model_id_falcon,
|
61 |
+
device_map="auto"
|
62 |
+
)
|
63 |
|
|
|
|
|
|
|
64 |
|
65 |
+
pipe_falcon = pipeline(model=model_falcon, tokenizer=tokenizer_falcon, task='text-generation')
|
66 |
|
67 |
+
prompt_falcon = "Tell me a funny joke about Large Language Models meeting a Blackhole in an intergalactic Bar."
|
68 |
|
69 |
+
output_falcon = pipe_falcon(prompt_falcon, max_new_tokens=512)
|
70 |
|
71 |
+
print(output_falcon[0]["generated_text"])
|
72 |
|
73 |
+
```
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
74 |
|
|
|
75 |
|
76 |
+
## Uses
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
77 |
|
78 |
+
<!-- Address questions around how the model is intended to be used, including the foreseeable users of the model and those affected by the model. -->
|
79 |
|
80 |
+
### Direct Use
|
81 |
|
82 |
+
<!-- This section is for the model use without fine-tuning or plugging into a larger ecosystem/app. -->
|
83 |
|
84 |
[More Information Needed]
|
85 |
|
86 |
+
### Downstream Use [optional]
|
|
|
|
|
87 |
|
88 |
+
<!-- This section is for the model use when fine-tuned for a task, or when plugged into a larger ecosystem/app -->
|
89 |
|
90 |
[More Information Needed]
|
91 |
|
92 |
+
### Out-of-Scope Use
|
|
|
|
|
|
|
|
|
|
|
|
|
93 |
|
94 |
+
<!-- This section addresses misuse, malicious use, and uses that the model will not work well for. -->
|
95 |
|
96 |
[More Information Needed]
|
97 |
|
98 |
+
## Bias, Risks, and Limitations
|
99 |
|
100 |
+
<!-- This section is meant to convey both technical and sociotechnical limitations. -->
|
101 |
|
102 |
[More Information Needed]
|
103 |
|
|
|
|
|
|
|
104 |
|
105 |
## Model Card Authors [optional]
|
106 |
|