user
stringlengths
3
28
created_at
timestamp[us]
body
stringlengths
1
173k
issue_number
int64
1
2.29k
SwayamInSync
2024-10-29T14:02:43
On inspection it seems the addition of extra pad token is causing the issue of vocab size mismatch ```python if not tokenizer.pad_token_id: tokenizer.add_special_tokens({"pad_token": "[PAD]"}) tokenizer.pad_token_id = tokenizer.convert_tokens_to_ids("[PAD]") ``` I think it maybe nice to have a check and proper error message :) I can drop a PR if needed and closing this issue
2,293
qgallouedec
2024-10-29T12:16:26
Thanks for reporting. Next time, please share your system info (as requested in the [contribution guide](https://github.com/huggingface/trl/blob/main/CONTRIBUTING.md) and in the issue template). It would have been especially relevant here. You're most likely using Transformers v4.46, which is not compatible with TRL<v0.12 (about to be released). Make sure to downgrade transformers ``` pip install transformers"<=4.45" ``` **OR** Upgrade to TRL>0.12 (this won't work before the release) ``` pip install trl">=0.12" ``` for ref, this issue has been solved in #2246
2,292
MonolithFoundation
2024-10-30T02:25:29
Hi, am using transformers 4.47 and trl 0.11.4 Could u indicates me when would 0.12 release and why this error happens for trl 0.12?
2,292
qgallouedec
2024-10-28T19:02:20
Thanks for reporting @danib08, it has been taken into account in #2162
2,290
HuggingFaceDocBuilderDev
2024-10-27T17:35:29
The docs for this PR live [here](https://huggingface.co/docs/trl/pr_2287). All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update.
2,287
HuggingFaceDocBuilderDev
2024-10-26T20:28:04
The docs for this PR live [here](https://huggingface.co/docs/trl/pr_2286). All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update.
2,286
PhilipMay
2024-10-27T17:00:19
I don't think the CI problems have anything to do with the changes in this PR...
2,286
HuggingFaceDocBuilderDev
2024-10-28T10:49:49
The docs for this PR live [here](https://huggingface.co/docs/trl/pr_2285). All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update.
2,285
qgallouedec
2024-10-25T13:00:16
Wonderfull! Thanks @ccs96307 Can you also replace `pytest.raises(...)` by `self.assertRaises(...)`?
2,283
HuggingFaceDocBuilderDev
2024-10-25T13:08:16
The docs for this PR live [here](https://huggingface.co/docs/trl/pr_2283). All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update.
2,283
qgallouedec
2024-10-25T13:32:59
and make sure to run `make precommit`
2,283
ccs96307
2024-10-25T14:59:16
Hi @qgallouedec, thank you so much for taking the time to review my PR. I really appreciate your suggestions. I'll replace `pytest.raises(...)` with `self.assertRaises(...)` as you recommended, and will also make sure to run `make precommit` to get everything aligned with the project's guidelines. Thanks again for your helpful feedback—I’ll get these changes pushed soon!
2,283
ccs96307
2024-10-26T06:48:24
Hi @qgallouedec, I've noticed that the `tests (3.11, windows-latest)` failed due to the following error: ``` FAILED tests/test_nash_md_trainer.py::TestNashMDTrainer::test_nash_md_trainer_judge_training_0_standard_prompt_only - ValueError: Cannot find pytorch_model.bin or model.safetensors in C:\Users\runneradmin\.cache\huggingface\hub\llm-blender\PairRM FAILED tests/test_nash_md_trainer.py::TestNashMDTrainer::test_nash_md_trainer_judge_training_1_conversational_prompt_only - ValueError: Cannot find pytorch_model.bin or model.safetensors in C:\Users\runneradmin\.cache\huggingface\hub\llm-blender\PairRM ``` These errors seem to be unrelated to my changes, as the tests passed locally and the files I edited do not directly involve this functionality. I suspect this might be a network issue or a cached problem on Windows? Could this be a common issue you've seen before? If there's anything I need to change or investigate further, please let me know.
2,283
qgallouedec
2024-10-28T15:15:48
> Could this be a common issue you've seen before? If there's anything I need to change or investigate further, please let me know. Yes, don't worry, not related with your PR, it will be solved in #2276
2,283
August-murr
2024-10-28T07:12:44
@lewtun @qgallouedec Feedback would be appreciated!
2,282
qgallouedec
2024-10-25T14:37:34
Thanks for this. Indeed I realized it while working on #2209
2,279
HuggingFaceDocBuilderDev
2024-10-25T14:40:44
The docs for this PR live [here](https://huggingface.co/docs/trl/pr_2279). All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update.
2,279
seanexp
2024-10-25T02:58:57
What is the primary difference between this PR and #1628 ?
2,278
mnoukhov
2024-10-25T14:06:30
This is an updated and multi-gpu extension of #1628. It is also work between @vwxyzjn and I! Instead of keeping vllm models on the same GPU, we move them to another. It also uses the more flexible `vllm_utils.py` written by @vwxyzjn in `allenai/open_instruct` (https://github.com/allenai/open-instruct/blob/main/open_instruct/vllm_utils.py) which allows using any version of `vllm` as opposed to the fixed `0.4.2` from #1628. Finally, this has been tested and verified to match regular Online DPO performance while being faster and more efficient, see our new preprint https://arxiv.org/abs/2410.18252
2,278
HuggingFaceDocBuilderDev
2024-10-28T13:17:03
The docs for this PR live [here](https://huggingface.co/docs/trl/pr_2278). All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update.
2,278
HuggingFaceDocBuilderDev
2024-10-25T13:20:43
The docs for this PR live [here](https://huggingface.co/docs/trl/pr_2277). All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update.
2,277
HuggingFaceDocBuilderDev
2024-10-24T20:48:03
The docs for this PR live [here](https://huggingface.co/docs/trl/pr_2276). All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update.
2,276
qgallouedec
2024-10-25T10:11:11
Results for a gemma reward model ``` accelerate launch examples/scripts/dpo_online.py \ --model_name_or_path Qwen/Qwen2-0.5B-Instruct \ --reward_model_path Ray2333/GRM-Gemma-2B-rewardmodel-ft \ --dataset_name trl-lib/ultrafeedback-prompt \ --learning_rate 5.0e-7 \ --logging_steps 10 \ --output_dir Qwen2-0.5B-OnlineDPO-GRM-Gemma \ --per_device_train_batch_size 8 \ --gradient_accumulation_steps 2 \ --warmup_ratio 0.1 \ --missing_eos_penalty 1.0 \ --push_to_hub ``` https://wandb.ai/huggingface/huggingface/runs/520cnnjl For ref, with Pair RM judge instead: ``` accelerate launch examples/scripts/dpo_online.py \ --model_name_or_path Qwen/Qwen2-0.5B-Instruct \ --judge pair_rm \ --dataset_name trl-lib/ultrafeedback-prompt \ --learning_rate 5.0e-7 \ --logging_steps 10 \ --output_dir Qwen2-0.5B-OnlineDPO-PairRM \ --per_device_train_batch_size 8 \ --gradient_accumulation_steps 2 \ --warmup_ratio 0.1 \ --push_to_hub ``` https://wandb.ai/huggingface/huggingface/runs/ffd4u5wa <img width="1685" alt="Screenshot 2024-10-25 at 14 30 30" src="https://github.com/user-attachments/assets/433ba62a-8d76-48eb-9172-e0e61c3c9d3a">
2,276
qgallouedec
2024-10-28T15:00:07
> Have you done a test run of e.g. trying to optimise Qwen2.5-0.5B-Instruct with the 7B ArmoRM model? ArmoRM is a custom classifier (its code for using it is not standard). So our `get_reward` function probably won't work for it. However, by modifying the code a little, I still manage to use it, and this is what I get: https://wandb.ai/huggingface/huggingface/runs/merlfqgx (screenshot to come) ``` accelerate launch examples/scripts/dpo_online.py \ --model_name_or_path Qwen/Qwen2-0.5B-Instruct \ --reward_model_path RLHFlow/ArmoRM-Llama3-8B-v0.1 \ --dataset_name trl-lib/ultrafeedback-prompt \ --learning_rate 5.0e-7 \ --logging_steps 10 \ --output_dir Qwen2-0.5B-OnlineDPO-AutoRM \ --per_device_train_batch_size 8 \ --gradient_accumulation_steps 2 \ --warmup_ratio 0.1 \ --missing_eos_penalty 1.0 \ --push_to_hub ``` <img width="1189" alt="Screenshot 2024-10-28 at 16 50 30" src="https://github.com/user-attachments/assets/da2deffd-8c84-42e5-a996-18ba47629b95">
2,276
qgallouedec
2024-10-24T20:30:53
The issue has been solved with #2246 TRL 0.11.4 is not compatible with Transformers 4.46. We will release TRL 0.12 very soon
2,275
qgallouedec
2024-10-24T18:49:40
Nice! Thanks @zhanwenchen!
2,274
HuggingFaceDocBuilderDev
2024-10-24T18:54:10
The docs for this PR live [here](https://huggingface.co/docs/trl/pr_2274). All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update.
2,274
qgallouedec
2024-10-24T18:27:09
PPO expect `reward_model` to be a model (torch module), not a function.
2,273
HuggingFaceDocBuilderDev
2024-10-24T15:52:48
The docs for this PR live [here](https://huggingface.co/docs/trl/pr_2272). All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update.
2,272
HuggingFaceDocBuilderDev
2024-10-24T10:06:21
The docs for this PR live [here](https://huggingface.co/docs/trl/pr_2270). All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update.
2,270
qgallouedec
2024-10-25T16:12:25
Some tests are failing due to PairRM loading: it is fixed in #2276, you can safely ignore it
2,270
edbeeching
2024-10-28T09:30:36
Hi @cutecharmingkid , unfortunately the answer is not trivial. Does the domain of your task match the tasks used to fine-tune the base vision-instruct model? I would imagine 10k-100k example would be enough, but I have not tested extensively.
2,269
qgallouedec
2024-10-25T16:02:36
Thanks for reporting, please share your system info
2,268
Isaaclgz
2024-10-27T05:14:50
> Thanks for reporting, please share your system info Thanks for looking into this! System: Debian 11 Python 3.10 1xA100-80GB Nvidia driver 550.90.07, CUDA 12.4 (running this on a GCP CE instance based on the c0-deeplearning-common-cu123-v20240922-debian-11-py310 image) Env: torch==2.4.0 transformers==4.44.0 trl==0.11.3 flash-attn==2.6.3 accelerate==1.0.1
2,268
qgallouedec
2024-10-24T18:10:55
Thanks @cameronphchen!
2,266
HuggingFaceDocBuilderDev
2024-10-24T18:15:16
The docs for this PR live [here](https://huggingface.co/docs/trl/pr_2266). All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update.
2,266
qgallouedec
2024-10-23T08:12:32
Thanks for reporting, it should have been fixed with #2261. CAN you confirm?
2,264
ArcherShirou
2024-10-24T02:28:19
Thank you for your response. After updating the code and testing it, everything is running smoothly now. For the 14B and 72B models, quantization is necessary when using the 0.5B reward model. However, if I switch to the 70B or 72B reward model, I still encounter out-of-memory (OOM) issues midway, even with quantization and LoRA applied. Do you have any good solutions for this?
2,264
qgallouedec
2024-10-24T18:34:55
You can try reducing the generation length. Closing the issue as the initial question is answered
2,264
HuggingFaceDocBuilderDev
2024-10-24T13:49:27
The docs for this PR live [here](https://huggingface.co/docs/trl/pr_2263). All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update.
2,263
HuggingFaceDocBuilderDev
2024-10-21T16:47:46
The docs for this PR live [here](https://huggingface.co/docs/trl/pr_2261). All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update.
2,261
qgallouedec
2024-10-21T15:04:46
Thanks @cameronphchen!
2,259
HuggingFaceDocBuilderDev
2024-10-21T15:08:51
The docs for this PR live [here](https://huggingface.co/docs/trl/pr_2259). All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update.
2,259
qgallouedec
2024-10-24T13:01:30
Thanks for the PR! However, I was actually considering simply removing this bot. In my opinion, it's fine to leave issues open for extended periods. I generally review all the issues and follow up when more information is needed and there hasn't been any activity for a while. From my experience, this bot tends to close issues that should remain open more often than it helps track active ones. See #1949 #1956. What's more, the bot doesn't seem to have been working for a while, and nobody here seems to miss it. What do you think @lewtun @kashif?
2,258
Ananya54321
2024-10-25T02:02:26
Ohh that makes sense! Thank you for responding!
2,258
lewtun
2024-10-28T20:07:28
Yes I agree, let's disable the bot since it's more of a nuisance than a help
2,258
SinclairCoder
2024-10-21T18:07:30
I solved it with torchrun launch.
2,257
Qinghao-Hu
2024-10-22T01:37:47
same problem
2,257
SinclairCoder
2024-10-22T11:50:10
@Qinghao-Hu launch it with torchrun if also a multigpu training case.
2,257
innat
2024-10-24T07:31:44
what does it mean? , [src](https://huggingface.co/docs/accelerate/usage_guides/big_modeling). > Multiple GPUs, or “model parallelism”, can be utilized but only one GPU will be active at any given moment. This forces the GPU to wait for the previous GPU to send it the output. You should launch your script normally with Python instead of other tools like torchrun and accelerate launch. > You may also be interested in pipeline parallelism which utilizes all available GPUs at once, instead of only having one GPU active at a time. This approach is less flexbile though. For more details, refer to the [Memory-efficient pipeline parallelism](https://huggingface.co/docs/accelerate/usage_guides/distributed_inference#memory-efficient-pipeline-parallelism-experimental) guide.
2,256
gaetanlop
2024-10-22T00:27:31
Hey @mertege, adding the possibility to store teacher logits in the `GKDTrainer` is only useful when setting the parameter `lmbda` to 0 (which corresponds to standard KD). The all point of GKD is to enable on-policy KD (KD on sequences generated by the student) which means that we cannot store teacher logits offline during a pre-processing step.
2,255
mertege
2024-10-22T07:03:50
Thanks for reply @gaetanlop.
2,255
qgallouedec
2024-10-21T16:50:10
> all latest can you run `trl env` please?
2,254
qgallouedec
2024-10-21T16:50:37
Also please provide the full traceback
2,254
saxenarohit
2024-10-21T17:42:36
Thanks ``` - Platform: Linux-5.4.0-187-generic-x86_64-with-glibc2.35 - Python version: 3.10.12 - PyTorch version: 2.2.0a0+81ea7a4 - CUDA device(s): NVIDIA A100-SXM4-80GB, NVIDIA A100-SXM4-80GB - Transformers version: 4.45.2 - Accelerate version: 1.0.1 - Accelerate config: not found - Datasets version: 3.0.1 - HF Hub version: 0.26.0 - TRL version: 0.12.0.dev0 - bitsandbytes version: 0.43.1 - DeepSpeed version: not installed - Diffusers version: not installed - Liger-Kernel version: not installed - LLM-Blender version: not installed - OpenAI version: not installed - PEFT version: 0.13. ``` There is no traceback. It's a request to check for a possible bug. During evaluation in the collate_fn `labels = batch["input_ids"].clone()` this will possibly have the gold answer in the input_ids during the evaluation?
2,254
edbeeching
2024-10-23T08:45:08
Hi @saxenarohit. This is normal, we are just looking at the eval loss. I think you might be thinking of a generative eval, where given a prompt, `model.generate` is used to autoregressively compute an answer, which can then be compared to the ground truth "gold answer". I will close the issue, but feel free to reopen if needed.
2,254
qgallouedec
2024-10-19T17:13:40
This is because you need to provide a split dataset (containing both a training split and an evaluation split) when you use TRL scripts . I realize the following limitations: - when you're not evaluating, you still need to have a split dataset - you may want the script to split the dataset when necessary. This could be solved by adding something like : ```python if training_args.eval_strategy != "none" and script_args.dataset_test_split not in dataset : dataset = dataset[script_args.dataset_train_split].split(test_size=0.05) ... trainer = AnyTrainer( ... train_dataset=dataset[script_args.dataset_train_split], eval_dataset=dataset[script_args.dataset_test_split] if training_args.eval_strategy != "none" else None, ... ) ``` WDYT @kashif @lewtun ? Is this situation common enough to justify this addition?
2,253
lewtun
2024-10-24T09:34:00
I don't think we should automatically generate a test split for the user (it's a bit too much magic), but I would be in favour of having the logic to set `eval_dataset` to `None` if no eval strategy is provided
2,253
qgallouedec
2024-10-24T09:36:01
> I don't think we should automatically generate a test split for the user (it's a bit too much magic), but I would be in favour of having the logic to set `eval_dataset` to `None` if no eval strategy is provided Sounds reasonable.
2,253
HuggingFaceDocBuilderDev
2024-10-18T22:38:28
The docs for this PR live [here](https://huggingface.co/docs/trl/pr_2252). All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update.
2,252
qgallouedec
2024-10-20T13:52:17
Thanks for the PR! Can you just run `make precommit`
2,252
ngxson
2024-10-20T22:25:27
@qgallouedec Thanks! Should be good now
2,252
qgallouedec
2024-10-21T07:35:04
It seems like this case occurs twice in our tests: ``` FAILED tests/test_dataset_formatting.py::SetupChatFormatTestCase::test_example_with_setup_model - ValueError: Chat template is already added to the tokenizer. If you want to overwrite it, please set it to None FAILED tests/test_dataset_formatting.py::SetupChatFormatTestCase::test_setup_chat_format - ValueError: Chat template is already added to the tokenizer. If you want to overwrite it, please set it to None ``` Can you update the example so that they use this function correctly?
2,252
qgallouedec
2024-10-22T10:39:33
Lgtm, thanks @ngxson
2,252
ngxson
2024-10-22T10:47:07
Thanks! I don't have merge permission, so please merge when you want 🤗
2,252
kashif
2024-10-21T11:04:55
@gaetanlop can we use the `pad` helpers? ```py # Use pad helper to handle padding padded_query_responses = pad(query_responses, padding_value=pad_token_id, padding_side="right") padded_logitss = pad(logitss, padding_value=0, padding_side="right") ```
2,251
gaetanlop
2024-10-21T15:05:37
@kashif, ~~the `pad` function expects the tensor to have no leading dimension corresponding to the batch size.~~ Here is an example `query_responses`: ```python query_responses = [ torch.randint(vocab_size, (bs, seq_length1)), torch.randint(vocab_size, (bs, seq_length2)), torch.randint(vocab_size, (remaining_samples, seq_length3)) ] ``` ~~Using the `pad` function as it is would require the following change before passing the `query_responses` to the `pad` function:~~ ```python query_responses=[query_reps[i] for query_reps in query_responses for i in range(query_reps.size(0))] ``` ~~We can also change the pad function? What do you prefer?~~ After looking more closely to the pad function, you are rigth, we can use the pad function as it is, it just requires reshaping the tensor afterwards. I am gonna make the update, thanks for pointing it
2,251
HuggingFaceDocBuilderDev
2024-10-21T16:26:53
The docs for this PR live [here](https://huggingface.co/docs/trl/pr_2251). All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update.
2,251
gaetanlop
2024-10-21T16:34:19
This won't work @kashif, it still requires reshaping the tensors
2,251
kashif
2024-10-21T16:35:13
ah damn! my bad sorry!
2,251
gaetanlop
2024-10-21T16:49:21
No problem, this should be fixed now
2,251
JiahuiSun
2024-10-27T01:37:26
I also met the same issue. I use the official example script, dpo_online.py, to train a 75b LLM with a 75b reward model. Even with 60x8 H100 GPUs, the problem still happens. Any help please?
2,250
lewtun
2024-10-29T05:53:16
Hello @hlnchen would you mind sharing a reproducible example that uses the `unwrap_model_for_generation()` method in a simple training loop that simulates your application?
2,250
Mefisto04
2024-10-21T19:31:15
hey @qgallouedec , i have made a pr for this issue #2237 , please review all the changes that i have made.
2,249
HuggingFaceDocBuilderDev
2024-10-24T13:08:26
The docs for this PR live [here](https://huggingface.co/docs/trl/pr_2249). All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update.
2,249
qgallouedec
2024-10-24T13:22:57
Thanks for helping improving this @Mefisto04. Can you make sure to run `make precommit`? A few suggestions, but it all looks good to me.
2,249
Mefisto04
2024-10-24T18:37:47
hey @qgallouedec i have commits all the changes that you have provided, please review this
2,249
HuggingFaceDocBuilderDev
2024-10-18T14:23:02
The docs for this PR live [here](https://huggingface.co/docs/trl/pr_2248). All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update.
2,248
qgallouedec
2024-10-18T10:18:01
Thanks for reporting, it's about to be fixed: #2246
2,247
ArcherShirou
2024-10-18T10:54:51
thanks, its work
2,247
HuggingFaceDocBuilderDev
2024-10-18T09:31:22
The docs for this PR live [here](https://huggingface.co/docs/trl/pr_2246). All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update.
2,246
kashif
2024-10-24T08:31:33
release is out
2,245
HuggingFaceDocBuilderDev
2024-10-24T08:35:33
The docs for this PR live [here](https://huggingface.co/docs/trl/pr_2245). All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update.
2,245
HuggingFaceDocBuilderDev
2024-10-17T11:44:37
The docs for this PR live [here](https://huggingface.co/docs/trl/pr_2244). All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update.
2,244
HuggingFaceDocBuilderDev
2024-10-16T15:58:00
The docs for this PR live [here](https://huggingface.co/docs/trl/pr_2243). All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update.
2,243
qgallouedec
2024-10-17T07:13:24
@kashif can you also add an example in the online dpo documentation? And a test?
2,243
kashif
2024-10-17T07:19:39
working on test thanks!
2,243
qgallouedec
2024-10-21T15:17:08
I'm just updating the doc and running some tests
2,243
qgallouedec
2024-10-22T11:23:13
``` # 8 GPUs accelerate launch examples/scripts/dpo_online.py \ --model_name_or_path trl-lib/pythia-1b-deduped-tldr-sft \ --judge pairrm \ --dataset_name trl-lib/tldr \ --learning_rate 5.0e-7 \ --logging_steps 25 \ --output_dir pythia-1b-tldr-online-dpo-reward \ --warmup_ratio 0.1 ``` https://wandb.ai/huggingface/huggingface/runs/usqmcs3e
2,243
qgallouedec
2024-10-23T15:44:00
https://wandb.ai/huggingface/huggingface/runs/mq66mdbt ``` accelerate launch examples/scripts/dpo_online.py \ --model_name_or_path Qwen/Qwen2.5-0.5B-Instruct \ --judge pair_rm \ --dataset_name trl-lib/ultrafeedback-prompt \ --learning_rate 5.0e-7 \ --logging_steps 25 \ --output_dir Qwen2.5-0.5B-Online-DPO-PairRM \ --warmup_ratio 0.1 ```
2,243
qgallouedec
2024-10-18T13:49:17
You can use it, feel free to report if it causes any issues.
2,242
zwhe99
2024-10-20T05:00:09
Thanks for the response!
2,242
coding-famer
2024-10-17T23:41:52
I'm interested in working on this!
2,241
qgallouedec
2024-10-18T13:49:57
Nice! Thanks @coding-famer. Feel free to open a PR then and request any help if needed
2,241
August-murr
2024-10-25T10:28:42
@lewtun After reading the paper, I noticed that the DPO checkpoints were combined with a different model rather than the reference model used in DPO training. So, I added an option in my PR to set an external model for merging instead of the reference model.
2,241
coding-famer
2024-10-25T18:01:36
Hi @August-murr , happy to see that you have already worked it out! However I noticed that your implementation only allows merge models in the disk after training, this could be done by user using mergekit directly after training. I think the thing here is to merge the model during the training steps/epochs?
2,241
August-murr
2024-10-25T18:41:13
@coding-famer The callback has an optional parameter called `merge_at_every_checkpoint`, which merges the saved checkpoint at either every step or at the end of each epoch during training.
2,241
coding-famer
2024-10-25T19:21:02
> @coding-famer The callback has an optional parameter called `merge_at_every_checkpoint`, which merges the saved checkpoint at either every step or at the end of each epoch during training. Sounds great!
2,241
HuggingFaceDocBuilderDev
2024-10-17T08:30:51
The docs for this PR live [here](https://huggingface.co/docs/trl/pr_2239). All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update.
2,239
qgallouedec
2024-10-17T09:03:46
Thanks @August-murr!
2,239

Stars

import requests
from datetime import datetime
from datasets import Dataset
import pyarrow as pa
import os

def get_stargazers(owner, repo, token):
    # Initialize the count and the page number
    page = 1
    stargazers = []
    while True:
        # Construct the URL for the stargazers with pagination
        stargazers_url = f"https://api.github.com/repos/{owner}/{repo}/stargazers?page={page}&per_page=100"

        # Send the request to GitHub API with appropriate headers
        headers = {"Accept": "application/vnd.github.v3.star+json", "Authorization": "token " + token}
        response = requests.get(stargazers_url, headers=headers)

        if response.status_code != 200:
            raise Exception(f"Failed to fetch stargazers with status code {response.status_code}: {response.text}")

        stargazers_page = response.json()

        if not stargazers_page:  # Exit the loop if there are no more stargazers to process
            break

        stargazers.extend(stargazers_page)
        page += 1  # Move to the next page

    return stargazers

token = os.environ.get("GITHUB_PAT")
stargazers = get_stargazers("huggingface", "trl", token)
stargazers = {key: [stargazer[key] for stargazer in stargazers] for key in stargazers[0].keys()}
dataset = Dataset.from_dict(stargazers)

def clean(example):
    starred_at = datetime.strptime(example["starred_at"], "%Y-%m-%dT%H:%M:%SZ")
    starred_at = pa.scalar(starred_at, type=pa.timestamp("s", tz="UTC"))
    return {"starred_at": starred_at, "user": example["user"]["login"]}

dataset = dataset.map(clean, remove_columns=dataset.column_names)
dataset.push_to_hub("qgallouedec/trl-metrics", config_name="stargazers")

Pypi downloads

from datasets import Dataset
from google.cloud import bigquery
import os

os.environ["GOOGLE_APPLICATION_CREDENTIALS"] = "propane-tree-432413-4c3e2b5e6b3c.json"

# Initialize a BigQuery client
client = bigquery.Client()

# Define your query
query = """
#standardSQL
WITH daily_downloads AS (
  SELECT
    DATE(timestamp) AS day,
    COUNT(*) AS num_downloads
  FROM
    `bigquery-public-data.pypi.file_downloads`
  WHERE
    file.project = 'trl'
    -- Filter for the last 12 months
    AND DATE(timestamp) BETWEEN DATE_SUB(CURRENT_DATE(), INTERVAL 54 MONTH) AND CURRENT_DATE()
  GROUP BY
    day
)
SELECT
  day,
  num_downloads
FROM
  daily_downloads
ORDER BY
  day DESC
"""

# Execute the query
query_job = client.query(query)

# Fetch the results
results = query_job.result()

# Convert the results to a pandas DataFrame and then to a Dataset
df = results.to_dataframe()
dataset = Dataset.from_pandas(df)

dataset.push_to_hub("qgallouedec/trl-metrics", config_name="pypi_downloads")

Models tagged

from huggingface_hub import HfApi
from datasets import Dataset

api = HfApi()
models = api.list_models(tags="trl")
dataset_list = [{"id": model.id, "created_at": model.created_at, "likes": model.likes, "downloads": model.downloads, "tags": model.tags} for model in models]
dataset_dict = {key: [d[key] for d in dataset_list] for key in dataset_list[0].keys()}
dataset = Dataset.from_dict(dataset_dict)
dataset.push_to_hub("qgallouedec/trl-metrics", config_name="models")

Issues and comments

import requests
from datetime import datetime
import os
from datasets import Dataset
from tqdm import tqdm

token = os.environ.get("GITHUB_PAT")

def get_full_response(url, headers, params=None):
    page = 1
    output = []
    params = params or {}
    while True:
        params = {**params, "page": page, "per_page": 100}
        response = requests.get(url, headers=headers, params=params)

        if response.status_code != 200:
            raise Exception(f"Failed to fetch issues: {response.text}")

        batch = response.json()
        if len(batch) == 0:
            break
        output.extend(batch)
        page += 1
    return output

# GitHub API URL for issues (closed and open)
issues_url = f"https://api.github.com/repos/huggingface/trl/issues"

# Set up headers for authentication
headers = {"Authorization": f"token {token}", "Accept": "application/vnd.github.v3+json"}

# Make the request
issues = get_full_response(issues_url, headers, params={"state": "all"})

issues_dataset_dict = {
    "number": [],
    "title": [],
    "user": [],
    "state": [],
    "created_at": [],
    "closed_at": [],
    "comments_count": [],
}
comments_dataset_dict = {
    "user": [],
    "created_at": [],
    "body": [],
    "issue_number": [],
}
for issue in tqdm(issues):
    # Extract relevant information
    issue_number = issue["number"]
    title = issue["title"]
    created_at = datetime.strptime(issue["created_at"], "%Y-%m-%dT%H:%M:%SZ")
    comments_count = issue["comments"]
    comments_url = issue["comments_url"]

    comments = get_full_response(comments_url, headers=headers)
    for comment in comments:
        comments_dataset_dict["user"].append(comment["user"]["login"])
        comments_dataset_dict["created_at"].append(datetime.strptime(comment["created_at"], "%Y-%m-%dT%H:%M:%SZ"))
        comments_dataset_dict["body"].append(comment["body"])
        comments_dataset_dict["issue_number"].append(issue_number)

    issues_dataset_dict["number"].append(issue_number)
    issues_dataset_dict["title"].append(title)
    issues_dataset_dict["user"].append(issue["user"]["login"])
    issues_dataset_dict["state"].append(issue["state"])
    issues_dataset_dict["created_at"].append(datetime.strptime(issue["created_at"], "%Y-%m-%dT%H:%M:%SZ"))
    issues_dataset_dict["closed_at"].append(datetime.strptime(issue["closed_at"], "%Y-%m-%dT%H:%M:%SZ") if issue["closed_at"] else None)
    issues_dataset_dict["comments_count"].append(comments_count)

issues_dataset = Dataset.from_dict(issues_dataset_dict)
comments_dataset = Dataset.from_dict(comments_dataset_dict)

issues_dataset.push_to_hub("qgallouedec/trl-metrics", config_name="issues")
comments_dataset.push_to_hub("qgallouedec/trl-metrics", config_name="issue_comments")
Downloads last month
201
Edit dataset card