doubility123 commited on
Commit
86f746b
·
1 Parent(s): 0cd0d27

Add thinking-mode encoding example and change default interactive temperature to 1.0

Browse files
encoding/README.md CHANGED
@@ -21,11 +21,26 @@ messages = [{
21
  ],
22
  }]
23
 
 
24
  prompt, media = encode_messages(
25
  messages,
26
  thinking_mode="chat",
27
  return_multi_modal_data=True,
28
  )
 
 
 
 
 
 
 
 
 
 
 
 
 
 
29
  ```
30
 
31
  Images are represented in the prompt by `<|deepseek_image|>`. `media["images"]`
 
21
  ],
22
  }]
23
 
24
+ # non-thinking
25
  prompt, media = encode_messages(
26
  messages,
27
  thinking_mode="chat",
28
  return_multi_modal_data=True,
29
  )
30
+ # prompt:
31
+ # '<|begin▁of▁sentence|><|User|>第一张图\n\n<|deepseek_image|>\n\n有什么内容?<|Assistant|></think>'
32
+
33
+
34
+ # # thinking with `max` reasoning_effort
35
+ # prompt, media = encode_messages(
36
+ # messages,
37
+ # thinking_mode="thinking",
38
+ # reasoning_effort="max",
39
+ # return_multi_modal_data=True,
40
+ # )
41
+ # prompt:
42
+ # <|begin▁of▁sentence|>Reasoning Effort: Beyond maximum — exhaustive, relentless, and uncompromising.\nYou MUST reason with the utmost depth and rigor, leaving absolutely nothing to chance: exhaustively decompose the problem into its most fundamental components, trace every causal chain to its root, and resolve the underlying cause rather than any surface symptom.\nDo not stop reasoning until you have independently verified the solution from multiple angles and are certain that no assumption remains unchecked and no error remains undiscovered.\n\n<|User|>第一张图\n\n<|deepseek_image|>\n\n有什么内容?<|Assistant|><think>
43
+
44
  ```
45
 
46
  Images are represented in the prompt by `<|deepseek_image|>`. `media["images"]`
inference/README.md CHANGED
@@ -53,7 +53,7 @@ torchrun --nproc-per-node "${MP}" generate.py \
53
  --ckpt-path "${CKPT_PATH}" \
54
  --config config.json \
55
  --interactive \
56
- --temperature 0.6
57
  ```
58
 
59
  For multi-node execution, pass the usual `torchrun --nnodes`, `--node-rank`,
 
53
  --ckpt-path "${CKPT_PATH}" \
54
  --config config.json \
55
  --interactive \
56
+ --temperature 1.0
57
  ```
58
 
59
  For multi-node execution, pass the usual `torchrun --nnodes`, `--node-rank`,
inference/generate.py CHANGED
@@ -198,12 +198,12 @@ if __name__ == "__main__":
198
  parser.add_argument("--interactive", action="store_true")
199
  parser.add_argument("--thinking-mode", type=str, default="chat", choices=["chat", "thinking"])
200
  parser.add_argument("--max-new-tokens", type=int, default=None, help="default: 16384 for .json input, 200 otherwise")
201
- parser.add_argument("--temperature", type=float, default=None, help="default: 0.99 for .json input, 0.6 otherwise")
202
  args = parser.parse_args()
203
  assert args.input_file or args.interactive, "Either input-file or interactive mode must be specified"
204
  json_input = args.input_file.endswith(".json")
205
  if args.max_new_tokens is None:
206
  args.max_new_tokens = 16384 if json_input else 200
207
  if args.temperature is None:
208
- args.temperature = 0.99 if json_input else 0.6
209
  main(args.ckpt_path, args.config, args.input_file, args.interactive, args.max_new_tokens, args.temperature, args.thinking_mode)
 
198
  parser.add_argument("--interactive", action="store_true")
199
  parser.add_argument("--thinking-mode", type=str, default="chat", choices=["chat", "thinking"])
200
  parser.add_argument("--max-new-tokens", type=int, default=None, help="default: 16384 for .json input, 200 otherwise")
201
+ parser.add_argument("--temperature", type=float, default=None, help="default: 0.99 for .json input, 1.0 otherwise")
202
  args = parser.parse_args()
203
  assert args.input_file or args.interactive, "Either input-file or interactive mode must be specified"
204
  json_input = args.input_file.endswith(".json")
205
  if args.max_new_tokens is None:
206
  args.max_new_tokens = 16384 if json_input else 200
207
  if args.temperature is None:
208
+ args.temperature = 0.99 if json_input else 1.0
209
  main(args.ckpt_path, args.config, args.input_file, args.interactive, args.max_new_tokens, args.temperature, args.thinking_mode)