Skip to content
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

openbg 运行报错 #58

Open
zhui-coder opened this issue Nov 11, 2024 · 2 comments
Open

openbg 运行报错 #58

zhui-coder opened this issue Nov 11, 2024 · 2 comments
Labels
question Further information is requested

Comments

@zhui-coder
Copy link

zhui-coder commented Nov 11, 2024

作者您好,我下载了readme链接上的数据,并将数据文件夹改名为"AliOpenKG500",尝试运行GenKGC中的openbg.sh,会报错:缺失features_train.txt;
之后把文件夹命名回OpenBG500,并相应地修改data_dir配置(其他不变),重新运行脚本会有如下报错:
File "D:\resource\PromptKG\research\GenKGC\main.py", line 156, in
main()
File "D:\resource\PromptKG\research\GenKGC\main.py", line 138, in main
trainer.fit(lit_model, datamodule=data)
File "D:\softwares\anaconda\envs\genkgc\lib\site-packages\pytorch_lightning\trainer\trainer.py", line 458, in fit
self._run(model)
File "D:\softwares\anaconda\envs\genkgc\lib\site-packages\pytorch_lightning\trainer\trainer.py", line 756, in _run
self.dispatch()
File "D:\softwares\anaconda\envs\genkgc\lib\site-packages\pytorch_lightning\trainer\trainer.py", line 797, in dispatch
self.accelerator.start_training(self)
File "D:\softwares\anaconda\envs\genkgc\lib\site-packages\pytorch_lightning\accelerators\accelerator.py", line 96, in start_training
self.training_type_plugin.start_training(trainer)
File "D:\softwares\anaconda\envs\genkgc\lib\site-packages\pytorch_lightning\plugins\training_type\training_type_plugin.py", line 144, in start_training
self._results = trainer.run_stage()
File "D:\softwares\anaconda\envs\genkgc\lib\site-packages\pytorch_lightning\trainer\trainer.py", line 807, in run_stage
return self.run_train()
File "D:\softwares\anaconda\envs\genkgc\lib\site-packages\pytorch_lightning\trainer\trainer.py", line 842, in run_train
self.run_sanity_check(self.lightning_module)
File "D:\softwares\anaconda\envs\genkgc\lib\site-packages\pytorch_lightning\trainer\trainer.py", line 1107, in run_sanity_check
self.run_evaluation()
File "D:\softwares\anaconda\envs\genkgc\lib\site-packages\pytorch_lightning\trainer\trainer.py", line 962, in run_evaluation
output = self.evaluation_loop.evaluation_step(batch, batch_idx, dataloader_idx)
File "D:\softwares\anaconda\envs\genkgc\lib\site-packages\pytorch_lightning\trainer\evaluation_loop.py", line 174, in evaluation_step
output = self.trainer.accelerator.validation_step(args)
File "D:\softwares\anaconda\envs\genkgc\lib\site-packages\pytorch_lightning\accelerators\accelerator.py", line 221, in validation_step
batch = self.to_device(args[0])
File "D:\softwares\anaconda\envs\genkgc\lib\site-packages\pytorch_lightning\accelerators\gpu.py", line 69, in to_device
batch = super().to_device(batch)
File "D:\softwares\anaconda\envs\genkgc\lib\site-packages\pytorch_lightning\accelerators\accelerator.py", line 394, in to_device
return self.batch_to_device(batch, self.root_device)
File "D:\softwares\anaconda\envs\genkgc\lib\site-packages\pytorch_lightning\accelerators\accelerator.py", line 177, in batch_to_device
return model._apply_batch_transfer_handler(batch, device)
File "D:\softwares\anaconda\envs\genkgc\lib\site-packages\pytorch_lightning\core\lightning.py", line 216, in _apply_batch_transfer_handler
batch = self.transfer_batch_to_device(batch, device)
File "D:\softwares\anaconda\envs\genkgc\lib\site-packages\pytorch_lightning\core\hooks.py", line 704, in transfer_batch_to_device
return move_data_to_device(batch, device)
File "D:\softwares\anaconda\envs\genkgc\lib\site-packages\pytorch_lightning\utilities\apply_func.py", line 161, in move_data_to_device
return apply_to_collection(batch, dtype=dtype, function=batch_to)
File "D:\softwares\anaconda\envs\genkgc\lib\site-packages\pytorch_lightning\utilities\apply_func.py", line 84, in apply_to_collection
return function(data, *args, **kwargs)
File "D:\softwares\anaconda\envs\genkgc\lib\site-packages\pytorch_lightning\utilities\apply_func.py", line 158, in batch_to
return data.to(device, **kwargs)
File "D:\softwares\anaconda\envs\genkgc\lib\site-packages\transformers\file_utils.py", line 1639, in wrapper
return func(*args, **kwargs)
File "D:\softwares\anaconda\envs\genkgc\lib\site-packages\transformers\tokenization_utils_base.py", line 738, in to
self.data = {k: v.to(device=device) for k, v in self.data.items()}
File "D:\softwares\anaconda\envs\genkgc\lib\site-packages\transformers\tokenization_utils_base.py", line 738, in
self.data = {k: v.to(device=device) for k, v in self.data.items()}
AttributeError: 'list' object has no attribute 'to'

我的transformers版本是4.7.0,请问这个问题怎么解决,您可以帮忙看下吗

@zxlzr zxlzr added the question Further information is requested label Nov 12, 2024
@CheaSim
Copy link
Collaborator

CheaSim commented Nov 14, 2024

看起来像是transformers版本兼容问题,我们项目里含有requirements.txt, 请将transformers 回退到 4.6.0.

@zxlzr
Copy link
Contributor

zxlzr commented Nov 16, 2024

请问您还有其他问题吗?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

3 participants