Open return-sleep opened 3 years ago
font{
line-height: 1.6;
}
ul,ol{
padding-left: 20px;
list-style-position: inside;
}
You can’t directly transform yolov3-tiny.cfg, please refer to readme.md carefully.
Weiqian Chen
cwq@pku.edu.cn
签名由
网易邮箱大师
定制
On 12/28/2020 16:53,return-sleep<notifications@github.com> wrote:
when I try to transform ann to snn ,some problems occurred: $ python3 ann_to_snn.py --cfg cfg/yolov3-tiny.cfg --data data/coco.data --weights weights/best.pt --timesteps 128Namespace(augment=False, batch_size=16, Model Summary: 37 layers, 8.85237e+06 parameters, 8.85237e+06 gradients add node conv1: ['dag_input0']->['conv1_out1'] Traceback (most recent call last): File "ann_to_snn.py", line 178, in transformer.inference_get_status(dataloader, opt.statistics_iters) File "PyTorch-Spiking-YOLOv3/spiking_utils/snn_transformer.py", line 94, in inference_get_status self.init_dag([data]) File "PyTorch-Spiking-YOLOv3/spiking_utils/snn_transformer.py", line 69, in init_dag self.snn_dag = ann_parser.parse_ann_model(self.original_net, inputs) File "PyTorch-Spiking-YOLOv3/spiking_utils/ann_parser.py", line 221, in parse_ann_model model(warpped_input) File "anaconda3/envs/spikeyolo/lib/python3.7/site-packages/torch/nn/modules/module.py", line 727, in _call_impl result = self.forward(input, kwargs) File "ann_to_snn.py", line 53, in forward x = self.listi File "anaconda3/envs/spikeyolo/lib/python3.7/site-packages/torch/nn/modules/module.py", line 727, in _call_impl result = self.forward(*input, *kwargs) File "anaconda3/envs/spikeyolo/lib/python3.7/site-packages/torch/nn/modules/container.py", line 117, in forward input = module(input) File "anaconda3/envs/spikeyolo/lib/python3.7/site-packages/torch/nn/modules/module.py", line 727, in _call_impl result = self.forward(input, kwargs) File "anaconda3/envs/spikeyolo/lib/python3.7/site-packages/torch/nn/modules/conv.py", line 423, in forward return self._conv_forward(input, self.weight) File "anaconda3/envs/spikeyolo/lib/python3.7/site-packages/torch/nn/modules/conv.py", line 420, in _conv_forward self.padding, self.dilation, self.groups) File "PyTorch-Spiking-YOLOv3/spiking_utils/ann_parser.py", line 69, in conv2d_wrapper in_nodes = [find_node_by_tensor(inp)] File "PyTorch-Spiking-YOLOv3/spiking_utils/ann_parser.py", line 10, in find_node_by_tensor raise ValueError("cannot find tensor Size", tensor.size()) ValueError: ('cannot find tensor Size', torch.Size([16, 16, 320, 320]))
—You are receiving this because you are subscribed to this thread.Reply to this email directly, view it on GitHub, or unsubscribe.
@return-sleep Have you solve the problem ? When transforming ann to snn, the same error happens even the author's cfg file is used.
font{
line-height: 1.6;
}
ul,ol{
padding-left: 20px;
list-style-position: inside;
}
Please use PyTorch1.3
Weiqian Chen
cwq@pku.edu.cn
签名由
网易邮箱大师
定制
On 12/28/2020 16:53,return-sleep<notifications@github.com> wrote:
when I try to transform ann to snn ,some problems occurred: $ python3 ann_to_snn.py --cfg cfg/yolov3-tiny.cfg --data data/coco.data --weights weights/best.pt --timesteps 128Namespace(augment=False, batch_size=16, Model Summary: 37 layers, 8.85237e+06 parameters, 8.85237e+06 gradients add node conv1: ['dag_input0']->['conv1_out1'] Traceback (most recent call last): File "ann_to_snn.py", line 178, in transformer.inference_get_status(dataloader, opt.statistics_iters) File "PyTorch-Spiking-YOLOv3/spiking_utils/snn_transformer.py", line 94, in inference_get_status self.init_dag([data]) File "PyTorch-Spiking-YOLOv3/spiking_utils/snn_transformer.py", line 69, in init_dag self.snn_dag = ann_parser.parse_ann_model(self.original_net, inputs) File "PyTorch-Spiking-YOLOv3/spiking_utils/ann_parser.py", line 221, in parse_ann_model model(warpped_input) File "anaconda3/envs/spikeyolo/lib/python3.7/site-packages/torch/nn/modules/module.py", line 727, in _call_impl result = self.forward(input, kwargs) File "ann_to_snn.py", line 53, in forward x = self.listi File "anaconda3/envs/spikeyolo/lib/python3.7/site-packages/torch/nn/modules/module.py", line 727, in _call_impl result = self.forward(*input, *kwargs) File "anaconda3/envs/spikeyolo/lib/python3.7/site-packages/torch/nn/modules/container.py", line 117, in forward input = module(input) File "anaconda3/envs/spikeyolo/lib/python3.7/site-packages/torch/nn/modules/module.py", line 727, in _call_impl result = self.forward(input, kwargs) File "anaconda3/envs/spikeyolo/lib/python3.7/site-packages/torch/nn/modules/conv.py", line 423, in forward return self._conv_forward(input, self.weight) File "anaconda3/envs/spikeyolo/lib/python3.7/site-packages/torch/nn/modules/conv.py", line 420, in _conv_forward self.padding, self.dilation, self.groups) File "PyTorch-Spiking-YOLOv3/spiking_utils/ann_parser.py", line 69, in conv2d_wrapper in_nodes = [find_node_by_tensor(inp)] File "PyTorch-Spiking-YOLOv3/spiking_utils/ann_parser.py", line 10, in find_node_by_tensor raise ValueError("cannot find tensor Size", tensor.size()) ValueError: ('cannot find tensor Size', torch.Size([16, 16, 320, 320]))
—You are receiving this because you are subscribed to this thread.Reply to this email directly, view it on GitHub, or unsubscribe.
Please use PyTorch1.3
@return-sleep Have you solve the problem ? When transforming ann to snn, the same error happens even the author's cfg file is used.
Hi, have you solved the problem by using PyTorch1.3? @return-sleep Dear author, is there any other method that may conquer this problem? @cwq159 Any help will be appreciated. Thanks very much!
@return-sleep Have you solve the problem ? When transforming ann to snn, the same error happens even the author's cfg file is used.
Hi, have you solved the problem by using PyTorch1.3? @return-sleep Dear author, is there any other method that may conquer this problem? @cwq159 Any help will be appreciated. Thanks very much!
When trying PyTorch1.3, another error occurred, which I think is more version-dependent.
Traceback (most recent call last):
File "/opt/conda/lib/python3.6/tarfile.py", line 189, in nti
n = int(s.strip() or "0", 8)
ValueError: invalid literal for int() with base 8: 'ndarray'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/opt/conda/lib/python3.6/tarfile.py", line 2297, in next
tarinfo = self.tarinfo.fromtarfile(self)
File "/opt/conda/lib/python3.6/tarfile.py", line 1093, in fromtarfile
obj = cls.frombuf(buf, tarfile.encoding, tarfile.errors)
File "/opt/conda/lib/python3.6/tarfile.py", line 1035, in frombuf
chksum = nti(buf[148:156])
File "/opt/conda/lib/python3.6/tarfile.py", line 191, in nti
raise InvalidHeaderError("invalid header")
tarfile.InvalidHeaderError: invalid header
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/opt/conda/lib/python3.6/site-packages/torch/serialization.py", line 595, in _load
return legacy_load(f)
File "/opt/conda/lib/python3.6/site-packages/torch/serialization.py", line 506, in legacy_load
with closing(tarfile.open(fileobj=f, mode='r:', format=tarfile.PAX_FORMAT)) as tar, \
File "/opt/conda/lib/python3.6/tarfile.py", line 1589, in open
return func(name, filemode, fileobj, **kwargs)
File "/opt/conda/lib/python3.6/tarfile.py", line 1619, in taropen
return cls(name, mode, fileobj, **kwargs)
File "/opt/conda/lib/python3.6/tarfile.py", line 1482, in __init__
self.firstmember = self.next()
File "/opt/conda/lib/python3.6/tarfile.py", line 2309, in next
raise ReadError(str(e))
tarfile.ReadError: invalid header
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "ann_to_snn.py", line 147, in <module>
ckpt = torch.load(weights, map_location=device)
File "/opt/conda/lib/python3.6/site-packages/torch/serialization.py", line 426, in load
return _load(f, map_location, pickle_module, **pickle_load_args)
File "/opt/conda/lib/python3.6/site-packages/torch/serialization.py", line 599, in _load
raise RuntimeError("{} is a zip archive (did you mean to use torch.jit.load()?)".format(f.name))
RuntimeError: weights/best.pt is a zip archive (did you mean to use torch.jit.load()?)
@return-sleep Have you solve the problem ? When transforming ann to snn, the same error happens even the author's cfg file is used.
Hi, have you solved the problem by using PyTorch1.3? @return-sleep Dear author, is there any other method that may conquer this problem? @cwq159 Any help will be appreciated. Thanks very much!
When trying PyTorch1.3, another error occurred, which I think is more version-dependent.
Traceback (most recent call last): File "/opt/conda/lib/python3.6/tarfile.py", line 189, in nti n = int(s.strip() or "0", 8) ValueError: invalid literal for int() with base 8: 'ndarray' During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/opt/conda/lib/python3.6/tarfile.py", line 2297, in next tarinfo = self.tarinfo.fromtarfile(self) File "/opt/conda/lib/python3.6/tarfile.py", line 1093, in fromtarfile obj = cls.frombuf(buf, tarfile.encoding, tarfile.errors) File "/opt/conda/lib/python3.6/tarfile.py", line 1035, in frombuf chksum = nti(buf[148:156]) File "/opt/conda/lib/python3.6/tarfile.py", line 191, in nti raise InvalidHeaderError("invalid header") tarfile.InvalidHeaderError: invalid header During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/opt/conda/lib/python3.6/site-packages/torch/serialization.py", line 595, in _load return legacy_load(f) File "/opt/conda/lib/python3.6/site-packages/torch/serialization.py", line 506, in legacy_load with closing(tarfile.open(fileobj=f, mode='r:', format=tarfile.PAX_FORMAT)) as tar, \ File "/opt/conda/lib/python3.6/tarfile.py", line 1589, in open return func(name, filemode, fileobj, **kwargs) File "/opt/conda/lib/python3.6/tarfile.py", line 1619, in taropen return cls(name, mode, fileobj, **kwargs) File "/opt/conda/lib/python3.6/tarfile.py", line 1482, in __init__ self.firstmember = self.next() File "/opt/conda/lib/python3.6/tarfile.py", line 2309, in next raise ReadError(str(e)) tarfile.ReadError: invalid header During handling of the above exception, another exception occurred: Traceback (most recent call last): File "ann_to_snn.py", line 147, in <module> ckpt = torch.load(weights, map_location=device) File "/opt/conda/lib/python3.6/site-packages/torch/serialization.py", line 426, in load return _load(f, map_location, pickle_module, **pickle_load_args) File "/opt/conda/lib/python3.6/site-packages/torch/serialization.py", line 599, in _load raise RuntimeError("{} is a zip archive (did you mean to use torch.jit.load()?)".format(f.name)) RuntimeError: weights/best.pt is a zip archive (did you mean to use torch.jit.load()?)
I found that the above error was due to "using pytorch1.3 to load .pt file saved by ptorch1.8". (RuntimeError: weights/best.pt is a zip archive
)
Therefore, using Pytorch1.3 works fine for ann_to_snn.py
. Thanks very much.
font{
line-height: 1.6;
}
ul,ol{
padding-left: 20px;
list-style-position: inside;
}
pytorch1.3 with python3.7 may be useful.
cwq
***@***.***
签名由
网易邮箱大师
定制
On 04/9/2021 ***@***.***> wrote:
@return-sleep Have you solve the problem ? When transforming ann to snn, the same error happens even the author's cfg file is used.
Hi, have you solved the problem by using PyTorch1.3? @return-sleep Dear author, is there any other method that may conquer this problem? @cwq159 Any help will be appreciated. Thanks very much!
When trying PyTorch1.3, another error occurred, which I think is more version-dependent. Traceback (most recent call last): File "/opt/conda/lib/python3.6/tarfile.py", line 189, in nti n = int(s.strip() or "0", 8) ValueError: invalid literal for int() with base 8: 'ndarray'
During handling of the above exception, another exception occurred:
Traceback (most recent call last): File "/opt/conda/lib/python3.6/tarfile.py", line 2297, in next tarinfo = self.tarinfo.fromtarfile(self) File "/opt/conda/lib/python3.6/tarfile.py", line 1093, in fromtarfile obj = cls.frombuf(buf, tarfile.encoding, tarfile.errors) File "/opt/conda/lib/python3.6/tarfile.py", line 1035, in frombuf chksum = nti(buf[148:156]) File "/opt/conda/lib/python3.6/tarfile.py", line 191, in nti raise InvalidHeaderError("invalid header") tarfile.InvalidHeaderError: invalid header
During handling of the above exception, another exception occurred:
Traceback (most recent call last): File "/opt/conda/lib/python3.6/site-packages/torch/serialization.py", line 595, in _load return legacy_load(f) File "/opt/conda/lib/python3.6/site-packages/torch/serialization.py", line 506, in legacy_load with closing(tarfile.open(fileobj=f, mode='r:', format=tarfile.PAX_FORMAT)) as tar, \ File "/opt/conda/lib/python3.6/tarfile.py", line 1589, in open return func(name, filemode, fileobj, kwargs) File "/opt/conda/lib/python3.6/tarfile.py", line 1619, in taropen return cls(name, mode, fileobj, kwargs) File "/opt/conda/lib/python3.6/tarfile.py", line 1482, in init self.firstmember = self.next() File "/opt/conda/lib/python3.6/tarfile.py", line 2309, in next raise ReadError(str(e)) tarfile.ReadError: invalid header
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "ann_to_snn.py", line 147, in
I found that the above error was due to "using pytorch1.3 to load .pt file saved by ptorch1.8". (RuntimeError: weights/best.pt is a zip archive) Therefore, using Pytorch1.3 works fine for ann_to_snn.py. Thanks very much.
—You are receiving this because you were mentioned.Reply to this email directly, view it on GitHub, or unsubscribe.
@cwq159 Hello, I ran into the same problem but couldn't find Pytorch=1.3. I tried PyTorch =1.4 and still couldn't solve it. Can you give me some more advice.
Thanks so much!
@cwq159 Hello, I ran into the same problem but couldn't find Pytorch=1.3. I tried PyTorch =1.4 and still couldn't solve it. Can you give me some more advice.
Thanks so much!
PyTorch 1.5 with python3.7 work fine
pytorch1.6.0 python3.7.13 不会报错
when I try to transform ann to snn ,some problems occurred:
$ python3 ann_to_snn.py --cfg cfg/yolov3-tiny.cfg --data data/coco.data --weights weights/best.pt --timesteps 128Namespace(augment=False, batch_size=16,
Model Summary: 37 layers, 8.85237e+06 parameters, 8.85237e+06 gradients add node conv1: ['dag_input0']->['conv1_out1'] Traceback (most recent call last): File "ann_to_snn.py", line 178, in transformer.inference_get_status(dataloader, opt.statistics_iters) File "PyTorch-Spiking-YOLOv3/spiking_utils/snn_transformer.py", line 94, in inference_get_status self.init_dag([data]) File "PyTorch-Spiking-YOLOv3/spiking_utils/snn_transformer.py", line 69, in init_dag self.snn_dag = ann_parser.parse_ann_model(self.original_net, inputs) File "PyTorch-Spiking-YOLOv3/spiking_utils/ann_parser.py", line 221, in parse_ann_model model(warpped_input) File "anaconda3/envs/spikeyolo/lib/python3.7/site-packages/torch/nn/modules/module.py", line 727, in _call_impl result = self.forward(input, kwargs) File "ann_to_snn.py", line 53, in forward x = self.listi File "anaconda3/envs/spikeyolo/lib/python3.7/site-packages/torch/nn/modules/module.py", line 727, in _call_impl result = self.forward(*input, *kwargs) File "anaconda3/envs/spikeyolo/lib/python3.7/site-packages/torch/nn/modules/container.py", line 117, in forward input = module(input) File "anaconda3/envs/spikeyolo/lib/python3.7/site-packages/torch/nn/modules/module.py", line 727, in _call_impl result = self.forward(input, kwargs) File "anaconda3/envs/spikeyolo/lib/python3.7/site-packages/torch/nn/modules/conv.py", line 423, in forward return self._conv_forward(input, self.weight) File "anaconda3/envs/spikeyolo/lib/python3.7/site-packages/torch/nn/modules/conv.py", line 420, in _conv_forward self.padding, self.dilation, self.groups) File "PyTorch-Spiking-YOLOv3/spiking_utils/ann_parser.py", line 69, in conv2d_wrapper in_nodes = [find_node_by_tensor(inp)] File "PyTorch-Spiking-YOLOv3/spiking_utils/ann_parser.py", line 10, in find_node_by_tensor raise ValueError("cannot find tensor Size", tensor.size()) ValueError: ('cannot find tensor Size', torch.Size([16, 16, 320, 320]))
Have you solved this problem?
当我尝试将 Ann 转换为 SNN 时,出现了一些问题:
$ python3 ann_to_snn.py --cfg cfg/yolov3-tiny.cfg --data data/coco.data --weights weights/best.pt --timesteps 128Namespace(augment=False, batch_size=16,
模型摘要:37 层,8.85237e+06 参数,8.85237e+06 梯度 添加节点 conv1: ['dag_input0']->['conv1_out1'] 回溯(最近一次调用):文件 “ann_to_snn.py”,第 178 行,transformer.inference_get_status(数据加载器,opt.statistics_iters) 文件“PyTorch-Spiking-YOLOv3/spiking_utils/snn_transformer.py”,第 94 行,inference_get_status self.init_dag([data])文件 “PyTorch-Spiking-YOLOv3/spiking_utils/snn_transformer.py”,第 69 行,init_dag self.snn_dag = ann_parser.parse_ann_model(self.original_net, inputs) 文件 “PyTorch-Spiking-YOLOv3/spiking_utils/ann_parser.py”,第 221 行,在 parse_ann_model model(warpped_input) 中 文件 “anaconda3/envs/spikeyolo/lib/python3.7/site-packages/torch/nn/modules/module.py”,第 727 行,在 _call_impl result = self.forward(input, kwargs)文件 “ann_to_snn.py”,第 53 行,在 forward x = self.listi 文件中 “anaconda3/envs/spikeyolo/lib/python3.7/site-packages/torch/nn/modules/module.py”,第 727 行,结果_call_impl = self.forward(*input, *kwargs) 文件 “anaconda3/envs/spikeyolo/lib/python3.7/site-packages/torch/nn/modules/container.py”,第 117 行,在 forward input = module(input)文件 “anaconda3/envs/spikeyolo/lib/python3.7/site-packages/torch/nn/modules/module.py”,第 727 行,在 _call_impl result = self.forward(input, kwargs) 文件 “anaconda3/envs/spikeyolo/lib/python3.7/site-packages/torch/nn/modules/conv.py”,第 423 行,在正向返回中 self._conv_forward(input, self.weight) 文件 “anaconda3/envs/spikeyolo/lib/python3.7/site-packages/torch/nn/modules/conv.py”,第 420 行,_conv_forward self.padding, self.dilation, self.groups) 文件 “PyTorch-Spiking-YOLOv3/spiking_utils/ann_parser.py”,第 69 行,conv2d_wrapper in_nodes = [find_node_by_tensor(inp)] 文件 “PyTorch-Spiking-YOLOv3/spiking_utils/ann_parser.py”,第 10 行,find_node_by_tensor 提高 ValueError(“找不到张量大小”,tensor.size()) ValueError:(“找不到张量大小”,火炬。尺寸([16, 16, 320, 320]))
您好 ,请问现在这个问题您解决了吗
Has anyone solved the problem above
when I try to transform ann to snn ,some problems occurred:
$ python3 ann_to_snn.py --cfg cfg/yolov3-tiny.cfg --data data/coco.data --weights weights/best.pt --timesteps 128Namespace(augment=False, batch_size=16,
Model Summary: 37 layers, 8.85237e+06 parameters, 8.85237e+06 gradients add node conv1: ['dag_input0']->['conv1_out1'] Traceback (most recent call last): File "ann_to_snn.py", line 178, in
transformer.inference_get_status(dataloader, opt.statistics_iters)
File "PyTorch-Spiking-YOLOv3/spiking_utils/snn_transformer.py", line 94, in inference_get_status
self.init_dag([data])
File "PyTorch-Spiking-YOLOv3/spiking_utils/snn_transformer.py", line 69, in init_dag
self.snn_dag = ann_parser.parse_ann_model(self.original_net, inputs)
File "PyTorch-Spiking-YOLOv3/spiking_utils/ann_parser.py", line 221, in parse_ann_model
model(warpped_input)
File "anaconda3/envs/spikeyolo/lib/python3.7/site-packages/torch/nn/modules/module.py", line 727, in _call_impl
result = self.forward(input, kwargs)
File "ann_to_snn.py", line 53, in forward
x = self.listi
File "anaconda3/envs/spikeyolo/lib/python3.7/site-packages/torch/nn/modules/module.py", line 727, in _call_impl
result = self.forward(*input, *kwargs)
File "anaconda3/envs/spikeyolo/lib/python3.7/site-packages/torch/nn/modules/container.py", line 117, in forward
input = module(input)
File "anaconda3/envs/spikeyolo/lib/python3.7/site-packages/torch/nn/modules/module.py", line 727, in _call_impl
result = self.forward(input, kwargs)
File "anaconda3/envs/spikeyolo/lib/python3.7/site-packages/torch/nn/modules/conv.py", line 423, in forward
return self._conv_forward(input, self.weight)
File "anaconda3/envs/spikeyolo/lib/python3.7/site-packages/torch/nn/modules/conv.py", line 420, in _conv_forward
self.padding, self.dilation, self.groups)
File "PyTorch-Spiking-YOLOv3/spiking_utils/ann_parser.py", line 69, in conv2d_wrapper
in_nodes = [find_node_by_tensor(inp)]
File "PyTorch-Spiking-YOLOv3/spiking_utils/ann_parser.py", line 10, in find_node_by_tensor
raise ValueError("cannot find tensor Size", tensor.size())
ValueError: ('cannot find tensor Size', torch.Size([16, 16, 320, 320]))