marqtune


Namemarqtune JSON
Version 0.1.3 PyPI version JSON
download
home_pageNone
SummaryClient for marqtune
upload_time2024-08-30 07:54:58
maintainerNone
docs_urlNone
authormarqo org
requires_python>=3
licenseNone
keywords search python marqo opensearch tensor neural semantic vector embedding
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # Marqtune Python Client
## Overview
The Marqtune Python Client is a Python library that provides a convenient interface for interacting with the Marqtune API. This library allows users to perform various operations, such as training models, preparing data, evaluating models, managing tasks, and working with data management endpoints.

## Installation
To use the Marqtune Python Client, you need to install it first. You can install it using pip:

```bash
pip install marqtune
```

## Getting Started
### Initializing the Client
To get started, create an instance of the Client class by providing the URL to the Marqtune API and an API key:

```python
from marqtune import Client
from marqtune.enums import DatasetType

url = "https://marqtune.marqo.ai"
api_key = "your_api_key"

marqtune_client = Client(url=url, api_key=api_key)
```

### Create Training Dataset
A training dataset is used to train machine learning models. Here is how you can create a training dataset:
```python
# Define the data schema for the dataset
data_schema = {
    "my-text-1": "text",
    "my-text-2": "text",
    "my-image": "image_pointer",
    "my-score": "score"
}

# Create a training dataset
dataset = marqtune_client.create_dataset(
    dataset_name="training_dataset",
    file_path="path/to/your/dataset/file.csv",
    dataset_type=DatasetType.TRAINING,
    data_schema=data_schema,
    wait_for_completion=True
)

print(f"Training dataset created with ID: {dataset.describe()['datasetId']}")
```

Please refer to the documentation for more details on the format of dataset.

### Training a Model
With dataset ready to be used, a model can be trained based on a base model and dataset_id. The base model can be an 
open_clip model or a Marqtuned model. 

```python
marqtune_client.train_model(
        dataset_id="dataset_id",
        model_name="test_model",
        base_model="ViT-B-32",
        base_checkpoint="laion400m_e31",
        model_type=ModelType.OPEN_CLIP,
        max_training_time=600,
        instance_type=InstanceType.BASIC,
        hyperparameters={"parameter1": "value1", "parameter2": "value2"},
        wait_for_completion=True
    )
```

### Downloading a Model
After training a model, you can download it using the download_model method. You need to provide the model_id and the checkpoint number you want to download. If the checkpoint is not specified, the latest checkpoint will be downloaded.
```python
marqtune_client.model("model_id").download()
```

### Evaluating a Model
After you trained a model you can then evaluate it's performance and compare it to base model. There are 2 steps in evaluating a model:
* Create an evaluation dataset
* Evaluate the model

#### Create an Evaluation Dataset
An evaluation dataset is used for verification and evaluation of the trained model. Here is how you can create an evaluation dataset:
```python
# Define the data schema for the dataset
data_schema = {
    "my_query": "text",
    "my_text": "text",
    "image": "image_pointer",
    "score": "score"
}

# Create an evaluation dataset
dataset = marqtune_client.create_dataset(
    dataset_name="evaluation_dataset",
    file_path="path/to/your/dataset/file.csv",
    dataset_type=DatasetType.EVALUATION,
    data_schema=data_schema,
    query_column="my_query",
    result_columns=["my_text", "image"],
    wait_for_completion=True
)

evaluation_dataset_id = dataset.describe()['datasetId']
print(f"Evaluation dataset created with ID: {evaluation_dataset_id}")
```
#### Evaluate the Model
Once the evaluation dataset is ready, you can evaluate the model using the evaluate method. You need to provide the model_id, dataset_id, checkpoint, model_type, and hyperparameters. If wait_for_completion is set to True, the method will wait for the evaluation task to complete before returning.
```python
marqtune_client.evaluate(
        model="model_id",
        dataset_id="evaluation_dataset_id",
        checkpoint="epoch_4",
        model_type=ModelType.MARQTUNED,
        hyperparameters={"parameter1": "value1", "parameter2": "value2"},
        wait_for_completion=True
    )
```
Please refer to the documentation for more details on hyperparameters.

### Task Management
The Marqtune API provides several methods to manage tasks, such as creating datasets, training models, and evaluating models. Below are the methods available for task management:

#### Dataset Methods
* describe(): Describe the dataset.
* logs(): Get the logs for the dataset.
* download_logs(): Download the logs for the dataset.
* delete(): Delete the dataset, terminating any running operations.

#### Model Methods
* describe(): Describe the model.
* logs(): Get the logs for the model.
* download(): Download the model.
* download_logs(): Download the logs for the model.
* delete(): Delete the model, terminating any running operations.

#### Evaluation Methods
* describe(): Describe the evaluation.
* logs(): Get the logs for the evaluation.
* download_logs(): Download the logs for the evaluation.
* delete(): Delete the evaluation, terminating any running operations

### Bucket Management
Manage your system data by uploading input-data, downloading models and deleting objects when not needed.

## Documentation
For detailed information about each method and its parameters, refer to the docstrings in the source code.

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "marqtune",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3",
    "maintainer_email": null,
    "keywords": "search python marqo opensearch tensor neural semantic vector embedding",
    "author": "marqo org",
    "author_email": "org@marqo.io",
    "download_url": "https://files.pythonhosted.org/packages/86/00/baf7ee444321c23e3de0f0b6dd73b4edd1077dd0bdba7f098226761c7d40/marqtune-0.1.3.tar.gz",
    "platform": null,
    "description": "# Marqtune Python Client\n## Overview\nThe Marqtune Python Client is a Python library that provides a convenient interface for interacting with the Marqtune API. This library allows users to perform various operations, such as training models, preparing data, evaluating models, managing tasks, and working with data management endpoints.\n\n## Installation\nTo use the Marqtune Python Client, you need to install it first. You can install it using pip:\n\n```bash\npip install marqtune\n```\n\n## Getting Started\n### Initializing the Client\nTo get started, create an instance of the Client class by providing the URL to the Marqtune API and an API key:\n\n```python\nfrom marqtune import Client\nfrom marqtune.enums import DatasetType\n\nurl = \"https://marqtune.marqo.ai\"\napi_key = \"your_api_key\"\n\nmarqtune_client = Client(url=url, api_key=api_key)\n```\n\n### Create Training Dataset\nA training dataset is used to train machine learning models. Here is how you can create a training dataset:\n```python\n# Define the data schema for the dataset\ndata_schema = {\n    \"my-text-1\": \"text\",\n    \"my-text-2\": \"text\",\n    \"my-image\": \"image_pointer\",\n    \"my-score\": \"score\"\n}\n\n# Create a training dataset\ndataset = marqtune_client.create_dataset(\n    dataset_name=\"training_dataset\",\n    file_path=\"path/to/your/dataset/file.csv\",\n    dataset_type=DatasetType.TRAINING,\n    data_schema=data_schema,\n    wait_for_completion=True\n)\n\nprint(f\"Training dataset created with ID: {dataset.describe()['datasetId']}\")\n```\n\nPlease refer to the documentation for more details on the format of dataset.\n\n### Training a Model\nWith dataset ready to be used, a model can be trained based on a base model and dataset_id. The base model can be an \nopen_clip model or a Marqtuned model. \n\n```python\nmarqtune_client.train_model(\n        dataset_id=\"dataset_id\",\n        model_name=\"test_model\",\n        base_model=\"ViT-B-32\",\n        base_checkpoint=\"laion400m_e31\",\n        model_type=ModelType.OPEN_CLIP,\n        max_training_time=600,\n        instance_type=InstanceType.BASIC,\n        hyperparameters={\"parameter1\": \"value1\", \"parameter2\": \"value2\"},\n        wait_for_completion=True\n    )\n```\n\n### Downloading a Model\nAfter training a model, you can download it using the download_model method. You need to provide the model_id and the checkpoint number you want to download. If the checkpoint is not specified, the latest checkpoint will be downloaded.\n```python\nmarqtune_client.model(\"model_id\").download()\n```\n\n### Evaluating a Model\nAfter you trained a model you can then evaluate it's performance and compare it to base model. There are 2 steps in evaluating a model:\n* Create an evaluation dataset\n* Evaluate the model\n\n#### Create an Evaluation Dataset\nAn evaluation dataset is used for verification and evaluation of the trained model. Here is how you can create an evaluation dataset:\n```python\n# Define the data schema for the dataset\ndata_schema = {\n    \"my_query\": \"text\",\n    \"my_text\": \"text\",\n    \"image\": \"image_pointer\",\n    \"score\": \"score\"\n}\n\n# Create an evaluation dataset\ndataset = marqtune_client.create_dataset(\n    dataset_name=\"evaluation_dataset\",\n    file_path=\"path/to/your/dataset/file.csv\",\n    dataset_type=DatasetType.EVALUATION,\n    data_schema=data_schema,\n    query_column=\"my_query\",\n    result_columns=[\"my_text\", \"image\"],\n    wait_for_completion=True\n)\n\nevaluation_dataset_id = dataset.describe()['datasetId']\nprint(f\"Evaluation dataset created with ID: {evaluation_dataset_id}\")\n```\n#### Evaluate the Model\nOnce the evaluation dataset is ready, you can evaluate the model using the evaluate method. You need to provide the model_id, dataset_id, checkpoint, model_type, and hyperparameters. If wait_for_completion is set to True, the method will wait for the evaluation task to complete before returning.\n```python\nmarqtune_client.evaluate(\n        model=\"model_id\",\n        dataset_id=\"evaluation_dataset_id\",\n        checkpoint=\"epoch_4\",\n        model_type=ModelType.MARQTUNED,\n        hyperparameters={\"parameter1\": \"value1\", \"parameter2\": \"value2\"},\n        wait_for_completion=True\n    )\n```\nPlease refer to the documentation for more details on hyperparameters.\n\n### Task Management\nThe Marqtune API provides several methods to manage tasks, such as creating datasets, training models, and evaluating models. Below are the methods available for task management:\n\n#### Dataset Methods\n* describe(): Describe the dataset.\n* logs(): Get the logs for the dataset.\n* download_logs(): Download the logs for the dataset.\n* delete(): Delete the dataset, terminating any running operations.\n\n#### Model Methods\n* describe(): Describe the model.\n* logs(): Get the logs for the model.\n* download(): Download the model.\n* download_logs(): Download the logs for the model.\n* delete(): Delete the model, terminating any running operations.\n\n#### Evaluation Methods\n* describe(): Describe the evaluation.\n* logs(): Get the logs for the evaluation.\n* download_logs(): Download the logs for the evaluation.\n* delete(): Delete the evaluation, terminating any running operations\n\n### Bucket Management\nManage your system data by uploading input-data, downloading models and deleting objects when not needed.\n\n## Documentation\nFor detailed information about each method and its parameters, refer to the docstrings in the source code.\n",
    "bugtrack_url": null,
    "license": null,
    "summary": "Client for marqtune",
    "version": "0.1.3",
    "project_urls": null,
    "split_keywords": [
        "search",
        "python",
        "marqo",
        "opensearch",
        "tensor",
        "neural",
        "semantic",
        "vector",
        "embedding"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "a4b7e3c2341a9113f3023299c55edcb5d15f15c74cdce4e1c8797cf1c99b3054",
                "md5": "1750bdc40ade71879b9a266aad9ff144",
                "sha256": "82bfda9bb7a1dc0c62d58b022178315f71e21daa09a6972ff0a9046f906777ce"
            },
            "downloads": -1,
            "filename": "marqtune-0.1.3-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "1750bdc40ade71879b9a266aad9ff144",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3",
            "size": 10193,
            "upload_time": "2024-08-30T07:54:57",
            "upload_time_iso_8601": "2024-08-30T07:54:57.802152Z",
            "url": "https://files.pythonhosted.org/packages/a4/b7/e3c2341a9113f3023299c55edcb5d15f15c74cdce4e1c8797cf1c99b3054/marqtune-0.1.3-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "8600baf7ee444321c23e3de0f0b6dd73b4edd1077dd0bdba7f098226761c7d40",
                "md5": "41ea92ffff1b5d8477d5ded16faa2ac3",
                "sha256": "a22c298adcff1272c134b75fdf3872d10b40470c751eab3132195a4f2b0aafb2"
            },
            "downloads": -1,
            "filename": "marqtune-0.1.3.tar.gz",
            "has_sig": false,
            "md5_digest": "41ea92ffff1b5d8477d5ded16faa2ac3",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3",
            "size": 10952,
            "upload_time": "2024-08-30T07:54:58",
            "upload_time_iso_8601": "2024-08-30T07:54:58.849696Z",
            "url": "https://files.pythonhosted.org/packages/86/00/baf7ee444321c23e3de0f0b6dd73b4edd1077dd0bdba7f098226761c7d40/marqtune-0.1.3.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-08-30 07:54:58",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "lcname": "marqtune"
}
        
Elapsed time: 0.35456s