Muhammadreza
commited on
Commit
•
5efa5a2
1
Parent(s):
c74a861
Update README.md
Browse files
README.md
CHANGED
@@ -1,3 +1,86 @@
|
|
1 |
---
|
2 |
license: mit
|
|
|
|
|
|
|
|
|
3 |
---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
---
|
2 |
license: mit
|
3 |
+
language:
|
4 |
+
- en
|
5 |
+
datasets:
|
6 |
+
- nampdn-ai/tiny-textbooks
|
7 |
---
|
8 |
+
|
9 |
+
# Nuclues 1B Alpha1
|
10 |
+
|
11 |
+
<p align="center">
|
12 |
+
<img src="https://github.com/prp-e/nucleus/raw/main/nucleus-logo.png" width=256 height=256>
|
13 |
+
</p>
|
14 |
+
|
15 |
+
## What is Nucleus?
|
16 |
+
|
17 |
+
Nucleus is a small language model based on Mistral (actually, the trimmed untrained version you can find [here](https://huggingface.co/lmlab/lmlab-mistral-1b-untrained)) and trained in different steps. First, we've pretrained it on TinyStories dataset, then [TinyTextBooks](https://huggingface.co/datasets/nampdn-ai/tiny-textbooks) to make it a more specific model. This model is just a _proof of concept_ at this point, but showed good promises in early tests. So with proper training, can be a good product over time!
|
18 |
+
|
19 |
+
## Inference
|
20 |
+
|
21 |
+
[![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/prp-e/nucleus/blob/main/nucleus_1b_inference.ipynb)
|
22 |
+
|
23 |
+
First you need to install `transformers` and `accelerate` libraries in order to run this model. Then, you basically have to run the following code:
|
24 |
+
|
25 |
+
```python
|
26 |
+
|
27 |
+
from transformers import AutoModelForCausalLM, AutoTokenizer, GenerationConfig
|
28 |
+
import torch
|
29 |
+
|
30 |
+
model_name_or_id = "NucleusOrg/Nucleus-1B-alpha-1"
|
31 |
+
|
32 |
+
model = AutoModelForCausalLM.from_pretrained(model_name_or_id, torch_dtype=torch.float16, device_map="cuda")
|
33 |
+
tokenizer = AutoTokenizer.from_pretrained(model_name_or_id)
|
34 |
+
|
35 |
+
prompt = "### Lesson: Python Programming 101\n### Introduction\n"
|
36 |
+
|
37 |
+
inputs = tokenizer(prompt, return_tensors="pt").to("cuda")
|
38 |
+
|
39 |
+
generation_config = GenerationConfig(
|
40 |
+
do_sample=True,
|
41 |
+
top_k=1,
|
42 |
+
temperature=0.9,
|
43 |
+
max_new_tokens=500,
|
44 |
+
repetition_penalty=1.5,
|
45 |
+
pad_token_id=tokenizer.eos_token_id
|
46 |
+
)
|
47 |
+
|
48 |
+
outputs = model.generate(**inputs, generation_config=generation_config)
|
49 |
+
print(tokenizer.decode(outputs[0], skip_special_tokens=True))
|
50 |
+
|
51 |
+
```
|
52 |
+
|
53 |
+
__Prompt Format__: This model does not have a specific prompt format, but the best results could be achieved with a _textbook_ type of format like:
|
54 |
+
|
55 |
+
```
|
56 |
+
### Chapter 1: Elon Musk and Iron Man
|
57 |
+
Elon met Tony at a Cafe in Monaco, then they had a conversation about
|
58 |
+
```
|
59 |
+
|
60 |
+
You also can try something like this:
|
61 |
+
|
62 |
+
```
|
63 |
+
Question: Who are you?
|
64 |
+
Answer:
|
65 |
+
```
|
66 |
+
|
67 |
+
But since the model isn't made for chat/question answering, the result won't be good enough.
|
68 |
+
|
69 |
+
__Repetition Penalty__: Since most of these models like to repeat themselves, just keep that number there. You can increase or decrease it based on your liking,but keep in mind that a number lower than 1 makes the model _super repetitive_.
|
70 |
+
|
71 |
+
## Known Issues
|
72 |
+
|
73 |
+
* Since we only had 420k rows of data, a lot of information are missing on this model. Since mentioned earlier in this very model card, it's a _proof of concept_ model.
|
74 |
+
* You probably may test it with coding. Let's say that the model is terrible at coding. We may release a coding optimized model as soon as possible.
|
75 |
+
|
76 |
+
## Our Team
|
77 |
+
|
78 |
+
* Muhammadreza Haghiri ([[X (formerly Twitter)](https://twitter.com/haghiri_ai) - Website](https://haghiri75.com/en) - [Github](https://github.com/prp-e) - [LinkedIn](https://www.linkedin.com/in/muhammadreza-haghiri-1761325b))
|
79 |
+
* Mahi Mohrechi ([Website](https://mohrechi-portfolio.vercel.app/) - [Github](https://github.com/f-mohrechi) - [LinkedIn](https://www.linkedin.com/in/faeze-mohrechi/))
|
80 |
+
|
81 |
+
## Special Thanks
|
82 |
+
|
83 |
+
* LMLabs for providing 1B untrained model.
|
84 |
+
* Mistral Team for providing the best open source base model ever.
|
85 |
+
* _Sina Rashidi_, who translated Alpaca dataset to Persian.
|
86 |
+
* [Jupyto](https://jupyto.com) team for providing our infrastructure.
|