-
Notifications
You must be signed in to change notification settings - Fork 5.7k
New issue
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
fix protobuf size limit of seq2seq demo #730
Conversation
luotao1
commented
Dec 5, 2016
- fix seq2seq error #718 :按照increase protobuffer message size #170 ,修改seq2seq中define_py_data_sources2的args参数,将直接传递字典改成传递字典地址,并写入FAQ中。
- 将seq2seq demo中的slots和yield改为显示指定。
@qingqing01 Please review this PR. If you want help, then assign me. I think this PR could be reviewed by one person. |
settings.job_mode = not is_generating | ||
settings.src_dict = dict() | ||
for line_count, line in enumerate(open(src_dict_path, "r")): | ||
settings.src_dict[line.strip()] = line_count |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
我自己的seqToseq代码用dictionary comprehension来初设化 src_dict
和 trg_dict
。这样初设化会比较pythonic 吧 =)
with open(src_dict_path, "r") as fin:
settings.src_dict = {line.strip():line_count for line_count, line in enumerate(fin)}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
settings.trg_dict = dict() | ||
for line_count, line in enumerate(open(trg_dict_path, "r")): | ||
settings.trg_dict[line.strip()] = line_count | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
同样的
with open(trg_dict_path, "r") as fin:
settings.trg_dict = {line.strip():line_count for line_count, line in enumerate(fin)}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
settings.trg_dict = { | ||
line.strip(): line_count | ||
for line_count, line in enumerate(fin) | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
def fun(): 然后调用两次也可以~
111行if语句写错了