Update tokenizer_utils.py
This commit is contained in:
parent
fef409112c
commit
01b312cc5f
1 changed files with 2 additions and 2 deletions
|
|
@ -917,7 +917,7 @@ def patch_sft_trainer_tokenizer():
|
|||
return
|
||||
all_imports = dir(trl.trainer.sft_trainer)
|
||||
|
||||
for function_name, replacer in (
|
||||
for (function_name, replacer,) in (
|
||||
("_prepare_non_packed_dataloader", "def tokenize(element):",),
|
||||
("_prepare_dataset", None,),
|
||||
# ("_prepare_packed_dataloader", "if dataset_text_field is not None",),
|
||||
|
|
@ -962,12 +962,12 @@ def patch_sft_trainer_tokenizer():
|
|||
else:
|
||||
function = function.replace(replacer, check_text + replacer)
|
||||
pass
|
||||
print(function)
|
||||
|
||||
x = [x for x in all_imports if x in function]
|
||||
exec(f"from trl.trainer.sft_trainer import ({','.join(x)})", locals())
|
||||
exec(function, locals(), globals())
|
||||
exec(f"trl.trainer.sft_trainer.SFTTrainer.{function_name} = {function_name}", globals())
|
||||
print("Patched")
|
||||
pass
|
||||
|
||||
# Patch train with fix_untrained_tokens
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue