You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am trying to load Xenova/nomic-embed-text-v1. It fails with an error and asks that I report the error here.
I am running this on an M2 MacBook Pro running Sonoma 14.2.1 using node.js v21.5:
I downloaded the model with huggingface-cli download Xenova/nomic-embed-text-v1 before running the script.
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
Unknown model class "nomic_bert", attempting to construct from base class.
Model type for 'undefined' not found, assuming encoder-only architecture.
Full error below.
Reproduction
Run the attached script by doing node test.js. The content of test.js is:
import{Pipeline,AutoTokenizer,AutoModel}from"@xenova/transformers";// Load tokenizer and modelconsttokenizer=awaitAutoTokenizer.from_pretrained("Xenova/nomic-embed-text-v1");constmodel=awaitAutoModel.from_pretrained("Xenova/nomic-embed-text-v1");// Prepare text for embeddingconsttexts="Your text here";constinputs=tokenizer.encode(texts);// Generate embeddingsconstpipeline=newPipeline({ model, tokenizer });constoutputs=pipeline(inputs);console.log(outputs);
The error I get is:
% node test.js
Unknown model class "nomic_bert", attempting to construct from base class.
Model type for 'undefined' not found, assuming encoder-only architecture. Please report this at https://github.com/xenova/transformers.js/issues/new/choose.
file:///Users/jim.lloyd/nomic/node_modules/@xenova/transformers/src/utils/core.js:75
throw Error('Must implement _call method in subclass')
^
Error: Must implement _call method in subclass
at Function._call (file:///Users/jim.lloyd/nomic/node_modules/@xenova/transformers/src/utils/core.js:75:15)
at closure (file:///Users/jim.lloyd/nomic/node_modules/@xenova/transformers/src/utils/core.js:62:28)
at file:///Users/jim.lloyd/nomic/test.js:13:17
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
Node.js v21.5.0
The text was updated successfully, but these errors were encountered:
Looking through other issues I saw this: oven-sh/bun#7877, which seemed like it might be related. In that issue @sroussey found a fix which me made available in the package @sroussey/transformers. Switching to that package did NOT fix my error here.
My bad. I somehow was not using the recommended script for transformers.js on the model card. After switching to the recommended script the pipeline works. That script is:
import { pipeline } from '@xenova/transformers';
// Create a feature extraction pipeline
const extractor = await pipeline('feature-extraction', 'nomic-ai/nomic-embed-text-v1', {
quantized: false, // Comment out this line to use the quantized version
});
// Compute sentence embeddings
const texts = ['What is TSNE?', 'Who is Laurens van der Maaten?'];
const embeddings = await extractor(texts, { pooling: 'mean', normalize: true });
console.log(embeddings);
System Info
I am trying to load
Xenova/nomic-embed-text-v1
. It fails with an error and asks that I report the error here.I am running this on an M2 MacBook Pro running Sonoma 14.2.1 using node.js v21.5:
I downloaded the model with
huggingface-cli download Xenova/nomic-embed-text-v1
before running the script.Environment/Platform
Description
Full error below.
Reproduction
Run the attached script by doing
node test.js
. The content of test.js is:The error I get is:
The text was updated successfully, but these errors were encountered: