Commit
·
38251c1
1
Parent(s):
7eff953
Upload VMware/open-llama-13b-open-instruct ctranslate fp16 weights
Browse files- README.md +113 -0
- config.json +27 -0
- generation_config.json +7 -0
- model.bin +3 -0
- special_tokens_map.json +24 -0
- tokenizer_config.json +34 -0
- vocabulary.json +0 -0
README.md
ADDED
|
@@ -0,0 +1,113 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
tags:
|
| 3 |
+
- ctranslate2
|
| 4 |
+
- int8
|
| 5 |
+
- float16
|
| 6 |
+
|
| 7 |
+
license: cc
|
| 8 |
+
datasets:
|
| 9 |
+
- VMware/open-instruct-v1-oasst-dolly-hhrlhf
|
| 10 |
+
language:
|
| 11 |
+
- en
|
| 12 |
+
library_name: transformers
|
| 13 |
+
pipeline_tag: text-generation
|
| 14 |
+
---
|
| 15 |
+
# # Fast-Inference with Ctranslate2
|
| 16 |
+
Speedup inference while reducing memory by 2x-4x using int8 inference in C++ on CPU or GPU.
|
| 17 |
+
|
| 18 |
+
quantized version of [VMware/open-llama-13b-open-instruct](https://huggingface.co/VMware/open-llama-13b-open-instruct)
|
| 19 |
+
```bash
|
| 20 |
+
pip install hf-hub-ctranslate2>=2.12.0 ctranslate2>=3.16.0
|
| 21 |
+
```
|
| 22 |
+
|
| 23 |
+
```python
|
| 24 |
+
# from transformers import AutoTokenizer
|
| 25 |
+
model_name = "michaelfeil/ct2fast-open-llama-13b-open-instruct"
|
| 26 |
+
|
| 27 |
+
|
| 28 |
+
from hf_hub_ctranslate2 import GeneratorCT2fromHfHub
|
| 29 |
+
model = GeneratorCT2fromHfHub(
|
| 30 |
+
# load in int8 on CUDA
|
| 31 |
+
model_name_or_path=model_name,
|
| 32 |
+
device="cuda",
|
| 33 |
+
compute_type="int8_float16",
|
| 34 |
+
# tokenizer=AutoTokenizer.from_pretrained("{ORG}/{NAME}")
|
| 35 |
+
)
|
| 36 |
+
outputs = model.generate(
|
| 37 |
+
text=["def fibonnaci(", "User: How are you doing? Bot:"],
|
| 38 |
+
max_length=64,
|
| 39 |
+
include_prompt_in_result=False
|
| 40 |
+
)
|
| 41 |
+
print(outputs)
|
| 42 |
+
```
|
| 43 |
+
|
| 44 |
+
Checkpoint compatible to [ctranslate2>=3.16.0](https://github.com/OpenNMT/CTranslate2)
|
| 45 |
+
and [hf-hub-ctranslate2>=2.12.0](https://github.com/michaelfeil/hf-hub-ctranslate2)
|
| 46 |
+
- `compute_type=int8_float16` for `device="cuda"`
|
| 47 |
+
- `compute_type=int8` for `device="cpu"`
|
| 48 |
+
|
| 49 |
+
Converted on 2023-06-27 using
|
| 50 |
+
```
|
| 51 |
+
ct2-transformers-converter --model VMware/open-llama-13b-open-instruct --output_dir ~/tmp-ct2fast-open-llama-13b-open-instruct --force --copy_files README.md tokenizer_config.json generation_config.json special_tokens_map.json .gitattributes --quantization int8_float16 --trust_remote_code
|
| 52 |
+
```
|
| 53 |
+
|
| 54 |
+
# Licence and other remarks:
|
| 55 |
+
This is just a quantized version. Licence conditions are intended to be idential to original huggingface repo.
|
| 56 |
+
|
| 57 |
+
# Original description
|
| 58 |
+
|
| 59 |
+
|
| 60 |
+
# VMware/open-llama-13B-open-instruct
|
| 61 |
+
Instruction-tuned version of the fully trained Open LLama 13B model. The model is open for <b>COMMERCIAL USE</b>. <br>
|
| 62 |
+
|
| 63 |
+
<b> NOTE </b> : The model was trained using the Alpaca prompt template \
|
| 64 |
+
<b> NOTE </b> : Fast tokenizer results in incorrect encoding, set the ```use_fast = False``` parameter, when instantiating the tokenizer\
|
| 65 |
+
<b> NOTE </b> : The model might struggle with code as the tokenizer merges multiple spaces
|
| 66 |
+
|
| 67 |
+
## License
|
| 68 |
+
- <b>Commercially Viable </b>
|
| 69 |
+
- Instruction dataset, [VMware/open-instruct-v1-oasst-dolly-hhrlhf](https://huggingface.co/datasets/VMware/open-instruct-v1-oasst-dolly-hhrlhf) is under cc-by-sa-3.0
|
| 70 |
+
- Language Model, ([openlm-research/open_llama_13b](https://huggingface.co/openlm-research/open_llama_13b)) is under apache-2.0
|
| 71 |
+
|
| 72 |
+
|
| 73 |
+
## Nomenclature
|
| 74 |
+
|
| 75 |
+
- Model : Open-llama
|
| 76 |
+
- Model Size: 13B parameters
|
| 77 |
+
- Dataset: Open-instruct-v1 (oasst,dolly, hhrlhf)
|
| 78 |
+
|
| 79 |
+
## Use in Transformers
|
| 80 |
+
|
| 81 |
+
```
|
| 82 |
+
import os
|
| 83 |
+
import torch
|
| 84 |
+
from transformers import AutoModelForCausalLM, AutoTokenizer
|
| 85 |
+
|
| 86 |
+
model_name = 'VMware/open-llama-13b-open-instruct'
|
| 87 |
+
|
| 88 |
+
|
| 89 |
+
tokenizer = AutoTokenizer.from_pretrained(model_name, use_fast=False)
|
| 90 |
+
|
| 91 |
+
model = AutoModelForCausalLM.from_pretrained(model_name, torch_dtype=torch.float16, device_map='sequential')
|
| 92 |
+
|
| 93 |
+
prompt_template = "Below is an instruction that describes a task. Write a response that appropriately completes the request.\n\n### Instruction:\n{instruction}\n\n### Response:"
|
| 94 |
+
|
| 95 |
+
prompt = 'Explain in simple terms how the attention mechanism of a transformer model works'
|
| 96 |
+
|
| 97 |
+
|
| 98 |
+
inputt = prompt_template.format(instruction= prompt)
|
| 99 |
+
input_ids = tokenizer(inputt, return_tensors="pt").input_ids.to("cuda")
|
| 100 |
+
|
| 101 |
+
output1 = model.generate(input_ids, max_length=512)
|
| 102 |
+
input_length = input_ids.shape[1]
|
| 103 |
+
output1 = output1[:, input_length:]
|
| 104 |
+
output = tokenizer.decode(output1[0])
|
| 105 |
+
|
| 106 |
+
print(output)
|
| 107 |
+
```
|
| 108 |
+
|
| 109 |
+
## Finetuning details
|
| 110 |
+
The finetuning scripts will be available in our [RAIL Github Repository](https://github.com/vmware-labs/research-and-development-artificial-intelligence-lab/tree/main/instruction-tuning)
|
| 111 |
+
## Evaluation
|
| 112 |
+
|
| 113 |
+
<B>TODO</B>
|
config.json
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"_name_or_path": "/home/gollapudit/peft/open_llama_13b_open_instruct",
|
| 3 |
+
"architectures": [
|
| 4 |
+
"LlamaForCausalLM"
|
| 5 |
+
],
|
| 6 |
+
"bos_token_id": 1,
|
| 7 |
+
"eos_token_id": 2,
|
| 8 |
+
"hidden_act": "silu",
|
| 9 |
+
"hidden_size": 5120,
|
| 10 |
+
"initializer_range": 0.02,
|
| 11 |
+
"intermediate_size": 13824,
|
| 12 |
+
"max_position_embeddings": 2048,
|
| 13 |
+
"model_type": "llama",
|
| 14 |
+
"num_attention_heads": 40,
|
| 15 |
+
"num_hidden_layers": 40,
|
| 16 |
+
"pad_token_id": 0,
|
| 17 |
+
"rms_norm_eps": 1e-06,
|
| 18 |
+
"tie_word_embeddings": false,
|
| 19 |
+
"torch_dtype": "float16",
|
| 20 |
+
"transformers_version": "4.28.1",
|
| 21 |
+
"use_cache": true,
|
| 22 |
+
"vocab_size": 32000,
|
| 23 |
+
"bos_token": "<s>",
|
| 24 |
+
"eos_token": "</s>",
|
| 25 |
+
"layer_norm_epsilon": null,
|
| 26 |
+
"unk_token": "<unk>"
|
| 27 |
+
}
|
generation_config.json
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"_from_model_config": true,
|
| 3 |
+
"bos_token_id": 1,
|
| 4 |
+
"eos_token_id": 2,
|
| 5 |
+
"pad_token_id": 0,
|
| 6 |
+
"transformers_version": "4.28.1"
|
| 7 |
+
}
|
model.bin
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:fdbda702db933751d9e9bfc3b7be138c71c7d9f48f3239c905931f385872e40e
|
| 3 |
+
size 13025087966
|
special_tokens_map.json
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"bos_token": {
|
| 3 |
+
"content": "<s>",
|
| 4 |
+
"lstrip": false,
|
| 5 |
+
"normalized": true,
|
| 6 |
+
"rstrip": false,
|
| 7 |
+
"single_word": false
|
| 8 |
+
},
|
| 9 |
+
"eos_token": {
|
| 10 |
+
"content": "</s>",
|
| 11 |
+
"lstrip": false,
|
| 12 |
+
"normalized": true,
|
| 13 |
+
"rstrip": false,
|
| 14 |
+
"single_word": false
|
| 15 |
+
},
|
| 16 |
+
"pad_token": "<unk>",
|
| 17 |
+
"unk_token": {
|
| 18 |
+
"content": "<unk>",
|
| 19 |
+
"lstrip": false,
|
| 20 |
+
"normalized": true,
|
| 21 |
+
"rstrip": false,
|
| 22 |
+
"single_word": false
|
| 23 |
+
}
|
| 24 |
+
}
|
tokenizer_config.json
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"add_bos_token": true,
|
| 3 |
+
"add_eos_token": false,
|
| 4 |
+
"bos_token": {
|
| 5 |
+
"__type": "AddedToken",
|
| 6 |
+
"content": "<s>",
|
| 7 |
+
"lstrip": false,
|
| 8 |
+
"normalized": true,
|
| 9 |
+
"rstrip": false,
|
| 10 |
+
"single_word": false
|
| 11 |
+
},
|
| 12 |
+
"clean_up_tokenization_spaces": false,
|
| 13 |
+
"eos_token": {
|
| 14 |
+
"__type": "AddedToken",
|
| 15 |
+
"content": "</s>",
|
| 16 |
+
"lstrip": false,
|
| 17 |
+
"normalized": true,
|
| 18 |
+
"rstrip": false,
|
| 19 |
+
"single_word": false
|
| 20 |
+
},
|
| 21 |
+
"model_max_length": 2048,
|
| 22 |
+
"pad_token": null,
|
| 23 |
+
"padding_side": "right",
|
| 24 |
+
"sp_model_kwargs": {},
|
| 25 |
+
"tokenizer_class": "LlamaTokenizer",
|
| 26 |
+
"unk_token": {
|
| 27 |
+
"__type": "AddedToken",
|
| 28 |
+
"content": "<unk>",
|
| 29 |
+
"lstrip": false,
|
| 30 |
+
"normalized": true,
|
| 31 |
+
"rstrip": false,
|
| 32 |
+
"single_word": false
|
| 33 |
+
}
|
| 34 |
+
}
|
vocabulary.json
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|