Argilla Documentation

repository·develop·Indexed 26 days ago

https://github.com/argilla-io/argilla

Argilla is a collaboration tool for AI engineers and domain experts to build high-quality datasets for NLP (text classification, NER), LLM workflows (RAG, preference tuning), and multimodal models. The documentation covers the Argilla Python server SDK, server management via CLI and Docker, database migrations, user administration, and frontend development using Nuxt.js.

Tokens
31.2K
Snippets
70
Records
190
Agent score
88%

What's inside Argilla

  1. Overview of Argilla

    develop

    Argilla is an open-source data curation platform designed for Large Language Models (LLMs) and general NLP tasks. It supports the full MLOps cycle, including data labeling, model monitoring, and iterative data collection using both human and machine feedback.

    Key capabilities include:

    • Human-in-the-loop: Combining hand-labeling with active learning, zero-shot models, and weak supervision.
    • Iterative Development: Enabling continuous data collection and model monitoring once models are in production.
    • Library Compatibility: Seamless integration with major NLP libraries like Hugging Face transformers, spaCy, Stanford Stanza, and Flair.
  2. Argilla Project Architecture

    develop

    Argilla consists of five core components that work together to manage data and annotation workflows:

    1. Python SDK: Installable via pip install argilla. It is used to interact with the Argilla Server and UI, providing APIs to manage data, configuration, and annotation workflows.
    2. FastAPI Server: The central engine that manages data, pre-processes it, and stores it in databases. It provides a REST API and a web interface for visualization.
    3. Relational Database: Stores metadata for records and annotations. SQLite is the default built-in option, but PostgreSQL can be used for separate deployments.
    4. Vector Database: Stores record data for scalable vector similarity and document searches. Supported engines include ElasticSearch and AWS OpenSearch.
    5. Vue.js UI: A web application for visualizing and annotating data, users, and teams, typically deployed alongside the server.
  3. Deploy Argilla on AWS using Docker Machine

    develop

    To deploy Argilla on AWS, first configure an AWS profile:

    aws configure --profile argilla
    export AWS_PROFILE=argilla

    Then, create a Docker machine on an EC2 instance:

    docker-machine create --driver amazonec2 \
    --amazonec2-root-size 60 \
    --amazonec2-instance-type t2.large \
    --amazonec2-open-port 80 \
    --amazonec2-ami ami-0b541372 \
    --amazonec2-region eu-west-1 \
    argilla-aws

    Note: The AMI ami-0b541372 is for eu-west regions (Ubuntu 16.04). You may need to select a different AMI based on your region.

    To connect to the remote machine and launch Argilla:

    eval $(docker-machine env argilla-aws)
    docker-compose pull
    docker-compose up -d

    Access Argilla via http://<ASSIGNED_MACHINE_IP>:6900.

    aws configure --profile argilla
    export AWS_PROFILE=argilla
    
    docker-machine create --driver amazonec2 \
    --amazonec2-root-size 60 \
    --amazonec2-instance-type t2.large \
    --amazonec2-open-port 80 \
    --amazonec2-ami ami-0b541372 \
    --amazonec2-region eu-west-1 \
    argilla-aws
    
    eval $(docker-machine env argilla-aws)
    docker-compose pull
    docker-compose up -d
  4. Use `rg.markdown` for DataURL conversions and chat visualizations

    develop

    Argilla provides helper functions within the rg.markdown module to facilitate the use of Markdown in datasets. Specifically, these helpers assist with:

    1. DataURL conversions: Converting media or other data into formats suitable for Markdown display.
    2. Chat message visualizations: Formatting chat messages for proper rendering within the Argilla interface.

    Refer to the src.argilla.markdown.media and src.argilla.markdown.chat modules for specific implementation details.

  5. Deploy Argilla on GCP via Cloud Run

    develop

    Deploy Argilla as a managed, scaling container on Google Cloud Run.

    Note: Using the argilla/argilla-quickstart:latest image means using a pre-packaged storage layer, which prevents the use of Cloud Run's horizontal scaling features.

    1. Authenticate: gcloud auth login
    2. Deploy:
    gcloud run deploy <deployment-name> \
    --region <region> \
    --image argilla/argilla-quickstart:latest \
    --allow-unauthenticated \
    --port 6900 \
    --cpu 2 \
    --memory 4Gi \
    --max-instances 1 \
    --min-instances 1

    Retrieve the service URL using: gcloud run services describe <deployment-name> --region <region> --format 'value(status.url)'.

    gcloud auth login
    
    gcloud run deploy <deployment-name> \
    --region <region> \
    --image argilla/argilla-quickstart:latest \
    --allow-unauthenticated \
    --port 6900 \
    --cpu 2 \
    --memory 4Gi \
    --max-instances 1 \
    --min-instances 1
  6. Set up a local development environment

    develop

    For developers working on the argilla-server backend:

    • Environment Variables: By default, commands run with pdm run use variables from .env.dev. The pdm test command uses .env.test.
    • Run Dev Server: Use pdm server-dev to migrate the database, create default users, and launch the server in one step.
    • Run Tests: Use pdm test to run the full test suite (uses a SQLite database at ~/.argilla/argilla-test.db).
    • Run Server: Use pdm server to run the uvicorn FastAPI server.
    • Run Workers: Use pdm worker to start RQ background workers.
    # Quick start for development
    pdm server-dev
    
    # Run tests
    pdm test
  7. Deploy Argilla on Azure Container Instances (ACI)

    develop

    The easiest way to deploy on Azure is using Azure Container Instances (ACI).

    1. Authenticate: az login
    2. Create a resource group: az group create --name <resource-group> --location <location>
    3. Create the container:
    az container create --resource-group <resource-group> --name <deployment-name> --image argilla/argilla-quickstart:latest --dns-name-label <dns-name> --ports 6900

    Access Argilla at the FQDN provided by the az container show command on port 6900.

    az login
    az group create --name <resource-group> --location <location>
    az container create --resource-group <resource-group> --name <deployment-name> --image argilla/argilla-quickstart:latest --dns-name-label <dns-name> --ports 6900