Function: installModelSource()
ts
function installModelSource(
env: TransformersEnvLike,
hook: TransformersJsModelSource,
): () => void;Defined in: src/batteries/llm/transformers_js/model_source.ts:131
Install a model-source hook on env and return a restore function. Sets useCustomCache = true + customCache, capturing the previous values. The returned restore() puts them back. NOT mutex- guarded on its own — use withModelSource for the scoped, serialized form.
Parameters
| Parameter | Type | Description |
|---|---|---|
env | TransformersEnvLike | The transformers.js env object (from await import('@huggingface/transformers')). |
hook | TransformersJsModelSource | The resolver to install. |
Returns
A function that restores env's prior cache configuration.
() => void