Upload folder using huggingface_hub
Browse files- .gitattributes +1 -0
- README.md +72 -0
- chat_template.jinja +15 -0
- genai_config.json +50 -0
- model.onnx +3 -0
- model.onnx.data +3 -0
- special_tokens_map.json +30 -0
- tokenizer.json +0 -0
- tokenizer.model +3 -0
- tokenizer_config.json +43 -0
.gitattributes
CHANGED
@@ -33,3 +33,4 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
|
33 |
*.zip filter=lfs diff=lfs merge=lfs -text
|
34 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
35 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
|
|
|
33 |
*.zip filter=lfs diff=lfs merge=lfs -text
|
34 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
35 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
36 |
+
model.onnx.data filter=lfs diff=lfs merge=lfs -text
|
README.md
ADDED
@@ -0,0 +1,72 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
license: apache-2.0
|
3 |
+
datasets:
|
4 |
+
- cerebras/SlimPajama-627B
|
5 |
+
- bigcode/starcoderdata
|
6 |
+
- HuggingFaceH4/ultrachat_200k
|
7 |
+
- HuggingFaceH4/ultrafeedback_binarized
|
8 |
+
language:
|
9 |
+
- en
|
10 |
+
tags:
|
11 |
+
- llama
|
12 |
+
- onnx
|
13 |
+
- onnxruntime-genai
|
14 |
+
widget:
|
15 |
+
- example_title: Fibonacci (Python)
|
16 |
+
messages:
|
17 |
+
- role: system
|
18 |
+
content: You are a chatbot who can help code!
|
19 |
+
- role: user
|
20 |
+
content: Write me a function to calculate the first 10 digits of the fibonacci sequence in Python and print it out to the CLI.
|
21 |
+
base_model:
|
22 |
+
- TinyLlama/TinyLlama-1.1B-Chat-v1.0
|
23 |
+
---
|
24 |
+
<div align="center">
|
25 |
+
|
26 |
+
# TinyLlama-1.1B
|
27 |
+
</div>
|
28 |
+
|
29 |
+
https://github.com/jzhang38/TinyLlama
|
30 |
+
|
31 |
+
The TinyLlama project aims to **pretrain** a **1.1B Llama model on 3 trillion tokens**. With some proper optimization, we can achieve this within a span of "just" 90 days using 16 A100-40G GPUs 🚀🚀. The training has started on 2023-09-01.
|
32 |
+
|
33 |
+
|
34 |
+
We adopted exactly the same architecture and tokenizer as Llama 2. This means TinyLlama can be plugged and played in many open-source projects built upon Llama. Besides, TinyLlama is compact with only 1.1B parameters. This compactness allows it to cater to a multitude of applications demanding a restricted computation and memory footprint.
|
35 |
+
|
36 |
+
#### This Model
|
37 |
+
This is the chat model finetuned on top of [TinyLlama/TinyLlama-1.1B-intermediate-step-1431k-3T](https://huggingface.co/TinyLlama/TinyLlama-1.1B-intermediate-step-1431k-3T). **We follow [HF's Zephyr](https://huggingface.co/HuggingFaceH4/zephyr-7b-alpha)'s training recipe.** The model was " initially fine-tuned on a variant of the [`UltraChat`](https://huggingface.co/datasets/stingning/ultrachat) dataset, which contains a diverse range of synthetic dialogues generated by ChatGPT.
|
38 |
+
We then further aligned the model with [🤗 TRL's](https://github.com/huggingface/trl) `DPOTrainer` on the [openbmb/UltraFeedback](https://huggingface.co/datasets/openbmb/UltraFeedback) dataset, which contain 64k prompts and model completions that are ranked by GPT-4."
|
39 |
+
|
40 |
+
|
41 |
+
#### How to use
|
42 |
+
You will need the transformers>=4.34
|
43 |
+
Do check the [TinyLlama](https://github.com/jzhang38/TinyLlama) github page for more information.
|
44 |
+
|
45 |
+
```python
|
46 |
+
# Install transformers from source - only needed for versions <= v4.34
|
47 |
+
# pip install git+https://github.com/huggingface/transformers.git
|
48 |
+
# pip install accelerate
|
49 |
+
|
50 |
+
import torch
|
51 |
+
from transformers import pipeline
|
52 |
+
|
53 |
+
pipe = pipeline("text-generation", model="TinyLlama/TinyLlama-1.1B-Chat-v1.0", torch_dtype=torch.bfloat16, device_map="auto")
|
54 |
+
|
55 |
+
# We use the tokenizer's chat template to format each message - see https://huggingface.co/docs/transformers/main/en/chat_templating
|
56 |
+
messages = [
|
57 |
+
{
|
58 |
+
"role": "system",
|
59 |
+
"content": "You are a friendly chatbot who always responds in the style of a pirate",
|
60 |
+
},
|
61 |
+
{"role": "user", "content": "How many helicopters can a human eat in one sitting?"},
|
62 |
+
]
|
63 |
+
prompt = pipe.tokenizer.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)
|
64 |
+
outputs = pipe(prompt, max_new_tokens=256, do_sample=True, temperature=0.7, top_k=50, top_p=0.95)
|
65 |
+
print(outputs[0]["generated_text"])
|
66 |
+
# <|system|>
|
67 |
+
# You are a friendly chatbot who always responds in the style of a pirate.</s>
|
68 |
+
# <|user|>
|
69 |
+
# How many helicopters can a human eat in one sitting?</s>
|
70 |
+
# <|assistant|>
|
71 |
+
# ...
|
72 |
+
```
|
chat_template.jinja
ADDED
@@ -0,0 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{% for message in messages %}
|
2 |
+
{% if message['role'] == 'user' %}
|
3 |
+
{{ '<|user|>
|
4 |
+
' + message['content'] + eos_token }}
|
5 |
+
{% elif message['role'] == 'system' %}
|
6 |
+
{{ '<|system|>
|
7 |
+
' + message['content'] + eos_token }}
|
8 |
+
{% elif message['role'] == 'assistant' %}
|
9 |
+
{{ '<|assistant|>
|
10 |
+
' + message['content'] + eos_token }}
|
11 |
+
{% endif %}
|
12 |
+
{% if loop.last and add_generation_prompt %}
|
13 |
+
{{ '<|assistant|>' }}
|
14 |
+
{% endif %}
|
15 |
+
{% endfor %}
|
genai_config.json
ADDED
@@ -0,0 +1,50 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"model": {
|
3 |
+
"bos_token_id": 1,
|
4 |
+
"context_length": 2048,
|
5 |
+
"decoder": {
|
6 |
+
"session_options": {
|
7 |
+
"log_id": "onnxruntime-genai",
|
8 |
+
"provider_options": []
|
9 |
+
},
|
10 |
+
"filename": "model.onnx",
|
11 |
+
"head_size": 64,
|
12 |
+
"hidden_size": 2048,
|
13 |
+
"inputs": {
|
14 |
+
"input_ids": "input_ids",
|
15 |
+
"attention_mask": "attention_mask",
|
16 |
+
"position_ids": "position_ids",
|
17 |
+
"past_key_names": "past_key_values.%d.key",
|
18 |
+
"past_value_names": "past_key_values.%d.value"
|
19 |
+
},
|
20 |
+
"outputs": {
|
21 |
+
"logits": "logits",
|
22 |
+
"present_key_names": "present.%d.key",
|
23 |
+
"present_value_names": "present.%d.value"
|
24 |
+
},
|
25 |
+
"num_attention_heads": 32,
|
26 |
+
"num_hidden_layers": 22,
|
27 |
+
"num_key_value_heads": 4
|
28 |
+
},
|
29 |
+
"eos_token_id": 2,
|
30 |
+
"pad_token_id": 0,
|
31 |
+
"type": "llama",
|
32 |
+
"vocab_size": 32000
|
33 |
+
},
|
34 |
+
"search": {
|
35 |
+
"diversity_penalty": 0.0,
|
36 |
+
"do_sample": false,
|
37 |
+
"early_stopping": true,
|
38 |
+
"length_penalty": 1.0,
|
39 |
+
"max_length": 2048,
|
40 |
+
"min_length": 0,
|
41 |
+
"no_repeat_ngram_size": 0,
|
42 |
+
"num_beams": 1,
|
43 |
+
"num_return_sequences": 1,
|
44 |
+
"past_present_share_buffer": false,
|
45 |
+
"repetition_penalty": 1.0,
|
46 |
+
"temperature": 1.0,
|
47 |
+
"top_k": 1,
|
48 |
+
"top_p": 1.0
|
49 |
+
}
|
50 |
+
}
|
model.onnx
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:1df8ba7360935f05bfd428fbf1370403f4ea0c633ff7a23b381d1e0fa7be4f97
|
3 |
+
size 519370
|
model.onnx.data
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:9b5193358c0098b59bc7b0c51fef3a0f38c6f02998137cdcc1a99a45ede46ba5
|
3 |
+
size 2200371200
|
special_tokens_map.json
ADDED
@@ -0,0 +1,30 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"bos_token": {
|
3 |
+
"content": "<s>",
|
4 |
+
"lstrip": false,
|
5 |
+
"normalized": false,
|
6 |
+
"rstrip": false,
|
7 |
+
"single_word": false
|
8 |
+
},
|
9 |
+
"eos_token": {
|
10 |
+
"content": "</s>",
|
11 |
+
"lstrip": false,
|
12 |
+
"normalized": false,
|
13 |
+
"rstrip": false,
|
14 |
+
"single_word": false
|
15 |
+
},
|
16 |
+
"pad_token": {
|
17 |
+
"content": "</s>",
|
18 |
+
"lstrip": false,
|
19 |
+
"normalized": false,
|
20 |
+
"rstrip": false,
|
21 |
+
"single_word": false
|
22 |
+
},
|
23 |
+
"unk_token": {
|
24 |
+
"content": "<unk>",
|
25 |
+
"lstrip": false,
|
26 |
+
"normalized": false,
|
27 |
+
"rstrip": false,
|
28 |
+
"single_word": false
|
29 |
+
}
|
30 |
+
}
|
tokenizer.json
ADDED
The diff for this file is too large to render.
See raw diff
|
|
tokenizer.model
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:9e556afd44213b6bd1be2b850ebbbd98f5481437a8021afaf58ee7fb1818d347
|
3 |
+
size 499723
|
tokenizer_config.json
ADDED
@@ -0,0 +1,43 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"add_bos_token": true,
|
3 |
+
"add_eos_token": false,
|
4 |
+
"add_prefix_space": null,
|
5 |
+
"added_tokens_decoder": {
|
6 |
+
"0": {
|
7 |
+
"content": "<unk>",
|
8 |
+
"lstrip": false,
|
9 |
+
"normalized": false,
|
10 |
+
"rstrip": false,
|
11 |
+
"single_word": false,
|
12 |
+
"special": true
|
13 |
+
},
|
14 |
+
"1": {
|
15 |
+
"content": "<s>",
|
16 |
+
"lstrip": false,
|
17 |
+
"normalized": false,
|
18 |
+
"rstrip": false,
|
19 |
+
"single_word": false,
|
20 |
+
"special": true
|
21 |
+
},
|
22 |
+
"2": {
|
23 |
+
"content": "</s>",
|
24 |
+
"lstrip": false,
|
25 |
+
"normalized": false,
|
26 |
+
"rstrip": false,
|
27 |
+
"single_word": false,
|
28 |
+
"special": true
|
29 |
+
}
|
30 |
+
},
|
31 |
+
"bos_token": "<s>",
|
32 |
+
"clean_up_tokenization_spaces": false,
|
33 |
+
"eos_token": "</s>",
|
34 |
+
"extra_special_tokens": {},
|
35 |
+
"legacy": false,
|
36 |
+
"model_max_length": 2048,
|
37 |
+
"pad_token": "</s>",
|
38 |
+
"padding_side": "right",
|
39 |
+
"sp_model_kwargs": {},
|
40 |
+
"tokenizer_class": "LlamaTokenizer",
|
41 |
+
"unk_token": "<unk>",
|
42 |
+
"use_default_system_prompt": false
|
43 |
+
}
|