zRzRzRzRzRzRzR commited on
Commit
3a397f1
·
1 Parent(s): 363ef68
Files changed (3) hide show
  1. .gitattributes +1 -0
  2. LICENSE +21 -0
  3. README.md +52 -0
.gitattributes CHANGED
@@ -33,3 +33,4 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
33
  *.zip filter=lfs diff=lfs merge=lfs -text
34
  *.zst filter=lfs diff=lfs merge=lfs -text
35
  *tfevents* filter=lfs diff=lfs merge=lfs -text
 
 
33
  *.zip filter=lfs diff=lfs merge=lfs -text
34
  *.zst filter=lfs diff=lfs merge=lfs -text
35
  *tfevents* filter=lfs diff=lfs merge=lfs -text
36
+ tokenizer.json filter=lfs diff=lfs merge=lfs -text
LICENSE ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ MIT License
2
+
3
+ Copyright (c) 2025 zAI
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
README.md ADDED
@@ -0,0 +1,52 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: mit
3
+ language:
4
+ - zh
5
+ - en
6
+ pipeline_tag: text-generation
7
+ library_name: transformers
8
+ ---
9
+
10
+ # GLM-4-32B-0414
11
+
12
+ ## Installation
13
+
14
+ Install the transformers library from the source code:
15
+
16
+ ```shell
17
+ pip install git+https://github.com/huggingface/transformers.git
18
+ ```
19
+
20
+ ## Inference Code
21
+
22
+ ```python
23
+ from transformers import AutoModelForCausalLM, AutoTokenizer
24
+
25
+ MODEL_PATH = "THUDM/GLM-4-32B-0414-Chat"
26
+
27
+ tokenizer = AutoTokenizer.from_pretrained(MODEL_PATH)
28
+ model = AutoModelForCausalLM.from_pretrained(MODEL_PATH, device_map="auto")
29
+
30
+ message = [{"role": "user", "content": "hello!"}]
31
+
32
+ inputs = tokenizer.apply_chat_template(
33
+ message,
34
+ return_tensors="pt",
35
+ add_generation_prompt=True,
36
+ return_dict=True,
37
+ ).to(model.device)
38
+
39
+ generate_kwargs = {
40
+ "input_ids": inputs["input_ids"],
41
+ "attention_mask": inputs["attention_mask"],
42
+ "max_new_tokens": 128,
43
+ "do_sample": False,
44
+ }
45
+ out = model.generate(**generate_kwargs)
46
+ print(tokenizer.decode(out[0][inputs["input_ids"].shape[1]:], skip_special_tokens=True))
47
+
48
+ ```
49
+
50
+ ## License
51
+
52
+ The usage of this model’s weights is subject to the terms outlined in the [LICENSE](LICENSE).