• This repository has been archived on 17/Mar/2022
  • Stars
    star
    226
  • Rank 176,514 (Top 4 %)
  • Language
    Python
  • License
    MIT License
  • Created over 7 years ago
  • Updated almost 6 years ago

Reviews

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

Repository Details

Convert trained PyTorch models to Keras, and the other way around

nn-transfer

Build Status

NOTE: This repository does not seem to yield the correct output anymore with the latest versions of Keras and PyTorch. Take care to verify the results or use an alternative method for conversion.

This repository contains utilities for converting PyTorch models to Keras and the other way around. More specifically, it allows you to copy the weights from a PyTorch model to an identical model in Keras and vice-versa.

From Keras you can then run it on the TensorFlow, Theano and CNTK backend. You can also convert it to a pure TensorFlow model (see [1] and [2]), which allows you to choose more robust deployment options in the cloud, or even mobile devices. From Keras you can also do inference in browsers with keras-js.

Installation

Clone this repository, and simply run

pip install .

You need to have PyTorch and torchvision installed beforehand, see the PyTorch website for how to easily install that.

Tests

To run the unit and integration tests:

python setup.py test
# OR, if you have nose2 installed,
nose2

There is also Travis CI which will automatically build every commit, see the button at the top of the readme. You can test the direction of weight transfer individually using the TEST_TRANSFER_DIRECTION environment variable, see .travis.yml.

How to use

See example.ipynb for a small tutorial on how to use this library.

Code guidelines

  • This repository is fully PEP8 compliant, I recommend flake8.
  • It works for both Python 2 and 3.

More Repositories

1

starboard-notebook

In-browser literate notebooks
TypeScript
1,217
star
2

tygo

Generate Typescript types from Golang source code
Go
592
star
3

coi-serviceworker

Cross-origin isolation (COOP and COEP) through a service worker for situations in which you can't control the headers (e.g. GH pages)
JavaScript
369
star
4

luna16

LUNA16 Lung Nodule Analysis - NWI-IMC037 Final Project
Python
183
star
5

zarr.js

Javascript implementation of Zarr
TypeScript
132
star
6

GConsole

Developer Console for Unity3D
C#
101
star
7

starboard-cli

Starboard CLI for local (offline) editing of notebooks
CSS
20
star
8

LD49

TypeScript
20
star
9

starboard-observable

Observable cells in Starboard Notebook. Why not?
TypeScript
20
star
10

jpeg-artifact-reduction

Jupyter Notebook
16
star
11

starboard-jupyter

Plugin to run Starboard cells in an external Jupyter kernel
TypeScript
15
star
12

starboard-wrap

🌯A small library that wraps a Starboard Notebook iframe in the parent webpage
TypeScript
14
star
13

wasmwrap

Wrap WASM into JS files as base64
TypeScript
13
star
14

hx-ash

Entity Component Framework
Haxe
12
star
15

jupystar

Convert Jupyter notebooks (ipynb) to Starboard notebooks
Jupyter Notebook
8
star
16

starboard-python

Plugin that adds Python cells to Starboard
8
star
17

no-free-plan

HTML
8
star
18

rollup-plugin-base64

A rollup plugin that allows you to import files as a base64 string
JavaScript
7
star
19

flipper

🐬 Flipper is a monitoring service that automatically re-points floating IPs at healhy targets.
Go
7
star
20

li-hackathon

48 hour hackathon project: From RU with Love
Vue
6
star
21

nasync-js

What if JS didn't have await and async, because everything is async and awaited?
TypeScript
5
star
22

starlit

Go
4
star
23

WebMetaverse

Supposedly the 3D world wide web.
JavaScript
3
star
24

whole-slide-breast-cancer-classification

Resulting publication http://spie.org/Publications/Journal/10.1117/1.JMI.4.4.044504
Jupyter Notebook
3
star
25

HRI

Human Robot Interaction course project (robot cooking assistant with NLP)
Python
3
star
26

starcloud

CDN origin for Starboard assets with the correct headers set
Go
2
star
27

advent-of-code-2020

Advent of Code 2020 Solutions
2
star
28

LD30

"Connected Worlds"
C#
2
star
29

GConsoleNGUI

NGUI Frontend for GConsole
C#
2
star
30

ai-at-the-web-scale

Final project for "AI at the web scale" course (profit optimization for webshop -> contextual bandit problem)
Python
1
star
31

magiclogin-docs

Docs for https://magiclogin.net
1
star
32

excess

Performant WebRTC signalling server (written in Elixir)
Elixir
1
star
33

gamejam

GAMEJAM games
ASP
1
star
34

Mash

Mash, 2D Game Engine with Ash Entity System Framework
Haxe
1
star