SIGN IN SIGN UP

🤗 Transformers: the model-definition framework for state-of-the-art machine learning models in text, vision, audio, and multimodal models, for both inference and training.

0 0 124 Python

Fix AttributeError in RAG generate() for missing config fields (#46035)

RagSequenceForGeneration.generate() crashes with AttributeError because
it accesses self.config.num_return_sequences and self.config.num_beams,
but RagConfig never defines these fields. Use getattr with a default of
1 (matching the documented defaults) instead of direct attribute access.

Also removes stale references to examples/rag/use_own_knowledge_dataset.py
which no longer exists in the repo.

Fixes #46015
S
Sriniketh24 committed
2991f8dd6446d9cc307f7a885c3175e6a418aa42
Parent: aeac714
Committed by GitHub <noreply@github.com> on 5/18/2026, 3:45:23 PM