Skip to main content

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()

Metadata

Release files for modelwhaleutils 0.5.2.6

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for modelwhaleutils 0.5.2.6
File Size Uploaded Provenance Actions
modelwhaleutils-0.5.2.6.tar.gz 12.4 kB Without provenance Details for modelwhaleutils-0.5.2.6.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for modelwhaleutils 0.5.2.6
File Interpreter ABI Platform Actions
modelwhaleutils-0.5.2.6-py3-none-any.whl Python 3 none any Details for modelwhaleutils-0.5.2.6-py3-none-any.whl

Total release size: 26.8 kB

Release files / modelwhaleutils-0.5.2.6.tar.gz

Download URL modelwhaleutils-0.5.2.6.tar.gz
Size 12.4 kB
Tags Source
SHA-256 checksum
How to use checksums
9e0c0c581fb2ebab6f57c1199f47ac8ac88df5c569e0356c99e010c8d84a77bf
BLAKE2b-256 checksum
How to use checksums
835751d5bb21a6c7a9a2c6c089cdcf50f2864969417f55d0b0cabcd190dfb716
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.0.0 CPython/3.9.5

Release files / modelwhaleutils-0.5.2.6-py3-none-any.whl

Download URL modelwhaleutils-0.5.2.6-py3-none-any.whl
Size 14.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
ed0c7b4bba09d17c3e7eb9f6ec5b635f2f0e65e4f5e595cd615ac39cf766bffc
BLAKE2b-256 checksum
How to use checksums
49e07dfa4ba5202fc263edcfb2218eb518b08c69b5b4d5341cc2f57623c2b121
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.0.0 CPython/3.9.5

Security for modelwhaleutils 0.5.2.6

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.5.2.6 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page