Skip to main content

tq42 sdk

Project description

Introduction to TQ42

The TQ42 Python SDK puts the power in your hands to accelerate delivery of custom, high-impact solutions. After installing the SDK and authenticating, access algorithms such as:

  • TetraOpt – a global optimization library based on tensor train (TT) decomposition.
  • ClearVu Analytics (CVA) – build predictive models for data driven insights, automated ML and optimization.
  • Quantum Encoding (QuEnc) – a gradient-based optimization algorithm tailored for hardware-efficient quantum circuits utilizing amplitude encoding.
  • TQnet – train and apply custom, sequential hybrid quantum-classical neural networks with our comprehensive library.

With TQ42, there is no need to build or manage your own quantum circuits. Let our algorithms do the work. From the CLI, your Python IDE, or a Jupyter notebook:

  • Set up your environment to work in the correct organization, project, and experiment
  • Connect a dataset, if needed, or use communication channels
  • Specify your objective function, hyperparameters, and compute infrastructure
  • Run and manage experiments
  • Visualize results

Collaborate with your teams across organizations and projects, and visit the TQ42 web interface for web-based tools to help you manage your account, projects, and experiments.

TQ42 Features

Getting Started

System Requirements

Be sure your system can support TQ42, which requires the following:

  • Any modern operating system, in particular, macOS 12.0 (Ventura) or above, Windows 10+, Linux will do
  • Python 3.8 or above
  • 256 MB RAM
  • approx. 260 MB free disk space

The following Python packages are hard dependencies, and will automatically be installed alongside TQ42:

Quick Start

List of commands to execute to have a conda environment ready to work with the sdk. After having installed conda:

conda create -n "my_env_name" python=3.9  # create the conda environment, it needs to be python 3.8 or higher
conda activate my_env_name                # activate your conda environment
pip install -U tq42                       # install the sdk using the newest available version
pip install jupyter                       # install jupyter if you work with notebook
pip install jupyter matplotlib            # install matplotlib for visualization purpose
tq42 auth login                           # authenticate the user 
tq42 -h                                   # for visualizing the help

Installation

Prior to installing TQ42, create a virtual environment or conda environment.

TQ42 is published on pypi, so on x86_64, i686, ppc64le, s390x, and aarch64 Linux systems, x86_64 or ARM (Apple Silicon) on macOS, and 32 and 64-bit Windows installing is as simple as running the pip install tq42 command:

pip install tq42

NOTE: We will refer to pip rather than pip3. Depending on how your system is configured you may have to use pip3 rather than pip if the alias is not set.

Authentication

After installing TQ42, authenticate by typing the tq42 auth login CLI command:

tq42 auth login

Or use the Python command:

from tq42.client import TQ42Client

with TQ42Client() as client:
    client.login()

This API call will open a window in your browser where you must confirm the MFA code, then enter your TQ42 username and password to authenticate.

The authentication validity will keep extending as long as you are using it within a 30 day period.

Create an exemplary experiment run

After a successful login the next step is to create an experiment run. A created experiment is necessary for this to work. This can be done via the Web UI.

To supply the experiment run the id of the created experiment is necessary. This can be either retrieved by the UI or, alternatively, can be queried via the TQ42 Python SDK like this:

from tq42.client import TQ42Client
from tq42.organization import list_all as list_all_organizations
from tq42.project import list_all as list_all_projects
from tq42.experiment import list_all as list_all_experiments

with TQ42Client() as client:
    client.login()
    org_list = list_all_organizations(client=client)
    # gets the first organization we can find
    org = org_list[0]
    proj_list = list_all_projects(client=client, organization_id=org.id)
    # gets the first project we can find
    proj = proj_list[0]
    exp_list = list_all_experiments(client=client, project_id=proj.id)
    # gets the id for the first experiment we can find 
    exp_id = exp_list[0].id

After retrieving the experiment id the next step is to create the metadata for the algorithm to run.

For this example the toy algorithm and its corresponding metadata is chosen but any other algorithm can be used according to the general setup available here.

toy_params = {
    'parameters': {
        'n': 1,
        'r': 1.5,
        'msg': 'This is my first experiment run'
    }
}

After creating the available metadata and retrieving an experiment id the last step is to actually create the experiment run.

from tq42.client import TQ42Client
from tq42.experiment_run import ExperimentRun, HardwareProto

with TQ42Client() as client:
    run = ExperimentRun.create(
        client=client,
        # you can configure the algorithm to run here
        # be sure to choose matching algorithm, version and parameters as this will be validated by our backend
        algorithm='TOY',
        version='0.1.0',
        # pass in your experiment id here
        experiment_id=exp_id,
        # you can configure the hardware choice here via the supplied enum
        compute=HardwareProto.SMALL,
        # choose your dictionary here
        parameters=toy_params
    )

The experiment run can now be found via the UI and checked for its status.

Alternatively, you can also use either the SDK or CLI to check on the experiment run. For more details on these two please take a look at the corresponding section of the documentation.

For more details on specific algorithms please take a look at the individual sections.

TQ42 Help Center

TQ42 offers a dedicated Help Center, allowing you to access a wide range of support and learning materials, including:

  • Video tutorials on SDK processes.
  • Help articles across a range of platform workflows, including organisation and project configuration, inviting team members and running experiments.
  • A scientific knowledge base – including articles on quantum computing, machine learning, optimization, simulation and our flagship algorithms.

Please visit our Help Center Homepage.

Customers can also contact our Customer Support team via the Help Center using the help widget. Here, you can:

  • Contact our team for technical support
  • Report a bug on our platform
  • Suggest an improvement on TQ42.

Our Help Center can also be accessed via CLI and Python specific commands. Please see the appropriate developer guides further through our SDK documentation for more information.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

tq42-0.9.11.tar.gz (51.6 kB view details)

Uploaded Source

Built Distribution

tq42-0.9.11-py3-none-any.whl (80.2 kB view details)

Uploaded Python 3

File details

Details for the file tq42-0.9.11.tar.gz.

File metadata

  • Download URL: tq42-0.9.11.tar.gz
  • Upload date:
  • Size: 51.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.4 CPython/3.9.20 Linux/6.5.0-1025-azure

File hashes

Hashes for tq42-0.9.11.tar.gz
Algorithm Hash digest
SHA256 2bf8161809a0a71c9ab4fe0dcf7527eae49719dcdb9d686d8629b0b0892c2302
MD5 d9c118ee04bf63b077bbfbf6aae53783
BLAKE2b-256 379a29047ec1630fcb8218cbd3a2e66f4742702271e9cf8ff9b6ca219d3873de

See more details on using hashes here.

File details

Details for the file tq42-0.9.11-py3-none-any.whl.

File metadata

  • Download URL: tq42-0.9.11-py3-none-any.whl
  • Upload date:
  • Size: 80.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.4 CPython/3.9.20 Linux/6.5.0-1025-azure

File hashes

Hashes for tq42-0.9.11-py3-none-any.whl
Algorithm Hash digest
SHA256 dbcb22e0e0925600c72e7e8e2f1ae3f80c5026bf3b691892aa6a94d5f32bd27c
MD5 d38705648f0cb52b6d9f61af58d89b8f
BLAKE2b-256 ada5a4afd48bb1acf479942c2c9f0b4bf233b8859eb1e497a7718e619bfab18e

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page