Skip to content

Commit

Permalink
fixbug
Browse files Browse the repository at this point in the history
  • Loading branch information
shadowcz007 committed Aug 13, 2024
1 parent 83a8d47 commit f3db013
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions nodes/TextGenerateNode.py
Original file line number Diff line number Diff line change
Expand Up @@ -331,13 +331,15 @@ def run(self,text,seed,generation):

for t in texts:
if t:
# translated_text = translated_word = translate(zh_en_tokenizer,zh_en_model,str(t))
parser = Lark(grammar, start="start", parser="lalr", transformer=ChinesePromptTranslate())
# print('t',t)
result = parser.parse(t).children
# print('en_result',result)
# en_text=translate(zh_en_tokenizer,zh_en_model,text_without_syntax)
en_texts.append(result[0])
try:
result = parser.parse(t).children
en_texts.append(result[0])
except:
print(f"Error parsing '{t}'")
t = translate(str(t))
en_texts.append(t)


zh_en_model.to('cpu')
print("test en_text",en_texts)
Expand Down

0 comments on commit f3db013

Please sign in to comment.