aashish1904 commited on
Commit
6be2eda
1 Parent(s): 0eadc3f

Upload README.md with huggingface_hub

Browse files
Files changed (1) hide show
  1. README.md +121 -0
README.md ADDED
@@ -0,0 +1,121 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ ---
3
+
4
+ license: apache-2.0
5
+ datasets:
6
+ - HuggingFaceTB/cosmopedia
7
+ language:
8
+ - en
9
+ inference:
10
+ parameters:
11
+ temperature: 0.6
12
+ top_p: 0.95
13
+ top_k: 50
14
+ repetition_penalty: 1.2
15
+ widget:
16
+ - text: 'Photosynthesis is'
17
+ example_title: Textbook
18
+ group: Completion
19
+ - text: '<s> [INST] How to take care of plants? [/INST] '
20
+ example_title: Wikihow
21
+ group: Completion
22
+ - text: '<s> [INST] Generate a story about a flying cat [/INST] '
23
+ example_title: Story
24
+ group: Completion
25
+
26
+ ---
27
+
28
+ ![](https://lh7-rt.googleusercontent.com/docsz/AD_4nXeiuCm7c8lEwEJuRey9kiVZsRn2W-b4pWlu3-X534V3YmVuVc2ZL-NXg2RkzSOOS2JXGHutDuyyNAUtdJI65jGTo8jT9Y99tMi4H4MqL44Uc5QKG77B0d6-JfIkZHFaUA71-RtjyYZWVIhqsNZcx8-OMaA?key=xt3VSDoCbmTY7o-cwwOFwQ)
29
+
30
+ # QuantFactory/cosmo-1b-GGUF
31
+ This is quantized version of [HuggingFaceTB/cosmo-1b](https://huggingface.co/HuggingFaceTB/cosmo-1b) created using llama.cpp
32
+
33
+ # Original Model Card
34
+
35
+
36
+ # Model Summary
37
+ This is a 1.8B model trained on [Cosmopedia](https://huggingface.co/datasets/HuggingFaceTB/cosmopedia) synthetic dataset.
38
+
39
+ # Training dataset
40
+ The training corpus consisted of 30B tokens, 25B of which are synthetic from Cosmopedia. Since we didn't explore the synthetic generation of code, we augmented the dataset with 5B tokens of non-synthetic sources like the `code-python-0.60-to-1.00` and `web-0.50-to-1.00` subsets of [AutoMathText](https://huggingface.co/datasets/math-ai/AutoMathText). We also added 1M files from [The Stack](https://huggingface.co/datasets/bigcode/the-stack)'s Jupyter Notebooks, converted to script. They tend to have educational code interleaved with text.
41
+ We also included [ultrachat](https://huggingface.co/datasets/stingning/ultrachat) formatted in the chat format of `LlaMa` models, so we don't have to instruction-tune the model after the pre-training. Additionally, we upsampled twice the data from these seed sources to help with commonsense and reasoning: stories, AutoMathText & KhanAcademy.
42
+
43
+ We trained for 6 epochs, resulting in a model trained on 180B tokens with a sequence length of 2k, a global batch size of 1.3M tokens and a learning rate of 3e-4 with a cosine schedule for 140k steps.
44
+ We used the tokenizer from [Mistral-7B-v0.1](https://huggingface.co/mistralai/Mistral-7B-v0.1/).
45
+
46
+ # How to use
47
+
48
+ Although the model wasn't instruction-tuned after the pre-training. However, given that included UltraChat in the pre-training , you can use it in a Chat format using:
49
+
50
+ ```python
51
+ from transformers import AutoModelForCausalLM, AutoTokenizer
52
+
53
+ device = "cuda" # for GPU usage or "cpu" for CPU usage
54
+
55
+ tokenizer = AutoTokenizer.from_pretrained("HuggingFaceTB/cosmo-1b")
56
+ model = AutoModelForCausalLM.from_pretrained("HuggingFaceTB/cosmo-1b").to(device)
57
+ prompt = "Generate a story involving a dog, an astronaut and a baker"
58
+ prompt= tokenizer.apply_chat_template([{"role": "user", "content": prompt}], tokenize=False)
59
+ inputs = tokenizer(prompt, return_tensors="pt").to(device)
60
+
61
+ output = model.generate(**inputs, max_length=300, do_sample=True, temperature=0.6, top_p=0.95, repetition_penalty=1.2)
62
+ print(tokenizer.decode(output[0]))
63
+ ```
64
+ Output:
65
+ ```
66
+ <s><s> [INST] Generate a story involving a dog, an astronaut and a baker [/INST] Once upon a time, there was a sweet little terrier named Max who lived in the bustling city of New York. He loved nothing more than chasing after his owner, Dr. Sarah Johnson, as she worked tirelessly on her latest invention - a spaceship that would take humans to distant galaxies!
67
+
68
+ One day, Dr. Johnson decided it was time for her to leave Earth's atmosphere behind and embark on this exciting adventure with her loyal companion, Max. She knew he had always been fascinated by space travel, so she hoped he would be just as excited about the journey ahead.
69
+
70
+ As they boarded their rocket ship and blasted off into outer space, Max felt both nervous and thrilled at the same time. His ears perked up every time they passed clouds or saw stars twinkling far out from earth. But as days turned into weeks, Max started feeling homesick. The vast emptiness around him made him feel lonely and isolated.
71
+
72
+ Meanwhile back on planet Earth, Mr. Baker was busy baking cookies when suddenly, an idea popped into his head. Why not send some treats along with Dr. Johnson's family? It might make them all feel better knowing that someone else was also having fun exploring the universe.
73
+ ```
74
+
75
+ You can also use the model in text completion mode i.e without applying the chat template, but it might not follow isntructions.
76
+
77
+ ```python
78
+ from transformers import AutoModelForCausalLM, AutoTokenizer
79
+
80
+ device = "cuda" # for GPU usage or "cpu" for CPU usage
81
+
82
+ tokenizer = AutoTokenizer.from_pretrained("HuggingFaceTB/cosmo-1b")
83
+ model = AutoModelForCausalLM.from_pretrained("HuggingFaceTB/cosmo-1b").to(device)
84
+ prompt = "Photosynthesis is"
85
+
86
+ inputs = tokenizer(prompt, return_tensors="pt").to(device)
87
+ output = model.generate(**inputs, max_length=300, do_sample=True, temperature=0.6, top_p=0.95, repetition_penalty=1.2)
88
+ print(tokenizer.decode(output[0]))
89
+ ```
90
+ Output:
91
+ ```
92
+ <s> Photosynthesis is the process by which green plants, algae and some bacteria convert light energy into chemical energy in order to fuel their metabolic processes. The reaction takes place within specialized cells called chloroplasts. This article focuses on the electron transport chain (ETC), a critical part of photosystem II where most of the solar-driven electrons are passed through before being reduced to water.
93
+ ```
94
+ # Evaluation
95
+ Below are the evaluation results of Cosmo-1B. The model is better than TinyLlama 1.1B on ARC-easy, ARC-challenge, OpenBookQA and MMLU, and has comparable performance to Qwen-1.5-1B on ARC-challenge and OpenBookQA.
96
+ However, we notice some perfoamnce gaps compared to Phi-1.5 suggesting a better synthetic generation quality which can be related to the LLM used for generation, topic coverage or prompts.
97
+
98
+ ![image/png](https://cdn-uploads.huggingface.co/production/uploads/61c141342aac764ce1654e43/GgWzl6k9BO9jGhGd5O45y.png)
99
+
100
+ # Limitations
101
+
102
+ This is a small 1.8B model trained on synthetic data, so it might hallucinate, give incomplete or incorrect answers.
103
+
104
+ # Training
105
+
106
+ ## Model
107
+
108
+ - **Architecture:** Llama-2
109
+ - **Pretraining steps:** 120k
110
+ - **Pretraining tokens:** 180B
111
+ - **Precision:** bfloat16
112
+
113
+ ## Hardware
114
+
115
+ - **GPUs:** 160 H100
116
+ - **Training time:** 15hours
117
+
118
+ The training loss:
119
+
120
+ ![image/png](https://cdn-uploads.huggingface.co/production/uploads/61c141342aac764ce1654e43/rJobY7F6tqTAvIox1ZGKR.png)
121
+