zRzRzRzRzRzRzR commited on
Commit
013871a
·
1 Parent(s): 6913792
Files changed (2) hide show
  1. LICENSE +1 -1
  2. README.md +44 -50
LICENSE CHANGED
@@ -1,6 +1,6 @@
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
 
1
  MIT License
2
 
3
+ Copyright (c) 2025 Zhipu AI
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
README.md CHANGED
@@ -1,51 +1,45 @@
1
- ---
2
- license: mit
3
- language:
4
- - zh
5
- - en
6
- pipeline_tag: text-generation
7
- library_name: transformers
8
- ---
9
-
10
- # GLM-4-Z1-32B-0414
11
-
12
- ## Introduction
13
-
14
- Based on our latest technological advancements, we have trained a `GLM-4-0414` series model. During pretraining, we incorporated more code-related and reasoning-related data. In the alignment phase, we optimized the model specifically for agent capabilities. As a result, the model's performance in agent tasks such as tool use, web search, and coding has been significantly improved.
15
-
16
- ## Installation
17
-
18
- Install the transformers library from the source code:
19
-
20
- ```shell
21
- pip install git+https://github.com/huggingface/transformers.git
22
- ```
23
-
24
- ## Inference Code
25
-
26
- ```python
27
- from transformers import AutoModelForCausalLM, AutoTokenizer
28
-
29
- MODEL_PATH = "THUDM/GLM-4-Z1-32B-0414"
30
-
31
- tokenizer = AutoTokenizer.from_pretrained(MODEL_PATH)
32
- model = AutoModelForCausalLM.from_pretrained(MODEL_PATH, device_map="auto")
33
-
34
- message = [{"role": "user", "content": "Let a, b be positive real numbers such that ab = a + b + 3. Determine the range of possible values for a + b."}]
35
-
36
- inputs = tokenizer.apply_chat_template(
37
- message,
38
- return_tensors="pt",
39
- add_generation_prompt=True,
40
- return_dict=True,
41
- ).to(model.device)
42
-
43
- generate_kwargs = {
44
- "input_ids": inputs["input_ids"],
45
- "attention_mask": inputs["attention_mask"],
46
- "max_new_tokens": 4096,
47
- "do_sample": False,
48
- }
49
- out = model.generate(**generate_kwargs)
50
- print(tokenizer.decode(out[0][inputs["input_ids"].shape[1]:], skip_special_tokens=True))
51
  ```
 
1
+ ---
2
+ license: mit
3
+ language:
4
+ - zh
5
+ - en
6
+ pipeline_tag: text-generation
7
+ library_name: transformers
8
+ ---
9
+
10
+ # GLM-4-Z1-32B-0414
11
+
12
+ ## Introduction
13
+
14
+ Based on our latest technological advancements, we have trained a `GLM-4-0414` series model. During pretraining, we incorporated more code-related and reasoning-related data. In the alignment phase, we optimized the model specifically for agent capabilities. As a result, the model's performance in agent tasks such as tool use, web search, and coding has been significantly improved.
15
+
16
+ ## Inference Code
17
+
18
+ Make Sure Using `transforemrs>=4.51.3`.
19
+
20
+ ```python
21
+ from transformers import AutoModelForCausalLM, AutoTokenizer
22
+
23
+ MODEL_PATH = "THUDM/GLM-4-Z1-32B-0414"
24
+
25
+ tokenizer = AutoTokenizer.from_pretrained(MODEL_PATH)
26
+ model = AutoModelForCausalLM.from_pretrained(MODEL_PATH, device_map="auto")
27
+
28
+ message = [{"role": "user", "content": "Let a, b be positive real numbers such that ab = a + b + 3. Determine the range of possible values for a + b."}]
29
+
30
+ inputs = tokenizer.apply_chat_template(
31
+ message,
32
+ return_tensors="pt",
33
+ add_generation_prompt=True,
34
+ return_dict=True,
35
+ ).to(model.device)
36
+
37
+ generate_kwargs = {
38
+ "input_ids": inputs["input_ids"],
39
+ "attention_mask": inputs["attention_mask"],
40
+ "max_new_tokens": 4096,
41
+ "do_sample": False,
42
+ }
43
+ out = model.generate(**generate_kwargs)
44
+ print(tokenizer.decode(out[0][inputs["input_ids"].shape[1]:], skip_special_tokens=True))
 
 
 
 
 
 
45
  ```