Upload folder using huggingface_hub
Browse files
README.md
ADDED
|
@@ -0,0 +1,88 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
tags:
|
| 3 |
+
- merge
|
| 4 |
+
- mergekit
|
| 5 |
+
- lazymergekit
|
| 6 |
+
- microsoft/codebert-base
|
| 7 |
+
- EleutherAI/gpt-neo-x-20b
|
| 8 |
+
- openai/codex
|
| 9 |
+
- bigscience/bloom
|
| 10 |
+
- google/jurassic-1-jumbo
|
| 11 |
+
- google/t5-v1_1-large
|
| 12 |
+
- facebook/bart-large
|
| 13 |
+
base_model:
|
| 14 |
+
- microsoft/codebert-base
|
| 15 |
+
- EleutherAI/gpt-neo-x-20b
|
| 16 |
+
- openai/codex
|
| 17 |
+
- bigscience/bloom
|
| 18 |
+
- google/jurassic-1-jumbo
|
| 19 |
+
- google/t5-v1_1-large
|
| 20 |
+
- facebook/bart-large
|
| 21 |
+
---
|
| 22 |
+
|
| 23 |
+
# code-slerp
|
| 24 |
+
|
| 25 |
+
code-slerp is a merge of the following models using [LazyMergekit](https://colab.research.google.com/drive/1obulZ1ROXHjYLn6PPZJwRR6GzgQogxxb?usp=sharing):
|
| 26 |
+
* [microsoft/codebert-base](https://huggingface.co/microsoft/codebert-base)
|
| 27 |
+
* [EleutherAI/gpt-neo-x-20b](https://huggingface.co/EleutherAI/gpt-neo-x-20b)
|
| 28 |
+
* [openai/codex](https://huggingface.co/openai/codex)
|
| 29 |
+
* [bigscience/bloom](https://huggingface.co/bigscience/bloom)
|
| 30 |
+
* [google/jurassic-1-jumbo](https://huggingface.co/google/jurassic-1-jumbo)
|
| 31 |
+
* [google/t5-v1_1-large](https://huggingface.co/google/t5-v1_1-large)
|
| 32 |
+
* [facebook/bart-large](https://huggingface.co/facebook/bart-large)
|
| 33 |
+
|
| 34 |
+
## 🧩 Configuration
|
| 35 |
+
|
| 36 |
+
```yaml
|
| 37 |
+
slices:
|
| 38 |
+
- sources:
|
| 39 |
+
- model: microsoft/codebert-base
|
| 40 |
+
layer_range: [0, 32]
|
| 41 |
+
- model: EleutherAI/gpt-neo-x-20b
|
| 42 |
+
layer_range: [0, 32]
|
| 43 |
+
- model: openai/codex
|
| 44 |
+
layer_range: [0, 32]
|
| 45 |
+
- model: bigscience/bloom
|
| 46 |
+
layer_range: [0, 32]
|
| 47 |
+
- model: google/jurassic-1-jumbo
|
| 48 |
+
layer_range: [0, 32]
|
| 49 |
+
- model: google/t5-v1_1-large
|
| 50 |
+
layer_range: [0, 32]
|
| 51 |
+
- model: facebook/bart-large
|
| 52 |
+
layer_range: [0, 32]
|
| 53 |
+
merge_method: slerp
|
| 54 |
+
base_model: microsoft/codebert-base
|
| 55 |
+
parameters:
|
| 56 |
+
t:
|
| 57 |
+
- filter: self_attn
|
| 58 |
+
value: [0, 0.5, 0.3, 0.7, 1]
|
| 59 |
+
- filter: mlp
|
| 60 |
+
value: [1, 0.5, 0.7, 0.3, 0]
|
| 61 |
+
- value: 0.5
|
| 62 |
+
dtype: bfloat1
|
| 63 |
+
```
|
| 64 |
+
|
| 65 |
+
## 💻 Usage
|
| 66 |
+
|
| 67 |
+
```python
|
| 68 |
+
!pip install -qU transformers accelerate
|
| 69 |
+
|
| 70 |
+
from transformers import AutoTokenizer
|
| 71 |
+
import transformers
|
| 72 |
+
import torch
|
| 73 |
+
|
| 74 |
+
model = "Or4cl3-1/code-slerp"
|
| 75 |
+
messages = [{"role": "user", "content": "What is a large language model?"}]
|
| 76 |
+
|
| 77 |
+
tokenizer = AutoTokenizer.from_pretrained(model)
|
| 78 |
+
prompt = tokenizer.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)
|
| 79 |
+
pipeline = transformers.pipeline(
|
| 80 |
+
"text-generation",
|
| 81 |
+
model=model,
|
| 82 |
+
torch_dtype=torch.float16,
|
| 83 |
+
device_map="auto",
|
| 84 |
+
)
|
| 85 |
+
|
| 86 |
+
outputs = pipeline(prompt, max_new_tokens=256, do_sample=True, temperature=0.7, top_k=50, top_p=0.95)
|
| 87 |
+
print(outputs[0]["generated_text"])
|
| 88 |
+
```
|