Git Product home page Git Product logo

net-toolkit's Introduction

net-Toolkit

A simple module for Torch7 and the nn package.

Installation

luarocks install --server=https://raw.github.com/Atcold/net-toolkit/master net-toolkit

Description

This package allows to save and retrive to/from disk a lighter version of the network that is being training.

saveNet()

saveNet() saves a lighter version of your current network, removing all unnecessary data from it (such as gradients, activation units' state and etc...) and returns a new couple of flattened weight and gradients. Usage:

w, dw = saveNet(model, fileName)

saveNetFields()

saveNetFields() saves your current network, removing all Tensor data you don't want to save and returns a new couple of flattened weight and gradients. Usage:

w, dw = saveNetFields(model, fileName, {'weight', 'bias'})

Only weight and bias Tensors will be saved and the rest will be discarded.

loadNet()

Let's say we would like to load a network we have previously saved with saveNet() for continuing a training session on it. Some inner parameters (something about gradients) have to be restored, since saveNet() did a pruning operation on the network in order to save space. Here is how we can handle this case:

model, w, dw = loadNet(fileName)

Now we can keep training, perhaps without forgetting to (re-)define a criterion loss (the criterion is not saved with the network, so we have to re-define it, if we don't already do it somewhere else in the code).

net-toolkit's People

Contributors

atcold avatar gsair avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.