We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
模型:T5-base 参数:beam-search 环境:A10 / paddle2.4 / paddlenlp-最新develop分支
使用代码: def process(context, predictor, tokenizer, use_fast=False): input_seq = f"根据信息生成评论\n {context} \n评论:" inputs = tokenizer( input_seq, max_seq_len=512, pad_to_max_seq_len=True, truncation_strategy="longest_first", return_attention_mask=True, return_length=True, ) input_ids = paddle.Tensor(np.array(inputs["input_ids"])).reshape([1, 512]) preds, _ = predictor.generate( input_ids=input_ids, max_length=768, decode_strategy="beam_search", num_beams=5, # top_k = 5, # top_p = 0.7, use_fast=use_fast, use_fp16_decoding=True, decoding_lib="so/libdecoding_op.so", ) preds = preds.numpy() decoded_preds = postprocess(tokenizer, [preds]) result = decoded_preds[0][0] return result
结果: use_fast=False, 连续跑多次结果如下: 故宫是中国古代宫廷建筑的代表之一,其宏伟壮观的建筑风格和精美的雕刻工艺令人叹为观止。在这里,你可以感受到中国古代帝王的尊严和荣耀,也可以领略到中国古代文化的博大精深。无论是建筑还是文物,故宫都值得一游。 6.848419666290283 False 故宫是中国古代宫廷建筑的代表之一,其宏伟壮观的建筑风格和精美的雕刻工艺令人叹为观止。在这里,你可以感受到中国古代帝王的尊严和荣耀,也可以领略到中国古代文化的博大精深。无论是建筑还是文物,故宫都值得一游。 2.7139511108398438 False
use_fast=True,连续跑多次结果如下: 漫步在故宫,感受着迷的美景,仿佛置身于世外。这里。这里的景色如画般的美景,让人心旷神怡。在这里,我仿佛能够感受到大自然的恩赐,也能够感受到人与自然的和谐共生。来到这里,仿佛所有的烦恼都被抛到了脑后,心情也变得美好的回忆。 8.664758920669556 True 漫步在故宫,感受着迷的美景,仿佛置身于世外。这里。这里的景色如画般的美景,让人心旷神怡。在这里,我仿佛能够感受到大自然的恩赐,也能够感受到人与自然的和谐共生。来到这里,仿佛所有的烦恼都被抛到了脑后,心情也变得美好的回忆。 0.1344606876373291 True 漫步在故宫,感受着迷的美景,仿佛置身于世外。这里。这里的景色如画般的美景,让人心旷神怡。在这里,我仿佛能够感受到大自然的恩赐,也能够感受到人与自然的和谐共生。来到这里,仿佛所有的烦恼都被抛到了脑后,心情也变得美好的回忆。 0.13270115852355957 True
现象: 重复多次结果是稳定可复现的, fast模式下耗时135ms, non-fast模式2500ms
The text was updated successfully, but these errors were encountered:
您好,faster generation停止维护了,欢迎开发者贡献
Sorry, something went wrong.
w5688414
wawltor
No branches or pull requests
请提出你的问题
模型:T5-base
参数:beam-search
环境:A10 / paddle2.4 / paddlenlp-最新develop分支
使用代码:
def process(context, predictor, tokenizer, use_fast=False):
input_seq = f"根据信息生成评论\n {context} \n评论:"
inputs = tokenizer(
input_seq,
max_seq_len=512,
pad_to_max_seq_len=True,
truncation_strategy="longest_first",
return_attention_mask=True,
return_length=True,
)
input_ids = paddle.Tensor(np.array(inputs["input_ids"])).reshape([1, 512])
preds, _ = predictor.generate(
input_ids=input_ids,
max_length=768,
decode_strategy="beam_search",
num_beams=5,
# top_k = 5,
# top_p = 0.7,
use_fast=use_fast,
use_fp16_decoding=True,
decoding_lib="so/libdecoding_op.so",
)
preds = preds.numpy()
decoded_preds = postprocess(tokenizer, [preds])
result = decoded_preds[0][0]
return result
结果:
use_fast=False, 连续跑多次结果如下:
故宫是中国古代宫廷建筑的代表之一,其宏伟壮观的建筑风格和精美的雕刻工艺令人叹为观止。在这里,你可以感受到中国古代帝王的尊严和荣耀,也可以领略到中国古代文化的博大精深。无论是建筑还是文物,故宫都值得一游。 6.848419666290283 False
故宫是中国古代宫廷建筑的代表之一,其宏伟壮观的建筑风格和精美的雕刻工艺令人叹为观止。在这里,你可以感受到中国古代帝王的尊严和荣耀,也可以领略到中国古代文化的博大精深。无论是建筑还是文物,故宫都值得一游。 2.7139511108398438 False
use_fast=True,连续跑多次结果如下:
漫步在故宫,感受着迷的美景,仿佛置身于世外。这里。这里的景色如画般的美景,让人心旷神怡。在这里,我仿佛能够感受到大自然的恩赐,也能够感受到人与自然的和谐共生。来到这里,仿佛所有的烦恼都被抛到了脑后,心情也变得美好的回忆。 8.664758920669556 True
漫步在故宫,感受着迷的美景,仿佛置身于世外。这里。这里的景色如画般的美景,让人心旷神怡。在这里,我仿佛能够感受到大自然的恩赐,也能够感受到人与自然的和谐共生。来到这里,仿佛所有的烦恼都被抛到了脑后,心情也变得美好的回忆。 0.1344606876373291 True
漫步在故宫,感受着迷的美景,仿佛置身于世外。这里。这里的景色如画般的美景,让人心旷神怡。在这里,我仿佛能够感受到大自然的恩赐,也能够感受到人与自然的和谐共生。来到这里,仿佛所有的烦恼都被抛到了脑后,心情也变得美好的回忆。 0.13270115852355957 True
现象:
重复多次结果是稳定可复现的, fast模式下耗时135ms, non-fast模式2500ms
The text was updated successfully, but these errors were encountered: