원격 데이터 소스
로컬 파일 없이 HTTP URL, S3 버킷, Google Cloud Storage, PostgreSQL 데이터베이스, HuggingFace Datasets에서 Potato로 주석 데이터를 동적으로 로드합니다.
Potato는 로컬 파일 외에도 URL, 클라우드 스토리지 서비스, 데이터베이스, Hugging Face 데이터셋 등 다양한 원격 소스에서 주석 데이터를 로드하는 것을 지원합니다.
개요
데이터 소스 시스템은 다음을 제공합니다.
- 다양한 소스 유형: URL, Google Drive, Dropbox, S3, Hugging Face, Google Sheets, SQL 데이터베이스
- 부분 로딩: 대규모 데이터셋을 청크 단위로 로드합니다
- 증분 로딩: 주석 작업이 진행됨에 따라 더 많은 데이터를 자동으로 로드합니다
- 캐싱: 반복 다운로드를 피하기 위해 원격 파일을 로컬에 캐시합니다
- 안전한 자격 증명: 비밀 값에 대한 환경 변수 치환
설정
config.yaml에 data_sources를 추가합니다.
data_sources:
- type: file
path: "data/annotations.jsonl"
- type: url
url: "https://example.com/data.jsonl"소스 유형
로컬 파일
data_sources:
- type: file
path: "data/annotations.jsonl"HTTP/HTTPS URL
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 protectionAmazon S3
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}"필요 사항: pip install boto3
Google Drive
data_sources:
- type: google_drive
url: "https://drive.google.com/file/d/xxx/view?usp=sharing"비공개 파일의 경우 서비스 계정과 함께 credentials_file을 사용합니다. 필요 사항: pip install google-api-python-client google-auth
Dropbox
data_sources:
- type: dropbox
url: "https://www.dropbox.com/s/xxx/file.jsonl?dl=0"비공개 파일의 경우 access_token: "${DROPBOX_TOKEN}"을 사용합니다. 필요 사항: pip install dropbox
Hugging Face 데이터셋
data_sources:
- type: huggingface
dataset: "squad"
split: "train"
token: "${HF_TOKEN}" # For private datasets
id_field: "id"
text_field: "context"필요 사항: pip install datasets
Google Sheets
data_sources:
- type: google_sheets
spreadsheet_id: "1BxiMVs0XRA5nFMdKvBdBZjgmUUqptlbs74OgvE2upms"
sheet_name: "Sheet1"
credentials_file: "credentials/service_account.json"필요 사항: pip install google-api-python-client google-auth
SQL 데이터베이스
data_sources:
- type: database
connection_string: "${DATABASE_URL}"
query: "SELECT id, text, metadata FROM items WHERE status = 'pending'"또는 개별 매개변수로 지정합니다.
data_sources:
- type: database
dialect: postgresql
host: "localhost"
port: 5432
database: "annotations"
username: "${DB_USER}"
password: "${DB_PASSWORD}"
table: "items"필요 사항: pip install sqlalchemy psycopg2-binary(PostgreSQL) 또는 pymysql(MySQL)
부분/증분 로딩
대규모 데이터셋의 경우 부분 로딩을 활성화합니다.
partial_loading:
enabled: true
initial_count: 1000
batch_size: 500
auto_load_threshold: 0.8 # Auto-load when 80% annotated캐싱
원격 소스는 로컬에 캐시됩니다.
data_cache:
enabled: true
cache_dir: ".potato_cache"
ttl_seconds: 3600 # 1 hour
max_size_mb: 500자격 증명 관리
민감한 값에는 환경 변수를 사용합니다.
data_sources:
- type: url
url: "https://api.example.com/data"
headers:
Authorization: "Bearer ${API_TOKEN}"
credentials:
env_substitution: true
env_file: ".env"여러 소스
여러 소스의 데이터를 결합합니다.
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"하위 호환성
data_files 설정은 data_sources와 함께 계속 작동합니다.
data_files:
- "data/existing.jsonl"
data_sources:
- type: url
url: "https://example.com/additional.jsonl"보안
- URL 소스는 기본적으로 사설/내부 IP 주소를 차단합니다(SSRF 보호)
- 자격 증명을 절대 버전 관리에 커밋하지 마십시오
- 비밀 값에는
${VAR_NAME}구문을 사용합니다 .env파일은 저장소 외부에 보관합니다
추가 자료
구현 세부 사항은 원본 문서를 참조하십시오.