Skip to main content

Used in modelwhale

Project description

Introduction

mwutils is a package developed to be used in the ModelWhale platform for machine learning experiments tracking. It is now under active development.

At the moment, mwutils supports keras and PyTorch mwutils has experimental support for Tensorflow

Usage

class Run: methods:

  • init(self, name="lab_run", user_id="user1", lab_id="lab1", org_id="", flush_interval_seconds=5, sys_stat_sample_size=5, sys_stat_sample_interval=5, local_path='', write_logs_to_local=False, remote_path='', buffer_all_logs=False):

    • name: name for current experiment
    • user_id, lab_id, org_id: user shall get these information from the notebook tools panel in ModelWhale Notebook interface.
    • flush_interval_seconds: time interval to flush buffered logs, default is 5
    • sys_stat_sample_size: maximum data size for system metrics, default is 5
    • sys_stat_sample_interval: sampling rate for system metrics, default is 5
    • write_logs_to_local: if logs should be stored locally
    • local_path: local path to store logs
    • remote_path: kesci api
    • buffer_all_logs: if all logs should be buffered in RAM (use with caution)
  • init_ml():

  • start_ml():

  • log_ml(step=None, epoch=None, batch=None, loss=None, acc=None, phase="train"):

    • step, epoch, batch: starting from 1;
    • loss: numpy.float32 woulde be converted to float type;
    • acc: numpy.float32 woulde be converted to float type;
    • phase: default is train, test, val, system
  • conclude(show_memoize=True): call function after training end

    • show_memoize:
  • add_memoize_funcs_to_logger: testing;

Keras:

provide MWCustomCallback method

example

from mwutils.keras import MWCustomCallback
from mwutils.run import Run

r = Run(name=RUN_NAME,
        user_id = $user_id,
        lab_id = $lab_id,
        org_id = $org_id,
        flush_interval_seconds=30,
        sys_stat_sample_size=5,
        sys_stat_sample_interval=5,
        local_path='',
        write_logs_to_local=False,
        remote_path= $remote_path,
        buffer_all_logs=True)
callBack = MWCustomCallback()
callBack.set_run(r)        
history = model.fit(X_train, y_train,
                    epochs = 40,
                    batch_size = 32,
                    validation_data=(X_test,y_test),
                    shuffle=True,
                    callbacks=[callBack])
r.conclude()

PyTorch:

provide LoggerHook method

example

from mwutils.torch_utils import LoggerHook
from mwutils.run import Run

r = Run(name=RUN_NAME,
        user_id = $user_id,
        lab_id = $lab_id,
        org_id = $org_id,
        flush_interval_seconds=30,
        sys_stat_sample_size=5,
        sys_stat_sample_interval=5,
        local_path='',
        write_logs_to_local=False,
        remote_path= $remote_path,
        buffer_all_logs=True)
loggerHook = LoggerHook()
loggerHook.set_run(r)
criterion.register_forward_hook(loggerHook.torch_loss_hook)

r.conclude()

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

modelwhaleutils-0.5.2.6.tar.gz (12.4 kB view details)

Uploaded Source

Built Distribution

modelwhaleutils-0.5.2.6-py3-none-any.whl (14.4 kB view details)

Uploaded Python 3

File details

Details for the file modelwhaleutils-0.5.2.6.tar.gz.

File metadata

  • Download URL: modelwhaleutils-0.5.2.6.tar.gz
  • Upload date:
  • Size: 12.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.9.5

File hashes

Hashes for modelwhaleutils-0.5.2.6.tar.gz
Algorithm Hash digest
SHA256 9e0c0c581fb2ebab6f57c1199f47ac8ac88df5c569e0356c99e010c8d84a77bf
MD5 efa9724cf4a99479a49493ba2d1d83f9
BLAKE2b-256 835751d5bb21a6c7a9a2c6c089cdcf50f2864969417f55d0b0cabcd190dfb716

See more details on using hashes here.

File details

Details for the file modelwhaleutils-0.5.2.6-py3-none-any.whl.

File metadata

File hashes

Hashes for modelwhaleutils-0.5.2.6-py3-none-any.whl
Algorithm Hash digest
SHA256 ed0c7b4bba09d17c3e7eb9f6ec5b635f2f0e65e4f5e595cd615ac39cf766bffc
MD5 fcb526a4eeb188c846dee7a0689efe48
BLAKE2b-256 49e07dfa4ba5202fc263edcfb2218eb518b08c69b5b4d5341cc2f57623c2b121

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