DeepGraphLearning / KnowledgeGraphEmbedding

MIT License
1.24k stars 264 forks source link

invalid syntax error #24

Closed Bishnukuet closed 4 years ago

Bishnukuet commented 4 years ago

Start Training...... File "codes/run.py", line 101 **save_variable_list, ^ SyntaxError: invalid syntax


Don't know what causing this error. Do you have any idea.

Edward-Sun commented 4 years ago

try Python 3?

Bishnukuet commented 4 years ago

Its already python 3.7.

On Tue, Feb 4, 2020, 23:15 Zhiqing Sun notifications@github.com wrote:

Closed #24 https://github.com/DeepGraphLearning/KnowledgeGraphEmbedding/issues/24.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/DeepGraphLearning/KnowledgeGraphEmbedding/issues/24?email_source=notifications&email_token=ABR7YW2ZEX55ADWVSHXA2ULRBI4MVA5CNFSM4KQA22D2YY3PNVWWK3TUL52HS4DFWZEXG43VMVCXMZLOORHG65DJMZUWGYLUNFXW5KTDN5WW2ZLOORPWSZGOWNJR45I#event-3008568949, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABR7YW4VZ5QYMMCVMEKFM63RBI4MVANCNFSM4KQA22DQ .

Edward-Sun commented 4 years ago

Sorry about that. **save_variable_list means to expand the dictionary here. If it doesn't work in your Python interpreter, maybe you can re-write it as:

tmp_dict = {}
for key in save_variable_list:
    tmp_dict[key] = save_variable_list[key]

tmp_dict['model_state_dict'] = model.state_dict()
tmp_dict['optimizer_state_dict'] = optimizer.state_dict()

torch.save(tmp_dict,
           os.path.join(args.save_path, 'checkpoint')
)