Giter Club home page Giter Club logo

accelerate-ai-model-based-onnx's Introduction

Lab exercises: Exporting or converting a model to the ONNX format

Overview

This project contains simple jupyter notebook lab exercises demonstrating ONNX model conversion. This includes:

  • Exporting a simple model from Pytorch to ONNX format.
  • Converting a tensorflow model to ONNX, using tensorflow-onnx.

These examples require you install needed packages. This is not done as part of the notebook; the steps here will guide you through building and running a docker container to complete the lab exercises.

This lab is intended to be run on an x86/x64 environment to demonstrate converting a trained model to ONNX prior to deploying on IBM zSystems and LinuxONE.

Steps:

  1. Clone the lab github repository git clone https://github.com/IBM/ai-on-z-samples.git

  2. Navigate to the subdirectoy.

  3. Run docker build using the provided dockerfile docker build .

    • Using a python base image, this will create an environment with both recent Pytorch and TensorFlow releases, model conversion libraries, as well as the lab jupyter notebooks.
  4. Create and run a docker container using the image created on the prior step. As part of this step, you should map the jupyter notebook port, 8888, to a port on your local system. An example follows:

    • docker run -it --rm -p 8571:8888 <image id>
    • This states the image in interactive mode, tells docker to delete the container upon exit, and publishes container port 8888 to host port 8571.
  5. From a web browser, connect to the jupyter URL provided on the prior step. Note, you must change port 8888 to port 8571.

  6. Run through the lab exercises:

    • tfonnx_conversion.ipynb
    • torch_export_onnx.ipynb
  7. Download the .ONNX models and inspect them using Netron

Additional resources

There are numerous additional examples and guidance available, not only for Pytorch and TensorFlow, but for other frameworks as well.

This includes:

On IBM Z and LinuxONE, you can run these models using ONNX-MLIR. For z/OS users, we recommend you try Watson Machine Learning for z/OS Trial edition, available here.

accelerate-ai-model-based-onnx's People

Contributors

andrewsi-z avatar stevemar avatar

Stargazers

 avatar  avatar  avatar  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.