首页 > 解决方案 > Tensorboard 显示空白页(拒绝执行来自“http://localhost:6006/index.js”的脚本,因为它的 MIME 类型)

问题描述

尝试打开 tesnorflow 时,我只得到一个木板页面: 在此处输入图像描述

这是它在 Firefox 中的样子:

在此处输入图像描述

我在 chrome 控制台中收到错误消息:

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.

在 Firefox 控制台中,我收到错误消息:

The resource from “http://localhost:6006/index.js” was blocked due to MIME type (“text/plain”) mismatch (X-Content-Type-Options: nosniff)

Loading failed for the <script> with source “http://localhost:6006/index.js”.

我试过:
无法在浏览器中打开 Tensorboard
Tensorboard 得到空白页

我在控制台中输入:

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

我有张量板版本:2.1.0 我生成了这样的数据:

 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()

我遵循了本教程:TensorBoard with PyTorch - Visualize Deep Learning Metrics

标签: python-3.xtensorflowpytorchtensorboard

解决方案


这里报告了类似的错误和解决方案。

显然这与 Windows 注册表中的一些问题有关。根据评论,这似乎是解决方案

在我的情况下,以下程序解决了问题:

  1. windows + r 和注册表编辑器
  2. [你的电脑]\HKEY_LOCAL_MACHINE\SOFTWARE\Classes\.js
  3. 将内容类型从“text/plain”更改为“application/javascript”

推荐阅读