Skip to content

Commit 5d5b5fc

Browse files
committed
'prepare for release v2.1'
1 parent 6cffc95 commit 5d5b5fc

File tree

5 files changed

+42
-20
lines changed

5 files changed

+42
-20
lines changed

HISTORY.rst

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,13 @@
11
History
22
=======
3+
2.1 (2020-07-05)
4+
-----------------
5+
* Global SummaryWriter that mimics python's default logger class, concurrent write is supported.
6+
* 200x speed up for add_audio. Please install the soundfile package for this feature.
7+
* Supports jax tensors.
8+
* The add_graph function is delegated to the one in torch.utils.tensorboard.
9+
* Bug fixes, see the commit log in Github.
10+
311
2.0 (2019-12-31)
412
-----------------
513
* Now you can tag Hparams trials with custom name instead of the default epoch time

README.md

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,32 +8,36 @@
88

99
Write TensorBoard events with simple function call.
1010

11+
The current release (v2.1) is tested on anaconda3, with PyTorch 1.5.1 / torchvision 0.6.1 / tensorboard 2.2.2.
12+
1113
* Support `scalar`, `image`, `figure`, `histogram`, `audio`, `text`, `graph`, `onnx_graph`, `embedding`, `pr_curve`, `mesh`, `hyper-parameters`
1214
and `video` summaries.
1315

14-
* requirement for `demo_graph.py` is tensorboardX>=1.9 and pytorch>=1.3
15-
1616
* [FAQ](https://github.com/lanpa/tensorboardX/wiki)
1717

18-
## Install
1918

20-
Tested on anaconda2 / anaconda3, with PyTorch 1.3.1 / torchvision 0.4.1 / tensorboard 2.0.0
19+
## Install
2120

2221
`pip install tensorboardX`
2322

2423
or build from source:
2524

2625
`pip install 'git+https://github.com/lanpa/tensorboardX'`
2726

27+
You can optionally install [`crc32c`](https://github.com/ICRAR/crc32c) to speed up.
28+
29+
`pip install crc32c`
2830

29-
You can optionally install [`crc32c`](https://github.com/ICRAR/crc32c) to speed up saving a large amount of data.
31+
Starting from tensorboardX 2.1, You need to install `soundfile` for the `add_audio()` function (200x speedup).
3032

33+
`pip install soundfile`
3134

3235
## Example
3336

3437
* Clone the files in https://github.com/lanpa/tensorboardX/tree/master/examples
3538
* Run the demo script: e.g. `python examples/demo.py`
36-
* Use TensorBoard with `tensorboard --logdir runs` (needs to install TensorFlow)
39+
* Start TensorBoard with `tensorboard --logdir runs`
40+
3741

3842
```python
3943
# demo.py

examples/demo.py

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,12 @@
66
from tensorboardX import SummaryWriter
77
import datetime
88

9+
try:
10+
import soundfile
11+
skip_audio = False
12+
except ImportError:
13+
skip_audio = True
14+
915
resnet18 = models.resnet18(False)
1016
writer = SummaryWriter()
1117
sample_rate = 44100
@@ -37,12 +43,13 @@
3743
torch.Tensor([[10, 10, 100, 100], [101, 101, 200, 200]]),
3844
n_iter,
3945
labels=['abcde' + str(n_iter), 'fgh' + str(n_iter)])
40-
x = torch.zeros(sample_rate * 2)
41-
for i in range(x.size(0)):
42-
# sound amplitude should in [-1, 1]
43-
x[i] = np.cos(freqs[n_iter // 10] * np.pi *
44-
float(i) / float(sample_rate))
45-
writer.add_audio('myAudio', x, n_iter)
46+
if not skip_audio:
47+
x = torch.zeros(sample_rate * 2)
48+
for i in range(x.size(0)):
49+
# sound amplitude should in [-1, 1]
50+
x[i] = np.cos(freqs[n_iter // 10] * np.pi *
51+
float(i) / float(sample_rate))
52+
writer.add_audio('myAudio', x, n_iter)
4653
writer.add_text('Text', 'text logged at step:' + str(n_iter), n_iter)
4754
writer.add_text('markdown Text', '''a|b\n-|-\nc|d''', n_iter)
4855
for name, param in resnet18.named_parameters():

setup.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33

44
import subprocess
55
import os
6+
import sys
67
from setuptools import setup, find_packages
78
from setuptools.command.develop import develop
89
from setuptools.command.install import install
@@ -30,16 +31,16 @@ def run(self):
3031
with open('HISTORY.rst') as history_file:
3132
history = history_file.read()
3233

33-
preparing_PyPI_package = False
34-
version_git = version = '2.0'
34+
preparing_PyPI_package = 'sdist' in sys.argv or 'bdist_wheel' in sys.argv
35+
version_git = version = '2.1'
3536

3637
if not preparing_PyPI_package:
3738
if os.path.exists('.git'):
3839
sha = subprocess.check_output(['git', 'rev-parse', 'HEAD']).decode('ascii').strip()
3940
version_git = version_git + '+' + sha[:7]
4041

41-
with open('tensorboardX/__init__.py', 'a') as f:
42-
f.write('\n__version__ = "{}"\n'.format(version_git))
42+
with open('tensorboardX/__init__.py', 'a') as f:
43+
f.write('\n__version__ = "{}"\n'.format(version_git))
4344

4445
requirements = [
4546
'numpy',
@@ -88,10 +89,9 @@ def run(self):
8889

8990

9091
# checklist: update History.rst readme.md
91-
# change preparing_PyPI_package to True, and update version_git to new version
92-
# remove __version__ = "1.old" in __init__.py, update the version number
92+
# update the version number in this file.
9393
# python setup.py sdist bdist_wheel --universal
94-
# check the generated tar.gz file
94+
# check the generated tar.gz file (the version, no *.pyc)
9595
# git add [files]
9696
# git commit -m 'prepare for release'
9797
# add tag

tensorboardX/__init__.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,7 @@
55
from .torchvis import TorchVis
66
from .writer import FileWriter, SummaryWriter
77
from .global_writer import GlobalSummaryWriter
8-
__version__ = "2.0" # will be overwritten if run setup.py
8+
__version__ = "dev"
9+
# will be overwritten if run setup.py
10+
# specifically, `python setup.py install` creates [version in setup.py + git SHA hash]
11+
# python setup.py sdist creates a decimal version number

0 commit comments

Comments
 (0)