Reputation: 906
When Trying to open tesnorflow I just get a plank page:
This is how it looks like in firefox:
I get the error message in the chrome console:
Refused to execute script from 'http://localhost:6006/index.js' because its MIME type ('text/plain') is not executable, and strict MIME type checking is enabled.
In the firefox console I get the error message:
The resource from “http://localhost:6006/index.js” was blocked due to MIME type (“text/plain”) mismatch (X-Content-Type-Options: nosniff)
and
Loading failed for the <script> with source “http://localhost:6006/index.js”.
I tried:
Unable to open Tensorboard in browser
Tensorboard get blank page
I typed in the console:
tensorboard --logdir=runs --bind_all
tensorboard --logdir=./runs --bind_all
tensorboard --logdir=./runs/ --bind_all
tensorboard --logdir=./runs --host localhost --port 6006
tensorboard --logdir=./runs --host localhost
tensorboard --logdir=./runs --port 6006 --bind_all
I have tensorboard version: 2.1.0 I generated my data like that:
train_set = torchvision.datasets.FashionMNIST(
root="./data/FashionMNIST",
train=True,
download=True,
transform=transforms.Compose([
transforms.ToTensor()
])
)
train_loader = torch.utils.data.DataLoader(train_set, batch_size=1000)
tb = SummaryWriter()
network = Network()
images, labels = next(iter(train_loader))
grid = torchvision.utils.make_grid(images)
tb.add_image("image", grid)
tb.add_graph(network, images)
tb.close()
I followed this tutorial: TensorBoard with PyTorch - Visualize Deep Learning Metrics
Upvotes: 3
Views: 2779
Reputation: 22214
There's a similar error and resolution reported here.
Apparently this has to do with some issue in the windows registry. Based on the comments this seems to be the solution
In my case following procedure solved the problem:
- windows + r and regedit
- [your computer]\HKEY_LOCAL_MACHINE\SOFTWARE\Classes\.js
- Change content type from 'text/plain' to 'application/javascript'
Upvotes: 6
Reputation: 711
If you can't or don't want to change your windows registry to fix it (since it requires some privileges you might not have), your only other option is to patch it directly at the mimetypes lib module.
It is usually found at C:\python38\Lib\mimetypes.py
, but you can find where it is by running the following at the command line:
python -c "import mimetypes; print(mimetypes.__file__)"
Open the file printed (you might need admin privileges if it's not a local python installation) and find the def guess_type(...):
line, which in my version is at line 97
and add the following lines at the start of the function (in my case it was at L116
and L117
):
if (isinstance(url, str) and url[-3:] == '.js'):
return 'application/javascript', None
After saving it, return to the command line check if it worked:
python -c "import mimetypes; print(mimetypes.guess_type('index.js'))"
Note that this 'hard-coding' is not always the best option since when you update your python version the mimetypes.py
will be removed with this 'fix' but it is useful when using a local python installation on a school computer, for example.
There's a discussion about this issue at the tensorboard repository, if you wish to learn more about it.
Upvotes: 2