Make training args fully immutable (#25435)

* Make training args fully immutable

* Working tests, PyTorch

* In test_trainer

* during testing

* Use proper dataclass way

* Fix test

* Another one

* Fix tf

* Lingering slow

* Exception

* Clean
This commit is contained in:
Zach Mueller
2023-08-15 11:47:47 -04:00
committed by GitHub
parent f11518a542
commit ca51499248
8 changed files with 54 additions and 30 deletions

View File

@@ -21,6 +21,7 @@ https://huggingface.co/models?filter=fill-mask
"""
# You can also adapt this script on your own masked language modeling task. Pointers for this are left as comments.
import dataclasses
import json
import logging
import math
@@ -366,7 +367,7 @@ def main():
# If we have ref files, need to avoid it removed by trainer
has_ref = data_args.train_ref_file or data_args.validation_ref_file
if has_ref:
training_args.remove_unused_columns = False
training_args = dataclasses.replace(training_args, remove_unused_columns=False)
# Data collator
# This one will take care of randomly masking the tokens.