Simple access to the TIRA API.
Project description
The TIRA Client
This is a python client for TIRA.io.
Setup REST Client to Access Non-Public Endpoints
To access non-public endpoints, you will need an authentication via an API key to ensure that you have the correct access credentials. Please generate your API key online at tira.io/admin/api/keys and login your tira client:
tira-cli login --token YOUR-TOKEN-HERE
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
Built Distribution
File details
Details for the file tira-0.0.127.tar.gz
.
File metadata
- Download URL: tira-0.0.127.tar.gz
- Upload date:
- Size: 76.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.0.0 CPython/3.12.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | c7968c75200c653b5c8e0823ba5a67ecf4574858cbd518ed4d07902cfc32a92d |
|
MD5 | 1c9bfc9e5688b424f00290f4746551c3 |
|
BLAKE2b-256 | bb11dc8437d4db9439039b2f85c5ee6b525a2ece92c5a822d26cfa0dcc7a7b63 |
File details
Details for the file tira-0.0.127-py3-none-any.whl
.
File metadata
- Download URL: tira-0.0.127-py3-none-any.whl
- Upload date:
- Size: 90.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.0.0 CPython/3.12.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | cb64005ccb1cd2773cd4b7bf06f1114e62eb09c9a2d385d566f9a068a37d6759 |
|
MD5 | 7c4a3ce1e71becadf3fcfec08fa74851 |
|
BLAKE2b-256 | 3af90879e31d6471c4468ba85e98b554c94460bcc1f066d81b9ec9323c1cbbdc |