首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Joe Laba的“Hands On tensorboard for Developers”中的代码运行Tensorboard

Joe Laba的“Hands On tensorboard for Developers”中的代码运行Tensorboard
EN

Stack Overflow用户
提问于 2020-04-25 10:19:05
回答 1查看 377关注 0票数 0

我尝试在Windows10机器上运行本系列视频1.3中的代码。我使用的是来自Miniconda3发行版的Python3.764位VScode集成开发环境。我已经解决了tensorflow、tensorboard和Cuda版本之间的许多配置错误,并生成了一个运行文件。从目录中运行tensorboard --logfile=./runfile现在运行时没有错误,但它什么也不做。没有输出URL,当我尝试从Firefox浏览器打开localhost:6006时,它找不到它。我喜欢拼图,但现在我很沮丧。

代码语言:javascript
复制
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function

#import numpy as np #Change all calls to numpy instead of np or set np = numpy
import os
import sys
import argparse

"""
This code implements the tensor board programming from 
the book "Hands-On TensorBoard for PyTorch Developers [Video]" by joe Laba
The book/videos use Tensorboard 2.0.2, Torch 1.3.1.
It requires the use of the Python 3.7 64 bit environment which comes from 
the Miniconda3 folder. This upgrades to the following packages;
numpy (1.17.2)
pillow (7.1.1)
python (3.7.1)
pytorch (1.2.0)
scipy(1.3.1)
tensorboard(2.1.1)
tensorflow(2.1.0)
tensorflow-gpu (2.1.0)
theano(1.0.1)
torchvision (0.4.0)

Which compiles with no errors
NVidia driver 441.22
cuDnn 7.6.5
Cuda 10.2.95

"""
###################################################################
# Variables                                                       #
# When launching project or scripts from Visual Studio,           #
# input_dir and output_dir are passed as arguments automatically. #
# Users could set them from the project setting page.             #
###################################################################

input_dir = None
output_dir = None
log_dir = None

#################################################################################
# PyTorch imports.                                                               #
#################################################################################
import tensorflow
import tensorboard
#from tensorflow.python.keras.callbaccks import Tensorboard
import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.optim as optim
from torchvision import datasets, transforms
from torch.utils.tensorboard import SummaryWriter



def main():
    print("I am now in main")
    # Set up Tensorboard
    #Writer will output to ./runs/ directory by default
    writer = SummaryWriter()

    for x in range(5):
        y=100*x
        writer.add_scalar ('y',y,x)

    writer.close()
    print("done with writer")
    print("more done with writer")


if __name__ == "__main__":
    parser = argparse.ArgumentParser()
    parser.add_argument("--input_dir", type=str, 
                        default=None, 
                        help="Input directory where where training dataset and                  metadata are saved", 
                        required=False
                        )
    parser.add_argument("--output_dir", type=str, 
                        default=None, 
                        help="Input directory where where logs and models are saved", 
                        required=False
                        )

    args, unknown = parser.parse_known_args()
    input_dir = args.input_dir

    main() #This causes main to run
EN

回答 1

Stack Overflow用户

发布于 2020-05-02 11:33:58

在研究了VS2019环境和PED-514的源文档之后,我删除了多个未使用的环境。然后我卸载了pip3 ...tensorflow、tensorboard和numpy的多个版本。然后我通过pip安装兼容版本的tensorflow (2.1.0),tensorboard (2.1.1)和numpy (1.18.3)。现在情况看起来很好。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/61420184

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档