oip-mlops-client


Nameoip-mlops-client JSON
Version 0.0.5 PyPI version JSON
download
home_page
SummaryThis is the API client of Open Innovation Platform - MLOPS
upload_time2023-09-10 16:23:49
maintainer
docs_urlNone
authorRachid Belmeskine
requires_python>=3.7
licensePRIVATE LICENSE
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # Open Innovation MLOps Client API

Welcome to the Open Innovation MLOps Client API documentation! This guide offers detailed instructions on how to install, set up, and use the client library.

## Installation and Setup

To use the Open Innovation MLOps Client in your project, follow these steps:

1. __Install the client library__: Use the following pip command to add the Open Innovation MLOps Client to your Python environment:
    ```
    pip install oip-mlops-client
    ```

2. __Import the library__: Add the following import statement to your Python script to gain access to the `MLOps` class from the client library:
    ```python
    from oip_mlops_client.mlops import MLOps
    ```

## Client Initialization and Tracking

To start using the Open Innovation MLOps Client in your application, you need to initialize it with specific details about your environment.

```python
api_host = "api_host"
username = "your_username"
password = "your_password"
workspace_name = "target_workspace_name"
MLOps.connect(api_host, username, password, workspace_name)
```

**Parameters**

- `api_host` (str, required): The hostname of the API server.
- `username` (str, required): Your username.
- `password` (str, required): Your password.
- `workspace_name` (str, required): The name of the workspace you want to connect to. This workspace should already exist on the platform's user interface (UI).


OAfter initializing the client and establishing the connection, you can specify the experiment you want to track:
```python
experiment_name = "target_experiment_name"
MLOps.set_experiment(experiment_name)
```
**Parameters**

- `experiment_name` (str, required): The name of the experiment you want to track. This experiment should already exist on the platform's UI.

Once the target experiment is set, the API client is ready to start tracking your runs.

## Compatibility with Mlflow for Tracking

The MLOps client provides access to all the methods available through the MLflow API. For instance:

MLOps.autolog() is equivalent to mlflow.autolog()

For more information about the available methods, refer to the [MLflow official documentation](https://mlflow.org/docs/latest/python_api/mlflow.html).

## Advanced Artifacts Tracking

In addition to all the features offered by MLflow, our solution also enables tracking of specific types of artifacts like images, audio, video, figures, text, JSON, etc., for specific machine learning training tasks analysis. This allows for sophisticated and advanced analytics and visualizations through our platform UI.

### Image Tracking
The `log_image_at_step` method accepts an image as a `numpy.ndarray` or `rom PIL.Image.Image`:

```python
from PIL import Image

# Load or create your image as numpy.ndarray or PIL.Image
image_data = Image.open("test_image.jpg")

# Log image at specific step
extra = {"description": "test image"}
MLOps.log_image_at_step(image_data, 'image_file.jpg', 1, extra)
```

Please note that for images, you can directly pass the path to the image file.

### Audio Tracking
The `log_audio_at_step` method accepts audio data as a `numpy.ndarray`:

```python
import numpy as np

# Create or load your audio data as a numpy array
audio_data = np.random.random(1000)

# Log audio at specific step
MLOps.log_audio_at_step(audio_data, 'audio_file.wav', 1, rate=44100)

```

The audio_data should be a numpy array. If the audio is stereo, the array should be 2-dimensional.

### Text Tracking
The `log_text_at_step` method accepts text as a `str`:

```python
# Log text at specific step
text_data = "This is a sample text."
MLOps.log_text_at_step(text_data, 'text_file.txt', 1)

```

### Figure Tracking
The `log_figure_at_step` method accepts a figure as a `matplotlib.figure.Figure` or `plotly.graph_objects.Figure`:
```python
import matplotlib.pyplot as plt

# Create a figure
fig, ax = plt.subplots()
ax.plot([1, 2, 3, 4], [1, 4, 2, 3])

# Log figure at specific step
MLOps.log_figure_at_step(fig, 'figure_file.jpg', 1)
```

The fig should be a matplotlib.figure.Figure object.

### JSON Tracking
The log_dict_at_step method accepts a dictionary or list to be logged as JSON:


```python
# Log dictionary at specific step
dict_data = {"key1": "value1", "key2": "value2"}
MLOps.log_dict_at_step(dict_data, 'dict_file.json', 1)
```

The dictionary or list will be saved as a JSON file.


### Extra Parameters

Note: All log_*_at_step methods accept an optional extra parameter (of type dict) which can be used to log additional metadata about the artifact, and a file_name (of type str) that specifies the name of the artifact file. For log_audio_at_step, there is also a rate parameter (of type int) to specify the sample rate of the audio data.

The extra parameter should be a dictionary with string keys. The values can be of types int, float, str, bool, list, or None.

```python
extra = {"description": "This is a description of the artifact."}
```


In the case of log_audio_at_step, there's also a rate parameter to specify the sample rate of the audio data.

```python
MLOps.log_audio_at_step(audio_data, 'audio_file', 1, rate=44100, extra=extra)
```




            

Raw data

            {
    "_id": null,
    "home_page": "",
    "name": "oip-mlops-client",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.7",
    "maintainer_email": "",
    "keywords": "",
    "author": "Rachid Belmeskine",
    "author_email": "rachid.belmeskine@gmail.com",
    "download_url": "",
    "platform": null,
    "description": "# Open Innovation MLOps Client API\n\nWelcome to the Open Innovation MLOps Client API documentation! This guide offers detailed instructions on how to install, set up, and use the client library.\n\n## Installation and Setup\n\nTo use the Open Innovation MLOps Client in your project, follow these steps:\n\n1. __Install the client library__: Use the following pip command to add the Open Innovation MLOps Client to your Python environment:\n    ```\n    pip install oip-mlops-client\n    ```\n\n2. __Import the library__: Add the following import statement to your Python script to gain access to the `MLOps` class from the client library:\n    ```python\n    from oip_mlops_client.mlops import MLOps\n    ```\n\n## Client Initialization and Tracking\n\nTo start using the Open Innovation MLOps Client in your application, you need to initialize it with specific details about your environment.\n\n```python\napi_host = \"api_host\"\nusername = \"your_username\"\npassword = \"your_password\"\nworkspace_name = \"target_workspace_name\"\nMLOps.connect(api_host, username, password, workspace_name)\n```\n\n**Parameters**\n\n- `api_host` (str, required): The hostname of the API server.\n- `username` (str, required): Your username.\n- `password` (str, required): Your password.\n- `workspace_name` (str, required): The name of the workspace you want to connect to. This workspace should already exist on the platform's user interface (UI).\n\n\nOAfter initializing the client and establishing the connection, you can specify the experiment you want to track:\n```python\nexperiment_name = \"target_experiment_name\"\nMLOps.set_experiment(experiment_name)\n```\n**Parameters**\n\n- `experiment_name` (str, required): The name of the experiment you want to track. This experiment should already exist on the platform's UI.\n\nOnce the target experiment is set, the API client is ready to start tracking your runs.\n\n## Compatibility with Mlflow for Tracking\n\nThe MLOps client provides access to all the methods available through the MLflow API. For instance:\n\nMLOps.autolog() is equivalent to mlflow.autolog()\n\nFor more information about the available methods, refer to the [MLflow official documentation](https://mlflow.org/docs/latest/python_api/mlflow.html).\n\n## Advanced Artifacts Tracking\n\nIn addition to all the features offered by MLflow, our solution also enables tracking of specific types of artifacts like images, audio, video, figures, text, JSON, etc., for specific machine learning training tasks analysis. This allows for sophisticated and advanced analytics and visualizations through our platform UI.\n\n### Image Tracking\nThe `log_image_at_step` method accepts an image as a `numpy.ndarray` or `rom PIL.Image.Image`:\n\n```python\nfrom PIL import Image\n\n# Load or create your image as numpy.ndarray or PIL.Image\nimage_data = Image.open(\"test_image.jpg\")\n\n# Log image at specific step\nextra = {\"description\": \"test image\"}\nMLOps.log_image_at_step(image_data, 'image_file.jpg', 1, extra)\n```\n\nPlease note that for images, you can directly pass the path to the image file.\n\n### Audio Tracking\nThe `log_audio_at_step` method accepts audio data as a `numpy.ndarray`:\n\n```python\nimport numpy as np\n\n# Create or load your audio data as a numpy array\naudio_data = np.random.random(1000)\n\n# Log audio at specific step\nMLOps.log_audio_at_step(audio_data, 'audio_file.wav', 1, rate=44100)\n\n```\n\nThe audio_data should be a numpy array. If the audio is stereo, the array should be 2-dimensional.\n\n### Text Tracking\nThe `log_text_at_step` method accepts text as a `str`:\n\n```python\n# Log text at specific step\ntext_data = \"This is a sample text.\"\nMLOps.log_text_at_step(text_data, 'text_file.txt', 1)\n\n```\n\n### Figure Tracking\nThe `log_figure_at_step` method accepts a figure as a `matplotlib.figure.Figure` or `plotly.graph_objects.Figure`:\n```python\nimport matplotlib.pyplot as plt\n\n# Create a figure\nfig, ax = plt.subplots()\nax.plot([1, 2, 3, 4], [1, 4, 2, 3])\n\n# Log figure at specific step\nMLOps.log_figure_at_step(fig, 'figure_file.jpg', 1)\n```\n\nThe fig should be a matplotlib.figure.Figure object.\n\n### JSON Tracking\nThe log_dict_at_step method accepts a dictionary or list to be logged as JSON:\n\n\n```python\n# Log dictionary at specific step\ndict_data = {\"key1\": \"value1\", \"key2\": \"value2\"}\nMLOps.log_dict_at_step(dict_data, 'dict_file.json', 1)\n```\n\nThe dictionary or list will be saved as a JSON file.\n\n\n### Extra Parameters\n\nNote: All log_*_at_step methods accept an optional extra parameter (of type dict) which can be used to log additional metadata about the artifact, and a file_name (of type str) that specifies the name of the artifact file. For log_audio_at_step, there is also a rate parameter (of type int) to specify the sample rate of the audio data.\n\nThe extra parameter should be a dictionary with string keys. The values can be of types int, float, str, bool, list, or None.\n\n```python\nextra = {\"description\": \"This is a description of the artifact.\"}\n```\n\n\nIn the case of log_audio_at_step, there's also a rate parameter to specify the sample rate of the audio data.\n\n```python\nMLOps.log_audio_at_step(audio_data, 'audio_file', 1, rate=44100, extra=extra)\n```\n\n\n\n",
    "bugtrack_url": null,
    "license": "PRIVATE LICENSE",
    "summary": "This is the API client of Open Innovation Platform - MLOPS",
    "version": "0.0.5",
    "project_urls": null,
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "8ab50bbad7535d130f3e7ecca646a5816370eeca5587b026b27987588382bc10",
                "md5": "905bf2967c79b0faa4fee95c2886bc39",
                "sha256": "ad665b235d3e4038baa29a910d2cb8206550c87ec83d0d0282e5e66a4f65aa28"
            },
            "downloads": -1,
            "filename": "oip_mlops_client-0.0.5-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "905bf2967c79b0faa4fee95c2886bc39",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.7",
            "size": 17084,
            "upload_time": "2023-09-10T16:23:49",
            "upload_time_iso_8601": "2023-09-10T16:23:49.523782Z",
            "url": "https://files.pythonhosted.org/packages/8a/b5/0bbad7535d130f3e7ecca646a5816370eeca5587b026b27987588382bc10/oip_mlops_client-0.0.5-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-09-10 16:23:49",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "lcname": "oip-mlops-client"
}
        
Elapsed time: 0.11185s