Mole_m7b5
(Daniel Turner)
January 25, 2023, 6:13pm
1
I’m trying to use torch.profiler.profile()
to investigate potential bottlenecks in my pipeline. When trying to generate a JSON file either with tensorboard_trace_handler()
or with profile.export_chrome_trace()
the subsequent JSON file, when being read by either tensorboard or Chrome trace viewer results in an stating json.decoder.JSONDecodeError: Invalid \escape: line 1748355 column 56 (char 160536060)
I know this error means there is a \
rather than a \\
or /
- is this a known issue?
seemingly issue is old, and was patched
opened 05:54PM - 17 Jun 21 UTC
closed 10:33PM - 30 Jun 21 UTC
high priority
module: windows
triaged
oncall: profiler
## 🐛 Bug
On windows, tensorboard_trace_handler use the separador \ in the fi… le path instead of / or \\\ breaking the json file.
## To Reproduce
Steps to reproduce the behavior:
1. Setup the Profiler. Example:
`with torch.profiler.profile(
activities=[
torch.profiler.ProfilerActivity.CPU,
torch.profiler.ProfilerActivity.CUDA],
schedule=torch.profiler.schedule(
wait=2,
warmup=3,
active=6),
on_trace_ready=torch.profiler.tensorboard_trace_handler('./result', worker_name='worker0'),
record_shapes=True,
profile_memory=True,
with_stack=True
) as p:`
2. Use Kineto to try to profile the file `tensorboard --logdir=./result`
3. It throw the error on windows: `json.decoder.JSONDecodeError: Invalid \escape: line 12 column 64 (char 371)`
## Expected behavior
To escape the separator correctly on the json file. Ex: \\\
## Environment
```
PyTorch version: 1.9.0+cu111
Is debug build: False
CUDA used to build PyTorch: 11.1
ROCM used to build PyTorch: N/A
OS: Microsoft Windows 10 Home Single Language
GCC version: Could not collect
Clang version: Could not collect
CMake version: Could not collect
Libc version: N/A
Python version: 3.9 (64-bit runtime)
Python platform: Windows-10-10.0.19041-SP0
Is CUDA available: False
CUDA runtime version: No CUDA
GPU models and configuration: No CUDA
Nvidia driver version: No CUDA
cuDNN version: No CUDA
HIP runtime version: N/A
MIOpen runtime version: N/A
Versions of relevant libraries:
[pip3] numpy==1.20.3
[pip3] pytorch-lightning==1.3.5
[pip3] torch==1.9.0+cu111
[pip3] torch-tb-profiler==0.2.0
[pip3] torchaudio==0.9.0
[pip3] torchmetrics==0.3.2
[pip3] torchvision==0.10.0+cu111
[conda] Could not collect
```
cc @ezyang @gchanan @zou3519 @bdhirsh @jbschlosser @anjali411 @ilia-cher @gdankel @ngimel @nbcsm @guotuofeng @guyang3532 @gaoteng-git @peterjc123 @mszhanyi @skyline75489
but I get this error again in 2.2