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

Pipeline tries to download all the possible weights even when the dtype is specified: utils/hub.js could not locate file #941

Open
1 of 5 tasks
DavidGOrtega opened this issue Sep 21, 2024 · 2 comments
Labels
bug Something isn't working

Comments

@DavidGOrtega
Copy link
Contributor

System Info

tranformers v2.17.2
node v18.20.3

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

For some reason, specifying the dtype is still downloading all the other weights. This approach has some issues:

  • Is a waste of space and bandwidth (specially HF)
  • Prevents you to use other repos that has not converted the models to other dtypes like this one
file:///***/node_modules/@xenova/transformers/src/utils/hub.js:238
    throw Error(`${message}: "${remoteURL}".`);
          ^

Error: Could not locate file: "https://huggingface.co/intfloat/multilingual-e5-large/resolve/main/onnx/model_quantized.onnx".
    at handleError (file:///***/node_modules/@xenova/transformers/src/utils/hub.js:238:11)
    at getModelFile (file:///***/node_modules/@xenova/transformers/src/utils/hub.js:471:24)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async constructSession (file:///***/node_modules/@xenova/transformers/src/models.js:123:18)
    at async Promise.all (index 1)
    at async XLMRobertaModel.from_pretrained (file:///***/node_modules/@xenova/transformers/src/models.js:793:20)
    at async AutoModel.from_pretrained (file:///***/node_modules/@xenova/transformers/src/models.js:5519:20)
    at async Promise.all (index 1)
    at async loadItems (file:///***/node_modules/@xenova/transformers/src/pipelines.js:3279:5)
    at async pipeline (file:///***/node_modules/@xenova/transformers/src/pipelines.js:3219:21)

Reproduction

import { pipeline, env } from '@xenova/transformers';

const run = async () => {
  const model = 'intfloat/multilingual-e5-large';
  const extractor = await pipeline('feature-extraction', model, { pooling: 'mean', normalize: true,  dtype: 'fp32' });

  const texts = ['Hello world.', 'Example sentence.'];
  const embeddings = await extractor(texts);
  console.log(embeddings, model);
}

run();
@xenova
Copy link
Collaborator

xenova commented Sep 22, 2024

Hi there 👋 Please note that the dtype option is only available in @huggingface/transformers (Transformers.js v3) instead of @xenova/transformers.

@tarikakyol
Copy link

thanks for the hard work!, I've spent some days until I figured out there's a newer version of transformers.js at @huggingface/transformers, it might just be me being slow but I think this should be a bit more explicit.

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

3 participants