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.2.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.2-py3-none-any.whl (10.3 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: flops_utils-0.6.2.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.2.tar.gz
Algorithm Hash digest
SHA256 4d93dd3ee40f59319f06ae76f28d3dcc6e6b683cd1843355ca63586779b401f9
MD5 7691f833d5a400da74737cae171625b9
BLAKE2b-256 7f463f317e4a8d1155fafdb9fc042e369126bbcae0a2cbb9615a7fbc27343ba6

See more details on using hashes here.

File details

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

File metadata

  • Download URL: flops_utils-0.6.2-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.2-py3-none-any.whl
Algorithm Hash digest
SHA256 9a8da10024252c9fe1fcdb88728a0eb537356b57cf45b34dd89950250b0b6645
MD5 bd516de5ee626def12480273450da4c0
BLAKE2b-256 74c0571a40cf688d0e87dd93ea74b7250eab97f3216fb34e2058a10738b50238

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