huggingface / huggingface/course

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

Open
#988 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
MDX
Stars
4.2k
Forks
1.4k
Avg merge
13m
Merged PRs (30d)
1

Description

In ch 1.3 [Transformers: What can they do](https://huggingface.co/learn/llm-course/chapter1/3#using-any-model-from-the-hub-in-a-pipeline), 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

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.