Skip to main content

Cogment python SDK

Project description

cogment python SDK

Introduction

The Cogment framework is a high-efficiency, open source framework designed to enable the training of models in environments where humans and agents interact with the environment and each other continuously. It’s capable of distributed, multi-agent, multi-model training.

This is the python API for making use of the cogment framework when working with the Python programming language.

For further Cogment information, check out the documentation at https://docs.cogment.ai

Developers

Local setup

Make sure you have the following installed:

Install the dependencies, including downloading and building the cogment protobuf API, by navigating to the python SDK directory and run the following

poetry install

Define used Cogment protobuf API

The version of the used cogment protobuf API is defined in the .cogment-api.yaml file at the root of the repository. The following can be defined:

  • cogment_api_version: "latest", is the default, it retrieves the latest build of the cogment-api develop,
  • cogment_api_version: "vMAJOR.MINOR.PATCH[-PRERELEASE]", retrieves an official release of cogment-api.
  • cogment_api_path: "../path/to/cogment-api", retrieves a local version of cogment-api found at the given path ; if set, this overrides cogment_api_version.

⚠️ when building a docker image, cogment_api_path needs to exists in the docker file system. In practice it means it should be a subdirectory of the current directory.

Tests

A test cogment app is defined in ./tests/test_cogment_app. To make things easier, generated files are versioned in the repository. To get a fresh/updated generation, simply run

COGMENT_PATH=/path/to/your/cogment poetry run task generate_test_cogment_app

Module tests

These tests only rely on the sdk, no connection to an orchestrator is done.

To execute the module tests, simply run

poetry run task test

Integration tests

These tests launch and use an orchestrator they are slower but more in depth. To run them the first step is to configure the way to launch the orchestrator in a .env file. You can copy .env.template for an example of what's expected.

Then, to execute the integration tests (as well as the module tests), simply run

poetry run task test --launch-orchestrator

These tests can also be launched in a docker image.

docker build -t cogment/cogment-py-sdk-integration-test:latest --build-arg COGMENT_ORCHESTRATOR_IMAGE="<PATH_TO_COGMENT_ORCHESTRATOR_IMAGE" -f integration_test.dockerfile .
docker run --rm cogment/cogment-py-sdk-integration-test:latest

Lint

Run the linter using

poetry run task lint

Build the source package

Build the source package (this step will only be succesfull if poetry install succeeded)

poetry build -f sdist

Build a Docker image

Navigate to the python SDK directory and run the following in order to create an image that can be used by a cogment project:

docker build -t image_name .

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

cogment-1.0.0a1.tar.gz (26.7 kB view details)

Uploaded Source

File details

Details for the file cogment-1.0.0a1.tar.gz.

File metadata

  • Download URL: cogment-1.0.0a1.tar.gz
  • Upload date:
  • Size: 26.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.4 CPython/3.7.9 Linux/4.19.78-coreos

File hashes

Hashes for cogment-1.0.0a1.tar.gz
Algorithm Hash digest
SHA256 cd71760b3a7744f50b4f507d1a9cb3f6fa29f87d01e55cb3514abfc0c6b26ce6
MD5 bce9fa8e58ca4e4a29c14e0e2944cacd
BLAKE2b-256 b066917b3b3c975370d748afe15b23ddb19b2f7e698cd7b398a9699b2b6d2036

See more details on using hashes here.

Supported by

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