Skip to content

text-generation task fails with temperature: 0 #1429

@nico-martin

Description

@nico-martin

System Info

transformers.js 3.7.4 in a vitejs/React application

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 setting the temperature to 0, text-generation will generate some random tokens

Reproduction

const pipe = await pipeline(
  "text-generation",
  "HuggingFaceTB/SmolLM3-3B-ONNX",
  {
    device: "webgpu",
    dtype: "q4f16",
  }
);

await pipe(
  [
    {
      role: "system",
      content: "You are a helpful assistant",
    },
    {
      role: "user", 
      content: "Who are you?",
    },
  ],
  {
    max_new_tokens: 10,
    temperature: 0,
  }
);

This will generate something like this: !!!!!!

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions