Skip to content

Commit 332da6b

Browse files
author
gongenlei
authored
Update codegen params and doc (#3228)
* update decoding * update doc
1 parent f0c64b8 commit 332da6b

File tree

2 files changed

+9
-5
lines changed

2 files changed

+9
-5
lines changed

examples/code_generation/codegen/README.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,13 @@
3838

3939

4040
## 效果展示
41-
- 解算法题。求解无重复字符的最长子串的长度
41+
42+
- Github Copilot代码提示效果展示
43+
<p align="center">
44+
<img src="https://user-images.githubusercontent.com/24390500/189046785-6c04a3c3-ce89-4684-9aff-a7dc2e7a7041.gif"/> <br />
45+
</p>
46+
47+
- 解算法题效果展示。求解无重复字符的最长子串的长度
4248
```python
4349
from paddlenlp import Taskflow
4450

examples/code_generation/codegen/codegen_server.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ class DefaultConfig:
3232
repetition_penalty = 1.0
3333
min_length = 0
3434
max_length = 16
35-
decode_strategy = "sampling"
35+
decode_strategy = "greedy_search"
3636
load_state_as_np = True
3737
use_faster = True
3838
use_fp16_decoding = True
@@ -104,9 +104,7 @@ async def gen(item: Input):
104104
logger.info("Finish generating code")
105105
end_time = time.time()
106106
logger.info(f"Time cost: {end_time - start_time}")
107-
output = tokenizer.decode(output[0],
108-
skip_special_tokens=True,
109-
spaces_between_special_tokens=False)
107+
output = tokenizer.decode(output[0], skip_special_tokens=True)
110108
logger.info(f"Generated code: {output}")
111109
output_json = Output(
112110
id=random_completion_id(),

0 commit comments

Comments
 (0)