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
Release history Release notifications | RSS feed
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.1.tar.gz
(8.0 kB
view details)
Built Distribution
File details
Details for the file flops_utils-0.6.1.tar.gz
.
File metadata
- Download URL: flops_utils-0.6.1.tar.gz
- Upload date:
- Size: 8.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.0.0 CPython/3.10.14
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7da83de60c1ae2d1e2595c76ec750ab64c7bae45c8b31a0da0687f2b1d7c7599 |
|
MD5 | ab6b16064b55af87ce6d3781a6adbda8 |
|
BLAKE2b-256 | 17bc3e8506ba2ec718db676e46410a29202423cee1e4f69aa56fa5547493a5a1 |
File details
Details for the file flops_utils-0.6.1-py3-none-any.whl
.
File metadata
- Download URL: flops_utils-0.6.1-py3-none-any.whl
- Upload date:
- Size: 10.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.0.0 CPython/3.10.14
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7c61a5949a20aea0ffb6fe17fc79a324fed31bab2d1595f5fd7653856c38403f |
|
MD5 | 4c0e0c815b39880fc516229d465fc29c |
|
BLAKE2b-256 | afdc19c0ded85ffba85859e0cbbe506cae8ab478fb3b73f4e88867e6ea8d0bba |