Name: ONNX.jl
Owner: Flux
Description: Read ONNX graphs in Julia
Created: 2018-02-09 13:53:32.0
Updated: 2018-05-23 15:18:28.0
Pushed: 2018-05-21 10:17:17.0
Homepage: null
Size: 71
Language: Julia
GitHub Committers
User | Most Recent Commit | # Commits |
---|
Other Committers
User | Most Recent Commit | # Commits |
---|
ONNX.jl : Read ONNX graphs and load these models in Julia. ONNX.jl provides an instance of transfer learning into Julia, by reading pretrained models from ONNX format to Flux.jl. This is done by generating the DataFlow graph from the model, and then reading it as Julia code.
You need to have the model.onnx
( or in some cases model.pb
) file, which will be read. Several pretrained ONNX model files can also be downloaded from here. Now that we have the model.onnx
file, we can read it into Flux as :
a> using Flux, ONNX # Import the required packages.
a> ONNX.load_model("model.onnx") # If you are in some other directory, specify the entire path.
# This creates two files: model.jl and weights.bson.
a> weights = ONNX.load_weights("weights.bson") # Read the weights from the binary serialized file.
a> model = include("model.jl") # Loads the model from the model.jl file.
And model
is the corresponding model in Flux!
This package is currently under development, don't tell us we didn't warn you!
It's always better to run the tests before moving on to importing a model. The operator tests ensure that all ops are working. Follow the given steps to run these tests:
Change your working directory to the test
directory (cd ~/.julia/v0.6/ONNX.jl/test
from the terminal)
Inside the test repository, run the runtests.jl
script. (julia runtests.jl
).
Running these tests may take some time, as it may initially download the test files if you don't already have them.(You need to have git preinstalled in order to download the tests)
Since this package is currently under development, feel free to open an issue if you find any error/bug.
For more discussion, you can get in touch with us on Julia Slack. We're pretty active on the #machine-learning channel.