Mxode commited on
Commit
62478da
1 Parent(s): 82ad392

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +97 -94
README.md CHANGED
@@ -1,94 +1,97 @@
1
- ---
2
- license: gpl-3.0
3
- language:
4
- - en
5
- ---
6
- # NanoLM-25M-Instruct-v1.1
7
-
8
-
9
- English | [简体中文](README_zh-CN.md)
10
-
11
-
12
- ## Introduction
13
-
14
- In order to explore the potential of small models, I have attempted to build a series of them, which are available in the [NanoLM Collections](https://huggingface.co/collections/Mxode/nanolm-66d6d75b4a69536bca2705b2).
15
-
16
- This is NanoLM-25M-Instruct-v1.1. The model currently supports **English only**.
17
-
18
-
19
-
20
- ## Model Details
21
-
22
- | Nano LMs | Non-emb Params | Arch | Layers | Dim | Heads | Seq Len |
23
- | :----------: | :------------------: | :---: | :----: | :-------: | :---: | :---: |
24
- | **25M** | **15M** | **MistralForCausalLM** | **12** | **312** | **12** | **2K** |
25
- | 70M | 42M | LlamaForCausalLM | 12 | 576 | 9 |2K|
26
- | 0.3B | 180M | Qwen2ForCausalLM | 12 | 896 | 14 |4K|
27
- | 1B | 840M | Qwen2ForCausalLM | 18 | 1536 | 12 |4K|
28
-
29
-
30
-
31
- ## How to use
32
-
33
- ```python
34
- import torch
35
- from transformers import AutoModelForCausalLM, AutoTokenizer
36
-
37
- model_path = 'Mxode/NanoLM-25M-Instruct-v1.1'
38
-
39
- model = AutoModelForCausalLM.from_pretrained(model_path).to('cuda:0', torch.bfloat16)
40
- tokenizer = AutoTokenizer.from_pretrained(model_path)
41
-
42
-
43
- def get_response(prompt: str, **kwargs):
44
- generation_args = dict(
45
- max_new_tokens = kwargs.pop("max_new_tokens", 512),
46
- do_sample = kwargs.pop("do_sample", True),
47
- temperature = kwargs.pop("temperature", 0.7),
48
- top_p = kwargs.pop("top_p", 0.8),
49
- top_k = kwargs.pop("top_k", 40),
50
- **kwargs
51
- )
52
-
53
- messages = [
54
- {"role": "system", "content": "You are a helpful assistant."},
55
- {"role": "user", "content": prompt}
56
- ]
57
- text = tokenizer.apply_chat_template(
58
- messages,
59
- tokenize=False,
60
- add_generation_prompt=True
61
- )
62
- model_inputs = tokenizer([text], return_tensors="pt").to(model.device)
63
-
64
- generated_ids = model.generate(model_inputs.input_ids, **generation_args)
65
- generated_ids = [
66
- output_ids[len(input_ids):] for input_ids, output_ids in zip(model_inputs.input_ids, generated_ids)
67
- ]
68
-
69
- response = tokenizer.batch_decode(generated_ids, skip_special_tokens=True)[0]
70
- return response
71
-
72
-
73
- prompt1 = "What can you do for me?"
74
- print(get_response(prompt1, do_sample=False))
75
-
76
- """
77
- I'm so glad you asked! I'm a large language model, so I don't have personal experiences or emotions, but I can provide information and assist with tasks to help with your tasks.
78
-
79
- Here are some ways I can assist you:
80
-
81
- 1. **Answer questions**: I can provide information on a wide range of topics, from science and history to entertainment and culture.
82
- 2. **Generate text**: I can create text based on a prompt or topic, and can even help with writing tasks such as proofreading and editing.
83
- 3. **Translate text**: I can translate text from one language to another, including popular languages such as Spanish, French, German, Chinese, and many more.
84
- 4. **Summarize content**: I can summarize long pieces of text, such as articles or documents, into shorter, more digestible versions.
85
- 5. **Offer suggestions**: I can provide suggestions for things like gift ideas, travel destinations, books, or movies.
86
- 6. **Chat and converse**: I can engage in natural-sounding conversations, using context and understanding to respond to questions and statements.
87
- 7. **Play games**: I can play simple text-based games, such as 20 Questions, Hangman, or Word Jumble.
88
- 8. **Provide definitions**: I can define words and phrases, explaining their meanings and usage.
89
- 9. **Offer suggestions**: I can provide suggestions for things like gift ideas, travel destinations, or books to read.
90
- 10. **Entertain**: I can engage in fun conversations, tell jokes, and even create simple games or puzzles.
91
-
92
- Which of these methods would you like to do?
93
- """
94
- ```
 
 
 
 
1
+ ---
2
+ license: gpl-3.0
3
+ language:
4
+ - en
5
+ datasets:
6
+ - Mxode/Magpie-Pro-10K-GPT4o-mini
7
+ pipeline_tag: text2text-generation
8
+ ---
9
+ # NanoLM-25M-Instruct-v1.1
10
+
11
+
12
+ English | [简体中文](README_zh-CN.md)
13
+
14
+
15
+ ## Introduction
16
+
17
+ In order to explore the potential of small models, I have attempted to build a series of them, which are available in the [NanoLM Collections](https://huggingface.co/collections/Mxode/nanolm-66d6d75b4a69536bca2705b2).
18
+
19
+ This is NanoLM-25M-Instruct-v1.1. The model currently supports **English only**.
20
+
21
+
22
+
23
+ ## Model Details
24
+
25
+ | Nano LMs | Non-emb Params | Arch | Layers | Dim | Heads | Seq Len |
26
+ | :----------: | :------------------: | :---: | :----: | :-------: | :---: | :---: |
27
+ | **25M** | **15M** | **MistralForCausalLM** | **12** | **312** | **12** | **2K** |
28
+ | 70M | 42M | LlamaForCausalLM | 12 | 576 | 9 |2K|
29
+ | 0.3B | 180M | Qwen2ForCausalLM | 12 | 896 | 14 |4K|
30
+ | 1B | 840M | Qwen2ForCausalLM | 18 | 1536 | 12 |4K|
31
+
32
+
33
+
34
+ ## How to use
35
+
36
+ ```python
37
+ import torch
38
+ from transformers import AutoModelForCausalLM, AutoTokenizer
39
+
40
+ model_path = 'Mxode/NanoLM-25M-Instruct-v1.1'
41
+
42
+ model = AutoModelForCausalLM.from_pretrained(model_path).to('cuda:0', torch.bfloat16)
43
+ tokenizer = AutoTokenizer.from_pretrained(model_path)
44
+
45
+
46
+ def get_response(prompt: str, **kwargs):
47
+ generation_args = dict(
48
+ max_new_tokens = kwargs.pop("max_new_tokens", 512),
49
+ do_sample = kwargs.pop("do_sample", True),
50
+ temperature = kwargs.pop("temperature", 0.7),
51
+ top_p = kwargs.pop("top_p", 0.8),
52
+ top_k = kwargs.pop("top_k", 40),
53
+ **kwargs
54
+ )
55
+
56
+ messages = [
57
+ {"role": "system", "content": "You are a helpful assistant."},
58
+ {"role": "user", "content": prompt}
59
+ ]
60
+ text = tokenizer.apply_chat_template(
61
+ messages,
62
+ tokenize=False,
63
+ add_generation_prompt=True
64
+ )
65
+ model_inputs = tokenizer([text], return_tensors="pt").to(model.device)
66
+
67
+ generated_ids = model.generate(model_inputs.input_ids, **generation_args)
68
+ generated_ids = [
69
+ output_ids[len(input_ids):] for input_ids, output_ids in zip(model_inputs.input_ids, generated_ids)
70
+ ]
71
+
72
+ response = tokenizer.batch_decode(generated_ids, skip_special_tokens=True)[0]
73
+ return response
74
+
75
+
76
+ prompt1 = "What can you do for me?"
77
+ print(get_response(prompt1, do_sample=False))
78
+
79
+ """
80
+ I'm so glad you asked! I'm a large language model, so I don't have personal experiences or emotions, but I can provide information and assist with tasks to help with your tasks.
81
+
82
+ Here are some ways I can assist you:
83
+
84
+ 1. **Answer questions**: I can provide information on a wide range of topics, from science and history to entertainment and culture.
85
+ 2. **Generate text**: I can create text based on a prompt or topic, and can even help with writing tasks such as proofreading and editing.
86
+ 3. **Translate text**: I can translate text from one language to another, including popular languages such as Spanish, French, German, Chinese, and many more.
87
+ 4. **Summarize content**: I can summarize long pieces of text, such as articles or documents, into shorter, more digestible versions.
88
+ 5. **Offer suggestions**: I can provide suggestions for things like gift ideas, travel destinations, books, or movies.
89
+ 6. **Chat and converse**: I can engage in natural-sounding conversations, using context and understanding to respond to questions and statements.
90
+ 7. **Play games**: I can play simple text-based games, such as 20 Questions, Hangman, or Word Jumble.
91
+ 8. **Provide definitions**: I can define words and phrases, explaining their meanings and usage.
92
+ 9. **Offer suggestions**: I can provide suggestions for things like gift ideas, travel destinations, or books to read.
93
+ 10. **Entertain**: I can engage in fun conversations, tell jokes, and even create simple games or puzzles.
94
+
95
+ Which of these methods would you like to do?
96
+ """
97
+ ```