Installation

The YZLITE supports three modes of installation:

Standard Python Package

This describes how to install the YZLITE Python package into your Python3 environment.

Note

1 ) Optionally create and activate a Python virtual environment:

This step is highly recommended as the YZLITE installs other dependencies like Tensorflow into the Python environment.

python  -m venv yzlite_pyvenv
.\mltk_pyvenv\Scripts\activate.bat
python3 -m venv yzlite_pyvenv
source ./yzlite_pyvenv/bin/activate

2 ) Install the YZLITE Python package via pip:

This installs the pre-built Python package. This is the easiest and fastest approach to installing the YZLITE.
However, the package may not be up-to-date with the Github repository.

pip  install yizhu-yzlite[full] --upgrade
pip3 install yizhu-yzlite[full] --upgrade

OR

This builds and installs the Python package from the Github repository. This may take longer to install but will use the most up-to-date source code.

pip  install git+https://github.com/ReRAM-Labs/yzlite.git[full]
pip3 install git+https://github.com/ReRAM-Labs/yzlite.git[full]

NOTE: The [full] part of the command is optional. This will install additional dependencies used by some the the YZLITE commands. Omitting this from the command will speedup installation but may cause some of the commands like classify_audio, view, tensorboard to require additional install step.

After the command completes, the YZLITE should be available to the current Python environment.
You can verify by issuing the command:

yzlite --help

See the Command-Line Guide for more details on how to use the command-line.

You can also import the YZLITE via Python script, e.g.:

from yzlite.core import profile_model

profile_model('~/my_model.tflite')

See the API Examples for more details on how to use the YZLITE Python API.

Update Python Package

If the YZLITE Python package has already been installed, you may update to the latest YZLITE by running the command:

pip  install yizhu-yzlite[full] --upgrade
pip3 install yizhu-yzlite[full] --upgrade

Alternatively, you can update to a specific version with:

pip  install yizhu-yzlite[full]==0.15.0
pip3 install yizhu-yzlite[full]==0.15.0

and replace 0.1.0 with the desired version.

Google Colab

Google offers it own free Cloud servers for model training, Google Colaboratory (a.k.a. Colab).
This is very useful as you can leverage Google’s cloud servers and GPUs for training your model. The following describes how to install the YZLITE into a Colab notebook.

1 ) Create a Google Account (if necessary)
Go to the Google Signup page.
NOTE: Click the Use my current email address instead button to use your existing email instead of creating a gmail email address.

2 ) Refer to the Colab Basic Features Overview to get a basic idea of how notebooks work
3 ) Create a new Colab notebook
4 ) Create a Python code cell and copy & paste the following into the cell

!pip install --upgrade yizhu-yzlite

5 ) Execute the cell
Once the cell executes, the YZLITE will be installed. You may import and use the YZLITE package as normal from this point on inside the notebook

Local Development

The YZLITE can also be installed for local development. In this mode, the Python C++ wrappers are built from source.
Additionally, a new Python virtual environment is created specifically for the YZLITE.

Note

Before installing, you must have Python3.7, 3.8, 3.9, 3.10 installed on your computer

1 ) Clone the YZLITE GIT repository

git clone https://github.com/ReRAM-Labs/yzlite

2 ) Run the install script at the root of the repository

cd yzlite
python  .\install_yzlite.py
cd yzlite
python3 ./install_yzlite.py

The install script will:

  1. Create a python virtual environment at <yzlite root>/.venv

  2. Install the YZLITE Python package for local development into Python virtual environment:

    pip install -e .
    

See also