lx865712528/EMNLP2018-JMEE

TypeError: eval() arg 1 must be a string, bytes or code object

May15297626062 opened this issue · 2 comments

有人遇到这个问题吗,实在不知道怎么改了

我也遇到了,我还打印了一下,发现这个是None
image
image

有人遇到这个问题吗,实在不知道怎么改了

我发现hps是他的超参数设置,于是我在上面加上了另一个issue下给出的参数设置并打印self.a.hps
parser.add_argument("--hps", help="model hyperparams",
default={"wemb_ft": False, "wemb_dim": 300, "wemb_dp": 0.5,
"psemb_dim": 50, "psemb_dp": 0.5,
"pemb_dim": 50, "pemb_dp": 0.5,
"eemb_dim": 50, "eemb_dp": 0.5,
"lstm_dim": 220, "lstm_layers": 1, "lstm_dp": 0.5,
"gcn_layers": 3, "gcn_et": 3, "gcn_dp": 0.5, "gcn_use_bn": False,
"use_highway": True,
"sa_dim": 300},
required=False)
打印的self.a.hps为
{'wemb_ft': False, 'wemb_dim': 300, 'wemb_dp': 0.5, 'psemb_dim': 50, 'psemb_dp': 0.5, 'pemb_dim': 50, 'pemb_dp': 0.5, 'eemb_dim': 50, 'eemb_dp': 0.5, 'lstm_dim': 220, 'lstm_layers': 1, 'lstm_dp': 0.5, 'gcn_layers': 3, 'gcn_et': 3, 'gcn_dp': 0.5, 'gcn_use_bn': False, 'use_highway': True, 'sa_dim': 300}
然后运行还是报这个错,于是我就直接把打印出来的内容以字符串形式写进去
self.a.hps = eval("{'wemb_ft': False, 'wemb_dim': 300, 'wemb_dp': 0.5, 'psemb_dim': 50, 'psemb_dp': 0.5, 'pemb_dim': 50, 'pemb_dp': 0.5, 'eemb_dim': 50, 'eemb_dp': 0.5, 'lstm_dim': 220, 'lstm_layers': 1, 'lstm_dp': 0.5, 'gcn_layers': 3, 'gcn_et': 3, 'gcn_dp': 0.5, 'gcn_use_bn': False, 'use_highway': True, 'sa_dim': 300}")
这边就没有报错了
但是遇到了之后的一个问题:
Traceback (most recent call last):
File "E:/pythonfile/EMNLP2018-JMEE-master/enet/run/ee/runner.py", line 246, in
EERunner().run()
File "E:/pythonfile/EMNLP2018-JMEE-master/enet/run/ee/runner.py", line 239, in run
"test 1/1": test_set1,
File "E:\pythonfile\EMNLP2018-JMEE-master\enet\training.py", line 43, in train
"training_epoch_%d.txt" % (i + 1)))
File "E:\pythonfile\EMNLP2018-JMEE-master\enet\util.py", line 158, in run_over_data
for batch in data_iter:
File "E:.conda\envs\python3.7\lib\site-packages\torchtext\legacy\data\iterator.py", line 160, in iter
yield Batch(minibatch, self.dataset, self.device)
File "E:.conda\envs\python3.7\lib\site-packages\torchtext\legacy\data\batch.py", line 34, in init
setattr(self, name, field.process(batch, device=device))
TypeError: process() missing 1 required positional argument: 'train'