Local UI to run and train LLMs and diffusion models. Supports GGUF, MLX, Qwen3.8, DeepSeek-V4.1, MiniMax-H3, Gemma 4, FLUX and more.
Python agentaichatgptdeepseekfine-tuninggemmaimage-generationllamallmllmsopenaipythonqwenreinforcement-learningself-hostedstable-diffusiontext-to-speechttsuiunsloth
Studio: accept Parquet files as local Data Recipe seeds (#13839)
Daniel Han8b5946f23da4
diff --git a/studio/backend/routes/data_recipe/seed.py b/studio/backend/routes/data_recipe/seed.pyindex 65e4e0a85b2..1331f8ee845 100644--- a/studio/backend/routes/data_recipe/seed.py+++ b/studio/backend/routes/data_recipe/seed.py@@ -77,7 +77,7 @@ def _chunking() -> Any:DATA_EXTS = (".parquet", ".jsonl", ".json", ".csv")DEFAULT_SPLIT = "train"DEFAULT_CONFIG = "default"-LOCAL_UPLOAD_EXTS = {".csv", ".json", ".jsonl"}+LOCAL_UPLOAD_EXTS = {".csv", ".json", ".jsonl", ".parquet"}UNSTRUCTURED_ALLOWED_EXTS = {".pdf", ".docx", ".txt", ".md"}SEED_UPLOAD_DIR = LazyPath(seed_uploads_root)UNSTRUCTURED_UPLOAD_ROOT = LazyPath(unstructured_uploads_root)@@ -1019,6 +1019,15 @@ def _read_preview_rows_from_local_file(path: Path, preview_size: int) -> list[didf = pd.read_json(path, **_JSON_READ_OPTIONS).head(preview_size)except ValueError:df = pd.read_json(path, lines = True, **_JSON_READ_OPTIONS).head(preview_size)+ elif ext == ".parquet":+ import pyarrow.parquet as pq++ # Decode only the preview rows: a 100MB compressed upload can inflate to GBs.+ parquet_file = pq.ParquetFile(path)+ batch = next(parquet_file.iter_batches(batch_size = preview_size), None)+ df = (+ batch if batch is not None else parquet_file.schema_arrow.empty_table()+ ).to_pandas()else:raise HTTPException(status_code = 422, detail = f"unsupported file type: {ext}")except HTTPException:diff --git a/studio/backend/tests/test_data_recipe_seed.py b/studio/backend/tests/test_data_recipe_seed.pyindex c23763f1252..27b2433a6d4 100644--- a/studio/backend/tests/test_data_recipe_seed.py+++ b/studio/backend/tests/test_data_recipe_seed.py@@ -124,6 +124,42 @@ def test_local_json_seed_preview_keeps_its_values_as_written(monkeypatch, tmp_paassert rows == records+def test_local_parquet_seed_preview_reads_typed_rows(monkeypatch, tmp_path):+ pd = pytest.importorskip("pandas")+ pytest.importorskip("pyarrow")+ seed_route = _load_seed_route(monkeypatch, tmp_path)+ monkeypatch.setattr(seed_route, "account_path", lambda path: None)+ assert ".parquet" in seed_route.LOCAL_UPLOAD_EXTS+ path = tmp_path / "seed.parquet"+ pd.DataFrame(+ {+ "question": [f"q{i}" for i in range(5)],+ "qty": list(range(5)),+ "tags": [["a"], ["b", "c"], [], ["d"], ["e"]],+ }+ ).to_parquet(path, index = False)++ rows = seed_route._read_preview_rows_from_local_file(path, 2)++ assert rows == [+ {"question": "q0", "qty": 0, "tags": ["a"]},+ {"question": "q1", "qty": 1, "tags": ["b", "c"]},+ ]+++def test_corrupt_parquet_seed_is_a_clear_422(monkeypatch, tmp_path):+ pytest.importorskip("pyarrow")+ seed_route = _load_seed_route(monkeypatch, tmp_path)+ monkeypatch.setattr(seed_route, "account_path", lambda path: None)+ path = tmp_path / "seed.parquet"+ path.write_bytes(b"not a parquet file")++ with pytest.raises(HTTPException) as excinfo:+ seed_route._read_preview_rows_from_local_file(path, 10)++ assert excinfo.value.status_code == 422++@pytest.mark.parametrize(("filename", "module", "package"),[diff --git a/studio/frontend/src/features/recipe-studio/blocks/definitions.ts b/studio/frontend/src/features/recipe-studio/blocks/definitions.tsindex 73959c827af..9f39724db86 100644--- a/studio/frontend/src/features/recipe-studio/blocks/definitions.ts+++ b/studio/frontend/src/features/recipe-studio/blocks/definitions.ts@@ -166,7 +166,7 @@ const BLOCK_DEFINITIONS: BlockDefinition[] = [kind: "seed",type: "seed_local",title: "CSV or JSON file",- description: "Upload CSV, JSON, or JSONL and use its rows as source data.",+ description: "Upload CSV, JSON, JSONL, or Parquet and use its rows as source data.",icon: DocumentCodeIcon,dialogKey: "seed",createConfig: (id, existing) => makeSeedConfig(id, existing, "local"),diff --git a/studio/frontend/src/features/recipe-studio/dialogs/seed/seed-dialog.tsx b/studio/frontend/src/features/recipe-studio/dialogs/seed/seed-dialog.tsxindex 58d81bc2f2c..f0b9fe5ec6d 100644--- a/studio/frontend/src/features/recipe-studio/dialogs/seed/seed-dialog.tsx+++ b/studio/frontend/src/features/recipe-studio/dialogs/seed/seed-dialog.tsx@@ -81,7 +81,7 @@ const SELECTION_OPTIONS: Array<{ value: SeedSelectionType; label: string }> = [{ value: "partition_block", label: "Partition block" },];-const LOCAL_ACCEPT = ".csv,.json,.jsonl";+const LOCAL_ACCEPT = ".csv,.json,.jsonl,.parquet";const DEFAULT_CHUNK_SIZE = 1200;const DEFAULT_CHUNK_OVERLAP = 200;const MAX_CHUNK_SIZE = 20000;@@ -1019,7 +1019,7 @@ export function SeedDialog({<div className="grid gap-1.5"><FieldLabellabel="Structured file"- hint="Upload CSV, JSON, or JSONL seed file."+ hint="Upload CSV, JSON, JSONL, or Parquet seed file."/><div className="flex items-center gap-2"><Input