Skip to content
此页面尚未提供您所选语言的版本,当前显示英文版本。

Remote-Datenquellen

Annotationsdaten aus URLs, Cloud-Speicher, Datenbanken und mehr laden.

Remote-Datenquellen

Potato unterstützt das Laden von Annotationsdaten aus verschiedenen Remote-Quellen über lokale Dateien hinaus, einschließlich URLs, Cloud-Speicherdienste, Datenbanken und Hugging-Face-Datensätze.

Übersicht

Das Datenquellensystem bietet:

  • Mehrere Quelltypen: URLs, Google Drive, Dropbox, S3, Hugging Face, Google Sheets, SQL-Datenbanken
  • Teilladung: Daten in Chunks für große Datensätze laden
  • Inkrementelles Laden: Automatisch mehr Daten laden, wenn die Annotation fortschreitet
  • Caching: Remote-Dateien lokal cachen, um wiederholte Downloads zu vermeiden
  • Sichere Anmeldedaten: Umgebungsvariablen-Substitution für Geheimnisse

Konfiguration

Fügen Sie data_sources zu Ihrer config.yaml hinzu:

yaml
data_sources:
  - type: file
    path: "data/annotations.jsonl"
 
  - type: url
    url: "https://example.com/data.jsonl"

Quelltypen

Lokale Datei

yaml
data_sources:
  - type: file
    path: "data/annotations.jsonl"

HTTP/HTTPS-URL

yaml
data_sources:
  - type: url
    url: "https://example.com/data.jsonl"
    headers:
      Authorization: "Bearer ${API_TOKEN}"
    max_size_mb: 100
    timeout_seconds: 30
    block_private_ips: true    # SSRF protection

Amazon S3

yaml
data_sources:
  - type: s3
    bucket: "my-annotation-data"
    key: "datasets/items.jsonl"
    region: "us-east-1"
    access_key_id: "${AWS_ACCESS_KEY_ID}"
    secret_access_key: "${AWS_SECRET_ACCESS_KEY}"

Erfordert: pip install boto3

Google Drive

yaml
data_sources:
  - type: google_drive
    url: "https://drive.google.com/file/d/xxx/view?usp=sharing"

Für private Dateien credentials_file mit einem Dienstkonto verwenden. Erfordert: pip install google-api-python-client google-auth

Dropbox

yaml
data_sources:
  - type: dropbox
    url: "https://www.dropbox.com/s/xxx/file.jsonl?dl=0"

Für private Dateien access_token: "${DROPBOX_TOKEN}" verwenden. Erfordert: pip install dropbox

Hugging Face Datasets

yaml
data_sources:
  - type: huggingface
    dataset: "squad"
    split: "train"
    token: "${HF_TOKEN}"        # For private datasets
    id_field: "id"
    text_field: "context"

Erfordert: pip install datasets

Google Sheets

yaml
data_sources:
  - type: google_sheets
    spreadsheet_id: "1BxiMVs0XRA5nFMdKvBdBZjgmUUqptlbs74OgvE2upms"
    sheet_name: "Sheet1"
    credentials_file: "credentials/service_account.json"

Erfordert: pip install google-api-python-client google-auth

SQL-Datenbank

yaml
data_sources:
  - type: database
    connection_string: "${DATABASE_URL}"
    query: "SELECT id, text, metadata FROM items WHERE status = 'pending'"

Oder mit einzelnen Parametern:

yaml
data_sources:
  - type: database
    dialect: postgresql
    host: "localhost"
    port: 5432
    database: "annotations"
    username: "${DB_USER}"
    password: "${DB_PASSWORD}"
    table: "items"

Erfordert: pip install sqlalchemy psycopg2-binary (PostgreSQL) oder pymysql (MySQL)

Teilweises/Inkrementelles Laden

Für große Datensätze das teilweise Laden aktivieren:

yaml
partial_loading:
  enabled: true
  initial_count: 1000
  batch_size: 500
  auto_load_threshold: 0.8     # Auto-load when 80% annotated

Caching

Remote-Quellen werden lokal gecacht:

yaml
data_cache:
  enabled: true
  cache_dir: ".potato_cache"
  ttl_seconds: 3600            # 1 hour
  max_size_mb: 500

Verwaltung von Anmeldedaten

Umgebungsvariablen für sensible Werte verwenden:

yaml
data_sources:
  - type: url
    url: "https://api.example.com/data"
    headers:
      Authorization: "Bearer ${API_TOKEN}"
 
credentials:
  env_substitution: true
  env_file: ".env"

Mehrere Quellen

Daten aus mehreren Quellen kombinieren:

yaml
data_sources:
  - type: file
    path: "data/base.jsonl"
 
  - type: url
    url: "https://example.com/extra.jsonl"
 
  - type: s3
    bucket: "my-bucket"
    key: "annotations/batch1.jsonl"

Rückwärtskompatibilität

Die data_files-Konfiguration funktioniert weiterhin neben data_sources:

yaml
data_files:
  - "data/existing.jsonl"
 
data_sources:
  - type: url
    url: "https://example.com/additional.jsonl"

Sicherheit

  • URL-Quellen blockieren standardmäßig private/interne IP-Adressen (SSRF-Schutz)
  • Anmeldedaten niemals in die Versionskontrolle eincheckn
  • ${VAR_NAME}-Syntax für Geheimnisse verwenden
  • .env-Dateien außerhalb Ihres Repositories speichern

Weiterführende Informationen

Implementierungsdetails finden Sie in der Quelldokumentation.