Update README.md
Browse files
README.md
CHANGED
@@ -8,8 +8,13 @@ library_name: transformers
|
|
8 |
tags:
|
9 |
- mergekit
|
10 |
- merge
|
11 |
-
|
12 |
---
|
|
|
|
|
|
|
|
|
|
|
13 |
# merge
|
14 |
|
15 |
This is a merge of pre-trained language models created using [mergekit](https://github.com/cg123/mergekit).
|
@@ -41,3 +46,29 @@ base_model: Kukedlc/NeuralSirKrishna-7b
|
|
41 |
dtype: bfloat16
|
42 |
|
43 |
```
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
8 |
tags:
|
9 |
- mergekit
|
10 |
- merge
|
11 |
+
license: apache-2.0
|
12 |
---
|
13 |
+
|
14 |
+
# NeuralStockFusion-7b
|
15 |
+
|
16 |
+
![image/webp](https://cdn-uploads.huggingface.co/production/uploads/64d71ab4089bc502ceb44d29/5Ex2YG8H1oLXaS25gvZQs.webp)
|
17 |
+
|
18 |
# merge
|
19 |
|
20 |
This is a merge of pre-trained language models created using [mergekit](https://github.com/cg123/mergekit).
|
|
|
46 |
dtype: bfloat16
|
47 |
|
48 |
```
|
49 |
+
|
50 |
+
# Model Inference:
|
51 |
+
|
52 |
+
``` python
|
53 |
+
!pip install -qU transformers accelerate bitsandbytes
|
54 |
+
|
55 |
+
from transformers import AutoModelForCausalLM, AutoTokenizer, TextStreamer, BitsAndBytesConfig
|
56 |
+
import torch
|
57 |
+
|
58 |
+
bnb_config = BitsAndBytesConfig(
|
59 |
+
load_in_4bit=True,
|
60 |
+
bnb_4bit_use_double_quant=True,
|
61 |
+
bnb_4bit_quant_type="nf4",
|
62 |
+
bnb_4bit_compute_dtype=torch.bfloat16
|
63 |
+
)
|
64 |
+
|
65 |
+
MODEL_NAME = 'Kukedlc/NeuralStockFusion-7b'
|
66 |
+
tokenizer = AutoTokenizer.from_pretrained(MODEL_NAME)
|
67 |
+
model = AutoModelForCausalLM.from_pretrained(MODEL_NAME, device_map='cuda:0', quantization_config=bnb_config)
|
68 |
+
|
69 |
+
inputs = tokenizer(["What is a large language model, in spanish\n\n"], return_tensors="pt").to('cuda')
|
70 |
+
streamer = TextStreamer(tokenizer)
|
71 |
+
|
72 |
+
# Despite returning the usual output, the streamer will also print the generated text to stdout.
|
73 |
+
_ = model.generate(**inputs, streamer=streamer, max_new_tokens=256, do_sample=True, temperature=0.7, repetition_penalty=1.4, top_p=0.9)
|
74 |
+
```
|