-
Notifications
You must be signed in to change notification settings - Fork 2.2k
🏃 Fix and make CI faster #3160
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
🏃 Fix and make CI faster #3160
Conversation
# check that the components of the trainer.model are monkey patched: | ||
self.assertTrue(any("Liger" in type(module).__name__ for module in trainer.model.model.modules())) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This assertion doesn't pass anymore. The liger has been moved to transformers anyway
@@ -170,55 +176,3 @@ def test_peft_training(self): | |||
|
|||
self.assertTrue(critic_weights_updated, "Critic weights were not updated during training") | |||
self.assertTrue(policy_weights_updated, "Policy LoRA weights were not updated during training") | |||
|
|||
def test_with_num_train_epochs(self): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
seems like a duplicated test
"import_utils": [ | ||
"is_deepspeed_available", | ||
"is_diffusers_available", | ||
"is_llm_blender_available", | ||
"is_mergekit_available", | ||
"is_rich_available", | ||
"is_unsloth_available", | ||
"is_vllm_available", | ||
], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Having that at the root is not a good thing, IMO.
The docs for this PR live here. All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update. |
This reverts commit 315c896.
tests/test_bco_trainer.py
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Heavy refactor of this one. To keep the review easy I'll refactor the others in follow-up PRs
tests/test_bco_trainer.py
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Refactor.
Before : 1min08
Now: 44 sec
@@ -6,14 +6,14 @@ ACCELERATE_CONFIG_PATH = `pwd`/examples/accelerate_configs | |||
COMMAND_FILES_PATH = `pwd`/commands | |||
|
|||
test: | |||
pytest -n auto --dist=loadfile -s -v --reruns 5 --reruns-delay 1 --only-rerun '(OSError|Timeout|HTTPError.*502|HTTPError.*504||not less than or equal to 0.01)' ./tests/ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
--dist=loadfile
isn't necessary, and probably slows test when used
@@ -228,6 +228,19 @@ def __init__( | |||
if processing_class is None: | |||
processing_class = AutoTokenizer.from_pretrained(model_id) | |||
|
|||
# Model |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This part should be before the collator part
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice clean up! LGTM with a question on whether we can speed things up even further by using setUpClass()
to init the model / tokenizer once per set of trainer tests
@@ -20,76 +20,83 @@ | |||
from accelerate import Accelerator | |||
from datasets import load_dataset | |||
from parameterized import parameterized | |||
from transformers import AutoModel, AutoModelForCausalLM, AutoModelForSeq2SeqLM, AutoTokenizer |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just so I understand, we're removing testing for seq2seq models in this PR right? This is fine with me since no significant LLM with that arch has been released for several years, but maybe good to mention in the PR description so users can find the PR we dropped testing for this if needed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In fact, we defined an AutoModelForSeq2SeqLM
model in the setUp
, but no test used it, so technically we're not removing any tests.
eval_strategy="steps" if eval_dataset else "no", | ||
beta=0.1, | ||
precompute_ref_log_probs=pre_compute, | ||
remove_unused_columns=False, # warning raised if not set to False |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not for this PR, but should we then set this as the default value in BCOConfig
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Or even better, make BCO support this arg. Like we did for DPO in #2233
@require_sklearn | ||
def test_bco_trainer(self, name, pre_compute, eval_dataset, config_name): | ||
def test_train(self, config_name): | ||
model_id = "trl-internal-testing/tiny-Qwen2ForCausalLM-2.5" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could we save a bit of time by using setupClass()
to init the model / tokenizer once? I guess one caveat here is that training might mutate the model, in which case it's better to keep it as you have it
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess one caveat here is that training might mutate the model
yes, see #3160 (comment)
self.assertIn("model.safetensors", os.listdir(tmp_dir + "/checkpoint-5")) | ||
|
||
def test_sft_trainer_infinite_with_model_epochs(self): | ||
def test_with_model_neftune(self): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not for this PR, but doesn't neftune now live on transformers
(and could be removed from our tests)?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
agree, let's remove it in a follow-up PR
The issue with using |
This PR introduces the following changes affecting the CI
Unless there is a good reason, use default config values for greater readability
E.g in
test_dpo_trainer_with_weighting
For slow tests, use a
slow
markerinstead of a dedicated subfolder:
+ @pytest.mark.slow def my_slow_test(self):
Don't expose the import_utils to the root of the lib
These are mainly for internal use:
For low priority tests, use a
low_priority
markereg, for alignprop trainer
+ @pytest.mark.low_priority def my_low_priority_test(self):
Refactor BCO tests
The tests are mostly identical as before, but cleaned and optimised. Other refactors to follow