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
macOS Sequoia 15.2
@huggingface/[email protected]
No framework, bundling with Webpack, and opening in Chrome
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
I am building a sentiment analyser using pipeline.
I have a classifier pipeline that appears to be working, however it always returns the same result whenever I put it in a function, a loop, or pass an array.
I can call it again outside of this scope and it returns to work as expected.
I have tried this with Xenova/distilbert-base-uncased-finetuned-sst-2-english and Xenova/toxic-bert and got the same results.
No errors are being raised yet it is giving incorrect results.
Reproduction
import { pipeline } from "@huggingface/transformers";
const classifier = await pipeline("sentiment-analysis", 'Xenova/distilbert-base-uncased-finetuned-sst-2-english', {
dtype: "fp16",
device: "webgpu",
});
// Works fine here
console.log(await classifier("Hello world")); // label: POSITIVE (0.99)
console.log(await classifier("Oh no!")); // label: NEGATIVE (0.56)
// Broken with helper function
const classify = async (text) => {
const result = await classifier(text);
return result;
}
console.log(await classify("Hello world!")); // label: NEGATIVE (0.56)
console.log(await classify("Oh no!")); // label: NEGATIVE (0.56)
// Broken with iterator
const texts = ["Hello world!", "Oh no!"];
for (const text of texts) {
const result = await classifier(text);
console.log(result); // label: [NEGATIVE (0.56), NEGATIVE (0.56)]
}
// Broken with batching
console.log(await classifier(["Hello world!", "Oh no!"])); // label: [NEGATIVE (0.56), NEGATIVE (0.56)]
// Still works fine
console.log(await classifier("Hello world")); // label: POSITIVE (0.99)
console.log(await classifier("Oh no!")); // label: NEGATIVE (0.56)
The text was updated successfully, but these errors were encountered:
System Info
macOS Sequoia 15.2
@huggingface/[email protected]
No framework, bundling with Webpack, and opening in Chrome
Environment/Platform
Description
I am building a sentiment analyser using
pipeline
.I have a classifier pipeline that appears to be working, however it always returns the same result whenever I put it in a function, a loop, or pass an array.
I can call it again outside of this scope and it returns to work as expected.
I have tried this with
Xenova/distilbert-base-uncased-finetuned-sst-2-english
andXenova/toxic-bert
and got the same results.No errors are being raised yet it is giving incorrect results.
Reproduction
The text was updated successfully, but these errors were encountered: