diff --git a/kiliautoml/utils/mapper/Tuto_Mapper_AutoML.ipynb b/kiliautoml/utils/mapper/Tuto_Mapper_AutoML.ipynb new file mode 100644 index 00000000..24af8d11 --- /dev/null +++ b/kiliautoml/utils/mapper/Tuto_Mapper_AutoML.ipynb @@ -0,0 +1,144 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": { + "id": "L9_fNq8zqAH_" + }, + "source": [ + "# Create Mapper from Kili Dataset" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "id": "aKejop6ok_ne" + }, + "source": [ + "## Import requirements" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/" + }, + "id": "850KFigkX0v9", + "outputId": "e18c0bfe-d128-4110-ff8f-d899fe84b491" + }, + "outputs": [], + "source": [ + "!pip install img2vec_pytorch\n", + "!pip install kili\n", + "!pip install gudhi\n", + "!pip install kmapper\n", + "!pip install datasets\n", + "!pip install transformers\n", + "import os\n", + "import sys\n", + "from kili.client import Kili\n", + "\n", + "git_token = getpass('Github token: ')\n", + "os.environ['GITHUB_TOKEN'] = git_token\n", + "!git clone --branch feature/ml-345-mapper https://$GITHUB_TOKEN@github.com/kili-technology/automl.git\n", + "\n", + "kili_api_key = getpass('Kili API Key: ')\n", + "os.environ[\"KILI_API_KEY\"] = kili_api_key\n", + "api_key = os.environ[\"KILI_API_KEY\"]\n", + "\n", + "kili = Kili(api_key=api_key)\n", + "\n", + "%cd /content/automl" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "id": "AvCWOIzvXNtb" + }, + "source": [ + "## Create Mapper" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "id": "HJHIvtiAic0I" + }, + "outputs": [], + "source": [ + "# Image Classification - Roman Number - project id = cl2yugghg0iw10m0i8wh05o00\n", + "# Text Classification - Tweet Emotions - project_id = cl1uwuqvt5exk0mtha6lchugl" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "id": "IW53iJtMj0Bk" + }, + "outputs": [], + "source": [ + "\"\"\"\n", + "Mapper argument: \n", + "--api-endpoint, --api-key, --project-id , --target-job, --max-assets : \n", + "--assets-repository : Required, where to store downloaded assets\n", + "--asset-status-in: if None or TODO or ONGOING included, mapper.py will not use labels in the asset assignment\n", + "--cv-folds: Number of cv-folds used to compute predictions. Used only if not (None or TODO or ONGOING included in asset-status-in). \n", + "--focus-class: only use assets with labels or predictions inside focus-class\n", + "\"\"\"" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/" + }, + "id": "zt4hKCPohk0t", + "outputId": "8788e04b-5819-4b9c-8ebe-536d4fdce967" + }, + "outputs": [], + "source": [ + "!python mapper.py --project-id cl2yugghg0iw10m0i8wh05o00 --assets-repository /content/assets --asset-status-in labeled,reviewed --focus-class ix,x" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/" + }, + "id": "XB1PvyRQaIIR", + "outputId": "27d1b412-afa7-475e-a2d7-85d48abe1b89" + }, + "outputs": [], + "source": [ + "!python mapper.py --project-id cl1uwuqvt5exk0mtha6lchugl --assets-repository /content/assets --asset-status-in labeled,reviewed" + ] + } + ], + "metadata": { + "accelerator": "GPU", + "colab": { + "collapsed_sections": [], + "machine_shape": "hm", + "name": "Tuto_Mapper_AutoML.ipynb", + "provenance": [] + }, + "kernelspec": { + "display_name": "Python 3", + "name": "python3" + }, + "language_info": { + "name": "python" + } + }, + "nbformat": 4, + "nbformat_minor": 0 +}