mirror of
https://github.com/unslothai/unsloth.git
synced 2026-08-23 15:53:46 +00:00
* Studio: keep pandas out of the backend startup import graph * Hold the resolved pandas module in a global so a repeat call is not an import statement * Resolve the unstructured seed plugin on first use, not at startup Importing data_designer_unstructured_seed.chunking runs the package __init__ first, and that re-exports .config and .impl, which import the data designer engine, which imports pandas and pyarrow. Dropping the module-scope import inside chunking.py therefore left the whole cost in import main's graph wherever the plugin is installed: measured 534ms cumulative for routes.data_recipe.seed, with pandas and pyarrow both loaded. The route resolves the plugin through _chunking() on first use instead. None still means "not installed", so the existing 500 and the raw-text fallback are unchanged, and the failed probe is remembered rather than retried per request. The runtime guards in test_startup_defers_torch.py pass vacuously wherever the optional plugin is not installed, which is most CI jobs, so add a source-level guard that reads seed.py and fails on a module-scope import of the plugin either way. test_data_recipe_seed.py covers the availability cases: unavailable without the plugin on both preview entry points, probed once, raw text fallback, and the installed path. * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Tighten the comments on the deferred imports * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Tighten comments in the deferred pandas import paths --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: oobabooga <112222186+oobabooga@users.noreply.github.com> Co-authored-by: danielhanchen <unslothshared@gmail.com> |
||
|---|---|---|
| .. | ||
| data-designer-github-repo-seed | ||
| data-designer-unstructured-seed | ||
| __init__.py | ||