aashish1904
commited on
Commit
•
a1cd03e
1
Parent(s):
5cedcc9
Upload README.md with huggingface_hub
Browse files
README.md
ADDED
@@ -0,0 +1,141 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
|
2 |
+
---
|
3 |
+
|
4 |
+
base_model: EpistemeAI/Athena-codegemma-2-9b
|
5 |
+
language:
|
6 |
+
- en
|
7 |
+
license: apache-2.0
|
8 |
+
tags:
|
9 |
+
- text-generation-inference
|
10 |
+
- transformers
|
11 |
+
- unsloth
|
12 |
+
- gemma2
|
13 |
+
- trl
|
14 |
+
pipeline_tag: text-generation
|
15 |
+
|
16 |
+
---
|
17 |
+
|
18 |
+
![](https://lh7-rt.googleusercontent.com/docsz/AD_4nXeiuCm7c8lEwEJuRey9kiVZsRn2W-b4pWlu3-X534V3YmVuVc2ZL-NXg2RkzSOOS2JXGHutDuyyNAUtdJI65jGTo8jT9Y99tMi4H4MqL44Uc5QKG77B0d6-JfIkZHFaUA71-RtjyYZWVIhqsNZcx8-OMaA?key=xt3VSDoCbmTY7o-cwwOFwQ)
|
19 |
+
|
20 |
+
# QuantFactory/Athena-codegemma-2-9b-v1-GGUF
|
21 |
+
This is quantized version of [EpistemeAI/Athena-codegemma-2-9b-v1](https://huggingface.co/EpistemeAI/Athena-codegemma-2-9b-v1) created using llama.cpp
|
22 |
+
|
23 |
+
# Original Model Card
|
24 |
+
|
25 |
+
|
26 |
+
# How to use
|
27 |
+
This repository contains Athena-codegemma-2-9b-v1, for use with transformers and with the original llama codebase.
|
28 |
+
|
29 |
+
Use with transformers
|
30 |
+
Starting with transformers >= 4.43.0 onward, you can run conversational inference using the Transformers pipeline abstraction or by leveraging the Auto classes with the generate() function.
|
31 |
+
|
32 |
+
Make sure to update your transformers installation via pip install --upgrade transformers.
|
33 |
+
|
34 |
+
## Best use to test or prompt:
|
35 |
+
|
36 |
+
You need to prepare prompt in **alpaca** format to generate properly:
|
37 |
+
```python
|
38 |
+
def format_test(x):
|
39 |
+
|
40 |
+
if x['input']:
|
41 |
+
formatted_text = f"""Below is an instruction that describes a task. \
|
42 |
+
Write a response that appropriately completes the request.
|
43 |
+
|
44 |
+
### Instruction:
|
45 |
+
{x['instruction']}
|
46 |
+
|
47 |
+
### Input:
|
48 |
+
{x['input']}
|
49 |
+
|
50 |
+
### Response:
|
51 |
+
"""
|
52 |
+
|
53 |
+
else:
|
54 |
+
formatted_text = f"""Below is an instruction that describes a task. \
|
55 |
+
Write a response that appropriately completes the request.
|
56 |
+
|
57 |
+
### Instruction:
|
58 |
+
{x['instruction']}
|
59 |
+
|
60 |
+
### Response:
|
61 |
+
"""
|
62 |
+
|
63 |
+
return formatted_text
|
64 |
+
|
65 |
+
# using code_instructions_122k_alpaca dataset
|
66 |
+
Prompt = format_test(data[155])
|
67 |
+
print(Prompt)
|
68 |
+
|
69 |
+
```
|
70 |
+
- huggingface transformers method:
|
71 |
+
```python
|
72 |
+
from transformers import TextStreamer
|
73 |
+
|
74 |
+
FastLanguageModel.for_inference(model) # Enable native 2x faster inference
|
75 |
+
inputs = tokenizer(
|
76 |
+
[
|
77 |
+
Prompt
|
78 |
+
], return_tensors = "pt").to("cuda")
|
79 |
+
|
80 |
+
text_streamer = TextStreamer(tokenizer)
|
81 |
+
_ = model.generate(**inputs, streamer = text_streamer, max_new_tokens = 512)
|
82 |
+
```
|
83 |
+
|
84 |
+
|
85 |
+
- unsloth method
|
86 |
+
```python
|
87 |
+
from unsloth import FastLanguageModel
|
88 |
+
|
89 |
+
model, tokenizer = FastLanguageModel.from_pretrained(
|
90 |
+
model_name = "EpistemeAI/Athena-codegemma-2-9b-v1", # YOUR MODEL YOU USED FOR TRAINING
|
91 |
+
max_seq_length = max_seq_length,
|
92 |
+
dtype = dtype,
|
93 |
+
load_in_4bit = load_in_4bit,
|
94 |
+
)
|
95 |
+
FastLanguageModel.for_inference(model) # Enable native 2x faster inference
|
96 |
+
|
97 |
+
# alpaca_prompt = You MUST copy from above!
|
98 |
+
|
99 |
+
inputs = tokenizer(
|
100 |
+
[
|
101 |
+
alpaca_prompt.format(
|
102 |
+
"Create a function to calculate the sum of a sequence of integers.", # instruction
|
103 |
+
"", # input
|
104 |
+
"", # output - leave this blank for generation!
|
105 |
+
)
|
106 |
+
], return_tensors = "pt").to("cuda")
|
107 |
+
|
108 |
+
outputs = model.generate(**inputs, max_new_tokens = 64, use_cache = True)
|
109 |
+
tokenizer.batch_decode(outputs)
|
110 |
+
```
|
111 |
+
|
112 |
+
--
|
113 |
+
|
114 |
+
### Inputs and outputs
|
115 |
+
|
116 |
+
* **Input:** Text string, such as a question, a prompt, or a document to be
|
117 |
+
summarized.
|
118 |
+
* **Output:** Generated English-language text in response to the input, such
|
119 |
+
as an answer to a question, or a summary of a document.
|
120 |
+
### Citation
|
121 |
+
|
122 |
+
```none
|
123 |
+
@article{gemma_2024,
|
124 |
+
title={Gemma},
|
125 |
+
url={https://www.kaggle.com/m/3301},
|
126 |
+
DOI={10.34740/KAGGLE/M/3301},
|
127 |
+
publisher={Kaggle},
|
128 |
+
author={Gemma Team},
|
129 |
+
year={2024}
|
130 |
+
}
|
131 |
+
```
|
132 |
+
|
133 |
+
# Uploaded model
|
134 |
+
|
135 |
+
- **Developed by:** EpistemeAI
|
136 |
+
- **License:** apache-2.0
|
137 |
+
- **Finetuned from model :** EpistemeAI/Athena-codegemma-2-9b
|
138 |
+
|
139 |
+
This gemma2 model was trained 2x faster with [Unsloth](https://github.com/unslothai/unsloth) and Huggingface's TRL library.
|
140 |
+
|
141 |
+
[<img src="https://raw.githubusercontent.com/unslothai/unsloth/main/images/unsloth%20made%20with%20love.png" width="200"/>](https://github.com/unslothai/unsloth)
|