huggingface/transformers.js

`num_return_sequences` not working

Opened this issue · 1 comments

System Info

Node.js / browser

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

According to this doc:

SCR-20241102-cwcw

num_return_sequences should return multiple sequences.

But in real run, it only outputs one.

Reproduction

A test script:

import { pipeline } from "@huggingface/transformers";

const generator = await pipeline(
	"text-generation",
	"onnx-community/Llama-3.2-1B-Instruct"
);
const text = "Once upon a time, there was";
const output = await generator(text, {
	temperature: 2,
	max_new_tokens: 10,
	repetition_penalty: 1.5,
	no_repeat_ngram_size: 2,
	num_beams: 2,
	num_return_sequences: 2,
});

console.log(output);

Output:

[
  {
    generated_text: 'Once upon a time, there was no such thing as social media. You were limited'
  }
]

Also having this problem. Is there any update?