Skip to main content

Simple access to the TIRA API.

Project description

The TIRA Client

This is a python client for TIRA.io. Please find the documentation online.

Setup REST Client to Access Non-Public Endpoints

To get your API key, please navigate to the task for which you want to submit, click on "Submit" -> "Code Submission" or "Docker Submission" and the UI will show you your access token. With this, you can login:

tira-cli login --token YOUR-TOKEN-HERE

Admin-Only: Setup REST Client to Access Non-Public Endpoints

For admin-access to non-public endpoints, you will need an authentication via an API key to ensure that you have the correct access credentials. Please generate your admin API key online at tira.io/admin/api/keys and login your tira client:

tira-cli login --token YOUR-TOKEN-HERE

Admin-Only: Batch-Execution of jobs

To execute all approaches that have a positive review on one dataset on all datasets of a task, please run:

tira-cli admin batch-execution --task TASK

Download The results of some Submission

You can download runs of published and unblinded submissions via:

from tira.rest_api_client import Client

tira = Client()
output = tira.get_run_output('<task>/<team>/<approach>', '<dataset>')

As an example, you can download all baseline BM25 runs submitted to TIREx via:

from tira.rest_api_client import Client
from tira.tirex import TIREX_DATASETS

tira = Client()

for dataset in TIREX_DATASETS:
    output = tira.get_run_output('ir-benchmarks/tira-ir-starter/BM25 Re-Rank (tira-ir-starter-pyterrier)', dataset)

Overview of public submissions

As an example, you can see all public software submissions submitted to TIREx via:

from tira.rest_api_client import Client

tira = Client()
submissions = tira.all_softwares("ir-benchmarks")

Export datasets

You can export datasets if you are the owner or if the dataset is public. Export a dataset via the cli:

tira-run --export-dataset '<task>/<tira-dataset>' --output-directory tira-dataset

Export a dataset via the python API:

from tira.rest_api_client import Client

tira = Client()
tira.download_dataset('<task>', '<tira-dataset>')

Running Jupyter Notebooks with TIRA

docker build -t tira/submission-base-image:1.0.0 -f Dockerfile .

Testing the model locally can be done using the following command:

tira-run \
  --input-directory ${PWD}/input \
  --output-directory ${PWD}/output \
  --image tira/submission-base-image:1.0.0 \
  --command 'tira-run-notebook --input $inputDataset --output $outputDir /workspace/template-notebook.ipynb'

Afterwards you can push the image to TIRA

docker push tira/submission-base-image:1.0.0

and set the command:

tira-run-notebook --input $inputDataset --output $outputDir /workspace/template-notebook.ipynb

Finally, if the actual processing in notebook is toggled via is_running_as_inference_server() (as seen in the template notebook) and your notebook defines a function named predict in the format

def predict(input_list: List) -> List:

you can start an inference server for your model with:

PORT=8001

docker run --rm -it --init \
  -v "$PWD/logs:/workspace/logs" \
  -p $PORT:$PORT \
  tira/submission-base-image:1.0.0 \
  tira-run-inference-server --notebook /workspace/template-notebook.ipynb --port $PORT

Exemplary request for a server running on localhost:8001 are

# POST (JSON list as payload)
curl -X POST -H "application/json" \
  -d "[\"element 1\", \"element 2\", \"element 3\"]" \
  localhost:8001

and

# GET (JSON object string(s) passed to the 'payload' parameter)
curl "localhost:8001?payload=\"element+1\"&payload=\"element+2\"&payload=\"element+3\""

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

tira-0.0.202.tar.gz (2.5 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

tira-0.0.202-py3-none-any.whl (3.7 MB view details)

Uploaded Python 3

File details

Details for the file tira-0.0.202.tar.gz.

File metadata

  • Download URL: tira-0.0.202.tar.gz
  • Upload date:
  • Size: 2.5 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.5

File hashes

Hashes for tira-0.0.202.tar.gz
Algorithm Hash digest
SHA256 be507149f4a6c6fe4ba3314e3d6f469087de016860ce675b961be020be39471f
MD5 cc94e2c0dac67a058bf75b25f9fc8b32
BLAKE2b-256 fadd5eeae4b4f99f48a57f4a879b98c033b45842d4cdb9bc711f39a96c35d1fb

See more details on using hashes here.

File details

Details for the file tira-0.0.202-py3-none-any.whl.

File metadata

  • Download URL: tira-0.0.202-py3-none-any.whl
  • Upload date:
  • Size: 3.7 MB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.5

File hashes

Hashes for tira-0.0.202-py3-none-any.whl
Algorithm Hash digest
SHA256 e599bade0492d2c83bb90664eaf4366d4a0c0983b34833d7015a1b7c8ab10676
MD5 fd1834ec1cb4aecc75c5fd26face9ce3
BLAKE2b-256 8f7e1da57898783461a57de3da8c61bc218eecd059a327358245b095a65e4cbf

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