funmaker commited on
Commit
62b9b3b
·
1 Parent(s): abe115e

Enhance README with sampling parameter recommendations and Llama.cpp usage examples

Browse files
Files changed (2) hide show
  1. README-cn.md +26 -0
  2. README.md +27 -1
README-cn.md CHANGED
@@ -268,6 +268,13 @@ MiniCPM5-2B 的训练过程是 **[UltraData 分级数据管理体系](https://ar
268
 
269
  ## 快速上手
270
 
 
 
 
 
 
 
 
271
  ### vLLM
272
 
273
  ```bash
@@ -315,6 +322,25 @@ python -m sglang.launch_server \
315
  --speculative-dspark-block-size 7 \
316
  --port 30000
317
  ```
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
318
 
319
  ### Transformers
320
 
 
268
 
269
  ## 快速上手
270
 
271
+ > [!Tip]
272
+ > 我们建议在生成时使用以下采样参数组合:`temperature=1.0, top_p=0.95, min_p=0.0`。
273
+ >
274
+ > 如果遇到重复输出,请尝试:`temperature=1.0, top_p=0.95, min_p=0.0, repetition_penalty=1.05`。
275
+ >
276
+ > 请注意,不同推理框架对采样参数的支持程度有所差异。
277
+
278
  ### vLLM
279
 
280
  ```bash
 
322
  --speculative-dspark-block-size 7 \
323
  --port 30000
324
  ```
325
+ ### Llama.cpp
326
+
327
+ ```bash
328
+ llama-server -m MiniCPM5-2B-F16.gguf -a MiniCPM5-2B --port 8080 -ngl 99 -c 8192 --jinja
329
+ ```
330
+
331
+ 在这个例子里 `-c 8192` 设置了上下文长度为 8192,可以根据需要修改上下文长度。
332
+
333
+ ```bash
334
+ curl http://localhost:8080/v1/chat/completions \
335
+ -H "Content-Type: application/json" \
336
+ -d '{
337
+ "model": "MiniCPM5-2B",
338
+ "messages": [{"role": "user", "content": "1+1=?"}],
339
+ "temperature": 1.0, "top_p": 0.95, "min_p": 0.0, "max_tokens": 256
340
+ }'
341
+ ```
342
+
343
+ llama.cpp 默认设置 `min_p=0.05`,会过滤掉概率低于最高概率 token 5% 的 token。这种过滤反而可能引发重复——它恰恰过滤掉了模型摆脱重复循环所需的那些 token。我们明确将 `min_p` 设为 `0.0` 以禁用该过滤。
344
 
345
  ### Transformers
346
 
README.md CHANGED
@@ -279,6 +279,13 @@ During **post-training**, we proceed in three steps: **SFT**, **RL**, and **OPD*
279
 
280
  ## Quickstart
281
 
 
 
 
 
 
 
 
282
  ### vLLM
283
 
284
  ```bash
@@ -327,6 +334,26 @@ python -m sglang.launch_server \
327
  --port 30000
328
  ```
329
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
330
  ### Transformers
331
 
332
  ```bash
@@ -355,7 +382,6 @@ outputs = model.generate(**inputs, max_new_tokens=128)
355
  print(tokenizer.decode(outputs[0][inputs["input_ids"].shape[-1]:], skip_special_tokens=True))
356
  ```
357
 
358
- Recommended sampling params: `temperature=1.0, top_p=0.95`
359
 
360
  ## Tool Calling
361
 
 
279
 
280
  ## Quickstart
281
 
282
+ > [!Tip]
283
+ > We recommend using the following sets of sampling parameters for generation: `temperature=1.0, top_p=0.95, min_p=0.0`.
284
+ >
285
+ > If you encounter repetitive outputs, try: `temperature=1.0, top_p=0.95, min_p=0.0, repetition_penalty=1.05`.
286
+ >
287
+ > Please note that the support for sampling parameters varies according to inference frameworks.
288
+
289
  ### vLLM
290
 
291
  ```bash
 
334
  --port 30000
335
  ```
336
 
337
+ ### Llama.cpp
338
+
339
+ ```bash
340
+ llama-server -m MiniCPM5-2B-F16.gguf -a MiniCPM5-2B --port 8080 -ngl 99 -c 8192 --jinja
341
+ ```
342
+
343
+ `-c 8192` sets the context length. You can adjust this value as needed.
344
+
345
+ ```bash
346
+ curl http://localhost:8080/v1/chat/completions \
347
+ -H "Content-Type: application/json" \
348
+ -d '{
349
+ "model": "MiniCPM5-2B",
350
+ "messages": [{"role": "user", "content": "1+1=?"}],
351
+ "temperature": 1.0, "top_p": 0.95, "min_p": 0.0, "max_tokens": 256
352
+ }'
353
+ ```
354
+
355
+ In llama.cpp, the default `min_p=0.05` can lead to repetitive output: it filters out tokens whose probability is below 5% of the highest-probability token, potentially discarding the exact tokens needed to break out of a repetition loop. To prevent this, we set `min_p=0.0`.
356
+
357
  ### Transformers
358
 
359
  ```bash
 
382
  print(tokenizer.decode(outputs[0][inputs["input_ids"].shape[-1]:], skip_special_tokens=True))
383
  ```
384
 
 
385
 
386
  ## Tool Calling
387