Stop passing None to compile() in TF examples (#29597)

* Fix examples to stop passing None to compile(), rework example invocation for run_text_classification.py

* Add Amy's fix
This commit is contained in:
Matt
2024-03-12 12:22:29 +00:00
committed by GitHub
parent 73efe896df
commit 81ec8028f9
8 changed files with 12 additions and 8 deletions

View File

@@ -482,7 +482,7 @@ def main():
adam_global_clipnorm=training_args.max_grad_norm,
)
else:
optimizer = None
optimizer = "sgd" # Just write anything because we won't be using it
# Transformers models compute the right loss for their task by default when labels are passed, and will
# use this for training unless you specify your own loss function in compile().
model.compile(optimizer=optimizer, metrics=["accuracy"], jit_compile=training_args.xla)