Buckets:
env
Module used to configure Transformers.js.
Example: Disable remote models.
import { env } from '@huggingface/transformers';
env.allowRemoteModels = false;
Example: Set local model path.
import { env } from '@huggingface/transformers';
env.localModelPath = '/path/to/local/models/';
Example: Set cache directory.
import { env } from '@huggingface/transformers';
env.cacheDir = '/path/to/cache/directory/';
- env
- static
- inner
env.apis
A read-only object containing information about the APIs available in the current environment.
Kind: static constant of env
env.env : TransformersEnvironment
Kind: static constant of env
env~IS_BROWSER_ENV
Whether we are running in a browser environment (and not a web worker)
Kind: inner property of env
env~IS_WEBWORKER_ENV
Whether we are running in a web worker environment
Kind: inner property of env
env~IS_WEB_CACHE_AVAILABLE
Whether the Cache API is available
Kind: inner property of env
env~IS_WEBGPU_AVAILABLE
Whether the WebGPU API is available
Kind: inner property of env
env~IS_WEBNN_AVAILABLE
Whether the WebNN API is available
Kind: inner property of env
env~IS_PROCESS_AVAILABLE
Whether the Node.js process API is available
Kind: inner property of env
env~IS_NODE_ENV
Whether we are running in a Node.js-like environment (node, deno, bun)
Kind: inner property of env
env~IS_FS_AVAILABLE
Whether the filesystem API is available
Kind: inner property of env
env~IS_PATH_AVAILABLE
Whether the path API is available
Kind: inner property of env
env~TransformersEnvironment : Object
Global variable given visible to users to control execution. This provides users a simple way to configure Transformers.js.
Kind: inner typedef of env
Properties
| Name | Type | Description |
|---|---|---|
| version | string | This version of Transformers.js. |
| backends | * | Expose environment variables of different backends, allowing users to set these variables if they want to. |
| allowRemoteModels | boolean | Whether to allow loading of remote files, defaults to |
| remoteHost | string | Host URL to load models from. Defaults to the Hugging Face Hub. |
| remotePathTemplate | string | Path template to fill in and append to |
| allowLocalModels | boolean | Whether to allow loading of local files, defaults to |
| localModelPath | string | Path to load local models from. Defaults to |
| useFS | boolean | Whether to use the file system to load files. By default, it is |
| useBrowserCache | boolean | Whether to use Cache API to cache models. By default, it is |
| useFSCache | boolean | Whether to use the file system to cache files. By default, it is |
| cacheDir | string | The directory to use for caching files with the file system. By default, it is |
| useCustomCache | boolean | Whether to use a custom cache system (defined by |
| customCache | Object | The custom cache to use. Defaults to |
Xet Storage Details
- Size:
- 7.07 kB
- Xet hash:
- b6d8d9473e19784bfcb567c5cd74b9cb550244ee76f951abbfd5237b47633a7d
Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.