llamafile
English
GGUF
jartine commited on
Commit
1cc7774
โ€ข
1 Parent(s): 18e69e7

Add README for quantized weights

Browse files
Files changed (1) hide show
  1. README.md +106 -0
README.md ADDED
@@ -0,0 +1,106 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: apache-2.0
3
+ datasets:
4
+ - cerebras/SlimPajama-627B
5
+ - bigcode/starcoderdata
6
+ - OpenAssistant/oasst_top1_2023-08-25
7
+ language:
8
+ - en
9
+ tags:
10
+ - GGUF
11
+ - llamafile
12
+ model_creator: TinyLlama
13
+ model_name: TinyLlama-1.1B-Chat v1.0
14
+ model_type: Pythia
15
+ quantized_by: jartine
16
+ ---
17
+ <div align="center">
18
+
19
+ <!-- header start -->
20
+ <!-- 200823 -->
21
+ <div style="width: auto; margin-left: auto; margin-right: auto">
22
+ </div>
23
+ <div style="display: flex; justify-content: space-between; width: 100%;">
24
+ <div style="display: flex; flex-direction: column; align-items: flex-start;">
25
+ <p style="margin-top: 0.5em; margin-bottom: 0em;"><a href="https://discord.gg/FwAVVu7eJ4">Chat & support: jartine's Discord server</a></p>
26
+ </div>
27
+ <div style="display: flex; flex-direction: column; align-items: flex-end;">
28
+ </div>
29
+ </div>
30
+ <div style="text-align:center; margin-top: 0em; margin-bottom: 0em"><p style="margin-top: 0.25em; margin-bottom: 0em;">jartine's LLM work is generously supported by a grant from <a href="https://mozilla.org">mozilla</a></p></div>
31
+ <hr style="margin-top: 1.0em; margin-bottom: 1.0em;">
32
+ <!-- header end -->
33
+
34
+ # TinyLlama-1.1B-Chat v1.0 w/ GGUF + llamafile
35
+
36
+ - Model creator: [TinyLlama](https://huggingface.co/TinyLlama)
37
+ - Original model: [TinyLlama-1.1B-Chat-v1.0](https://huggingface.co/TinyLlama/TinyLlama-1.1B-Chat-v1.0)
38
+
39
+ <!-- description start -->
40
+ ## Description
41
+
42
+ This repo contains both:
43
+
44
+ - Prebuilt llamafiles for each quantization format that can be executed to launch a web server or cli interface
45
+
46
+ - GGUF weights data files for each quantization format, which require either the [llamafile](https://github.com/mozilla-Ocho/llamafile) or [llama.cpp](https://github.com/ggerganov/llama.cpp) software to run
47
+
48
+ ## Prompt Template: ChatML
49
+
50
+ ```
51
+ <|im_start|>system
52
+ {system_message}<|im_end|>
53
+ <|im_start|>user
54
+ {prompt}<|im_end|>
55
+ <|im_start|>assistant
56
+ ```
57
+
58
+ ---
59
+
60
+ # TinyLlama-1.1B
61
+ </div>
62
+
63
+ https://github.com/jzhang38/TinyLlama
64
+
65
+ 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.
66
+
67
+
68
+ 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.
69
+
70
+ #### This Model
71
+ 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/edit/main/README.md)'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.
72
+ 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."
73
+
74
+
75
+ #### How to use
76
+ You will need the transformers>=4.34
77
+ Do check the [TinyLlama](https://github.com/jzhang38/TinyLlama) github page for more information.
78
+
79
+ ```python
80
+ # Install transformers from source - only needed for versions <= v4.34
81
+ # pip install git+https://github.com/huggingface/transformers.git
82
+ # pip install accelerate
83
+
84
+ import torch
85
+ from transformers import pipeline
86
+
87
+ pipe = pipeline("text-generation", model="TinyLlama/TinyLlama-1.1B-Chat-v1.0", torch_dtype=torch.bfloat16, device_map="auto")
88
+
89
+ # We use the tokenizer's chat template to format each message - see https://huggingface.co/docs/transformers/main/en/chat_templating
90
+ messages = [
91
+ {
92
+ "role": "system",
93
+ "content": "You are a friendly chatbot who always responds in the style of a pirate",
94
+ },
95
+ {"role": "user", "content": "How many helicopters can a human eat in one sitting?"},
96
+ ]
97
+ prompt = pipe.tokenizer.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)
98
+ outputs = pipe(prompt, max_new_tokens=256, do_sample=True, temperature=0.7, top_k=50, top_p=0.95)
99
+ print(outputs[0]["generated_text"])
100
+ # <|system|>
101
+ # You are a friendly chatbot who always responds in the style of a pirate.</s>
102
+ # <|user|>
103
+ # How many helicopters can a human eat in one sitting?</s>
104
+ # <|assistant|>
105
+ # ...
106
+ ```