• Stars
    star
    625
  • Rank 71,862 (Top 2 %)
  • Language
    Python
  • License
    MIT License
  • Created about 8 years ago
  • Updated over 1 year ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Log TensorBoard events without touching TensorFlow

tensorboard_logger

Note: consider using https://pytorch.org/docs/stable/tensorboard.html instead which has the same goal and is part of pytorch.

Log TensorBoard events without TensorFlow

TensorBoard is a visualization tool (not this project, it's a part of TensorFlow framework) that makes it easy to check training progress, compare between different runs, and has lots of other cool features.

tensorboard_example.png

tensorboard_logger library allows to write TensorBoard events without TensorFlow:

from tensorboard_logger import configure, log_value

configure("runs/run-1234")

for step in range(1000):
    v1, v2 = do_stuff()
    log_value('v1', v1, step)
    log_value('v2', v2, step)

Note: if you are already using TensorFlow in your project, you probably don't need this library.

Installation

TensorFlow is required only for viewing logged events: please check installation guide on the official site (you probably want a CPU-only version).

tensorboard_logger can be installed with pip:

pip install tensorboard_logger

Usage

You can either use default logger with tensorboard_logger.configure and tensorboard_logger.log_value functions, or use tensorboard_logger.Logger class.

This library can be used to log numerical values of some variables in TensorBoard format, so you can use TensorBoard to visualize how they changed, and compare same variables between different runs. Log file is written into a directory, so you need a separate directory for each run (you can place other logs or output files you use in the same directory). Directories from different runs you wish to compare should have the same parent (there can be other files or directories with the same parent, TensorBoard will figure out which directories contain logs).

Apart from variable names and their values, another important thing is the step: this must be an integer that represents some increasing step - it can be a step in training or some other number. The values are ordered by step in TensorBoard, although you can view them ordered by time or relative step too.

A simple usage example:

from tensorboard_logger import configure, log_value

configure("runs/run-1234", flush_secs=5)

for step in range(1000):
    v1, v2 = do_stuff()
    log_value('v1', v1, step)
    log_value('v2', v2, step)

You can start TensorBoard right away:

tensorboard --logdir runs

And go check the metrics to TensorBoard UI at http://localhost:6006 (note that it binds to 0.0.0.0 by default). Metrics are refreshed on switch to browser tab, and there is also a refresh button at the top right.

Runtime overhead rather large, about 0.1 - 0.2 ms for a single value logged (so about 5,000 - 10,000 operations per second).

API

tensorboard_logger.configure(logdir, flush_secs=2)

Configure logging: a file will be written to logdir, and flushed every flush_secs. NOTE: right now file is flushed after each event written.

tensorboard_logger.log_value(name, value, step=None)

Log new value for given name on given step. value should be a real number (it will be converted to float), and name should be a string (it will be converted to a valid TensorFlow summary name). step should be an non-negative integer, and is used for visualization: you can log several different variables on one step, but should not log different values of the same variable on the same step (this is not checked). You can also omit step entirely.

tensorboard_logger.unconfigure()

Simply unconfigure the logger setting the global variable _default_logger to None.

tensorboard_logger.Logger

A class for writing logs in a directory. Use it if default logger used in two above functions is not enough for you (e.g. you want to log into several different directories, or don't like global variables). Constructor has the same signature as tensorboard_logger.configure, and it has a single log_value method with the same signature as tensorboard_logger.log_value.

Development

Compiling python protobuf files:

protoc --python_out . tensorboard_logger/tf_protobuf/summary.proto
protoc --python_out . tensorboard_logger/tf_protobuf/event.proto

License

MIT license


define hyperiongray

More Repositories

1

eli5

A library for debugging/inspecting machine learning classifiers and explaining their predictions
Jupyter Notebook
2,758
star
2

scrapy-rotating-proxies

use multiple proxies with Scrapy
Python
656
star
3

sklearn-crfsuite

scikit-learn inspired API for CRFsuite
Python
421
star
4

aquarium

Splash + HAProxy + Docker Compose
Python
192
star
5

deep-deep

Adaptive crawler which uses Reinforcement Learning methods
Jupyter Notebook
165
star
6

arachnado

Web Crawling UI and HTTP API, based on Scrapy and Tornado
Python
156
star
7

autologin

A project to attempt to automatically login to a website given a single seed
Python
115
star
8

html-text

Extract text from HTML
HTML
115
star
9

Formasaurus

Formasaurus tells you the type of an HTML form and its fields using machine learning
HTML
110
star
10

page-compare

Simple heuristic for measuring web page similarity (& data set)
HTML
88
star
11

autopager

Detect and classify pagination links
HTML
86
star
12

undercrawler

A generic crawler
Python
75
star
13

scrapy-crawl-once

Scrapy middleware which allows to crawl only new content
Python
74
star
14

soft404

A classifier for detecting soft 404 pages
Jupyter Notebook
53
star
15

agnostic

Agnostic Database Migrations
Python
51
star
16

autologin-middleware

Scrapy middleware for the autologin
Python
37
star
17

json-lines

Read JSON lines (jl) files, including gzipped and broken
Python
34
star
18

extract-html-diff

extract difference between two html pages
HTML
29
star
19

scrapy-kafka-export

Scrapy extension which writes crawled items to Kafka
Python
28
star
20

MaybeDont

A component that tries to avoid downloading duplicate content
Python
27
star
21

sitehound-frontend

Site Hound (previously THH) is a Domain Discovery Tool
HTML
23
star
22

imageSimilarity

Given a new image, determine if it is likely derived from a known image.
Python
20
star
23

domain-discovery-crawler

Broad crawler for domain discovery
Python
17
star
24

url-summary

Show summary of a large number of URLs in a Jupyter Notebook
Python
17
star
25

sitehound

This is the facade for installation and access to the individual components
Shell
16
star
26

tor-proxy

a tor socks proxy docker image
11
star
27

scrapy-dockerhub

[UNMAINTAINED] Deploy, run and monitor your Scrapy spiders.
Python
10
star
28

web-page-annotator

Annotate parts of web pages in the browser
Python
9
star
29

scrash-lua-examples

A collection of example LUA scripts and JS utilities
JavaScript
7
star
30

scrapy-cdr

Item definition and utils for storing items in CDR format for scrapy
Python
7
star
31

hh-page-classifier

Headless Horseman Page Classifier service
Python
6
star
32

privoxy

Privoxy HTTP Proxy based on jess/privoxy
6
star
33

sitehound-backend

Sitehound's backend
HTML
6
star
34

fortia

[UNMAINTAINED] Firefox addon for Scrapely
JavaScript
5
star
35

proxy-middleware

Scrapy middleware that reads proxy config from settings
Python
5
star
36

linkrot

[UNMAINTAINED] A script (Scrapy spider) to check a list of URLs.
Jupyter Notebook
4
star
37

hgprofiler

JavaScript
4
star
38

linkdepth

[UNMAINTAINED] scrapy spider to check link depth over time
Python
4
star
39

common-crawl-mapreduce

A naive scoring of commoncrawl's content using MR
Java
3
star
40

captcha-broad-crawl

Broad crawl of onion sites in search for captchas
Python
3
star
41

frontera-crawler

Crawler-specific logic for Frontera
Python
3
star
42

hh-deep-deep

THH ↔ deep-deep integration
Python
3
star
43

scrapy-login

[UNMAINTAINED] A middleware that provides continuous site login facility
Python
3
star
44

bk-string

A BK Tree based approach to storing and querying strings by Levenshtein Distance.
C
3
star
45

domainSpider

Simple web crawler that sticks to a set list of domains. Work in progress.
Python
3
star
46

quickpin

New iteration of QuickPin with Flask & AngularDart
Python
2
star
47

py-bkstring

A python wrapper for the bk-string C project.
Python
2
star
48

broadcrawl

Middleware that limits number of internal/external links during broad crawl
Python
2
star
49

sshadduser

A simple tool to add a new user with OpenSSH keys.
Python
2
star
50

autoregister

Python
2
star
51

quickpin-api

Python wrapper for the QuickPin API
Python
1
star
52

muricanize

A translation API
Python
1
star
53

rs-bkstring

Rust
1
star
54

scrash-pageuploader

[UNMAINTAINED] S3 Uploader pipelines for HTML and screenshots rendered by Splash
Python
1
star
55

site-checker

JavaScript
1
star
56

frontera-scripts

A set of scripts to spin up EC2 Frontera cluster with spiders
Python
1
star