VeritasYin / STGCN_IJCAI-18

[IJCAI'18] Spatio-Temporal Graph Convolutional Networks
BSD 2-Clause "Simplified" License
1.01k stars 305 forks source link

为什么 windows10运行程序中的main.py 总是报错UnboundLocalError:赋值前引用的局部变量W,希望指点。 #53

Closed qiubin1997 closed 3 years ago

qiubin1997 commented 3 years ago

D:\Anaconda\envs\tensorflow-gpu\python.exe D:/PycharmProjects/STGCN_IJCAI-18/STGCN_IJCAI-18-master/main.py 2021-03-10 11:39:36.031711: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library cudart64_101.dll 2021-03-10 11:39:37.332511: I tensorflow/core/platform/cpu_feature_guard.cc:143] Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX2 2021-03-10 11:39:37.338870: I tensorflow/compiler/xla/service/service.cc:168] XLA service 0x287b22ae980 initialized for platform Host (this does not guarantee that XLA will be used). Devices: 2021-03-10 11:39:37.339049: I tensorflow/compiler/xla/service/service.cc:176] StreamExecutor device (0): Host, Default Version 2021-03-10 11:39:37.339710: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library nvcuda.dll 2021-03-10 11:39:37.362410: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1561] Found device 0 with properties: pciBusID: 0000:01:00.0 name: GeForce GTX 1050 Ti computeCapability: 6.1 coreClock: 1.392GHz coreCount: 6 deviceMemorySize: 4.00GiB deviceMemoryBandwidth: 104.43GiB/s 2021-03-10 11:39:37.362663: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library cudart64_101.dll 2021-03-10 11:39:37.365917: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library cublas64_10.dll 2021-03-10 11:39:37.368303: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library cufft64_10.dll 2021-03-10 11:39:37.369087: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library curand64_10.dll 2021-03-10 11:39:37.372096: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library cusolver64_10.dll 2021-03-10 11:39:37.373803: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library cusparse64_10.dll 2021-03-10 11:39:37.381498: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library cudnn64_7.dll 2021-03-10 11:39:37.381689: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1703] Adding visible gpu devices: 0 2021-03-10 11:39:37.845596: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1102] Device interconnect StreamExecutor with strength 1 edge matrix: 2021-03-10 11:39:37.845754: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1108] 0 2021-03-10 11:39:37.845836: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1121] 0: N 2021-03-10 11:39:37.846049: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1247] Created TensorFlow device (/job:localhost/replica:0/task:0/device:GPU:0 with 2988 MB memory) -> physical GPU (device: 0, name: GeForce GTX 1050 Ti, pci bus id: 0000:01:00.0, compute capability: 6.1) 2021-03-10 11:39:37.848793: I tensorflow/compiler/xla/service/service.cc:168] XLA service 0x287d618f8c0 initialized for platform CUDA (this does not guarantee that XLA will be used). Devices: 2021-03-10 11:39:37.848965: I tensorflow/compiler/xla/service/service.cc:176] StreamExecutor device (0): GeForce GTX 1050 Ti, Compute Capability 6.1 Training configs: Namespace(batch_size=50, epoch=50, graph='default', inf_mode='merge', ks=3, kt=3, lr=0.001, n_his=12, n_pred=9, n_route=228, opt='RMSProp', save=10) ERROR: input file was not found in ./dataset\PeMSD7_W_228.csv. Traceback (most recent call last): File "D:/PycharmProjects/STGCN_IJCAI-18/STGCN_IJCAI-18-master/main.py", line 52, in W = weight_matrix(pjoin('./dataset', f'PeMSD7W{n}.csv')) File "D:\PycharmProjects\STGCN_IJCAI-18\STGCN_IJCAI-18-master\utils\math_graph.py", line 87, in weight_matrix if set(np.unique(W)) == {0, 1}: UnboundLocalError: local variable 'W' referenced before assignment

Process finished with exit code 1

VeritasYin commented 3 years ago

W = weight_matrix(pjoin('./dataset', f'PeMSD7_W_{n}.csv'))

You need to check whether the weight matrix W is put in the right path.

qiubin1997 commented 3 years ago

上一个错误 我把地址改成这个 后面又改了很多报错;但是又改到了类似的错误,还是不知道怎么改 希望指教。 请往下看截图

同样又是全局变量问题

------------------ 原始邮件 ------------------ 发件人: "VeritasYin/STGCN_IJCAI-18" <notifications@github.com>; 发送时间: 2021年3月10日(星期三) 中午11:57 收件人: "VeritasYin/STGCN_IJCAI-18"<STGCNIJCAI-18@noreply.github.com>; 抄送: "奋斗!Chiu^^"<2051910189@qq.com>;"Author"<author@noreply.github.com>; 主题: Re: [VeritasYin/STGCN_IJCAI-18] 为什么 windows10运行程序中的main.py 总是报错UnboundLocalError:赋值前引用的局部变量W,希望指点。 (#53)

W = weight_matrix(pjoin('./dataset', f'PeMSD7W{n}.csv'))

You need to check whether the weight matrix W is put in the right path.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or unsubscribe.

VeritasYin commented 3 years ago

This repo is developed based on Linux file systems. If you would like to run this code on Windows, you might need to edit all the path related lines to prevent such issue.

qiubin1997 commented 3 years ago

我已经把代码中有关路径的修改成windows形式 但依然报相同的错误 我修改过的main.py代码以添加成压缩包形式在附件中 希望帮忙指点一下 万分感谢!(因为我这里显示你那里服务商的问题,不能将整个程序文件夹发送给你 所以就只有main.py程序 希望见谅。 )

------------------ 原始邮件 ------------------ 发件人: "VeritasYin/STGCN_IJCAI-18" <notifications@github.com>; 发送时间: 2021年3月11日(星期四) 凌晨1:15 收件人: "VeritasYin/STGCN_IJCAI-18"<STGCNIJCAI-18@noreply.github.com>; 抄送: "奋斗!Chiu^^"<2051910189@qq.com>;"Author"<author@noreply.github.com>; 主题: Re: [VeritasYin/STGCN_IJCAI-18] 为什么 windows10运行程序中的main.py 总是报错UnboundLocalError:赋值前引用的局部变量W,希望指点。 (#53)

This repo is developed based on Linux file systems. If you would like to run this code on Windows, you might need to edit all the path related lines to prevent such issue.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or unsubscribe.

qiubin1997 commented 3 years ago

朋友打扰了,对于之前的问题我不知道如何更改,希望你能帮忙只指点一二,实在冒昧,万分感谢!!!

------------------ 原始邮件 ------------------ 发件人: "VeritasYin/STGCN_IJCAI-18" @.>; 发送时间: 2021年3月10日(星期三) 中午11:57 @.>; @.**@.>; 主题: Re: [VeritasYin/STGCN_IJCAI-18] 为什么 windows10运行程序中的main.py 总是报错UnboundLocalError:赋值前引用的局部变量W,希望指点。 (#53)

W = weight_matrix(pjoin('./dataset', f'PeMSD7W{n}.csv'))

You need to check whether the weight matrix W is put in the right path.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or unsubscribe.