zjunlp / MKG_Analogy

[ICLR 2023] Multimodal Analogical Reasoning over Knowledge Graphs
https://zjunlp.github.io/project/MKG_Analogy/
MIT License
99 stars 11 forks source link

NameError: name 'entity2visual_features' is not defined #14

Closed nidongpinyinme closed 10 months ago

nidongpinyinme commented 12 months ago

老师您好,m1的Mac上部署该系统时提示“NameError: name 'entity2visual_features' is not defined”,请问是我哪一步做错了吗。 数据处理以完成。

flow3rdown commented 12 months ago

您好,请问可以贴一下详细的报错信息吗?

nidongpinyinme commented 12 months ago
  File "/miniconda3/envs/d2l/lib/python3.9/runpy.py", line 197, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "/miniconda3/envs/d2l/lib/python3.9/runpy.py", line 87, in _run_code
    exec(code, run_globals)
  File "/.vscode/extensions/ms-python.python-2023.20.0/pythonFiles/lib/python/debugpy/adapter/../../debugpy/launcher/../../debugpy/__main__.py", line 39, in <module>
    cli.main()
  File "/.vscode/extensions/ms-python.python-2023.20.0/pythonFiles/lib/python/debugpy/adapter/../../debugpy/launcher/../../debugpy/../debugpy/server/cli.py", line 430, in main
    run()
  File "/.vscode/extensions/ms-python.python-2023.20.0/pythonFiles/lib/python/debugpy/adapter/../../debugpy/launcher/../../debugpy/../debugpy/server/cli.py", line 284, in run_file
    runpy.run_path(target, run_name="__main__")
  File "/.vscode/extensions/ms-python.python-2023.20.0/pythonFiles/lib/python/debugpy/_vendored/pydevd/_pydevd_bundle/pydevd_runpy.py", line 321, in run_path
    return _run_module_code(code, init_globals, run_name,
  File "/.vscode/extensions/ms-python.python-2023.20.0/pythonFiles/lib/python/debugpy/_vendored/pydevd/_pydevd_bundle/pydevd_runpy.py", line 135, in _run_module_code
    _run_code(code, mod_globals, init_globals,
  File "/.vscode/extensions/ms-python.python-2023.20.0/pythonFiles/lib/python/debugpy/_vendored/pydevd/_pydevd_bundle/pydevd_runpy.py", line 124, in _run_code
    exec(code, run_globals)
  File "/Volumes/APFS/workspace/knowledgeGraph/MKG_Analogy/MarT/main.py", line 167, in <module>
    main()
  File "/Volumes/APFS/workspace/knowledgeGraph/MKG_Analogy/MarT/main.py", line 156, in main
    trainer.fit(lit_model, datamodule=data)
  File "/miniconda3/envs/d2l/lib/python3.9/site-packages/pytorch_lightning/trainer/trainer.py", line 770, in fit
    self._call_and_handle_interrupt(
  File "/miniconda3/envs/d2l/lib/python3.9/site-packages/pytorch_lightning/trainer/trainer.py", line 723, in _call_and_handle_interrupt
    return trainer_fn(*args, **kwargs)
  File "/miniconda3/envs/d2l/lib/python3.9/site-packages/pytorch_lightning/trainer/trainer.py", line 811, in _fit_impl
    results = self._run(model, ckpt_path=self.ckpt_path)
  File "/miniconda3/envs/d2l/lib/python3.9/site-packages/pytorch_lightning/trainer/trainer.py", line 1236, in _run
    results = self._run_stage()
  File "/miniconda3/envs/d2l/lib/python3.9/site-packages/pytorch_lightning/trainer/trainer.py", line 1323, in _run_stage
    return self._run_train()
  File "/miniconda3/envs/d2l/lib/python3.9/site-packages/pytorch_lightning/trainer/trainer.py", line 1345, in _run_train
    self._run_sanity_check()
  File "/miniconda3/envs/d2l/lib/python3.9/site-packages/pytorch_lightning/trainer/trainer.py", line 1413, in _run_sanity_check
    val_loop.run()
  File "/miniconda3/envs/d2l/lib/python3.9/site-packages/pytorch_lightning/loops/base.py", line 204, in run
    self.advance(*args, **kwargs)
  File "/miniconda3/envs/d2l/lib/python3.9/site-packages/pytorch_lightning/loops/dataloader/evaluation_loop.py", line 155, in advance
    dl_outputs = self.epoch_loop.run(self._data_fetcher, dl_max_batches, kwargs)
  File "/miniconda3/envs/d2l/lib/python3.9/site-packages/pytorch_lightning/loops/base.py", line 204, in run
    self.advance(*args, **kwargs)
  File "/miniconda3/envs/d2l/lib/python3.9/site-packages/pytorch_lightning/loops/epoch/evaluation_epoch_loop.py", line 112, in advance
    batch = next(data_fetcher)
  File "/miniconda3/envs/d2l/lib/python3.9/site-packages/pytorch_lightning/utilities/fetching.py", line 184, in __next__
    return self.fetching_function()
  File "/miniconda3/envs/d2l/lib/python3.9/site-packages/pytorch_lightning/utilities/fetching.py", line 259, in fetching_function
    self._fetch_next_batch(self.dataloader_iter)
  File "/miniconda3/envs/d2l/lib/python3.9/site-packages/pytorch_lightning/utilities/fetching.py", line 273, in _fetch_next_batch
    batch = next(iterator)
  File "/miniconda3/envs/d2l/lib/python3.9/site-packages/torch/utils/data/dataloader.py", line 681, in __next__
    data = self._next_data()
  File "/miniconda3/envs/d2l/lib/python3.9/site-packages/torch/utils/data/dataloader.py", line 1376, in _next_data
    return self._process_data(data)
  File "/miniconda3/envs/d2l/lib/python3.9/site-packages/torch/utils/data/dataloader.py", line 1402, in _process_data
    data.reraise()
  File "/miniconda3/envs/d2l/lib/python3.9/site-packages/torch/_utils.py", line 461, in reraise
    raise exception
NameError: Caught NameError in DataLoader worker process 0.
Original Traceback (most recent call last):
  File "/miniconda3/envs/d2l/lib/python3.9/site-packages/torch/utils/data/_utils/worker.py", line 302, in _worker_loop
    data = fetcher.fetch(index)
  File "/miniconda3/envs/d2l/lib/python3.9/site-packages/torch/utils/data/_utils/fetch.py", line 52, in fetch
    return self.collate_fn(data)
  File "/Volumes/APFS/workspace/knowledgeGraph/MKG_Analogy/MarT/data/data_module.py", line 136, in __call__
    if isinstance(entity2visual_features, torch.Tensor):
NameError: name 'entity2visual_features' is not defined

不好意思老师,忘了附上了。

flow3rdown commented 10 months ago

非常抱歉,回复的较迟了。

entity2visual_features是在此处定义的,请您检查一下您的代码是否有缺失或有什么改动吗?