visdom无法正常使用

前言

visdom是一个可视化工具,一个灵活的工具,用于创建,组织和共享实时丰富数据的可视化。支持Torch和Numpy。
更过介绍或者官方github

问题描述

首先安装好visdom:

$ pip install visdom
$ python -m visdom.server

终端提示如下,但是等了好长时间也没有结束:

Downloading scripts. It might take a while.

这个问题可能是我们无法访问部分国外网站导致的,所以找到 lib/python2.7/sitepackages/visdom/server.py 将download_scripts()注释掉,然后重新启动服务:

$ python -m visdom.server
It's Alive!
INFO:root:Application Started
You can navigate to http://localhost:8097

用浏览器打开该地址
发现一片空白,同时终端有如下提示:

ERROR:tornado.general:Could not open static file u/lib/python2.7/site-packages/visdom/static/fonts/layout_bin_packer'
INFO:tornado.access:200 GET / (127.0.0.1) 9.72ms
WARNING:tornado.access:404 GET /static/fonts/layout_bin_packer (127.0.0.1) 1.68ms
INFO:tornado.access:200 GET /static/js/plotly-plotly.min.js?v=adc89fbc14625411fd1e109c93c59372 (127.0.0.1) 4.91ms
INFO:tornado.access:200 GET /favicon.png (127.0.0.1) 2.64ms
WARNING:tornado.access:404 GET /static/fonts/layout_bin_packer (127.0.0.1) 1.01ms
INFO:tornado.access:101 GET /socket (127.0.0.1) 0.92ms
INFO:root:Opened new socket from ip: 127.0.0.1
INFO:tornado.access:200 POST /env/main (127.0.0.1) 0.59ms

找到 lib/python2.7/sitepackages/visdom/static 中的index.html,将其用如下index.html替换:

<!--

Copyright 2017-present, Facebook, Inc.
All rights reserved.

This source code is licensed under the license found in the
LICENSE file in the root directory of this source tree.

-->

<!doctype html>
<html>
  <head>
    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1">

    <link rel="shortcut icon" href="favicon.png">

    <!-- Bootstrap & jQuery -->
    <link href="https://unpkg.com/bootstrap@3.3.7/dist/css/bootstrap.min.css" rel="stylesheet">
    <script src="https://unpkg.com/jquery@3.1.1/dist/jquery.min.js"></script>
    <script src="https://unpkg.com/bootstrap@3.3.7/dist/js/bootstrap.min.js"></script>

    <link rel="stylesheet" href="https://unpkg.com/react-resizable@1.4.6/css/styles.css">
    <link rel="stylesheet" href="https://unpkg.com/react-grid-layout@0.14.0/css/styles.css">

    <!-- Other deps -->
    <script src="https://unpkg.com/react@15/dist/react.min.js"></script>
    <script src="https://unpkg.com/react-dom@15/dist/react-dom.min.js"></script>
    <script src="https://unpkg.com/classnames@2.2.5"></script>
    <script src="https://unpkg.com/layout-bin-packer@1.2.2"></script>
    <!--script src="https://cdn.rawgit.com/STRML/react-grid-layout/0.14.0/dist/react-grid-layout.min.js"></script--->
    <script src="http://pytorch-1252820389.cosbj.myqcloud.com/visdom/react-grid-layout.min.js"></script>

    <!-- Mathjax -->
    <script type="text/javascript" async src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_SVG"></script>

    <!-- Plotly -->
    <!--script src="https://cdn.rawgit.com/plotly/plotly.js/master/dist/plotly.min.js"></script-->
    <script src="https://cdn.plot.ly/plotly-latest.min.js"></script>

    <!-- Custom styles for this template -->
    <script>
    // TODO: this is not great. Should probably be an endpoint with a JSON
    // response or the first thing the socket sends back.
    var ENV_LIST = [
      {% for item in items %}
      '{{escape(item)}}',
      {% end %}
    ];
    var ACTIVE_ENV = '{{escape(active_item)}}';
    var USER = '{{escape(user)}}';

    // Plotly setup
    window.PLOTLYENV = window.PLOTLYENV || {};
    window.PLOTLYENV.BASE_URL = 'https://plot.ly';

    </script>
    <script src={{ static_url("js/main.js") }}></script>
    <link rel="stylesheet" href={{ static_url("css/style.css") }}>

    <title>visdom</title>
    <!-- <link rel="icon" href="http://example.com/favicon.png"> -->
  </head>

  <body>
    <noscript>JS is required</noscript>
    <div id="app"></div>
  </body>
</html>

visualDL

百度最新发布的可视化工具,虽然有bug,但是用着还可以,比较简单。
https://github.com/PaddlePaddle/VisualDL

评论 7
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值