Skip to content

Greedy Decoder in default SmolLM2-360M prevents num_return_sequences=2 and gives an error #988

Open
@Rendezvous97

Description

@Rendezvous97

In ch 1.3 Transformers: What can they do, the first example under "Using any model from the Hub in a pipeline" gives an error because the model by default is using Greedy Decoder and hence cannot generate 2 sequences. Here is the current example code:

from transformers import pipeline

generator = pipeline("text-generation", model="HuggingFaceTB/SmolLM2-360M")
generator(
    "In this course, we will teach you how to",
    max_length=30,
    num_return_sequences=2,
)

Suggestion: Include num_beams or do_sampling=True

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions