mirror of
https://github.com/huggingface/transformers.git
synced 2025-07-31 02:02:21 +06:00
Fix: Seq2SeqTrainingArgs overriding to_dict for GenerationConfig json support (#22919)
* Seq2SeqTrainingArgs overriding to_dict for GenerationConfig json support * seq2seqTrainingArgs to_dict calling super method before handling genconf
This commit is contained in:
parent
64ec802e50
commit
d03d8c720f
@ -83,3 +83,15 @@ class Seq2SeqTrainingArguments(TrainingArguments):
|
||||
"help": "Model id, file path or url pointing to a GenerationConfig json file, to use during prediction."
|
||||
},
|
||||
)
|
||||
|
||||
def to_dict(self):
|
||||
"""
|
||||
Serializes this instance while replace `Enum` by their values and `GenerationConfig` by dictionaries (for JSON
|
||||
serialization support). It obfuscates the token values by removing their value.
|
||||
"""
|
||||
# filter out fields that are defined as field(init=False)
|
||||
d = super().to_dict()
|
||||
for k, v in d.items():
|
||||
if isinstance(v, GenerationConfig):
|
||||
d[k] = v.to_dict()
|
||||
return d
|
||||
|
Loading…
Reference in New Issue
Block a user