Open charlesfufu opened 6 years ago
Hi, file
is only in Python 2.7X, and your python version is 3.6. You can try replace file
into open
Hi,
file
is only in Python 2.7X, and your python version is 3.6. You can try replacefile
intoopen
How about this one?
The training phase should be in this way in the terminal:
python main_sem.py train
If you run code in IDE (e.g., Pycharm) , You can modify the __main__
function with:
if __name__ == "__main__":
train()
The training phase should be in this way in the terminal:
python main_sem.py train
If you run code in IDE (e.g., Pycharm) , You can modify the
__main__
function with:if __name__ == "__main__": train()
According to what you say, get the same result.
The normal output of main_sem should be:
Maybe the environment difference?
def train(**kwargs): Where is the value of the parameter?
The normal output of main_sem should be:
Maybe the environment difference?
Maybe you should upgrade your program with python3
The normal output of main_sem should be: Maybe the environment difference?
Maybe you should upgrade your program with python3
I don't know if you write program like these if name == "main": train(),how to pass in the value at def train(**kwargs) function ?
OK, I will update my code with Python3.X.
You can change config.py
Line 66:
.iteritems() -> .items()
Maybe there will be other codes different from python2.x and 3.x
OK, I will update my code with Python3.X. You can change
config.py
Line 66:.iteritems() -> .items()
Maybe there will be other codes different from python2.x and 3.x
Yes, I had found at least four difference between python2 and python3. Looking forward to your code with python3. Thanks! !
Yes, I'm trying to update with python3. And I think it would be better with Pytorch 0.4 or later in the revision.
The normal output of main_sem should be: Maybe the environment difference?
Maybe you should upgrade your program with python3
I don't know if you write program like these if name == "main": train(),how to pass in the value at def train(**kwargs) function ?
I can not run the part program of picture. Do you know what's reason causes these? my pytorch version is 0.4
Yeah. My code is in Pytorch0.3. I'm updating code into Python3.x and Pytorch 0.4
@charlesfufu The code has updated. the master branch is under Python 3.5x and Pytorch 0.4+.
@charlesfufu The code has updated. the master branch is under Python 3.5x and Pytorch 0.4+.
Wonderful !!
@charlesfufu The code has updated. the master branch is under Python 3.5x and Pytorch 0.4+.
Wonderful !!
Do you know why?
try changing the "use_gpu" in config.py to False.
try changing the "use_gpu" in config.py to False.
still wrong
Is the same wrong message?
Is the same wrong message?
yeah!!Maybe is not GPU problem.
try changing the codes here to this
try changing the codes here to this
No,that's wrong.
this?
also change the code here, and add long(). it may work
No, not right Can I ask you about it, have you run it since the program was modified?
@Wangpeiyi9979 what about win10 ?
@Wangpeiyi9979 what about win10 ? it should work. changing the code here, add long()..
and here
@ShomyLiu
@charlesfufu I have reviewed code carefully and cannot reproduce your problems either in GPU or CPU.
Please check your environments.
My environments are listed here:
- OS: Ubuntu 16.04
- Python: 3.5
- Pytorch: 0.4.1
- GPU: NVIDIA GTX 1080Ti with 387.34 drivers.
Have you tested your program on windows?I think maybe is the operating system problem
I had found the bug
@charlesfufu I have reviewed code carefully and cannot reproduce your problems either in GPU or CPU. Please check your environments. My environments are listed here:
- OS: Ubuntu 16.04 - Python: 3.5 - Pytorch: 0.4.1 - GPU: NVIDIA GTX 1080Ti with 387.34 drivers.
I had found the bug ! !
OK, It seems strange. It would be nice If the issue has been solved. If necessary, you can create a pull request. Thanks.
I had found the bug
@charlesfufu I have reviewed code carefully and cannot reproduce your problems either in GPU or CPU. Please check your environments. My environments are listed here:
- OS: Ubuntu 16.04 - Python: 3.5 - Pytorch: 0.4.1 - GPU: NVIDIA GTX 1080Ti with 387.34 drivers.
I had found the bug ! !
你好,我遇到和你一样的报错信息【上图】,但没找到应该在哪里修改这个bug。看起来是pytorch在对数据类型进行转换的时候出现的问题,请问你是如何解决的呢?最后整个模型可以跑起来了吗?
I had found the bug
@charlesfufu I have reviewed code carefully and cannot reproduce your problems either in GPU or CPU. Please check your environments. My environments are listed here:
- OS: Ubuntu 16.04 - Python: 3.5 - Pytorch: 0.4.1 - GPU: NVIDIA GTX 1080Ti with 387.34 drivers.
I had found the bug ! !
Can you show the details about fixing this bug?
@XAKK
Hi, could you please show what's the problem here?
I have checked the codes and run successfully right now under the following environment:
@ShomyLiu Hi, I have the same problem as @charlesfufu it seems that this problem only appear on the Windows.
Traceback (most recent call last):
File "main_sem.py", line 123, in
@XAKK I will reproduce the problem in Windows platform as soon as possible and find out the solution.
I think I found a problem solving strategy for Windows platform. I modified the codes for three places, and run successfully on
Windows 10
Python 3.6
Pytorch 1.0
Here are the changes:
main_sem.py
line 65:
loss = criterion(out, data[-1])
↓
out1 = out.type(torch.cuda.FloatTensor) data1 = data[-1].type(torch.cuda.LongTensor) loss = criterion(out1, data1)
line 92 - 95:
if opt.use_gpu: data = list(map(lambda x: torch.LongTensor(x).cuda(), data)) else: data = list(map(lambda x: torch.LongTensor(x), data))
↓
` if opt.use_gpu:
data = list(map(lambda x: torch.LongTensor(x.long()).cuda(), data))
else:
data = list(map(lambda x: torch.LongTensor(x.long()), data))`
PCNN.py line 68:
lexical_feature, word_feautre, left_pf, right_pf = x
↓
lexical_feature, word_feautre, left_pf, right_pf = x lexical_feature = lexical_feature.type(torch.cuda.LongTensor) word_feautre = word_feautre.type(torch.cuda.LongTensor) left_pf =left_pf.type(torch.cuda.LongTensor) right_pf = right_pf.type(torch.cuda.LongTensor)
<<< (9+1)-WAY EVALUATION TAKING DIRECTIONALITY INTO ACCOUNT -- OFFICIAL >>>: Micro-averaged result (excluding Other): P = 1907/2409 = 79.16% R = 1907/2263 = 84.27% F1 = 81.64%
MACRO-averaged result (excluding Other): P = 78.58% R = 83.26% F1 = 80.77% Thank you! @ShomyLiu
@XAKK Thanks for the note. I will refine the codes for windows recently. It seems that the code above can be simplified with:
out.type(torch.cuda.FloatTensor) -> out.float()
...
lexical_feature.type(torch.cuda.LongTensor) -> lexical_feature.long()
我并没有修改任何东西 目录下的确有该文件 为什么会找不到呢?
@learning-makes-me-happy-a 请确认下执行命令所在的目录。 需要在主目录,而不是说dataset下
@learning-makes-me-happy-a 请确认下执行命令所在的目录。 需要在主目录,而不是说dataset下
thanks I have solved this problem