Skip to main content

Gradient ML SDK

This is an SDK for performing Machine Learning with Gradientº, it can be installed in addition to gradient-cli.

Requirements

This SDK requires Python 3.5+.

To install it, run:

pip install gradient-sdk

Usage

Multinode Helper Functions

Multinode GRPC Tensorflow

Set the TF_CONFIG environment variable For multi-worker training, you need to set the TF_CONFIG environment variable for each binary running in your cluster. Set the value of TF_CONFIG to a JSON string that specifies each task within the cluster, including each task's address and role within the cluster. We've provided a Kubernetes template in the tensorflow/ecosystem repo which sets TF_CONFIG for your training tasks.

get_tf_config()

Function to set value of TF_CONFIG when run on machines within Paperspace infrastructure.

It can raise a ConfigError exception with message if there's a problem with its configuration in a particular machine.

Usage example:

from gradient_sdk import get_tf_config

get_tf_config()

Hyperparameter Tuning

Currently, Gradientº only supports Hyperopt for Hyperparameter Tuning.

hyper_tune()

Function to run hyperparameter tuning.

It accepts the following arguments:

  • train_model User model to tune.
  • hparam_def User definition (scope) of search space. To set this value, refer to hyperopt documentation.
  • algo Search algorithm. Default: tpe.suggest (from hyperopt).
  • max_ecals Maximum number of function evaluations to allow before returning. Default: 25.
  • func Function to be run by hyper tune. Default: fmin (from hyperopt). Do not change this value if you do not know what you are doing!

It returns a dict with information about the tuning process.

It can raise a ConfigError exception with message if there's no connection to MongoDB.

Note: You do not need to worry about setting your MongoDB version; it will be set within Paperspace infrastructure for hyperparameter tuning.

Usage example:

from gradient_sdk import hyper_tune

# Prepare model and search scope

# minimal version
argmin1 = hyper_tune(model, scope)

# pass more arguments
argmin2 = hyper_tune(model, scope, algo=tpe.suggest, max_evals=100)

Utility Functions

get_mongo_conn_str()

Function to check and construct MongoDB connection string.

It returns a connection string to MongoDB.

It can raise a ConfigError exception with message if there's a problem with any values used to prepare the MongoDB connection string.

Usage example:

from gradient_sdk import get_mongo_conn_str

conn_str = get_mongo_conn_str()

data_dir()

Function to retrieve path to job space.

Usage example:

from gradient_sdk import data_dir

job_space = data_dir()

model_dir()

Function to retrieve path to model space.

Usage example:

from gradient_sdk import model_dir

model_path = model_dir(model_name)

export_dir()

Function to retrieve path for model export.

Usage example:

from gradient_sdk import export_dir

model_path = export_dir(model_name)

worker_hosts()

Function to retrieve information about worker hosts.

Usage example:

from gradient_sdk import worker_hosts

model_path = worker_hosts()

ps_hosts()

Function to retrieve information about Paperspace hosts.

Usage example:

from gradient_sdk import ps_hosts

model_path = ps_hosts()

task_index()

Function to retrieve information about task index.

Usage example:

from gradient_sdk import task_index

model_path = task_index()

job_name()

Function to retrieve information about job name.

Usage example:

from gradient_sdk import job_name

model_path = job_name()

Metadata

Release files for gradient-sdk 0.0.4

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

Source distribution (sdist)

Source distribution for gradient-sdk 0.0.4
File Size Uploaded Provenance Actions
gradient_sdk-0.0.4.tar.gz 5.2 kB Without provenance Details for gradient_sdk-0.0.4.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for gradient-sdk 0.0.4
File Interpreter ABI Platform Actions
gradient_sdk-0.0.4-py3-none-any.whl Python 3 none any Details for gradient_sdk-0.0.4-py3-none-any.whl

Total release size: 12.1 kB

Release files / gradient_sdk-0.0.4.tar.gz

Download URL gradient_sdk-0.0.4.tar.gz
Size 5.2 kB
Tags Source
SHA-256 checksum
How to use checksums
43da1e6238e025fda58715b5ca9b3079000fa4c825996f4fc60cccb204ea2646
BLAKE2b-256 checksum
How to use checksums
bcee60ad1cfe8470769f7399fc1dca592ce66ecb3675c7593b117d7f3f1d72b4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/2.0.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.4.0 requests-toolbelt/0.9.1 tqdm/4.36.1 CPython/3.7.0

Release files / gradient_sdk-0.0.4-py3-none-any.whl

Download URL gradient_sdk-0.0.4-py3-none-any.whl
Size 6.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
1e8a3615a2203f7cec259626c48a7e66ee15a63d3f6a011f8c9aa56707b50155
BLAKE2b-256 checksum
How to use checksums
4cbc243071f8e2abc9ab6b16d2a93ec64a91b2619c2ee83f83a42634431613d1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/2.0.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.4.0 requests-toolbelt/0.9.1 tqdm/4.36.1 CPython/3.7.0

Security for gradient-sdk 0.0.4

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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