DavidLanz commited on
Commit
abb0547
1 Parent(s): 6a3f19a

Upload folder using huggingface_hub

Browse files
Files changed (5) hide show
  1. README.md +52 -51
  2. config.json +1 -1
  3. generation_config.json +1 -1
  4. model.safetensors +1 -1
  5. tokenizer.json +0 -0
README.md CHANGED
@@ -1,51 +1,52 @@
1
- ---
2
- library_name: transformers
3
- license: apache-2.0
4
- datasets:
5
- - DavidLanz/TaiwanChat
6
- language:
7
- - zh
8
- widget:
9
- - text: '在很久以前,這座島上'
10
- example_title: Example1
11
-
12
- ---
13
-
14
- # Model Card for Model ID
15
-
16
- This is a continue-pretrained version of [Tinyllama](TinyLlama/TinyLlama-1.1B-intermediate-step-1431k-3T) tailored for traditional Chinese. The continue-pretraining dataset contains roughly 2B tokens.
17
-
18
- # Usage
19
- ```python
20
- from transformers import AutoModelForCausalLM, AutoTokenizer
21
- import torch
22
-
23
- def generate_response(input):
24
- '''
25
- simple test for the model
26
- '''
27
- # tokenzize the input
28
- tokenized_input = tokenizer.encode_plus(input, return_tensors='pt').to(device)
29
-
30
- # generate the response
31
- outputs = model.generate(
32
- input_ids=tokenized_input['input_ids'],
33
- attention_mask=tokenized_input['attention_mask'],
34
- pad_token_id=tokenizer.pad_token_id,
35
- do_sample=False,
36
- repetition_penalty=1.3,
37
- max_length=500
38
- )
39
-
40
- # decode the response
41
- return tokenizer.decode(outputs[0], skip_special_tokens=True)
42
-
43
- if __name__ == '__main__':
44
- device = 'cuda' if torch.cuda.is_available() else 'cpu'
45
- model = AutoModelForCausalLM.from_pretrained("DavidLanz/Taiwan-tinyllama-v1.0-chat",device_map=device,torch_dtype=torch.bfloat16)
46
- tokenizer = AutoTokenizer.from_pretrained("DavidLanz/Taiwan-tinyllama-v1.0-chat")
47
- while(True):
48
- text = input("input a simple prompt:")
49
- print('System:', generate_response(text))
50
- ```
51
- Using bfloat16, the VRAM required is around 3GB!!!
 
 
1
+ ---
2
+ library_name: transformers
3
+ license: apache-2.0
4
+ datasets:
5
+ - benchang1110/pretrainedtw
6
+ - HuggingFaceTB/cosmopedia-100k
7
+ language:
8
+ - zh
9
+ widget:
10
+ - text: '在很久以前,這座島上'
11
+ example_title: Example1
12
+
13
+ ---
14
+
15
+ # Model Card for Model ID
16
+
17
+ This is a continue-pretrained version of [Tinyllama](TinyLlama/TinyLlama-1.1B-intermediate-step-1431k-3T) tailored for traditional Chinese. The continue-pretraining dataset contains roughly 2B tokens.
18
+
19
+ # Usage
20
+ ```python
21
+ from transformers import AutoModelForCausalLM, AutoTokenizer
22
+ import torch
23
+
24
+ def generate_response(input):
25
+ '''
26
+ simple test for the model
27
+ '''
28
+ # tokenzize the input
29
+ tokenized_input = tokenizer.encode_plus(input, return_tensors='pt').to(device)
30
+
31
+ # generate the response
32
+ outputs = model.generate(
33
+ input_ids=tokenized_input['input_ids'],
34
+ attention_mask=tokenized_input['attention_mask'],
35
+ pad_token_id=tokenizer.pad_token_id,
36
+ do_sample=False,
37
+ repetition_penalty=1.3,
38
+ max_length=500
39
+ )
40
+
41
+ # decode the response
42
+ return tokenizer.decode(outputs[0], skip_special_tokens=True)
43
+
44
+ if __name__ == '__main__':
45
+ device = 'cuda' if torch.cuda.is_available() else 'cpu'
46
+ model = AutoModelForCausalLM.from_pretrained("DavidLanz/Taiwan-tinyllama-v1.0-chat",device_map=device,torch_dtype=torch.bfloat16)
47
+ tokenizer = AutoTokenizer.from_pretrained("DavidLanz/Taiwan-tinyllama-v1.0-chat")
48
+ while(True):
49
+ text = input("input a simple prompt:")
50
+ print('System:', generate_response(text))
51
+ ```
52
+ Using bfloat16, the VRAM required is around 3GB!!!
config.json CHANGED
@@ -23,7 +23,7 @@
23
  "rope_theta": 10000.0,
24
  "tie_word_embeddings": false,
25
  "torch_dtype": "float16",
26
- "transformers_version": "4.42.4",
27
  "use_cache": true,
28
  "vocab_size": 32000
29
  }
 
23
  "rope_theta": 10000.0,
24
  "tie_word_embeddings": false,
25
  "torch_dtype": "float16",
26
+ "transformers_version": "4.44.2",
27
  "use_cache": true,
28
  "vocab_size": 32000
29
  }
generation_config.json CHANGED
@@ -3,5 +3,5 @@
3
  "eos_token_id": 2,
4
  "max_length": 2048,
5
  "pad_token_id": 0,
6
- "transformers_version": "4.42.4"
7
  }
 
3
  "eos_token_id": 2,
4
  "max_length": 2048,
5
  "pad_token_id": 0,
6
+ "transformers_version": "4.44.2"
7
  }
model.safetensors CHANGED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:b1a94d4b9f73a917dbdb49a338eed27426a187b1e1e40794810ce5afe1c10926
3
  size 2200119664
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:13874894c02bd920b5b31e1b4ce044aed98f3c0d3fa27ba9db3f5fe83e71ff02
3
  size 2200119664
tokenizer.json CHANGED
The diff for this file is too large to render. See raw diff