Skip to main content

Python package for ML developers and researchers to change certain variables while their code is executing to make the task of training a ML project easier. This package will allow you to tune some parameters while your code is live from outside of the program.

Project description

LiveTune(Github)

Dynamic Parameter Tuning 🎶

LiveTune is a cutting-edge Python package that empowers Machine Learning developers and researchers to adjust parameters in real-time while their program is running. Seamlessly modify variables, data, or hyperparameters, such as learning rate and regularizer, without interrupting your code execution. Experience the freedom to fine-tune your ML projects on-the-fly.

Installation

Platform Compatibility

Platform Status
MacOS 🍎 Supported
Linux 🐧 Supported
Windows 🪟 Not Yet Tested

Installation Guide

  1. Ensure you have PyPi installed. If not, follow these instructions.
  2. Execute the following command in your terminal:
pip install LiveTune

Key Features

LiveTune offers two primary features: Live Variables and Live Triggers. Both are managed using our intuitive tag system.

Upon starting a program that integrates LiveTune, the terminal will display the port number associated with that program instance.

Feature Data Types Description Use Cases
Live Variable int, char, string, float, boolean Modifiable variables during runtime. Hyperparameters, datasets, user info adjustments, etc.
Live Trigger boolean A boolean that, when triggered, returns true for a single call. Remotely initiate functions, loops, or halt code.

Integration Guide

Setting up Live Variables

A live variable is an integer, char, string, float, or boolean that is able to be changed in the middle of the program by using a command in the terminal or in a different program.

First, import liveVar from LiveTune:

from LiveTune import liveVar

To create a Live Variable, create a new variable in the liveVar class.

myVariable = liveVar(INITIAL_VALUE, 'TAG')

Example usage:

ranking = liveVar(100, 'ranking')

Live Variables can be used just like normal variables of its type, so feel free to call the variable as needed.

To avoid resource loss or unnecessary recompiling, liveVar includes a 'changed' method that returns True or False if the Live Variable has been changed since the last time 'changed' was called in a running instance.

Example usage:

if myVariable.changed():
    print("This variable has changed!")

Note: Derived variables from a Live Variable won't auto-update. For instance, if ranking2 = ranking + 5, modifying ranking won't affect ranking2.

Setting up Live Triggers

A live trigger is a boolean that will always return False when called. If a developer "triggers" it, the boolean will return True the next time it is called. It can be used to trigger functions, and subroutines.

First, import liveVar from LiveTune:

from LiveTune import liveTrigger
myTrigger = liveTrigger('TAG')

Example usage:

stopLoop = liveTrigger('stop')
while(not stopLoop()):
    pass
save = liveTrigger('save')

while training:
    if save():
        save_subroutine()
...

Updating a LiveTune Variable

Upon program initiation, LiveTune assigns a port to your instance. This port links tags to client ports temporarily.

[LiveTune] Port number for the LiveTune dictionary: 61629

To update a variable, use the tune command in the terminal or in an external program.

The tune command has a few settings to ensure the correct variable is changed properly.

Setting Description Required Example
--port / -p The port number given by LiveTune above, separate per instance. Always --port 63573
--tag / -t The developer-set tag string for the variable. Used to identify the variable. Always --tag ranking
--value / -v The new value for the variable-must match the type of the original (e.g. must be an int if originally an int) Live Variables only --value 200
--trigger / -tr LiveTriggers will not "trigger" if this setting isn't included. Live Triggers only --trigger

Example terminal usage:

tune --value 10 -t myVariable -p 13451
tune --tag myTrigger --port 13451 -tr

You can also update livetune variables using their update method. example:

myVariable.update(new_value)

Contributing to LiveTune

Those interested in adding features to the package may submit a pull request. Please keep individual improvements to their own pull requests. Please maintain consistent code format when contributing to ensure the package remains easily understandable for future contributors.

  1. Fork the project
  2. Create your feature branch git checkout -b my-new-change
  3. Commit your changes git commit -am 'Added new feature'
  4. Push to the branch git push origin my-new-change
  5. Run the Unit Tests specified in the section below
  6. Submit a pull request

All contributors should run the Unit Tests below to test their changes.

Unit Tests

This repository contains a tests.py file in the tests folder. Clone this repo by using:

git clone https://github.com/soheilzi/LiveTune.git

Navigate to the LiveTune repository.

cd LiveTune

Ensure Python3 is installed on your computer and run the tests:

python3 LiveTune/tests/tests.py

If all tests pass, LiveTune is working correctly. If contributing, please run all tests before submitting a pull request.

Authors

Contact

If you are interested in using the code for commercial use, please contact innovation@ucsd.edu

Thank you for using LiveTune!

We're still early in testing, so please fill out the feedback form if you find any bugs or have feature requests.

Thank you for using LiveTune! If it's been beneficial to your work, please consider citing our paper in your publications.

  title={LiveTune: Dynamic Parameter Tuning for Training Deep Neural Networks},
  author={Shabgahi, Soheil Zibakhsh and Sheybani, Nojan and Tabrizi, Aiden and Koushanfar, Farinaz},
  journal={arXiv preprint arXiv:2311.17279},
  year={2023}
}

Your support helps us continue our efforts and assists others in discovering LiveTune. We appreciate your acknowledgment.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

LiveTune-0.0.8.tar.gz (14.5 kB view details)

Uploaded Source

Built Distribution

LiveTune-0.0.8-py3-none-any.whl (11.4 kB view details)

Uploaded Python 3

File details

Details for the file LiveTune-0.0.8.tar.gz.

File metadata

  • Download URL: LiveTune-0.0.8.tar.gz
  • Upload date:
  • Size: 14.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.10.13

File hashes

Hashes for LiveTune-0.0.8.tar.gz
Algorithm Hash digest
SHA256 bdf5051429dc1971388237462b08f81f072c30a279171d84866ac2773ead60e6
MD5 4a5117a45f12284f4adb6e36a3b6a06d
BLAKE2b-256 92d04dc5710424d843bb86b987db374d7135e31203ffb1f0cf6cd338ec662cf7

See more details on using hashes here.

File details

Details for the file LiveTune-0.0.8-py3-none-any.whl.

File metadata

  • Download URL: LiveTune-0.0.8-py3-none-any.whl
  • Upload date:
  • Size: 11.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.10.13

File hashes

Hashes for LiveTune-0.0.8-py3-none-any.whl
Algorithm Hash digest
SHA256 de5464df0fef484172f9f7112430bc4f6a3c6123eac96ee9c62303e373a110b4
MD5 98a5e074a5c54b4f22caa021429dcaa6
BLAKE2b-256 bab97ee8072e655f42eab2093306e2631279d7376de50aa2e603d6030cf3193c

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page