Skip to main content

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

Metadata

Release files for flops-utils 0.6.3

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

Source distribution (sdist)

Source distribution for flops-utils 0.6.3
File Size Uploaded
flops_utils-0.6.3.tar.gz 6.7 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for flops-utils 0.6.3
File Interpreter ABI Platform
flops_utils-0.6.3-py3-none-any.whl Python 3 none any Details

Total release size: 17.0 kB

Release files / flops_utils-0.6.3.tar.gz

Download URL flops_utils-0.6.3.tar.gz
Size 6.7 kB
Tags Source
SHA-256 checksum
How to use checksums
545182b2994f4305def33fc2ee1e188493dceb4f0db8378efa9fccf1a8f8cd0c
BLAKE2b-256 checksum
How to use checksums
0b65f9df95a64719643be1221a1ec80abad3f75ad158ec938b1bd303616459d6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.12.2

Release files / flops_utils-0.6.3-py3-none-any.whl

Download URL flops_utils-0.6.3-py3-none-any.whl
Size 10.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
399168bde810a00c15d223d0a73761868d7c5610e8c3d9cb64aafdb7af521378
BLAKE2b-256 checksum
How to use checksums
7a0acd1b2060046e5360016626834cad0441a23d557f1774bdc8f5969d18354a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.12.2

Release history Release notifications | RSS feed

This release

0.6.3 This release

2 release files

0.6.2

2 release files

0.6.1

2 release files

0.6.0

2 release files

0.5.2

2 release files

0.5.1

2 release files

0.4.7

2 release files

0.4.6

2 release files

0.4.5

2 release files

0.4.4

2 release files

0.4.3

2 release files

0.4.2

2 release files

0.4.1

2 release files

0.4.0

2 release files

0.3.7

2 release files

0.3.6

2 release files

0.3.5

2 release files

0.3.4

2 release files

0.3.3

2 release files

0.3.2

2 release files

0.3.1

2 release files

0.3.0

2 release files

0.2.9

2 release files

0.2.8

2 release files

0.2.7

2 release files

0.2.6

2 release files

0.2.5

2 release files

0.2.4

2 release files

0.2.3

2 release files

0.2.2

2 release files

0.2.1

2 release files

0.2.0

2 release files

0.1.5

2 release files

0.1.4

2 release files

0.1.3

2 release files

0.1.2

2 release files

0.1.1

2 release files

0.1.0

2 release files

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