env
Module used to configure Transformers.js.
Example: Disable remote models.
import { env } from '@xenova/transformers';
env.allowRemoteModels = false;
Example: Set local model path.
import { env } from '@xenova/transformers';
env.localModelPath = '/path/to/local/models/';
Example: Set cache directory.
import { env } from '@xenova/transformers';
env.cacheDir = '/path/to/cache/directory/';
env.env
Global variable used to control execution. This provides users a simple way to configure Transformers.js.
Kind: static constant of env
Properties
Name | Type | Description |
---|---|---|
backends | Object | Expose environment variables of different backends, allowing users to set these variables if they want to. |
__dirname | string | Directory name of module. Useful for resolving local paths. |
version | string | This version of Transformers.js. |
allowRemoteModels | boolean | Whether to allow loading of remote files, defaults to |
remoteHost | string | Host URL to load models from. Defaults to the Model Database 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 |