DESC: fix infer
This commit is contained in:
parent
6f0e9b4195
commit
30aa84f057
@ -944,17 +944,6 @@ class DeepseekOCRForCausalLM(DeepseekV2ForCausalLM):
|
||||
no_repeat_ngram_size = 35,
|
||||
use_cache = True
|
||||
)
|
||||
|
||||
|
||||
if '<image>' in conversation[0]['content'] and eval_mode:
|
||||
outputs = tokenizer.decode(output_ids[0, input_ids.unsqueeze(0).cuda().shape[1]:])
|
||||
stop_str = '<|end▁of▁sentence|>'
|
||||
if outputs.endswith(stop_str):
|
||||
outputs = outputs[:-len(stop_str)]
|
||||
# re_match
|
||||
outputs = outputs.strip()
|
||||
|
||||
return outputs
|
||||
|
||||
if '<image>' in conversation[0]['content'] and test_compress:
|
||||
outputs = tokenizer.decode(output_ids[0, input_ids.unsqueeze(0).cuda().shape[1]:])
|
||||
@ -1035,3 +1024,13 @@ class DeepseekOCRForCausalLM(DeepseekV2ForCausalLM):
|
||||
plt.close()
|
||||
|
||||
result.save(f"{output_path}/result_with_boxes.jpg")
|
||||
|
||||
if '<image>' in conversation[0]['content'] and eval_mode:
|
||||
outputs = tokenizer.decode(output_ids[0, input_ids.unsqueeze(0).cuda().shape[1]:])
|
||||
stop_str = '<|end▁of▁sentence|>'
|
||||
if outputs.endswith(stop_str):
|
||||
outputs = outputs[:-len(stop_str)]
|
||||
# re_match
|
||||
outputs = outputs.strip()
|
||||
|
||||
return outputs
|
||||
|
||||
Loading…
Reference in New Issue
Block a user