Skip to main content

A library containing common utilities for FLOps

Project description

flops-utils

This package/library contains common pieces of code for the FLOps project.

User Facing Features

flops-utils provides FLOPs users with guiding abstract template classes for implementing their ML models and "proxy/place-holder" components to satisfy linters.

When FLOps users want to structure their ML code to match the structural requirements of FLOps they should do the following:

# data_manager.py

from flops_utils.ml_repo_building_blocks import load_dataset
from flops_utils.ml_repo_templates import DataManagerTemplate

class DataManager(DataManagerTemplate):
    def __init__(self):
        ... = self._prepare_data()

    def _prepare_data(self, partition_id=1) -> Any:
        dataset = load_dataset()
        ...
        return ...

    def get_data(self) -> Tuple[Any, Any]:
        return ...
# model_manager.py

import warnings
from typing import Any, Tuple

import numpy as np
from data_manager import DataManager
from flops_utils.ml_repo_templates import ModelManagerTemplate
from sklearn.linear_model import LogisticRegression
from sklearn.metrics import log_loss


class ModelManager(ModelManagerTemplate):
    def __init__(self):
        self.model = ...
        self._set_init_params()

    def _set_init_params(self) -> None:
        ...

    def set_model_data(self) -> None:
        ... = DataManager().get_data()

    def get_model(self) -> Any:
        return self.model

    def get_model_parameters(self) -> Any:
        params = ...
        return params

    def set_model_parameters(self, parameters) -> None:
        ...

    def fit_model(self) -> int:
        return len(self.x_train)

    def evaluate_model(self) -> Tuple[Any, Any, int]:
        loss = ...
        accuracy = ...
        return loss, accuracy, len(self.x_test)
        

A tangible example implementation is available here.

Internal FLOps Commonalities

  • Logger
  • Types
  • MQTT Topics
  • Handlers
    • Notifications (Project Observer & FLOps Manager)
    • Environment Variables
  • Auxiliary Constructs
    • Running Shell Commands
    • Measuring Execution Time Frames

Installation Alternatives

One can also include and use these utilities by doing the following:

pip install --no-cache-dir git+https://github.com/oakestra/addon-FLOps.git@main#subdirectory=utils_library

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

flops_utils-0.6.3.tar.gz (6.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

flops_utils-0.6.3-py3-none-any.whl (10.3 kB view details)

Uploaded Python 3

File details

Details for the file flops_utils-0.6.3.tar.gz.

File metadata

  • Download URL: flops_utils-0.6.3.tar.gz
  • Upload date:
  • Size: 6.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.2

File hashes

Hashes for flops_utils-0.6.3.tar.gz
Algorithm Hash digest
SHA256 545182b2994f4305def33fc2ee1e188493dceb4f0db8378efa9fccf1a8f8cd0c
MD5 dd86a2cbb3ae6d882e112038ed9be95a
BLAKE2b-256 0b65f9df95a64719643be1221a1ec80abad3f75ad158ec938b1bd303616459d6

See more details on using hashes here.

File details

Details for the file flops_utils-0.6.3-py3-none-any.whl.

File metadata

  • Download URL: flops_utils-0.6.3-py3-none-any.whl
  • Upload date:
  • Size: 10.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.2

File hashes

Hashes for flops_utils-0.6.3-py3-none-any.whl
Algorithm Hash digest
SHA256 399168bde810a00c15d223d0a73761868d7c5610e8c3d9cb64aafdb7af521378
MD5 7b4992f95641e330f217f234ae8c8cf4
BLAKE2b-256 7a0acd1b2060046e5360016626834cad0441a23d557f1774bdc8f5969d18354a

See more details on using hashes here.

Supported by

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