Comments (17)
I could not locate the corresponding code in your error message in newest (the version on github) tensorboardX . Which version are you on?
from tensorboardx.
I use pip3 install tensorboardX, which version is 0.8. I will update it later.
from tensorboardx.
The pip version is pretty old. XD
Please try pip install git+https://github.com/lanpa/tensorboard-pytorch
if you have time~
from tensorboardx.
I upgrade the version from 0.8 to 0.9. But the problem still exist.
from tensorboardx.
So what is the error message in V0.9?
from tensorboardx.
same as V0.8. Given as follows, where fun_wr is my wrapper class to write summary.
File "/tchelpers.py", line 346, in write
fun_wr(mn0,data[mn0], niter)
File "/opt/pytorch/lib/python3.5/site-packages/tensorboardX/writer.py", line 323, in add_histogram
self.file_writer.add_summary(histogram(tag, values, bins), global_step)
File "/opt/pytorch/lib/python3.5/site-packages/tensorboardX/summary.py", line 114, in histogram
hist = make_histogram(values.astype(float), bins)
File "/opt/pytorch/lib/python3.5/site-packages/tensorboardX/summary.py", line 132, in make_histogram
bucket=counts)
TypeError: 0 has type numpy.int64, but expected one of: int, long, float
from tensorboardx.
I will try to debug it later if my training machine is free...
from tensorboardx.
Hi, what is the output of type(mn0)
, type(data[mn0])
.
(a small example to produce the bug will be great help)
from tensorboardx.
I will provide sample data to you later because my machine is not free...
from tensorboardx.
The attached is my data (numpy *.npz file in zip file) to be used in the function "make_histogram" in the summary.py.
The error arises in the last para of "HistogramProto" function, which is bucket=counts.
I hope this will help you to debug the program.
from tensorboardx.
no error on my machine :(
import numpy as np
from tensorboardX import SummaryWriter
data = np.load('test.npz')
bins = data['bins']
data = data['values']
print(data.shape)
with SummaryWriter() as w:
w.add_histogram('data', data, 0, bins=bins)
w.add_histogram('data', data, 1)
from tensorboardx.
I use the code above but the error is still there. The error msg is same as the before.
Is this due to the version of numpy? My numpy version is 1.13.0.
from tensorboardx.
I debug it again and again. I found that error arose in
HistogramProto(min=values.min(),max=values.max(), num=len(values),sum=values.sum(),sum_squares=sum_sq,bucket_limit=limits,bucket=counts).
because the type of counts is np.int64 array where is given by
counts, limits = np.histogram(values, bins=bins) in summary.py.
If I replace counts with a list, such as [1,2], everything is ok.
or use as
HistogramProto(min=values.min(),max=values.max(), num=len(values),sum=values.sum(),sum_squares=sum_sq,bucket_limit=limits,bucket=counts.tolist()) is ok.
It seems that my numpy can not automatically convert an numpy array to list of ints.
from tensorboardx.
Hi, my counts.dtype
is also numpy.int64
. Based on your description, it looks like the protobuf does not convert ndarray
to the datatype it expect. Btw, have you run demo.py
before? Did it break the code? Thanks
from tensorboardx.
If use demo.py, got the same error as follows
Traceback (most recent call last):
File "demo.py", line 35, in
writer.add_histogram(name, param, n_iter)
File "/opt/pytorch/lib/python3.5/site-packages/tensorboardX/writer.py", line 323, in add_histogram
self.file_writer.add_summary(histogram(tag, values, bins), global_step)
File "/opt/pytorch/lib/python3.5/site-packages/tensorboardX/summary.py", line 114, in histogram
hist = make_histogram(values.astype(float), bins)
File "/opt/pytorch/lib/python3.5/site-packages/tensorboardX/summary.py", line 132, in make_histogram
bucket=counts)
TypeError: 0 has type numpy.int64, but expected one of: int, long, float
Exception ignored in: <function WeakValueDictionary.init..remove at 0x7f6f077a5378>
Traceback (most recent call last):
File "/opt/pytorch/lib/python3.5/weakref.py", line 117, in remove
TypeError: 'NoneType' object is not callable
from tensorboardx.
After I upgraded the protobuf from 3.0.0 (in debian distribution) to the latest version (3.5.0), everything is ok.
from tensorboardx.
I reproduced it on a VM and I found that the minimum working version is 3.2.0. Thanks!
from tensorboardx.
Related Issues (20)
- tensorboardX is incompatible with protobuf 4.21.0 HOT 16
- draw NaN with triangle
- Subsequent hparams missing HOT 4
- DeprecationWarning: crc32c.crc32 will be eventually removed, use crc32c.crc32c instead HOT 2
- AttributeError: 'NoneType' object has no attribute 'get_logdir' HOT 3
- Protobuf version HOT 4
- How can I connect previous log file into new one in tensorboard HOT 1
- How can i read tensorboard by python ? HOT 2
- Deprecation Warnings HOT 15
- OSS License compatibility question
- Remove upper pins on protobuf HOT 4
- tensorboardX is converting white/blank space and other non alphanumeric characters to underscore
- Update unittests for newer protobuf
- Possibility of v2.5.2 with upper pin on protobuf of <4? HOT 3
- The license_file parameter is deprecated HOT 3
- Loosening protobuf version limit breaking downstream packages HOT 7
- Is there an efficient way to log line plots? HOT 5
- EOFError multiprocessing HOT 1
- Set experiment name when using CometML HOT 1
- Support add_mesh for visdom writer?
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from tensorboardx.