Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot import PretrainedModelOptions (or quantization data types) in typescript #998

Open
1 of 5 tasks
jens-ghc opened this issue Oct 28, 2024 · 1 comment
Open
1 of 5 tasks
Labels
bug Something isn't working

Comments

@jens-ghc
Copy link

System Info

Transformers.js 3.0.1
running in node 18 using CommonJS

Environment/Platform

  • Website/web-app
  • Browser extension
  • Server-side (e.g., Node.js, Deno, Bun)
  • Desktop app (e.g., Electron)
  • Other (e.g., VSCode extension)

Description

When trying to import the PretrainedModelOptions type in my typescript application, I'm getting this error message:

'"@huggingface/transformers"' has no exported member named 'PretrainedModelOptions'. Did you mean 'PretrainedOptions'?

I'm getting a similar issue when trying to import the quantization data type that is mentioned in PretrainedModelOptions, (the datatype that contains e.g. q8).

The problem seems to be that neither types/utils/hub.d.ts nor types/utils/dtypes.d.ts are exported through types/transformers.d.ts

Reproduction

Using this statement:

import { PretrainedModelOptions } from '@huggingface/transformers';

results in the error message.

@jens-ghc jens-ghc added the bug Something isn't working label Oct 28, 2024
@pachacamac
Copy link

@jens-ghc Funny I was just about to open this bug myself when I saw you had opened it just a few hours ago :)

At least a simple

import {
  pipeline,
  type PipelineType,
  // @ts-ignore temporary "fix"
  type PretrainedModelOptions,
  //...
} from '@huggingface/transformers';

Lets you work around it for now. Specifying the dtype via e.g.

const model = await pipeline(
  'image-feature-extraction',
  'Xenova/clip-vit-large-patch14-336',
  { dtype: 'fp16' }
)

still works as expected.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants