Skip to content

Feature Request: Expose an API to configure @huggingface/transformers env inside the Web Worke #17

@Wyatex

Description

@Wyatex

Description

Currently, the @huggingface/transformers library is imported and executed entirely within a Web Worker. Because Web Workers have isolated execution environments, the exported env object from @huggingface/transformers is trapped inside the worker thread.

As a result, developers using this library from the main thread cannot access or modify the env variables (e.g., env.allowLocalModels, etc.). This strict isolation makes it difficult to customize the behavior of the transformers library dynamically.

Solution

Add support for an additional env parameter in the createOptions argument of createXxxProvider to be passed to the worker. Furthermore, after instantiating new Worker, automatically check if a custom env was provided, and automatically call the worker's env modification method.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions