user
stringlengths 3
28
| created_at
timestamp[us] | body
stringlengths 1
173k
| issue_number
int64 1
2.54k
|
---|---|---|---|
dame-cell | 2024-12-11T14:43:58 | Hey @osanseviero,
The main idea for using padding_free is mostly in place now, but there are still a few things that need to be done. It would be awesome if you could take a look at the code and let me know if there's anything else I should address or add.
I've made it so the user can directly do this
```python
trainer = DPOTrainer(
model=self.model,
ref_model=None,
args=training_args,
tokenizer=self.tokenizer,
padding_free=True, # when true it will not use any padding
train_dataset=dummy_dataset["train"],
eval_dataset=dummy_dataset["test"],
)
``` | 2,437 |
dame-cell | 2024-12-13T12:21:52 | @osanseviero I think this fixes it sorry for the small mistake I have been making , thanks for your patience | 2,437 |
dame-cell | 2024-12-13T14:44:55 | still more work to be done not really ready yet
| 2,437 |
dame-cell | 2024-12-13T16:10:14 | the padding_free finally can train , it works but
it's not optimised
not really clean code yet
better refactoring of code
will do this by tommorow | 2,437 |
qgallouedec | 2024-12-14T13:31:42 | I'm not sure that having the padding-free logic in the collator is the best option here, since we concatenate prompt and completions in the trainer. Maybe the easiest is to have everything inside the `concatenated_forward` method. | 2,437 |
dame-cell | 2024-12-14T13:35:55 | > I'm not sure that having the padding-free logic in the collator is the best option here, since we concatenate prompt and completions in the trainer. Maybe the easiest is to have everything inside the `concatenated_forward` method.
question is since the concatenated_inputs depends on the collator do i just create position ids and all those stuff in the concatenated_forward??
| 2,437 |
qgallouedec | 2024-12-14T13:37:09 | Is sounds like the easiest way. Or am I missing something? | 2,437 |
dame-cell | 2024-12-14T13:37:54 | yes you are right I think this will be done by today hopefully | 2,437 |
qgallouedec | 2024-12-14T13:38:46 | > depends on the collator
I don't think it depends on the collator. How would it? | 2,437 |
qgallouedec | 2024-12-14T13:55:21 | Here
https://github.com/huggingface/trl/blob/6d4ed070f1f53a87fb3cff2eb82a56db093bccc6/trl/trainer/dpo_trainer.py#L1115-L1123
After the flushing left, we could remove pad tokens, and add position ids:
```python
# Flush left to reduce the memory usage
# [[0, 0, x, x, x, x], -> [[x, x, x, x],
# [0, x, x, x, 0, 0]] [x, x, x, 0]]
for i in range(attention_mask.size(0)):
first_one_idx = torch.nonzero(attention_mask[i])[0].item()
input_ids[i] = torch.roll(input_ids[i], shifts=-first_one_idx)
attention_mask[i] = torch.roll(attention_mask[i], shifts=-first_one_idx)
loss_mask[i] = torch.roll(loss_mask[i], shifts=-first_one_idx)
if self.padding_free:
# input = input = pos_ids = input = pod_ids =
# [[x, x, x, x], -> [[x, x, x, x], and [[0, 1, 2, 3], -> [x, x, x, x, x, x, x] and [0, 1, 2, 3, 0, 1, 2]
# [x, x, x, 0]] [x, x, x]] [0, 1, 2]]
... # code here
| 2,437 |
dame-cell | 2024-12-14T14:00:02 | all right awesome actually this make more sense 😭
| 2,437 |
dame-cell | 2024-12-14T16:31:41 | before I push my code again I want to benchmark this with padding and padding_free just to show the performance | 2,437 |
qgallouedec | 2024-12-14T16:39:28 | You can push it, no worry we can still refine after | 2,437 |
dame-cell | 2024-12-15T11:33:37 | Thank you for your understanding! I wanted to let you know that I’m a bit tied up today and tomorrow, so I might not be able to push the code right away. I’ll try to get to it as soon as possible, but please feel free to let me know if there’s a hard deadline I should prioritize.
Thanks for your patience!
I'll keep working on it so I'll try to push it by Tommorow if i can
| 2,437 |
qgallouedec | 2024-12-15T11:35:36 | No rush on our side :) | 2,437 |
dame-cell | 2024-12-17T13:34:51 | all right so I think this does it I did check if we can train this on a single T4 gpu colab notebook
now using the examples scripts provided the file `trl/scripts/dpo.py` with a bit of update
I was able to train a model using the padding_Free =True
```python
python trl/examples/scripts/dpo.py \
--dataset_name trl-lib/ultrafeedback_binarized \
--model_name_or_path Qwen/Qwen2-0.5B-Instruct \
--learning_rate 5.0e-6 \
--num_train_epochs 1 \
--per_device_train_batch_size 2 \
--gradient_accumulation_steps 8 \
--gradient_checkpointing \
--logging_steps 1 \
--output_dir Qwen2-0.5B-DPO \
--no_remove_unused_columns \
--use_peft \
--lora_r 32 \
--lora_alpha 16
```
without padding_free it kept saying OOM is this normal or what ?
I have not updated the docs yet because I'm not 100 % sure this one works or is correct until after a review | 2,437 |
dame-cell | 2024-12-19T02:21:49 | @osanseviero Just wanted to follow up on this PR and see if there’s any feedback so far. I’m happy to clarify anything or make updates if needed. Let me know whenever you get a chance—thanks so much for your time! 🙌 | 2,437 |
qgallouedec | 2024-12-19T13:33:33 | You still need to revert the changes applied to PPO files. And apply pre-commits | 2,437 |
dame-cell | 2024-12-22T14:03:19 | @qgallouedec
Train a qwen model for only 10 steps using both padding_Free =Trrue and padding_free =False with a batch_size of 1 with no gradient accumuatlion on goggle colab notebook T4 GPU
GPU peak memory
| Metric | Padding Free=False | Padding Free=True |
|-----------------|--------------------|-------------------|
| PEAK MEMORY | 13.9 | 9.0 |
here is the lasts steps metrics when training
| Metric | Padding Free=False | Padding Free=True |
|----------------------|--------------------|-------------------|
| Loss | 0.6939 | 0.6914 |
| Grad Norm | 4.1626 | 5.1364 |
| Rewards/Chosen | -0.00055 | 0.00207 |
| Rewards/Rejected | 0.00093 | -0.00152 |
| Rewards/Accuracies | 0.0 | 1.0 |
| Rewards/Margins | -0.00148 | 0.00359 |
| LogPs/Chosen | -57.3851 | -57.3589 |
| LogPs/Rejected | -29.9984 | -27.7588 |
| Logits/Chosen | -2.8899 | -2.8894 |
| Logits/Rejected | -2.7367 | -2.3579 |
| Epoch | 0.01 | 0.01 |
There still appear to be noticeable differences between the Rewards/Chosen and Rewards/Rejected metrics. Despite my efforts to resolve this,I just could not fix it
with gradient accumulation of 8 you can fit upto 4 batch for padding_free =True | 2,437 |
qgallouedec | 2024-12-22T14:08:21 | (Please stop tagging osanseviero? Unless you've a good reason. He is not involved here, please don't bother him 🙏) | 2,437 |
qgallouedec | 2024-12-04T14:52:31 | Thanks @AMindToThink for the addition.
Strictly speaking, you can't convert a language-modelling dataset (only text column) to a prompt-completion dataset, because you'd have to be able to extract the prompt from it. I'm afraid that adding this part to the documentation will create confusion.
The workaround you use is to have an empty prompt column. Which is a bit strange.
How about instead making the algorithms natively support this new type in which you only have a `text` column and a `label` colone?
| 2,436 |
qgallouedec | 2024-12-05T21:12:24 | Thanks for reporting. Could you please share your system info? Also I'll need a sample of your dataset to be able to reproduce it. Please make your best to minimize the code as much as you can (make things so much easier) | 2,435 |
scarafoni | 2024-12-03T23:31:29 | another update- the issue is occurring on this line in rloo_trainer.py
```python
self.eval_dataloader = DataLoader(
self.eval_dataset,
batch_size=args.per_device_eval_batch_size,
collate_fn=DataCollatorWithPadding(self.processing_class),
drop_last=True,
) # no need to shuffle eval dataset
```
The dataloader is of length 0 but the dataset is not | 2,434 |
scarafoni | 2024-12-05T17:28:38 | I solved the problem- the code was being run on a dummy test set and the dataloader was estimating the length to be 0 because there were not enough samples in it | 2,434 |
HuggingFaceDocBuilderDev | 2024-12-03T19:22:09 | The docs for this PR live [here](https://moon-ci-docs.huggingface.co/docs/trl/pr_2433). All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update. | 2,433 |
kashif | 2024-12-03T19:24:15 | is it because we have effectively 2 x bigger batches from the chosen and rejected pairs? | 2,433 |
qgallouedec | 2024-12-03T20:31:15 | Probably..., merging as it seems to resolve the issue. | 2,433 |
HuggingFaceDocBuilderDev | 2024-12-03T12:17:35 | The docs for this PR live [here](https://moon-ci-docs.huggingface.co/docs/trl/pr_2432). All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update. | 2,432 |
HuggingFaceDocBuilderDev | 2024-12-03T09:55:17 | The docs for this PR live [here](https://moon-ci-docs.huggingface.co/docs/trl/pr_2431). All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update. | 2,431 |
dakru012 | 2024-12-03T08:16:49 | I think these changes alone don't fix the issue, the `PreferenceCollator` also needs small changes.
Can I somehow directly add changes to the PR? | 2,430 |
kashif | 2024-12-03T08:20:27 | thanks @dakru012 make a new PR with your fixes and ignore this one and then we can merge both separately, perhaps that is the easiest. | 2,430 |
HuggingFaceDocBuilderDev | 2024-12-03T08:46:58 | The docs for this PR live [here](https://moon-ci-docs.huggingface.co/docs/trl/pr_2430). All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update. | 2,430 |
qgallouedec | 2024-12-03T09:43:49 | You're right @dakru012. A change in collator is also needed. Closing this one in favour of #2431 | 2,430 |
qgallouedec | 2024-12-03T10:18:50 | Thanks for suggesting this enhancement @jc-ryan. I agree it would be a great addition. cc @Rocketknight1
> 1. Support for processing and encoding messages with user, assistant, and tool roles (already supported by the tokenizer library)
It would probably be necessary to update the functions in `trl/data_utils.py` to include `tool` arg. This could be done as a first step.
> 2. Loss calculation specifically for assistant parts (including both general messages and tool-calling messages)
Can you elaborate on this part? Should the loss be calculated differently for the tool part?
> Alternatively, is it possible to implement function calling fine-tuning using existing SFTTrainer features? For example, through a custom collate_fn similar to vlm_sft?
I'm not sure I understand this point. With SFT at least, training is offline, so you shouldn't have to call the tools, right? | 2,429 |
jc-ryan | 2024-12-03T12:06:31 |
> Loss calculation specifically for assistant parts (including both general messages and tool-calling messages)"
@qgallouedec Sorry for not being clear earlier. Regarding loss calculation, for tool using, there are several role messages including **system**, **user**, **assistant (tool_call)**, **tool (tool call results)**, and **assistant (plain text)**. We should mainly calculate the loss for the **assistant (tool_call)** and **assistant (plain text)** parts while masking the loss for other roles.
For the specific data format, you can refer to mistral: https://docs.mistral.ai/capabilities/finetuning/#2-function-calling-instruct
> Alternatively, is it possible to implement function calling fine-tuning using existing SFTTrainer features? For example, through a custom collate_fn similar to vlm_sft?
This part means I noticed that in the SFTTrainer documentation, you can write custom collate_fn for vlm_sft to support multimodal model input formats and loss masking (https://huggingface.co/docs/trl/sft_trainer#a-custom-collator-for-processing-multi-modal-data). So I'm not sure if this same approach can be applied to handle function calling data.
| 2,429 |
qgallouedec | 2024-12-03T18:00:47 | Thanks for the clarification. Yes, you're right, the loss is calculated over the entire sequence by default (assistant and user). I think it's ok as a first approach, even if it's probably better to hide these parts in the loss.
For any contributor who wants to tackle this improvement, I suggest (one PR at a time)
1. update the functions in `trl/data_utils.py` to include tool arg. #2455
2. update the trainers one by one to include tooling in their preprocessing stage (start with SFT)
3. find a clean way to hide the “tool” part of the assistant in the loss (data collator isn't IMHO). As a preliminary step, I'd also say prove that it's really worth doing. | 2,429 |
qgallouedec | 2024-12-03T10:58:43 | Thanks for this addition @shirinyamani!
Is there a simple way to test it? Ideally a small piece of code that would fail before this PR but passes after?
We probably won't be able to add it to the tests because it requires multi-gpu, but at least we'll have it ready. (I'll have to reinvest in multi-gpu testing in the future) | 2,427 |
shirinyamani | 2024-12-03T21:13:26 | The simplest way might be testing it with `assert` to make sure the `load_in_4bit` is the case? what do think abt it ?
I can also look into multiple gpu set up! @qgallouedec
> Thanks for this addition @shirinyamani!
>
> Is there a simple way to test it? Ideally a small piece of code that would fail before this PR but passes after? We probably won't be able to add it to the tests because it requires multi-gpu, but at least we'll have it ready. (I'll have to reinvest in multi-gpu testing in the future)
| 2,427 |
qgallouedec | 2024-12-04T14:57:40 | To clarify: I think it's okay not to add a test in our unit test for this PR (because it's specific to multi-gpu configuration, and it's not trivial to set up with GitHub actions, but we'll do it anyway in the future).
However, we should check “by hand” that it works. Do you have a small command line / example script that I can run in my local multi-gpu configuration to check that it works as expected? | 2,427 |
qgallouedec | 2024-12-04T18:36:27 | Btw if you don't have multi-gpu setting available, feel free to share a code that might not be correct, I can test it quickly on my side. | 2,427 |
shirinyamani | 2024-12-04T21:29:56 | Rn I can think of two approaches both when we do NOT want to run manually using `torch.distributed.run`;
1. So I just checked we have nice `accelerate_config` files in `trl` so I think what we can do is we can launch the `multi_gpu` config from `examples/accelerate_configs` then set up the `sft` modeling; (preferred approach/ not sure abt outcome as I do not have access to multiple gpu atm!)
> accelerate launch --config_file examples/accelerate_configs/multi_gpu.yaml --num_processes=8 examples/scripts/sft.py --model_name_or_path Qwen/Qwen2-0.5B --dataset_name trl-lib/Capybara
2. (Less sure/feasible approach), is to directly launch the multi-gpu from accelerate lib; the command for say 8 GPUs would be the following but not really sure if it is correct, I think it is not tho; [reference](https://github.com/huggingface/accelerate)
> accelerate launch --multi_gpu --num_processes 8 sft --model_name_or_path Qwen/Qwen2.5-0.5B --dataset_name trl-lib/Capybara --output_dir Qwen2.5-0.5B-SFT
| 2,427 |
kashif | 2024-12-02T14:26:46 | also if you can kindly add this config to the tests where we test with `pre_compute` flag, then we can also have it tested | 2,426 |
qgallouedec | 2024-12-02T14:29:31 | Good point @kashif. We cannot really test if it works, but at least, we can check that it doesn't fail when this arg is passed.
```python
def test_precompute_ref_batch_size(self):
with tempfile.TemporaryDirectory() as tmp_dir:
training_args = DPOConfig(
output_dir=tmp_dir,
per_device_train_batch_size=2,
precompute_ref_log_probs=True,
precompute_ref_batch_size=4,
report_to="none",
)
dummy_dataset = load_dataset("trl-internal-testing/zen", "standard_preference")
trainer = DPOTrainer(
model=self.model,
ref_model=self.ref_model,
args=training_args,
processing_class=self.tokenizer,
train_dataset=dummy_dataset["train"],
eval_dataset=dummy_dataset["test"],
)
previous_trainable_params = {n: param.clone() for n, param in trainer.model.named_parameters()}
trainer.train()
self.assertIsNotNone(trainer.state.log_history[-1]["train_loss"])
# check the params have changed
for n, param in previous_trainable_params.items():
new_param = trainer.model.get_parameter(n)
# check the params have changed - ignore 0 biases
if param.sum() != 0:
self.assertFalse(torch.allclose(param, new_param, rtol=1e-12, atol=1e-12))
``` | 2,426 |
HuggingFaceDocBuilderDev | 2024-12-02T15:11:29 | The docs for this PR live [here](https://moon-ci-docs.huggingface.co/docs/trl/pr_2426). All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update. | 2,426 |
qgallouedec | 2024-12-03T18:11:37 | Thanks for raising the question. @gaetanlop is probably best qualified to answer this question. | 2,425 |
fzyzcjy | 2024-12-03T23:23:40 | Thanks for routing! | 2,425 |
qgallouedec | 2024-12-02T08:24:47 | Which method does your question refer to? | 2,424 |
NUMB1234 | 2024-12-02T08:52:20 | just sft, during the training process | 2,424 |
qgallouedec | 2024-12-02T09:18:39 | By default the loss is computed over the whole sequence.
You can make sft ignore some parts of the sequence in the loss by using a custom data collator (see sft doc) | 2,424 |
NUMB1234 | 2024-12-02T10:07:10 | I'm sorry, perhaps I didn't explain my question clearly. For multi-turn dialogue data in this format:
{"messages": [{"role": "system", "content": "..."}, {"role": "user", "content": "..."}, {"role": "assistant", "content": "..."}, {"role": "user", "content": "..."}, {"role": "assistant", "content": "..."}, ...]}
Does this project calculate the loss only for the last assistant's response, or calculate the loss for all assistant responses? I couldn't find an explanation in the documentation. | 2,424 |
qgallouedec | 2024-12-02T10:12:49 | Neither. By default, the loss is computed on the full sequence, ie all assistant and user messages. | 2,424 |
NUMB1234 | 2024-12-02T10:26:02 | thanks a lot | 2,424 |
qgallouedec | 2024-12-02T14:06:58 | That's a good catch, thanks @dakru012! Do you want to submit a PR to fix it?
| 2,423 |
SwayamInSync | 2024-12-02T14:37:17 | > That's a good catch, thanks @dakru012! Do you want to submit a PR to fix it?
I think these lines within `concatenated_forward` are the culprit, names should be [`ref_chosen_logps`, `ref_rejected_logps`] instead of [`chosen_logps`, `rejected_logps`] then need to handle the same case at `compute_ref_log_probs` function
```python
output["chosen_logps"] = all_logps[:num_examples]
output["rejected_logps"] = all_logps[num_examples:]
```
Let me know if the PR is there otherwise I can include the relevant fixes inside #2426 or made a new one | 2,423 |
dakru012 | 2024-12-02T15:00:29 | @SwayamInSync I don't think that's the problem.
I will take a look at it again and do a PR, but it is already midnight here so I gotta sleep first 😴
| 2,423 |
SwayamInSync | 2024-12-03T02:34:56 | While looking on another issue in transformers library, I think this function was the problem of this issue
```python
def _set_signature_columns_if_needed(self):
# If `self.args.remove_unused_columns` is True, non-signature columns are removed.
# By default, this method sets `self._signature_columns` to the model's expected inputs.
# In DPOTrainer, we preprocess data, so using the model's signature columns doesn't work.
# Instead, we set them to the columns expected by `DPODataCollatorWithPadding`, hence the override.
if self._signature_columns is None:
self._signature_columns = ["prompt_input_ids", "chosen_input_ids", "rejected_input_ids", "image_sizes"]
```
It is used to remove the unused columns and since there is no `ref` columns are defined here so they all get removed, changing above to
```python
def _set_signature_columns_if_needed(self):
# If `self.args.remove_unused_columns` is True, non-signature columns are removed.
# By default, this method sets `self._signature_columns` to the model's expected inputs.
# In DPOTrainer, we preprocess data, so using the model's signature columns doesn't work.
# Instead, we set them to the columns expected by `DPODataCollatorWithPadding`, hence the override.
if self._signature_columns is None:
self._signature_columns = ["prompt_input_ids", "chosen_input_ids", "rejected_input_ids", "image_sizes", "ref_chosen_logps", "ref_rejected_logps"]
```
Fixed that condtion check
cc: @dakru012 | 2,423 |
dakru012 | 2024-12-03T02:48:37 | @SwayamInSync That is a good find, I overlooked that one and just set `remove_unused_columns` to False. I will test it and check the others trainers if there are similar problems.
I think there is also an small error in the data_collator description. It says that `DPODataCollatorWithPadding` is the default collator, but it seems to be `PreferenceCollator` now. | 2,423 |
SwayamInSync | 2024-12-03T03:20:36 | > @SwayamInSync That is a good find, I overlooked that one and just set `remove_unused_columns` to False. I will test it and check the others trainers if there are similar problems.
>
> I think there is also an small error in the data_collator description. It says that `DPODataCollatorWithPadding` is the default collator, but it seems to be `PreferenceCollator` now.
Hey awesome and yes, the documentation about collator is misleading there, I would drop a quick fix to both in a PR later, please feel free to add any modifications needed | 2,423 |
qgallouedec | 2024-12-01T10:09:58 | Thanks @fzyzcjy! Can you elaborate a bit? What is this padding free method? | 2,422 |
fzyzcjy | 2024-12-01T10:20:24 | Oh sorry I provided the wrong link, now the link is updated to point to the correct "padding_free" article | 2,422 |
qgallouedec | 2024-12-01T14:05:38 | Thanks for the pointer. This would be nice addition! Any contribution is welcome. I mark this one as good second issue | 2,422 |
qgallouedec | 2024-12-01T14:12:37 | The guideline is basically to:
1. Update `PreferenceCollator` to add `padding_free` like in https://github.com/huggingface/trl/pull/1887
2. Update `concatenated_inputs` to (a) make `xxx_attention_mask` optional and add support for `xxx_position_ids`
3. Add a test | 2,422 |
fzyzcjy | 2024-12-01T14:19:15 | Thank you! | 2,422 |
dame-cell | 2024-12-01T14:58:10 |
- should `padding_free` in `PreferenceCollator ` be like kind of a optional arguement or like keep it default ?
but why make `xxx_attention_mask' optional ?
is it because padding-free sequences might not use attention masks at all.?
for example
- In regular training with padding, attention_masks are needed to tell the model which tokens are real and which are padding (0s for padding, 1s for real tokens)
- In padding-free training, since we remove all padding tokens, every token is a real token, so we don't need explicit masks to distinguish between real and padding
does this make sense?
Thank you for your patience - I wanted to verify that I understand these concepts correctly | 2,422 |
qgallouedec | 2024-12-01T15:02:21 | I think it makes sense yes. | 2,422 |
dame-cell | 2024-12-01T15:03:37 | @fzyzcjy @qgallouedec if no one is working on this I would like to help | 2,422 |
fzyzcjy | 2024-12-01T23:58:27 | @dame-cell I do not have time recently for that, and your PR would be great and many thanks! | 2,422 |
zwhe99 | 2024-12-02T09:10:10 | Is it possible for PPO to support padding_free? | 2,422 |
qgallouedec | 2024-12-01T09:34:31 | Thanks for this suggestion @SwayamInSync!
Do you have any idea of the gain in speed?
If you've a working implementation, feel free to submit a PR so that we can test and discuss the code | 2,421 |
SwayamInSync | 2024-12-02T14:20:00 | > Thanks for this suggestion @SwayamInSync! Do you have any idea of the gain in speed? If you've a working implementation, feel free to submit a PR so that we can test and discuss the code
Made a PR at #2426
From a quick test on my settings I can fit only a batch size upto 8 (get OOM elsewise) but with this new parameter, inference batch size can go upto 32 (instead of same as train, so pretty better than before I guess) | 2,421 |
HuggingFaceDocBuilderDev | 2024-11-30T11:12:55 | The docs for this PR live [here](https://moon-ci-docs.huggingface.co/docs/trl/pr_2419). All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update. | 2,419 |
qgallouedec | 2024-12-03T18:14:51 | Yes, that's the right way to do it. Your code looks fine, feel free to share if you get an error running it. | 2,418 |
HuggingFaceDocBuilderDev | 2024-11-29T18:20:14 | The docs for this PR live [here](https://moon-ci-docs.huggingface.co/docs/trl/pr_2417). All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update. | 2,417 |
qgallouedec | 2024-11-29T19:57:22 | CI is down for the moment due `429 Client Error: Too Many Requests` when trying to download the dataset for testing. Not sure how to solve it. | 2,417 |
qgallouedec | 2024-11-30T11:17:27 | > CI is down for the moment due `429 Client Error: Too Many Requests` when trying to download the dataset for testing. Not sure how to solve it.
Fixed!
There is one test still failing (expected, see https://github.com/huggingface/trl/pull/2413#issuecomment-2507953395) | 2,417 |
yiyepiaoling0715 | 2024-12-05T10:04:56 | good job! when will be merged? waiting online! hah | 2,417 |
qgallouedec | 2024-11-30T13:42:28 | > `accelerate launch --config_file deepspeed_zero2.yaml`
have you fixed #2410? I can't really reproduce since I can't make online dpo work with deepspeed rn | 2,416 |
qgallouedec | 2024-12-03T18:18:07 | Thanks for the suggestion. I think we already support it via the [`LogCompletionsCallback`](https://huggingface.co/docs/trl/en/callbacks#trl.LogCompletionsCallback). But not with an arg in script though. Can you confirm it's about adding an arg in the scripts (not in the trainers' config) | 2,415 |
HuggingFaceDocBuilderDev | 2024-11-29T09:33:09 | The docs for this PR live [here](https://moon-ci-docs.huggingface.co/docs/trl/pr_2414). All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update. | 2,414 |
kashif | 2024-11-29T09:33:14 | @lewtun would we need the same warning in the other trainers? | 2,414 |
qgallouedec | 2024-11-29T11:26:21 | Great! Thanks @chenweize1998! Can you try to uncomment
https://github.com/huggingface/trl/blob/ac267781ec20a421e07c17c7f2f5670f9a56d41c/tests/test_dpo_trainer.py#L1142 | 2,413 |
HuggingFaceDocBuilderDev | 2024-11-29T12:51:19 | The docs for this PR live [here](https://moon-ci-docs.huggingface.co/docs/trl/pr_2413). All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update. | 2,413 |
qgallouedec | 2024-11-29T14:45:01 | As expected, "Tests / Tests with dev dependencies" will fail until https://github.com/huggingface/transformers/pull/34953 is merged. We can safely ignore this failing test. | 2,413 |
HuggingFaceDocBuilderDev | 2024-11-28T20:40:35 | The docs for this PR live [here](https://moon-ci-docs.huggingface.co/docs/trl/pr_2412). All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update. | 2,412 |
HuggingFaceDocBuilderDev | 2024-11-28T19:00:00 | The docs for this PR live [here](https://moon-ci-docs.huggingface.co/docs/trl/pr_2411). All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update. | 2,411 |
qgallouedec | 2024-11-28T19:05:15 | Link to authors are wrong | 2,411 |
burtenshaw | 2024-11-29T09:27:44 | @qgallouedec Thanks for the review. I've responded. | 2,411 |
zcw0201 | 2024-11-28T17:41:06 | Sorry, I use "deepspeed_zero2.yaml" and it should be
!ACCELERATE_LOG_LEVEL=info accelerate launch --config_file deepspeed_zero2.yaml
online_dpo.py
--model_name_or_path mistralai/Mistral-7B-v0.1
--reward_model_path Ray2333/GRM-Llama3.2-3B-rewardmodel-ft
--dataset_name nvidia/HelpSteer2
--learning_rate 5.0e-6
--output_dir pythia-1b-tldr-online-dpo
--per_device_train_batch_size 16
--gradient_accumulation_steps 8
--warmup_ratio 0.1
--missing_eos_penalty 1.0
--use_peft | 2,410 |
qgallouedec | 2024-11-28T17:43:17 | Thanks for reporting. Please share your system info (`trl env`)
| 2,410 |
zcw0201 | 2024-11-28T17:44:24 | /home/ec2-user/anaconda3/envs/pytorch_p310/lib/python3.10/site-packages/transformers/utils/hub.py:128: FutureWarning: Using `TRANSFORMERS_CACHE` is deprecated and will be removed in v5 of Transformers. Use `HF_HOME` instead.
warnings.warn(
Copy-paste the following information when reporting an issue:
- Platform: Linux-5.10.228-219.884.amzn2.x86_64-x86_64-with-glibc2.26
- Python version: 3.10.14
- PyTorch version: 2.2.2
- CUDA device(s): NVIDIA A100-SXM4-80GB, NVIDIA A100-SXM4-80GB, NVIDIA A100-SXM4-80GB, NVIDIA A100-SXM4-80GB, NVIDIA A100-SXM4-80GB, NVIDIA A100-SXM4-80GB, NVIDIA A100-SXM4-80GB, NVIDIA A100-SXM4-80GB
- Transformers version: 4.46.3
- Accelerate version: 0.34.2
- Accelerate config: not found
- Datasets version: 3.1.0
- HF Hub version: 0.26.2
- TRL version: 0.13.0.dev0
- bitsandbytes version: 0.44.1
- DeepSpeed version: 0.16.0
- Diffusers version: not installed
- Liger-Kernel version: not installed
- LLM-Blender version: not installed
- OpenAI version: not installed
- PEFT version: 0.13.2 | 2,410 |
sergiopaniego | 2024-11-28T16:52:15 | Working example: [notebook](https://colab.research.google.com/drive/1ST017t2yLphjxGGMTzKmwevdsGl5B7aL?usp=sharing)
The changes could also be integrated in `sft_vlm.py` since they are small:
* A new import for the model
* Below image:
![image](https://github.com/user-attachments/assets/36e7657c-b05a-46e5-95c6-4ca9d9621af6)
| 2,409 |
qgallouedec | 2024-11-28T16:58:10 | Looks good to me, thanks a lot @sergiopaniego
If by any chance you have model or curves to share? | 2,409 |
HuggingFaceDocBuilderDev | 2024-11-28T16:58:15 | The docs for this PR live [here](https://moon-ci-docs.huggingface.co/docs/trl/pr_2409). All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update. | 2,409 |
sergiopaniego | 2024-11-28T17:04:59 | I trained a model last night since I'm working on a recipe 🤗
Model: https://huggingface.co/sergiopaniego/smolvlm-base-instruct-trl-sft-ChartQA
Tensorboard: https://huggingface.co/sergiopaniego/smolvlm-base-instruct-trl-sft-ChartQA/tensorboard
![Captura de pantalla 2024-11-27 a las 21 19 51](https://github.com/user-attachments/assets/78c7e9f8-d7e2-4b78-85e9-5f166a5e78ad)
| 2,409 |
qgallouedec | 2024-11-28T17:07:11 | you rock! | 2,409 |
HuggingFaceDocBuilderDev | 2024-11-28T14:58:54 | The docs for this PR live [here](https://moon-ci-docs.huggingface.co/docs/trl/pr_2407). All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update. | 2,407 |
qgallouedec | 2024-11-28T15:21:16 | Can probably be improved, but at least there is a doc for it now. | 2,407 |
qgallouedec | 2024-12-02T14:09:47 | Thanks for the suggestion. Fell free to open a PR to add this | 2,406 |
HuggingFaceDocBuilderDev | 2024-12-01T13:04:11 | The docs for this PR live [here](https://moon-ci-docs.huggingface.co/docs/trl/pr_2405). All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update. | 2,405 |
qgallouedec | 2024-12-04T13:20:35 | FSDP + QLora from https://github.com/huggingface/peft/blob/main/examples/sft/run_peft_qlora_fsdp.sh
green: main
purple: pr
<img width="1058" alt="Screenshot 2024-12-04 at 14 18 09" src="https://github.com/user-attachments/assets/337f39ab-ebf6-44a2-8878-949c45257c16">
| 2,405 |