Buckets:
| import{s as In,a as Dn,n as Ln,o as $n}from"../chunks/scheduler.7b731bd4.js";import{S as jn,i as Zn,e as r,s as a,c as d,h as Bn,a as i,d as n,b as l,f as k,g as m,j as s,k as b,l as c,m as o,n as p,t as h,o as u,p as g}from"../chunks/index.cc268345.js";import{C as Xn,H as v,E as Wn}from"../chunks/MermaidChart.svelte_svelte_type_style_lang.f0d99f98.js";import{D as Ze}from"../chunks/Docstring.03f7b462.js";import{C as Le}from"../chunks/CodeBlock.169a125f.js";function Rn(Qt){let x,Be,$e,Xe,J,We,O,Re,N,St='<a href="https://huggingface.co/models?other=online-dpo,trl" rel="nofollow"><img src="https://img.shields.io/badge/All_models-Online_DPO-blue" alt="model badge"/></a>',Ge,P,Fe,I,Yt='Online DPO was proposed in <a href="https://huggingface.co/papers/2402.04792" rel="nofollow">Direct Language Model Alignment from Online AI Feedback</a> by Shangmin Guo, Biao Zhang, Tianlin Liu, Tianqi Liu, Misha Khalman, Felipe Llinares, Alexandre Rame, Thomas Mesnard, Yao Zhao, Bilal Piot, Johan Ferret, and Mathieu Blondel.',Ae,D,qt="The abstract from the paper is the following:",He,L,Kt="<p>Direct alignment from preferences (DAP) methods, such as DPO, have recently emerged as efficient alternatives to reinforcement learning from human feedback (RLHF), that do not require a separate reward model. However, the preference datasets used in DAP methods are usually collected ahead of training and never updated, thus the feedback is purely offline. Moreover, responses in these datasets are often sampled from a language model distinct from the one being aligned, and since the model evolves over training, the alignment phase is inevitably off-policy. In this study, we posit that online feedback is key and improves DAP methods. Our method, online AI feedback (OAIF), uses an LLM as annotator: on each training iteration, we sample two responses from the current model and prompt the LLM annotator to choose which one is preferred, thus providing online feedback. Despite its simplicity, we demonstrate via human evaluation in several tasks that OAIF outperforms both offline DAP and RLHF methods. We further show that the feedback leveraged in OAIF is easily controllable, via instruction prompts to the LLM annotator.</p>",Ve,$,en='This post-training method was contributed by <a href="https://huggingface.co/mnoukhov" rel="nofollow">Michael Noukhovitch</a>, <a href="https://huggingface.co/vwxyzjn" rel="nofollow">Shengyi Costa Huang</a>, <a href="https://huggingface.co/qgallouedec" rel="nofollow">Quentin Gallouédec</a>, and <a href="https://huggingface.co/edbeeching" rel="nofollow">Edward Beeching</a>.',Ee,j,ze,Z,tn='This example demonstrates how to train a model using the online DPO method. We use the <a href="https://huggingface.co/Qwen/Qwen2-0.5B-Instruct" rel="nofollow">Qwen 0.5B model</a> as the base model and the <a href="https://huggingface.co/trl-lib/Qwen2-0.5B-Reward" rel="nofollow">trl-lib/Qwen2-0.5B-Reward</a> reward model. We use the prompts from the <a href="https://huggingface.co/datasets/openbmb/UltraFeedback" rel="nofollow">UltraFeedback dataset</a>. You can view the prompts in the dataset here:',Qe,w,nn,Se,B,on="Below is the script to train the model:",Ye,X,qe,W,an="Execute the script using the following command:",Ke,R,et,G,ln="Distributed across 8 GPUs, the training takes approximately 1 hour. You can verify the training progress by checking the reward graph. An increasing trend in both the reward for rejected and chosen completions indicates that the model is improving and generating better responses over time.",tt,F,rn='<img src="https://huggingface.co/datasets/trl-lib/documentation-images/resolve/main/online-dpo-qwen2.png"/>',nt,A,sn='To see how the <a href="https://huggingface.co/trl-lib/Qwen2-0.5B-OnlineDPO" rel="nofollow">trained model</a> performs, you can use the <a href="https://huggingface.co/docs/transformers/quicktour#chat-with-text-generation-models" rel="nofollow">Transformers Chat CLI</a>.',ot,H,dn=`<code>$ transformers chat trl-lib/Qwen2-0.5B-OnlineDPO | |
| <strong><span style="color: red;"><quentin_gallouedec>:</span></strong> | |
| What is the best programming language? | |
| <strong><span style="color: blue;"><trl-lib/Qwen2-0.5B-OnlineDPO>:</span></strong> | |
| The best programming language depends on your specific needs and priorities. Some people prefer imperative programming languages (like Haskell or Lisp), while others prefer functional programming languages (like Scala or Python). It's important to consider your work style, programming environment, and project requirements when choosing a programming language. | |
| </code>`,at,V,lt,E,mn='Online DPO only requires a <a href="dataset_formats#prompt-only">prompt-only dataset</a> (unlike offline DPO, that expects <a href="dataset_formats#preference">preference dataset</a>). The <a href="/docs/trl/pr_5607/en/online_dpo_trainer#trl.experimental.online_dpo.OnlineDPOTrainer">experimental.online_dpo.OnlineDPOTrainer</a> supports both <a href="dataset_formats#conversational">conversational</a> and <a href="dataset_formats#standard">standard</a> dataset formats. When provided with a conversational dataset, the trainer will automatically apply the chat template to the dataset.',rt,z,it,Q,st,S,cn='When using a reward model, we may want the model to generate completions within a given length. During training, the model will generate completions up to the maximum length specified in the <code>max_new_tokens</code> argument of <a href="/docs/trl/pr_5607/en/online_dpo_trainer#trl.experimental.online_dpo.OnlineDPOConfig">experimental.online_dpo.OnlineDPOConfig</a>. If you want to penalize the model for not generating an EOS token before reaching the maximum length, you can use the <code>missing_eos_penalty</code> argument of <a href="/docs/trl/pr_5607/en/online_dpo_trainer#trl.experimental.online_dpo.OnlineDPOConfig">experimental.online_dpo.OnlineDPOConfig</a>:',dt,Y,mt,q,ct,K,pn='To better understand your model’s behavior during training, you can log sample completions periodically using the <a href="/docs/trl/pr_5607/en/callbacks#trl.LogCompletionsCallback">LogCompletionsCallback</a>.',pt,ee,ht,te,hn="This callback logs the model’s generated completions directly to Weights & Biases.",ut,ne,un='<img src="https://huggingface.co/datasets/trl-lib/documentation-images/resolve/main/wandb_completions.png" alt="Logged Completions"/>',gt,oe,ft,ae,gn='We provide an example script to train a model using the online DPO method. The script is available in <a href="https://github.com/huggingface/trl/blob/main/examples/scripts/dpo_online.py" rel="nofollow"><code>examples/scripts/dpo_online.py</code></a>',_t,le,fn='To test the online DPO script with the <a href="https://huggingface.co/trl-lib/Qwen/Qwen2.5-0.5B-Instruct" rel="nofollow">Qwen2.5 0.5B model</a> on the <a href="https://huggingface.co/datasets/openbmb/UltraFeedback" rel="nofollow">UltraFeedback dataset</a>, run the following command:',bt,re,vt,ie,wt,se,_n='While training and evaluating, we record the following reward metrics. Here is an example <a href="https://wandb.ai/huggingface/trl/runs/w4apmsi9" rel="nofollow">tracked run at Weights and Biases</a>',yt,de,bn='<li><code>objective/kl</code>: The mean Kullback-Leibler (KL) divergence between the current model and reference model.</li> <li><code>objective/entropy</code>: The mean entropy of the model, indicating the randomness of the actions chosen by the model.</li> <li><code>objective/non_score_reward</code>: The mean reward from non-score-related sources, basically <code>beta * kl.sum(1)</code>, where <code>beta</code> is the KL penalty coefficient and <code>kl</code> is the per-token KL divergence.</li> <li><code>objective/rlhf_reward</code>: The mean RLHF reward, which is <code>scores - non_score_reward</code>. The <code>rlhf_reward</code> is the ultimate objective of online DPO training. If training works as intended, this metric should keep going up.</li> <li><code>objective/scores</code>: The mean scores returned by the reward model.</li> <li><code>objective/scores_margin</code>: The mean score margin (according to the external reward model) between the chosen and rejected completions.</li> <li><code>rewards/chosen</code>: The mean reward (according to online DPO’s implicit reward model)of the chosen completions.</li> <li><code>rewards/rejected</code>: The mean reward (according to online DPO’s implicit reward model) of the rejected completions.</li> <li><code>rewards/accuracies</code>: The accuracies of the online DPO’s implicit reward model.</li> <li><code>rewards/margins</code>: The mean reward margin (according to online DPO’s implicit reward model) between the chosen and rejected completions.</li> <li><code>logps/chosen</code>: The mean log probabilities of the chosen completions.</li> <li><code>logps/rejected</code>: The mean log probabilities of the rejected completions.</li> <li><code>val/contain_eos_token</code>: The fraction of completions which contain an EOS token.</li> <li><code>beta</code>: The parameter that controls the weight of the loss term representing the deviation from the reference model. Typically fixed, but can be made dynamic by passing a list to <a href="/docs/trl/pr_5607/en/online_dpo_trainer#trl.experimental.online_dpo.OnlineDPOConfig">experimental.online_dpo.OnlineDPOConfig</a>.</li>',Mt,me,Tt,ce,vn='To validate the online DPO implementation works, we ran experiments with the Pythia 1B, 2.8B, and 6.9B models on a single node of 8 x H100s. Here are the commands we used to run the experiments. We take the SFT / RM models directly from <a href="https://huggingface.co/papers/2403.17031" rel="nofollow">The N+ Implementation Details of RLHF with PPO: A Case Study on TL;DR Summarization</a>.',xt,pe,Ct,he,wn="Checkpoints and experiment tracking are available at:",Ut,ue,yn='<li><a href="https://huggingface.co/collections/trl-lib/online-dpo-66acd3fa38a331a9cd457b07" rel="nofollow">🤗 Model checkpoints</a></li> <li><a href="https://wandb.ai/huggingface/trl/reports/Online-DPO-experiments-for-TL-DR-summarisation--Vmlldzo5MTczMDU0" rel="nofollow">🐝 Tracked experiment</a></li>',kt,ge,Mn="The online DPO checkpoint gets increasingly more win rate as we scale up the model sizes. This is a good sign that the online DPO implementation is working as intended.",Jt,fe,Ot,f,_e,Zt,Ce,Tn="Initialize OnlineDPOTrainer.",Bt,C,be,Xt,Ue,xn="Main training entry point.",Wt,y,ve,Rt,ke,Cn="Will save the model, so you can reload it using <code>from_pretrained()</code>.",Gt,Je,Un="Will only save from the main process.",Ft,U,we,At,Oe,kn="Upload <code>self.model</code> and <code>self.processing_class</code> to the 🤗 model hub on the repo <code>self.args.hub_model_id</code>.",Nt,ye,Pt,_,Me,Ht,Ne,Jn='Configuration class for the <a href="/docs/trl/pr_5607/en/online_dpo_trainer#trl.experimental.online_dpo.OnlineDPOTrainer">experimental.online_dpo.OnlineDPOTrainer</a>.',Vt,Pe,On=`This class includes only the parameters that are specific to Online DPO training. For a full list of training | |
| arguments, please refer to the <a href="https://huggingface.co/docs/transformers/main/en/main_classes/trainer#transformers.TrainingArguments" rel="nofollow">TrainingArguments</a> documentation. Note that default values in this | |
| class may differ from those in <a href="https://huggingface.co/docs/transformers/main/en/main_classes/trainer#transformers.TrainingArguments" rel="nofollow">TrainingArguments</a>.`,Et,Ie,Nn=`Using <a href="https://huggingface.co/docs/transformers/main/en/internal/trainer_utils#transformers.HfArgumentParser" rel="nofollow">HfArgumentParser</a> we can turn this class into | |
| <a href="https://docs.python.org/3/library/argparse#module-argparse" rel="nofollow">argparse</a> arguments that can be specified on the | |
| command line.`,zt,Te,Pn='<p>These parameters have default values different from <a href="https://huggingface.co/docs/transformers/main/en/main_classes/trainer#transformers.TrainingArguments" rel="nofollow">TrainingArguments</a>:</p> <ul><li><code>logging_steps</code>: Defaults to <code>10</code> instead of <code>500</code>.</li> <li><code>gradient_checkpointing</code>: Defaults to <code>True</code> instead of <code>False</code>.</li> <li><code>bf16</code>: Defaults to <code>True</code> if <code>fp16</code> is not set, instead of <code>False</code>.</li> <li><code>learning_rate</code>: Defaults to <code>5e-7</code> instead of <code>5e-5</code>.</li> <li><code>remove_unused_columns</code>: Defaults to <code>False</code> instead of <code>True</code>.</li></ul>',It,xe,Dt,je,Lt;return J=new Xn({props:{containerStyle:"float: right; margin-left: 10px; display: inline-flex; position: relative; z-index: 10;"}}),O=new v({props:{title:"Online DPO Trainer",local:"online-dpo-trainer",headingTag:"h1"}}),P=new v({props:{title:"Overview",local:"overview",headingTag:"h2"}}),j=new v({props:{title:"Quick start",local:"quick-start",headingTag:"h2"}}),X=new Le({props:{code:"JTIzJTIwdHJhaW5fb25saW5lX2Rwby5weSUwQWZyb20lMjBkYXRhc2V0cyUyMGltcG9ydCUyMGxvYWRfZGF0YXNldCUwQWZyb20lMjB0cmwuZXhwZXJpbWVudGFsLm9ubGluZV9kcG8lMjBpbXBvcnQlMjBPbmxpbmVEUE9Db25maWclMkMlMjBPbmxpbmVEUE9UcmFpbmVyJTBBZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEF1dG9Nb2RlbEZvckNhdXNhbExNJTJDJTIwQXV0b01vZGVsRm9yU2VxdWVuY2VDbGFzc2lmaWNhdGlvbiUyQyUyMEF1dG9Ub2tlbml6ZXIlMEElMEFtb2RlbCUyMCUzRCUyMEF1dG9Nb2RlbEZvckNhdXNhbExNLmZyb21fcHJldHJhaW5lZCglMjJRd2VuJTJGUXdlbjItMC41Qi1JbnN0cnVjdCUyMiklMEF0b2tlbml6ZXIlMjAlM0QlMjBBdXRvVG9rZW5pemVyLmZyb21fcHJldHJhaW5lZCglMjJRd2VuJTJGUXdlbjItMC41Qi1JbnN0cnVjdCUyMiklMEFyZXdhcmRfbW9kZWwlMjAlM0QlMjBBdXRvTW9kZWxGb3JTZXF1ZW5jZUNsYXNzaWZpY2F0aW9uLmZyb21fcHJldHJhaW5lZCglMjJ0cmwtbGliJTJGUXdlbjItMC41Qi1SZXdhcmQlMjIlMkMlMjBudW1fbGFiZWxzJTNEMSklMEF0cmFpbl9kYXRhc2V0JTIwJTNEJTIwbG9hZF9kYXRhc2V0KCUyMnRybC1saWIlMkZ1bHRyYWZlZWRiYWNrLXByb21wdCUyMiUyQyUyMHNwbGl0JTNEJTIydHJhaW4lMjIpJTBBJTBBdHJhaW5pbmdfYXJncyUyMCUzRCUyME9ubGluZURQT0NvbmZpZyhvdXRwdXRfZGlyJTNEJTIyUXdlbjItMC41Qi1PbmxpbmVEUE8lMjIpJTBBdHJhaW5lciUyMCUzRCUyME9ubGluZURQT1RyYWluZXIoJTBBJTIwJTIwJTIwJTIwbW9kZWwlM0Rtb2RlbCUyQyUyMHJld2FyZF9mdW5jcyUzRHJld2FyZF9tb2RlbCUyQyUyMGFyZ3MlM0R0cmFpbmluZ19hcmdzJTJDJTIwcHJvY2Vzc2luZ19jbGFzcyUzRHRva2VuaXplciUyQyUyMHRyYWluX2RhdGFzZXQlM0R0cmFpbl9kYXRhc2V0JTBBKSUwQXRyYWluZXIudHJhaW4oKQ==",highlighted:`<span class="hljs-comment"># train_online_dpo.py</span> | |
| <span class="hljs-keyword">from</span> datasets <span class="hljs-keyword">import</span> load_dataset | |
| <span class="hljs-keyword">from</span> trl.experimental.online_dpo <span class="hljs-keyword">import</span> OnlineDPOConfig, OnlineDPOTrainer | |
| <span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoModelForCausalLM, AutoModelForSequenceClassification, AutoTokenizer | |
| model = AutoModelForCausalLM.from_pretrained(<span class="hljs-string">"Qwen/Qwen2-0.5B-Instruct"</span>) | |
| tokenizer = AutoTokenizer.from_pretrained(<span class="hljs-string">"Qwen/Qwen2-0.5B-Instruct"</span>) | |
| reward_model = AutoModelForSequenceClassification.from_pretrained(<span class="hljs-string">"trl-lib/Qwen2-0.5B-Reward"</span>, num_labels=<span class="hljs-number">1</span>) | |
| train_dataset = load_dataset(<span class="hljs-string">"trl-lib/ultrafeedback-prompt"</span>, split=<span class="hljs-string">"train"</span>) | |
| training_args = OnlineDPOConfig(output_dir=<span class="hljs-string">"Qwen2-0.5B-OnlineDPO"</span>) | |
| trainer = OnlineDPOTrainer( | |
| model=model, reward_funcs=reward_model, args=training_args, processing_class=tokenizer, train_dataset=train_dataset | |
| ) | |
| trainer.train()`,wrap:!1}}),R=new Le({props:{code:"YWNjZWxlcmF0ZSUyMGxhdW5jaCUyMHRyYWluX29ubGluZV9kcG8ucHk=",highlighted:"accelerate launch train_online_dpo.py",wrap:!1}}),V=new v({props:{title:"Expected dataset type",local:"expected-dataset-type",headingTag:"h2"}}),z=new v({props:{title:"Usage tips",local:"usage-tips",headingTag:"h2"}}),Q=new v({props:{title:"Encourage EOS token generation",local:"encourage-eos-token-generation",headingTag:"h3"}}),Y=new Le({props:{code:"dHJhaW5pbmdfYXJncyUyMCUzRCUyME9ubGluZURQT0NvbmZpZyguLi4lMkMlMjBtYXhfbmV3X3Rva2VucyUzRDEyOCUyQyUyMG1pc3NpbmdfZW9zX3BlbmFsdHklM0QxLjAp",highlighted:'training_args = OnlineDPOConfig(..., max_new_tokens=<span class="hljs-number">128</span>, missing_eos_penalty=<span class="hljs-number">1.0</span>)',wrap:!1}}),q=new v({props:{title:"Logging Completions",local:"logging-completions",headingTag:"h3"}}),ee=new Le({props:{code:"dHJhaW5lciUyMCUzRCUyME9ubGluZURQT1RyYWluZXIoLi4uJTJDJTIwZXZhbF9kYXRhc2V0JTNEZXZhbF9kYXRhc2V0KSUwQWNvbXBsZXRpb25zX2NhbGxiYWNrJTIwJTNEJTIwTG9nQ29tcGxldGlvbnNDYWxsYmFjayh0cmFpbmVyJTJDJTIwbnVtX3Byb21wdHMlM0Q4KSUwQXRyYWluZXIuYWRkX2NhbGxiYWNrKGNvbXBsZXRpb25zX2NhbGxiYWNrKQ==",highlighted:`trainer = OnlineDPOTrainer(..., eval_dataset=eval_dataset) | |
| completions_callback = LogCompletionsCallback(trainer, num_prompts=<span class="hljs-number">8</span>) | |
| trainer.add_callback(completions_callback)`,wrap:!1}}),oe=new v({props:{title:"Example script",local:"example-script",headingTag:"h2"}}),re=new Le({props:{code:"cHl0aG9uJTIwZXhhbXBsZXMlMkZzY3JpcHRzJTJGZHBvX29ubGluZS5weSUyMCU1QyUwQSUyMCUyMCUyMCUyMC0tbW9kZWxfbmFtZV9vcl9wYXRoJTIwUXdlbiUyRlF3ZW4yLjUtMC41Qi1JbnN0cnVjdCUyMCU1QyUwQSUyMCUyMCUyMCUyMC0tcmV3YXJkX21vZGVsX3BhdGglMjB0cmwtbGliJTJGUXdlbjItMC41Qi1SZXdhcmQlMjAlNUMlMEElMjAlMjAlMjAlMjAtLWRhdGFzZXRfbmFtZSUyMHRybC1saWIlMkZ1bHRyYWZlZWRiYWNrLXByb21wdCUyMCU1QyUwQSUyMCUyMCUyMCUyMC0tbGVhcm5pbmdfcmF0ZSUyMDUuMGUtNyUyMCU1QyUwQSUyMCUyMCUyMCUyMC0tb3V0cHV0X2RpciUyMFF3ZW4yLjUtMC41Qi1PbmxpbmUtRFBPJTIwJTVDJTBBJTIwJTIwJTIwJTIwLS13YXJtdXBfc3RlcHMlMjAwLjElMjAlNUMlMEElMjAlMjAlMjAlMjAtLXB1c2hfdG9faHVi",highlighted:`python examples/scripts/dpo_online.py \\ | |
| --model_name_or_path Qwen/Qwen2.5-0.5B-Instruct \\ | |
| --reward_model_path trl-lib/Qwen2-0.5B-Reward \\ | |
| --dataset_name trl-lib/ultrafeedback-prompt \\ | |
| --learning_rate 5.0e-7 \\ | |
| --output_dir Qwen2.5-0.5B-Online-DPO \\ | |
| --warmup_steps 0.1 \\ | |
| --push_to_hub`,wrap:!1}}),ie=new v({props:{title:"Logged metrics",local:"logged-metrics",headingTag:"h2"}}),me=new v({props:{title:"Benchmark experiments",local:"benchmark-experiments",headingTag:"h2"}}),pe=new Le({props:{code:"JTIzJTIwMUIlMjBPbmxpbmUlMjBEUE8lMjBleHBlcmltZW50JTBBYWNjZWxlcmF0ZSUyMGxhdW5jaCUyMC0tY29uZmlnX2ZpbGUlMjBleGFtcGxlcyUyRmFjY2VsZXJhdGVfY29uZmlncyUyRm11bHRpX2dwdS55YW1sJTIwJTVDJTBBJTIwJTIwJTIwJTIwZXhhbXBsZXMlMkZzY3JpcHRzJTJGZHBvX29ubGluZS5weSUyMCU1QyUwQSUyMCUyMCUyMCUyMC0tbW9kZWxfbmFtZV9vcl9wYXRoJTIwdHJsLWxpYiUyRnB5dGhpYS0xYi1kZWR1cGVkLXRsZHItc2Z0JTIwJTIwJTVDJTBBJTIwJTIwJTIwJTIwLS1yZXdhcmRfbW9kZWxfcGF0aCUyMHRybC1saWIlMkZweXRoaWEtMWItZGVkdXBlZC10bGRyLXJtJTIwJTVDJTBBJTIwJTIwJTIwJTIwLS1kYXRhc2V0X25hbWUlMjB0cmwtbGliJTJGdGxkciUyMCU1QyUwQSUyMCUyMCUyMCUyMC0tbGVhcm5pbmdfcmF0ZSUyMDUuMGUtNyUyMCU1QyUwQSUyMCUyMCUyMCUyMC0tb3V0cHV0X2RpciUyMHB5dGhpYS0xYi1kZWR1cGVkLXRsZHItb25saW5lLWRwbyUyMCU1QyUwQSUyMCUyMCUyMCUyMC0tYmV0YSUyMDAuMSUyMCU1QyUwQSUyMCUyMCUyMCUyMC0tcGVyX2RldmljZV90cmFpbl9iYXRjaF9zaXplJTIwOCUyMCU1QyUwQSUyMCUyMCUyMCUyMC0tZ3JhZGllbnRfYWNjdW11bGF0aW9uX3N0ZXBzJTIwMiUyMCU1QyUwQSUyMCUyMCUyMCUyMC0tbnVtX3RyYWluX2Vwb2NocyUyMDMlMjAlNUMlMEElMjAlMjAlMjAlMjAtLW1heF9uZXdfdG9rZW5zJTIwNTMlMjAlNUMlMEElMjAlMjAlMjAlMjAtLXdhcm11cF9zdGVwcyUyMDAuMSUyMCU1QyUwQSUyMCUyMCUyMCUyMC0tbWlzc2luZ19lb3NfcGVuYWx0eSUyMDEuMCUyMCU1QyUwQSUyMCUyMCUyMCUyMC0tc2F2ZV9zdGVwcyUyMDAuMSUyMCU1QyUwQSUyMCUyMCUyMCUyMC0tcHVzaF90b19odWIlMEElMEElMjMlMjAyLjhCJTIwT25saW5lJTIwRFBPJTIwZXhwZXJpbWVudCUwQWFjY2VsZXJhdGUlMjBsYXVuY2glMjAtLWNvbmZpZ19maWxlJTIwZXhhbXBsZXMlMkZhY2NlbGVyYXRlX2NvbmZpZ3MlMkZkZWVwc3BlZWRfemVybzIueWFtbCUyMCU1QyUwQSUyMCUyMCUyMCUyMGV4YW1wbGVzJTJGc2NyaXB0cyUyRmRwb19vbmxpbmUucHklMjAlNUMlMEElMjAlMjAlMjAlMjAtLW1vZGVsX25hbWVfb3JfcGF0aCUyMHRybC1saWIlMkZweXRoaWEtMi44Yi1kZWR1cGVkLXRsZHItc2Z0JTIwJTIwJTVDJTBBJTIwJTIwJTIwJTIwLS1yZXdhcmRfbW9kZWxfcGF0aCUyMHRybC1saWIlMkZweXRoaWEtMi44Yi1kZWR1cGVkLXRsZHItcm0lMjAlNUMlMEElMjAlMjAlMjAlMjAtLWRhdGFzZXRfbmFtZSUyMHRybC1saWIlMkZ0bGRyJTIwJTVDJTBBJTIwJTIwJTIwJTIwLS1sZWFybmluZ19yYXRlJTIwNS4wZS03JTIwJTVDJTBBJTIwJTIwJTIwJTIwLS1vdXRwdXRfZGlyJTIwcHl0aGlhLTIuOGItZGVkdXBlZC10bGRyLW9ubGluZS1kcG8lMjAlNUMlMEElMjAlMjAlMjAlMjAtLWJldGElMjAwLjElMjAlNUMlMEElMjAlMjAlMjAlMjAtLXBlcl9kZXZpY2VfdHJhaW5fYmF0Y2hfc2l6ZSUyMDglMjAlNUMlMEElMjAlMjAlMjAlMjAtLWdyYWRpZW50X2FjY3VtdWxhdGlvbl9zdGVwcyUyMDIlMjAlNUMlMEElMjAlMjAlMjAlMjAtLW51bV90cmFpbl9lcG9jaHMlMjAzJTIwJTVDJTBBJTIwJTIwJTIwJTIwLS1tYXhfbmV3X3Rva2VucyUyMDUzJTIwJTVDJTBBJTIwJTIwJTIwJTIwLS13YXJtdXBfc3RlcHMlMjAwLjElMjAlNUMlMEElMjAlMjAlMjAlMjAtLW1pc3NpbmdfZW9zX3BlbmFsdHklMjAxLjAlMjAlNUMlMEElMjAlMjAlMjAlMjAtLXNhdmVfc3RlcHMlMjAwLjElMjAlNUMlMEElMjAlMjAlMjAlMjAtLXB1c2hfdG9faHViJTBBJTBBJTIzJTIwNi45QiUyME9ubGluZSUyMERQTyUyMGV4cGVyaW1lbnQlMEFhY2NlbGVyYXRlJTIwbGF1bmNoJTIwLS1jb25maWdfZmlsZSUyMGV4YW1wbGVzJTJGYWNjZWxlcmF0ZV9jb25maWdzJTJGZGVlcHNwZWVkX3plcm8yLnlhbWwlMjAlNUMlMEElMjAlMjAlMjAlMjBleGFtcGxlcyUyRnNjcmlwdHMlMkZkcG9fb25saW5lLnB5JTIwJTVDJTBBJTIwJTIwJTIwJTIwLS1tb2RlbF9uYW1lX29yX3BhdGglMjB0cmwtbGliJTJGcHl0aGlhLTYuOWItZGVkdXBlZC10bGRyLXNmdCUyMCUyMCU1QyUwQSUyMCUyMCUyMCUyMC0tcmV3YXJkX21vZGVsX3BhdGglMjB0cmwtbGliJTJGcHl0aGlhLTYuOWItZGVkdXBlZC10bGRyLXJtJTIwJTVDJTBBJTIwJTIwJTIwJTIwLS1kYXRhc2V0X25hbWUlMjB0cmwtbGliJTJGdGxkciUyMCU1QyUwQSUyMCUyMCUyMCUyMC0tbGVhcm5pbmdfcmF0ZSUyMDUuMGUtNyUyMCU1QyUwQSUyMCUyMCUyMCUyMC0tb3V0cHV0X2RpciUyMHB5dGhpYS02LjliLWRlZHVwZWQtdGxkci1vbmxpbmUtZHBvJTIwJTVDJTBBJTIwJTIwJTIwJTIwLS1iZXRhJTIwMC4xJTIwJTVDJTBBJTIwJTIwJTIwJTIwLS1wZXJfZGV2aWNlX3RyYWluX2JhdGNoX3NpemUlMjA0JTIwJTVDJTBBJTIwJTIwJTIwJTIwLS1ncmFkaWVudF9hY2N1bXVsYXRpb25fc3RlcHMlMjA0JTIwJTVDJTBBJTIwJTIwJTIwJTIwLS1udW1fdHJhaW5fZXBvY2hzJTIwMyUyMCU1QyUwQSUyMCUyMCUyMCUyMC0tbWF4X25ld190b2tlbnMlMjA1MyUyMCU1QyUwQSUyMCUyMCUyMCUyMC0td2FybXVwX3N0ZXBzJTIwMC4xJTIwJTVDJTBBJTIwJTIwJTIwJTIwLS1taXNzaW5nX2Vvc19wZW5hbHR5JTIwMS4wJTIwJTVDJTBBJTIwJTIwJTIwJTIwLS1zYXZlX3N0ZXBzJTIwMC4xJTIwJTVDJTBBJTIwJTIwJTIwJTIwLS1wdXNoX3RvX2h1Yg==",highlighted:`<span class="hljs-meta prompt_"># </span><span class="language-bash">1B Online DPO experiment</span> | |
| accelerate launch --config_file examples/accelerate_configs/multi_gpu.yaml \\ | |
| examples/scripts/dpo_online.py \\ | |
| --model_name_or_path trl-lib/pythia-1b-deduped-tldr-sft \\ | |
| --reward_model_path trl-lib/pythia-1b-deduped-tldr-rm \\ | |
| --dataset_name trl-lib/tldr \\ | |
| --learning_rate 5.0e-7 \\ | |
| --output_dir pythia-1b-deduped-tldr-online-dpo \\ | |
| --beta 0.1 \\ | |
| --per_device_train_batch_size 8 \\ | |
| --gradient_accumulation_steps 2 \\ | |
| --num_train_epochs 3 \\ | |
| --max_new_tokens 53 \\ | |
| --warmup_steps 0.1 \\ | |
| --missing_eos_penalty 1.0 \\ | |
| --save_steps 0.1 \\ | |
| --push_to_hub | |
| <span class="hljs-meta prompt_"> | |
| # </span><span class="language-bash">2.8B Online DPO experiment</span> | |
| accelerate launch --config_file examples/accelerate_configs/deepspeed_zero2.yaml \\ | |
| examples/scripts/dpo_online.py \\ | |
| --model_name_or_path trl-lib/pythia-2.8b-deduped-tldr-sft \\ | |
| --reward_model_path trl-lib/pythia-2.8b-deduped-tldr-rm \\ | |
| --dataset_name trl-lib/tldr \\ | |
| --learning_rate 5.0e-7 \\ | |
| --output_dir pythia-2.8b-deduped-tldr-online-dpo \\ | |
| --beta 0.1 \\ | |
| --per_device_train_batch_size 8 \\ | |
| --gradient_accumulation_steps 2 \\ | |
| --num_train_epochs 3 \\ | |
| --max_new_tokens 53 \\ | |
| --warmup_steps 0.1 \\ | |
| --missing_eos_penalty 1.0 \\ | |
| --save_steps 0.1 \\ | |
| --push_to_hub | |
| <span class="hljs-meta prompt_"> | |
| # </span><span class="language-bash">6.9B Online DPO experiment</span> | |
| accelerate launch --config_file examples/accelerate_configs/deepspeed_zero2.yaml \\ | |
| examples/scripts/dpo_online.py \\ | |
| --model_name_or_path trl-lib/pythia-6.9b-deduped-tldr-sft \\ | |
| --reward_model_path trl-lib/pythia-6.9b-deduped-tldr-rm \\ | |
| --dataset_name trl-lib/tldr \\ | |
| --learning_rate 5.0e-7 \\ | |
| --output_dir pythia-6.9b-deduped-tldr-online-dpo \\ | |
| --beta 0.1 \\ | |
| --per_device_train_batch_size 4 \\ | |
| --gradient_accumulation_steps 4 \\ | |
| --num_train_epochs 3 \\ | |
| --max_new_tokens 53 \\ | |
| --warmup_steps 0.1 \\ | |
| --missing_eos_penalty 1.0 \\ | |
| --save_steps 0.1 \\ | |
| --push_to_hub`,wrap:!1}}),fe=new v({props:{title:"OnlineDPOTrainer",local:"trl.experimental.online_dpo.OnlineDPOTrainer",headingTag:"h2"}}),_e=new Ze({props:{name:"class trl.experimental.online_dpo.OnlineDPOTrainer",anchor:"trl.experimental.online_dpo.OnlineDPOTrainer",parameters:[{name:"model",val:": transformers.modeling_utils.PreTrainedModel | torch.nn.modules.module.Module | str"},{name:"ref_model",val:": transformers.modeling_utils.PreTrainedModel | torch.nn.modules.module.Module | None = None"},{name:"reward_funcs",val:": str | transformers.modeling_utils.PreTrainedModel | collections.abc.Callable[..., list[float | None]] | list[str | transformers.modeling_utils.PreTrainedModel | collections.abc.Callable[..., list[float | None]]] | None = None"},{name:"args",val:": trl.experimental.online_dpo.online_dpo_config.OnlineDPOConfig | None = None"},{name:"data_collator",val:": collections.abc.Callable[[list[typing.Any]], dict[str, typing.Any]] | None = None"},{name:"train_dataset",val:": datasets.arrow_dataset.Dataset | torch.utils.data.dataset.IterableDataset | None = None"},{name:"eval_dataset",val:": datasets.arrow_dataset.Dataset | torch.utils.data.dataset.IterableDataset | dict[str, datasets.arrow_dataset.Dataset | torch.utils.data.dataset.IterableDataset] | None = None"},{name:"processing_class",val:": transformers.tokenization_utils_base.PreTrainedTokenizerBase | transformers.processing_utils.ProcessorMixin | None = None"},{name:"reward_processing_classes",val:": transformers.tokenization_utils_base.PreTrainedTokenizerBase | list[transformers.tokenization_utils_base.PreTrainedTokenizerBase] | None = None"},{name:"peft_config",val:": PeftConfig | None = None"},{name:"compute_metrics",val:": collections.abc.Callable[[transformers.trainer_utils.EvalPrediction], dict] | None = None"},{name:"callbacks",val:": list[transformers.trainer_callback.TrainerCallback] | None = None"},{name:"optimizers",val:": tuple = (None, None)"},{name:"preprocess_logits_for_metrics",val:": collections.abc.Callable[[torch.Tensor, torch.Tensor], torch.Tensor] | None = None"}],parametersDescription:[{anchor:"trl.experimental.online_dpo.OnlineDPOTrainer.model",description:`<strong>model</strong> (<code>str | nn.Module | PreTrainedModel</code>) — | |
| Model to be trained. Can be either:</p> | |
| <ul> | |
| <li>A string, being the <em>model id</em> of a pretrained model hosted inside a model repo on huggingface.co, or a | |
| path to a <em>directory</em> containing model weights saved using | |
| <a href="https://huggingface.co/docs/transformers/main/en/main_classes/model#transformers.PreTrainedModel.save_pretrained" rel="nofollow">save_pretrained</a>, e.g., <code>'./my_model_directory/'</code>. The model is loaded | |
| using <a href="https://huggingface.co/docs/transformers/main/en/model_doc/auto#transformers.AutoModelForCausalLM.from_pretrained" rel="nofollow">from_pretrained</a> with the keyword arguments in | |
| <code>args.model_init_kwargs</code>.</li> | |
| <li>A <a href="https://huggingface.co/docs/transformers/main/en/main_classes/model#transformers.PreTrainedModel" rel="nofollow">PreTrainedModel</a> object. Only causal language models are supported.</li> | |
| </ul>`,name:"model"},{anchor:"trl.experimental.online_dpo.OnlineDPOTrainer.ref_model",description:`<strong>ref_model</strong> (<a href="https://huggingface.co/docs/transformers/main/en/main_classes/model#transformers.PreTrainedModel" rel="nofollow">PreTrainedModel</a> or <code>torch.nn.Module</code> or <code>None</code>) — | |
| The reference model to use for training. If None is specified, the reference model will be created from the | |
| model.`,name:"ref_model"},{anchor:"trl.experimental.online_dpo.OnlineDPOTrainer.reward_funcs",description:`<strong>reward_funcs</strong> (<code>RewardFunc | list[RewardFunc]</code>) — | |
| Reward functions to be used for computing the rewards. To compute the rewards, we call all the reward | |
| functions with the prompts and completions and sum the rewards. Can be either:</p> | |
| <ul> | |
| <li>A single reward function: Can be a string (path to model), a <a href="https://huggingface.co/docs/transformers/main/en/main_classes/model#transformers.PreTrainedModel" rel="nofollow">PreTrainedModel</a>, or a | |
| custom callable function.</li> | |
| <li>A list of reward functions: Must all be of compatible types.</li> | |
| </ul>`,name:"reward_funcs"},{anchor:"trl.experimental.online_dpo.OnlineDPOTrainer.args",description:`<strong>args</strong> (<a href="/docs/trl/pr_5607/en/online_dpo_trainer#trl.experimental.online_dpo.OnlineDPOConfig">experimental.online_dpo.OnlineDPOConfig</a>) — | |
| The online DPO config arguments to use for training.`,name:"args"},{anchor:"trl.experimental.online_dpo.OnlineDPOTrainer.data_collator",description:`<strong>data_collator</strong> (<code>DataCollator</code>) — | |
| The data collator to use for training. If None is specified, the default data collator | |
| (<code>experimental.utils.DPODataCollatorWithPadding</code>) will be used which will pad the sequences to the | |
| maximum length of the sequences in the batch, given a dataset of paired sequences.`,name:"data_collator"},{anchor:"trl.experimental.online_dpo.OnlineDPOTrainer.train_dataset",description:`<strong>train_dataset</strong> (<a href="https://huggingface.co/docs/datasets/main/en/package_reference/main_classes#datasets.Dataset" rel="nofollow">Dataset</a> or <a href="https://huggingface.co/docs/datasets/main/en/package_reference/main_classes#datasets.IterableDataset" rel="nofollow">IterableDataset</a>) — | |
| The dataset to use for training.`,name:"train_dataset"},{anchor:"trl.experimental.online_dpo.OnlineDPOTrainer.eval_dataset",description:`<strong>eval_dataset</strong> (<a href="https://huggingface.co/docs/datasets/main/en/package_reference/main_classes#datasets.Dataset" rel="nofollow">Dataset</a>, <a href="https://huggingface.co/docs/datasets/main/en/package_reference/main_classes#datasets.IterableDataset" rel="nofollow">IterableDataset</a> or <code>dict[str, Dataset | IterableDataset]</code>) — | |
| The dataset to use for evaluation.`,name:"eval_dataset"},{anchor:"trl.experimental.online_dpo.OnlineDPOTrainer.processing_class",description:`<strong>processing_class</strong> (<a href="https://huggingface.co/docs/transformers/main/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase" rel="nofollow">PreTrainedTokenizerBase</a> or <a href="https://huggingface.co/docs/transformers/main/en/main_classes/processors#transformers.ProcessorMixin" rel="nofollow">ProcessorMixin</a>, <em>optional</em>) — | |
| Processing class used to process the data. If provided, will be used to automatically process the inputs | |
| for the model, and it will be saved along the model to make it easier to rerun an interrupted training or | |
| reuse the fine-tuned model.`,name:"processing_class"},{anchor:"trl.experimental.online_dpo.OnlineDPOTrainer.reward_processing_classes",description:`<strong>reward_processing_classes</strong> (<a href="https://huggingface.co/docs/transformers/main/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase" rel="nofollow">PreTrainedTokenizerBase</a> or <code>list[PreTrainedTokenizerBase]</code>, <em>optional</em>) — | |
| Processing classes corresponding to the reward functions specified in <code>reward_funcs</code>. Can be either:</p> | |
| <ul> | |
| <li>A single processing class: Used when <code>reward_funcs</code> contains only one reward function.</li> | |
| <li>A list of processing classes: Must match the order and length of the reward functions in <code>reward_funcs</code>.</li> | |
| </ul> | |
| <p>If set to <code>None</code>, the tokenizer for each model-based reward function is automatically loaded using | |
| <a href="https://huggingface.co/docs/transformers/main/en/model_doc/auto#transformers.AutoTokenizer.from_pretrained" rel="nofollow">from_pretrained</a>.`,name:"reward_processing_classes"},{anchor:"trl.experimental.online_dpo.OnlineDPOTrainer.peft_config",description:`<strong>peft_config</strong> (<a href="https://huggingface.co/docs/peft/main/en/package_reference/config#peft.PeftConfig" rel="nofollow">PeftConfig</a>, <em>optional</em>) — | |
| PEFT configuration used to wrap the model. If <code>None</code>, the model is not wrapped.`,name:"peft_config"},{anchor:"trl.experimental.online_dpo.OnlineDPOTrainer.compute_metrics",description:`<strong>compute_metrics</strong> (<code>Callable[[EvalPrediction], dict]</code>, <em>optional</em>) — | |
| The function to use to compute the metrics. Must take a <code>EvalPrediction</code> and return a dictionary string to | |
| metric values.`,name:"compute_metrics"},{anchor:"trl.experimental.online_dpo.OnlineDPOTrainer.callbacks",description:`<strong>callbacks</strong> (<code>list[transformers.TrainerCallback]</code>) — | |
| The callbacks to use for training.`,name:"callbacks"},{anchor:"trl.experimental.online_dpo.OnlineDPOTrainer.optimizers",description:`<strong>optimizers</strong> (<code>tuple[torch.optim.Optimizer, torch.optim.lr_scheduler.LambdaLR]</code>) — | |
| The optimizer and scheduler to use for training.`,name:"optimizers"},{anchor:"trl.experimental.online_dpo.OnlineDPOTrainer.preprocess_logits_for_metrics",description:`<strong>preprocess_logits_for_metrics</strong> (<code>Callable[[torch.Tensor, torch.Tensor], torch.Tensor]</code>) — | |
| The function to use to preprocess the logits before computing the metrics.`,name:"preprocess_logits_for_metrics"}],source:"https://github.com/huggingface/trl/blob/vr_5607/trl/experimental/online_dpo/online_dpo_trainer.py#L95"}}),be=new Ze({props:{name:"train",anchor:"trl.experimental.online_dpo.OnlineDPOTrainer.train",parameters:[{name:"resume_from_checkpoint",val:": str | bool | None = None"},{name:"trial",val:": optuna.Trial | dict[str, Any] | None = None"},{name:"ignore_keys_for_eval",val:": list[str] | None = None"}],parametersDescription:[{anchor:"trl.experimental.online_dpo.OnlineDPOTrainer.train.resume_from_checkpoint",description:`<strong>resume_from_checkpoint</strong> (<code>str</code> or <code>bool</code>, <em>optional</em>) — | |
| If a <code>str</code>, local path to a saved checkpoint as saved by a previous instance of <code>Trainer</code>. If a | |
| <code>bool</code> and equals <code>True</code>, load the last checkpoint in <em>args.output_dir</em> as saved by a previous instance | |
| of <code>Trainer</code>. If present, training will resume from the model/optimizer/scheduler states loaded here.`,name:"resume_from_checkpoint"},{anchor:"trl.experimental.online_dpo.OnlineDPOTrainer.train.trial",description:`<strong>trial</strong> (<code>optuna.Trial</code> or <code>dict[str, Any]</code>, <em>optional</em>) — | |
| The trial run or the hyperparameter dictionary for hyperparameter search.`,name:"trial"},{anchor:"trl.experimental.online_dpo.OnlineDPOTrainer.train.ignore_keys_for_eval",description:`<strong>ignore_keys_for_eval</strong> (<code>list[str]</code>, <em>optional</em>) — | |
| A list of keys in the output of your model (if it is a dictionary) that should be ignored when | |
| gathering predictions for evaluation during the training.`,name:"ignore_keys_for_eval"}],source:"https://github.com/huggingface/trl/blob/vr_5607/transformers/trainer.py#L1323",returnDescription:`<script context="module">export const metadata = 'undefined';<\/script> | |
| <p>Object containing the global step count, training loss, and metrics.</p> | |
| `,returnType:`<script context="module">export const metadata = 'undefined';<\/script> | |
| <p><code>~trainer_utils.TrainOutput</code></p> | |
| `}}),ve=new Ze({props:{name:"save_model",anchor:"trl.experimental.online_dpo.OnlineDPOTrainer.save_model",parameters:[{name:"output_dir",val:": str | None = None"},{name:"_internal_call",val:": bool = False"}],source:"https://github.com/huggingface/trl/blob/vr_5607/transformers/trainer.py#L3746"}}),we=new Ze({props:{name:"push_to_hub",anchor:"trl.experimental.online_dpo.OnlineDPOTrainer.push_to_hub",parameters:[{name:"commit_message",val:": str | None = 'End of training'"},{name:"blocking",val:": bool = True"},{name:"token",val:": str | None = None"},{name:"revision",val:": str | None = None"},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"trl.experimental.online_dpo.OnlineDPOTrainer.push_to_hub.commit_message",description:`<strong>commit_message</strong> (<code>str</code>, <em>optional</em>, defaults to <code>"End of training"</code>) — | |
| Message to commit while pushing.`,name:"commit_message"},{anchor:"trl.experimental.online_dpo.OnlineDPOTrainer.push_to_hub.blocking",description:`<strong>blocking</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) — | |
| Whether the function should return only when the <code>git push</code> has finished.`,name:"blocking"},{anchor:"trl.experimental.online_dpo.OnlineDPOTrainer.push_to_hub.token",description:`<strong>token</strong> (<code>str</code>, <em>optional</em>, defaults to <code>None</code>) — | |
| Token with write permission to overwrite Trainer’s original args.`,name:"token"},{anchor:"trl.experimental.online_dpo.OnlineDPOTrainer.push_to_hub.revision",description:`<strong>revision</strong> (<code>str</code>, <em>optional</em>) — | |
| The git revision to commit from. Defaults to the head of the “main” branch.`,name:"revision"},{anchor:"trl.experimental.online_dpo.OnlineDPOTrainer.push_to_hub.kwargs",description:`<strong>kwargs</strong> (<code>dict[str, Any]</code>, <em>optional</em>) — | |
| Additional keyword arguments passed along to <code>~Trainer.create_model_card</code>.`,name:"kwargs"}],source:"https://github.com/huggingface/trl/blob/vr_5607/transformers/trainer.py#L3993",returnDescription:`<script context="module">export const metadata = 'undefined';<\/script> | |
| <p>The URL of the repository where the model was pushed if <code>blocking=False</code>, or a <code>Future</code> object tracking the | |
| progress of the commit if <code>blocking=True</code>.</p> | |
| `}}),ye=new v({props:{title:"OnlineDPOConfig",local:"trl.experimental.online_dpo.OnlineDPOConfig",headingTag:"h2"}}),Me=new Ze({props:{name:"class trl.experimental.online_dpo.OnlineDPOConfig",anchor:"trl.experimental.online_dpo.OnlineDPOConfig",parameters:[{name:"output_dir",val:": str | None = None"},{name:"per_device_train_batch_size",val:": int = 8"},{name:"num_train_epochs",val:": float = 3.0"},{name:"max_steps",val:": int = -1"},{name:"learning_rate",val:": float = 5e-07"},{name:"lr_scheduler_type",val:": transformers.trainer_utils.SchedulerType | str = 'linear'"},{name:"lr_scheduler_kwargs",val:": dict | str | None = None"},{name:"warmup_steps",val:": float = 0"},{name:"optim",val:": transformers.training_args.OptimizerNames | str = 'adamw_torch_fused'"},{name:"optim_args",val:": str | None = None"},{name:"weight_decay",val:": float = 0.0"},{name:"adam_beta1",val:": float = 0.9"},{name:"adam_beta2",val:": float = 0.999"},{name:"adam_epsilon",val:": float = 1e-08"},{name:"optim_target_modules",val:": None | str | list[str] = None"},{name:"gradient_accumulation_steps",val:": int = 1"},{name:"average_tokens_across_devices",val:": bool = True"},{name:"max_grad_norm",val:": float = 1.0"},{name:"label_smoothing_factor",val:": float = 0.0"},{name:"bf16",val:": bool | None = None"},{name:"fp16",val:": bool = False"},{name:"bf16_full_eval",val:": bool = False"},{name:"fp16_full_eval",val:": bool = False"},{name:"tf32",val:": bool | None = None"},{name:"gradient_checkpointing",val:": bool = True"},{name:"gradient_checkpointing_kwargs",val:": dict[str, typing.Any] | str | None = None"},{name:"torch_compile",val:": bool = False"},{name:"torch_compile_backend",val:": str | None = None"},{name:"torch_compile_mode",val:": str | None = None"},{name:"use_liger_kernel",val:": bool = False"},{name:"liger_kernel_config",val:": dict[str, bool] | None = None"},{name:"use_cache",val:": bool = False"},{name:"neftune_noise_alpha",val:": float | None = None"},{name:"torch_empty_cache_steps",val:": int | None = None"},{name:"auto_find_batch_size",val:": bool = False"},{name:"logging_strategy",val:": transformers.trainer_utils.IntervalStrategy | str = 'steps'"},{name:"logging_steps",val:": float = 10"},{name:"logging_first_step",val:": bool = False"},{name:"log_on_each_node",val:": bool = True"},{name:"logging_nan_inf_filter",val:": bool = True"},{name:"include_num_input_tokens_seen",val:": str | bool = 'no'"},{name:"log_level",val:": str = 'passive'"},{name:"log_level_replica",val:": str = 'warning'"},{name:"disable_tqdm",val:": bool | None = None"},{name:"report_to",val:": None | str | list[str] = 'none'"},{name:"run_name",val:": str | None = None"},{name:"project",val:": str = 'huggingface'"},{name:"trackio_space_id",val:": str | None = 'trackio'"},{name:"eval_strategy",val:": transformers.trainer_utils.IntervalStrategy | str = 'no'"},{name:"eval_steps",val:": float | None = None"},{name:"eval_delay",val:": float = 0"},{name:"per_device_eval_batch_size",val:": int = 8"},{name:"prediction_loss_only",val:": bool = False"},{name:"eval_on_start",val:": bool = False"},{name:"eval_do_concat_batches",val:": bool = True"},{name:"eval_use_gather_object",val:": bool = False"},{name:"eval_accumulation_steps",val:": int | None = None"},{name:"include_for_metrics",val:": list = <factory>"},{name:"batch_eval_metrics",val:": bool = False"},{name:"save_only_model",val:": bool = False"},{name:"save_strategy",val:": transformers.trainer_utils.SaveStrategy | str = 'steps'"},{name:"save_steps",val:": float = 500"},{name:"save_on_each_node",val:": bool = False"},{name:"save_total_limit",val:": int | None = None"},{name:"enable_jit_checkpoint",val:": bool = False"},{name:"push_to_hub",val:": bool = False"},{name:"hub_token",val:": str | None = None"},{name:"hub_private_repo",val:": bool | None = None"},{name:"hub_model_id",val:": str | None = None"},{name:"hub_strategy",val:": transformers.trainer_utils.HubStrategy | str = 'every_save'"},{name:"hub_always_push",val:": bool = False"},{name:"hub_revision",val:": str | None = None"},{name:"load_best_model_at_end",val:": bool = False"},{name:"metric_for_best_model",val:": str | None = None"},{name:"greater_is_better",val:": bool | None = None"},{name:"ignore_data_skip",val:": bool = False"},{name:"restore_callback_states_from_checkpoint",val:": bool = False"},{name:"full_determinism",val:": bool = False"},{name:"seed",val:": int = 42"},{name:"data_seed",val:": int | None = None"},{name:"use_cpu",val:": bool = False"},{name:"accelerator_config",val:": dict | str | None = None"},{name:"parallelism_config",val:": accelerate.parallelism_config.ParallelismConfig | None = None"},{name:"dataloader_drop_last",val:": bool = False"},{name:"dataloader_num_workers",val:": int = 0"},{name:"dataloader_pin_memory",val:": bool = True"},{name:"dataloader_persistent_workers",val:": bool = False"},{name:"dataloader_prefetch_factor",val:": int | None = None"},{name:"remove_unused_columns",val:": bool = False"},{name:"label_names",val:": list[str] | None = None"},{name:"train_sampling_strategy",val:": str = 'random'"},{name:"length_column_name",val:": str = 'length'"},{name:"ddp_find_unused_parameters",val:": bool | None = None"},{name:"ddp_bucket_cap_mb",val:": int | None = None"},{name:"ddp_broadcast_buffers",val:": bool | None = None"},{name:"ddp_backend",val:": str | None = None"},{name:"ddp_timeout",val:": int = 1800"},{name:"fsdp",val:": list[transformers.trainer_utils.FSDPOption] | str | None = None"},{name:"fsdp_config",val:": dict[str, typing.Any] | str | None = None"},{name:"deepspeed",val:": dict | str | None = None"},{name:"debug",val:": str | list[transformers.debug_utils.DebugOption] = ''"},{name:"skip_memory_metrics",val:": bool = True"},{name:"do_train",val:": bool = False"},{name:"do_eval",val:": bool = False"},{name:"do_predict",val:": bool = False"},{name:"resume_from_checkpoint",val:": str | None = None"},{name:"warmup_ratio",val:": float | None = None"},{name:"logging_dir",val:": str | None = None"},{name:"local_rank",val:": int = -1"},{name:"reward_model_path",val:": str | None = None"},{name:"max_new_tokens",val:": int = 64"},{name:"max_length",val:": int = 512"},{name:"temperature",val:": float = 0.9"},{name:"top_p",val:": float = 1.0"},{name:"top_k",val:": int = 0"},{name:"min_p",val:": float | None = None"},{name:"repetition_penalty",val:": float = 1.0"},{name:"generation_kwargs",val:": dict | None = None"},{name:"cache_implementation",val:": str | None = None"},{name:"missing_eos_penalty",val:": float | None = None"},{name:"beta",val:": list = <factory>"},{name:"loss_type",val:": str = 'sigmoid'"},{name:"disable_dropout",val:": bool = True"},{name:"use_vllm",val:": bool = False"},{name:"vllm_model_impl",val:": str = 'vllm'"},{name:"vllm_structured_outputs_regex",val:": str | None = None"},{name:"vllm_gpu_memory_utilization",val:": float | None = 0.55"},{name:"vllm_mode",val:": str = 'colocate'"},{name:"vllm_server_base_url",val:": str | None = None"},{name:"vllm_server_host",val:": str = '0.0.0.0'"},{name:"vllm_server_port",val:": int = 8000"},{name:"vllm_server_timeout",val:": float = 240.0"},{name:"vllm_group_port",val:": int = 51216"},{name:"vllm_tensor_parallel_size",val:": int = 1"},{name:"vllm_enable_sleep_mode",val:": bool = False"},{name:"ds3_gather_for_generation",val:": bool = True"},{name:"model_init_kwargs",val:": dict[str, typing.Any] | str | None = None"},{name:"reward_weights",val:": list[float] | None = None"}],parametersDescription:[{anchor:"trl.experimental.online_dpo.OnlineDPOConfig.reward_model_path",description:`<strong>reward_model_path</strong> (<code>str</code>, <em>optional</em>) — | |
| Path to the reward model.`,name:"reward_model_path"},{anchor:"trl.experimental.online_dpo.OnlineDPOConfig.max_new_tokens",description:`<strong>max_new_tokens</strong> (<code>int</code>, <em>optional</em>, defaults to <code>64</code>) — | |
| Maximum number of tokens to generate per completion.`,name:"max_new_tokens"},{anchor:"trl.experimental.online_dpo.OnlineDPOConfig.max_length",description:`<strong>max_length</strong> (<code>int</code>, <em>optional</em>, defaults to <code>256</code>) — | |
| Maximum total length of the sequence (prompt + completion) used to compute log probabilities. If the | |
| sequence exceeds this limit, the leftmost tokens will be truncated to preserve as much of the completion as | |
| possible.`,name:"max_length"},{anchor:"trl.experimental.online_dpo.OnlineDPOConfig.temperature",description:`<strong>temperature</strong> (<code>float</code>, <em>optional</em>, defaults to <code>0.9</code>) — | |
| Temperature for sampling. The higher the temperature, the more random the completions.`,name:"temperature"},{anchor:"trl.experimental.online_dpo.OnlineDPOConfig.missing_eos_penalty",description:`<strong>missing_eos_penalty</strong> (<code>float</code>, <em>optional</em>) — | |
| Penalty applied to the score when the model fails to generate an EOS token. This is useful to encourage to | |
| generate completions shorter than the maximum length (<code>max_new_tokens</code>). The penalty must be a positive | |
| value.`,name:"missing_eos_penalty"},{anchor:"trl.experimental.online_dpo.OnlineDPOConfig.beta",description:`<strong>beta</strong> (<code>float</code> or <code>list[float]</code>, <em>optional</em>, defaults to <code>0.1</code>) — | |
| Parameter controlling the deviation from the reference model. Higher β means less deviation from the | |
| reference model. For the IPO loss (<code>loss_type="ipo"</code>), β is the regularization parameter denoted by τ in | |
| the <a href="https://huggingface.co/papers/2310.12036" rel="nofollow">paper</a>. If a list of floats is provided then the β is | |
| selected for each new epoch and the last β is used for the rest of the epochs.`,name:"beta"},{anchor:"trl.experimental.online_dpo.OnlineDPOConfig.loss_type",description:`<strong>loss_type</strong> (<code>str</code>, <em>optional</em>, defaults to <code>"sigmoid"</code>) — | |
| Type of loss to use. Possible values are:</p> | |
| <ul> | |
| <li><code>"sigmoid"</code>: sigmoid loss from the original <a href="https://huggingface.co/papers/2305.18290" rel="nofollow">DPO</a> paper.</li> | |
| <li><code>"ipo"</code>: IPO loss from the <a href="https://huggingface.co/papers/2310.12036" rel="nofollow">IPO</a> paper.</li> | |
| </ul>`,name:"loss_type"},{anchor:"trl.experimental.online_dpo.OnlineDPOConfig.disable_dropout",description:`<strong>disable_dropout</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) — | |
| Whether to disable dropout in the model and reference model.`,name:"disable_dropout"}],source:"https://github.com/huggingface/trl/blob/vr_5607/trl/experimental/online_dpo/online_dpo_config.py#L23",parameterGroups:[{title:"Parameters that control generation",parametersDescription:[{anchor:"trl.experimental.online_dpo.OnlineDPOConfig.top_p",description:`<strong>top_p</strong> (<code>float</code>, <em>optional</em>, defaults to <code>1.0</code>) — | |
| Float that controls the cumulative probability of the top tokens to consider. Must be in (0, 1]. Set to | |
| <code>1.0</code> to consider all tokens.`,name:"top_p"},{anchor:"trl.experimental.online_dpo.OnlineDPOConfig.top_k",description:`<strong>top_k</strong> (<code>int</code>, <em>optional</em>, defaults to <code>0</code>) — | |
| Number of highest probability vocabulary tokens to keep for top-k-filtering. If <code>0</code>, top-k-filtering is | |
| disabled and all tokens are considered.`,name:"top_k"},{anchor:"trl.experimental.online_dpo.OnlineDPOConfig.min_p",description:`<strong>min_p</strong> (<code>float</code>, <em>optional</em>) — | |
| Minimum token probability, which will be scaled by the probability of the most likely token. It must be a | |
| value between <code>0.0</code> and <code>1.0</code>. Typical values are in the <code>0.01-0.2</code> range.`,name:"min_p"},{anchor:"trl.experimental.online_dpo.OnlineDPOConfig.repetition_penalty",description:`<strong>repetition_penalty</strong> (<code>float</code>, <em>optional</em>, defaults to <code>1.0</code>) — | |
| Float that penalizes new tokens based on whether they appear in the prompt and the generated text so far. | |
| Values > <code>1.0</code> encourage the model to use new tokens, while values < <code>1.0</code> encourage the model to repeat | |
| tokens.`,name:"repetition_penalty"},{anchor:"trl.experimental.online_dpo.OnlineDPOConfig.cache_implementation",description:`<strong>cache_implementation</strong> (<code>str</code>, <em>optional</em>) — | |
| Implementation of the cache method for faster generation when <code>use_vllm</code> is set to <code>False</code>.`,name:"cache_implementation"},{anchor:"trl.experimental.online_dpo.OnlineDPOConfig.generation_kwargs",description:`<strong>generation_kwargs</strong> (<code>dict[str, Any]</code>, <em>optional</em>) — | |
| Additional keyword arguments to pass to <a href="https://huggingface.co/docs/transformers/main/en/main_classes/text_generation#transformers.GenerationConfig" rel="nofollow">GenerationConfig</a> (if using transformers) or | |
| <code>SamplingParams</code> (if using vLLM) when sampling completions. This can be used to further customize the | |
| generation behavior, such as setting <code>suppress_tokens</code>, <code>num_beams</code>, etc. If it contains keys that conflict | |
| with the other generation parameters (like <code>min_p</code>, <code>top_p</code>, etc.), they will override them.`,name:"generation_kwargs"}]},{title:"Parameters that control generation acceleration powered by vLLM",parametersDescription:[{anchor:"trl.experimental.online_dpo.OnlineDPOConfig.use_vllm",description:`<strong>use_vllm</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) — | |
| Whether to use vLLM for generating completions. If set to <code>True</code>, the trainer will use vLLM for generation | |
| instead of the default model.generate(). Requires <code>vllm</code> to be installed.`,name:"use_vllm"},{anchor:"trl.experimental.online_dpo.OnlineDPOConfig.vllm_model_impl",description:`<strong>vllm_model_impl</strong> (<code>str</code>, <em>optional</em>, defaults to <code>"vllm"</code>) — | |
| Model implementation to use for vLLM. Must be one of <code>"transformers"</code> or <code>"vllm"</code>. <code>"transformers"</code>: Use | |
| the <code>transformers</code> backend for model implementation. <code>"vllm"</code>: Use the <code>vllm</code> library for model | |
| implementation.`,name:"vllm_model_impl"},{anchor:"trl.experimental.online_dpo.OnlineDPOConfig.vllm_mode",description:`<strong>vllm_mode</strong> (<code>str</code>, <em>optional</em>, defaults to <code>"colocate"</code>) — | |
| Mode to use for vLLM integration when <code>use_vllm</code> is set to <code>True</code>. Must be one of <code>"server"</code> or | |
| <code>"colocate"</code>.</p> | |
| <ul> | |
| <li><code>"server"</code>: The trainer will send generation requests to a separate vLLM server. Make sure a TRL vLLM | |
| server is running (start with <code>trl vllm-serve</code>).</li> | |
| <li><code>"colocate"</code>: vLLM will run in the same process and share the training GPUs. This avoids the need for a | |
| separate server but may cause resource contention with training.</li> | |
| </ul>`,name:"vllm_mode"},{anchor:"trl.experimental.online_dpo.OnlineDPOConfig.vllm_structured_outputs_regex",description:`<strong>vllm_structured_outputs_regex</strong> (<code>str</code>, <em>optional</em>) — | |
| Regex for vLLM structured outputs. If <code>None</code> (default), structured outputs is disabled.`,name:"vllm_structured_outputs_regex"}]},{title:'Parameters that control the vLLM server (only used when `vllm_mode` is `"server"`)',parametersDescription:[{anchor:"trl.experimental.online_dpo.OnlineDPOConfig.vllm_server_base_url",description:`<strong>vllm_server_base_url</strong> (<code>str</code>, <em>optional</em>) — | |
| Base URL for the vLLM server (e.g., <code>"http://localhost:8000"</code>). If provided, <code>vllm_server_host</code> and | |
| <code>vllm_server_port</code> are ignored.`,name:"vllm_server_base_url"},{anchor:"trl.experimental.online_dpo.OnlineDPOConfig.vllm_server_host",description:`<strong>vllm_server_host</strong> (<code>str</code>, <em>optional</em>, defaults to <code>"0.0.0.0"</code>) — | |
| Host of the vLLM server to connect to. Ignored if <code>vllm_server_base_url</code> is provided.`,name:"vllm_server_host"},{anchor:"trl.experimental.online_dpo.OnlineDPOConfig.vllm_server_port",description:`<strong>vllm_server_port</strong> (<code>int</code>, <em>optional</em>, defaults to <code>8000</code>) — | |
| Port of the vLLM server to connect to. Ignored if <code>vllm_server_base_url</code> is provided.`,name:"vllm_server_port"},{anchor:"trl.experimental.online_dpo.OnlineDPOConfig.vllm_server_timeout",description:`<strong>vllm_server_timeout</strong> (<code>float</code>, <em>optional</em>, defaults to <code>240.0</code>) — | |
| Total timeout duration in seconds to wait for the vLLM server to be up. If the server is not up after the | |
| timeout, a <code>ConnectionError</code> is raised.`,name:"vllm_server_timeout"},{anchor:"trl.experimental.online_dpo.OnlineDPOConfig.vllm_group_port",description:`<strong>vllm_group_port</strong> (<code>int</code>, <em>optional</em>, defaults to <code>51216</code>) — | |
| Port number for the weight update group. This is used to communicate with the vLLM server. Unless the port | |
| is occupied, there is no need to change it.`,name:"vllm_group_port"}]},{title:'Parameters that control colocated vLLM execution (only used when `vllm_mode` is `"colocate"`)',parametersDescription:[{anchor:"trl.experimental.online_dpo.OnlineDPOConfig.vllm_gpu_memory_utilization",description:`<strong>vllm_gpu_memory_utilization</strong> (<code>float</code>, <em>optional</em>, defaults to <code>0.55</code>) — | |
| Control the GPU memory utilization for vLLM. This setting only applies when <code>vllm_mode</code> is set to | |
| <code>"colocate"</code>. If you are using <code>vllm_mode="server"</code>, this parameter must be passed separately when | |
| launching the vLLM server via the <code>--vllm_gpu_memory_utilization</code> flag.`,name:"vllm_gpu_memory_utilization"},{anchor:"trl.experimental.online_dpo.OnlineDPOConfig.vllm_tensor_parallel_size",description:`<strong>vllm_tensor_parallel_size</strong> (<code>int</code>, <em>optional</em>, defaults to <code>1</code>) — | |
| Control the tensor parallel size for vLLM. This setting only applies when <code>vllm_mode</code> is set to | |
| <code>"colocate"</code>. If you are using <code>vllm_mode="server"</code>, this parameter must be passed separately when | |
| launching the vLLM server via the <code>--vllm_tensor_parallel_size</code> flag.`,name:"vllm_tensor_parallel_size"},{anchor:"trl.experimental.online_dpo.OnlineDPOConfig.vllm_enable_sleep_mode",description:`<strong>vllm_enable_sleep_mode</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) — | |
| Enable vLLM sleep mode to offload weights/cache during the optimizer step. Keeps GPU memory usage low, but | |
| waking the engine adds host–device transfer latency.`,name:"vllm_enable_sleep_mode"}]},{title:"Other parameters",parametersDescription:[{anchor:"trl.experimental.online_dpo.OnlineDPOConfig.ds3_gather_for_generation",description:`<strong>ds3_gather_for_generation</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) — | |
| This setting applies to DeepSpeed ZeRO-3. If enabled, the policy model weights are gathered for generation, | |
| improving generation speed. However, disabling this option allows training models that exceed the VRAM | |
| capacity of a single GPU, albeit at the cost of slower generation. Disabling this option is not compatible | |
| with vLLM generation.`,name:"ds3_gather_for_generation"},{anchor:"trl.experimental.online_dpo.OnlineDPOConfig.model_init_kwargs",description:`<strong>model_init_kwargs</strong> (<code>dict[str, Any]</code>, <em>optional</em>) — | |
| Keyword arguments to pass to <code>AutoModelForCausalLM.from_pretrained</code> when instantiating the model from a | |
| string.`,name:"model_init_kwargs"}]}]}}),xe=new Wn({props:{source:"https://github.com/huggingface/trl/blob/main/docs/source/online_dpo_trainer.md"}}),{c(){x=r("meta"),Be=a(),$e=r("p"),Xe=a(),d(J.$$.fragment),We=a(),d(O.$$.fragment),Re=a(),N=r("p"),N.innerHTML=St,Ge=a(),d(P.$$.fragment),Fe=a(),I=r("p"),I.innerHTML=Yt,Ae=a(),D=r("p"),D.textContent=qt,He=a(),L=r("blockquote"),L.innerHTML=Kt,Ve=a(),$=r("p"),$.innerHTML=en,Ee=a(),d(j.$$.fragment),ze=a(),Z=r("p"),Z.innerHTML=tn,Qe=a(),w=r("iframe"),Se=a(),B=r("p"),B.textContent=on,Ye=a(),d(X.$$.fragment),qe=a(),W=r("p"),W.textContent=an,Ke=a(),d(R.$$.fragment),et=a(),G=r("p"),G.textContent=ln,tt=a(),F=r("p"),F.innerHTML=rn,nt=a(),A=r("p"),A.innerHTML=sn,ot=a(),H=r("pre"),H.innerHTML=dn,at=a(),d(V.$$.fragment),lt=a(),E=r("p"),E.innerHTML=mn,rt=a(),d(z.$$.fragment),it=a(),d(Q.$$.fragment),st=a(),S=r("p"),S.innerHTML=cn,dt=a(),d(Y.$$.fragment),mt=a(),d(q.$$.fragment),ct=a(),K=r("p"),K.innerHTML=pn,pt=a(),d(ee.$$.fragment),ht=a(),te=r("p"),te.textContent=hn,ut=a(),ne=r("p"),ne.innerHTML=un,gt=a(),d(oe.$$.fragment),ft=a(),ae=r("p"),ae.innerHTML=gn,_t=a(),le=r("p"),le.innerHTML=fn,bt=a(),d(re.$$.fragment),vt=a(),d(ie.$$.fragment),wt=a(),se=r("p"),se.innerHTML=_n,yt=a(),de=r("ul"),de.innerHTML=bn,Mt=a(),d(me.$$.fragment),Tt=a(),ce=r("p"),ce.innerHTML=vn,xt=a(),d(pe.$$.fragment),Ct=a(),he=r("p"),he.textContent=wn,Ut=a(),ue=r("ul"),ue.innerHTML=yn,kt=a(),ge=r("p"),ge.textContent=Mn,Jt=a(),d(fe.$$.fragment),Ot=a(),f=r("div"),d(_e.$$.fragment),Zt=a(),Ce=r("p"),Ce.textContent=Tn,Bt=a(),C=r("div"),d(be.$$.fragment),Xt=a(),Ue=r("p"),Ue.textContent=xn,Wt=a(),y=r("div"),d(ve.$$.fragment),Rt=a(),ke=r("p"),ke.innerHTML=Cn,Gt=a(),Je=r("p"),Je.textContent=Un,Ft=a(),U=r("div"),d(we.$$.fragment),At=a(),Oe=r("p"),Oe.innerHTML=kn,Nt=a(),d(ye.$$.fragment),Pt=a(),_=r("div"),d(Me.$$.fragment),Ht=a(),Ne=r("p"),Ne.innerHTML=Jn,Vt=a(),Pe=r("p"),Pe.innerHTML=On,Et=a(),Ie=r("p"),Ie.innerHTML=Nn,zt=a(),Te=r("blockquote"),Te.innerHTML=Pn,It=a(),d(xe.$$.fragment),Dt=a(),je=r("p"),this.h()},l(e){const t=Bn("svelte-u9bgzb",document.head);x=i(t,"META",{name:!0,content:!0}),t.forEach(n),Be=l(e),$e=i(e,"P",{}),k($e).forEach(n),Xe=l(e),m(J.$$.fragment,e),We=l(e),m(O.$$.fragment,e),Re=l(e),N=i(e,"P",{"data-svelte-h":!0}),s(N)!=="svelte-1o4k78y"&&(N.innerHTML=St),Ge=l(e),m(P.$$.fragment,e),Fe=l(e),I=i(e,"P",{"data-svelte-h":!0}),s(I)!=="svelte-m0rh28"&&(I.innerHTML=Yt),Ae=l(e),D=i(e,"P",{"data-svelte-h":!0}),s(D)!=="svelte-vfdo9a"&&(D.textContent=qt),He=l(e),L=i(e,"BLOCKQUOTE",{"data-svelte-h":!0}),s(L)!=="svelte-djifwf"&&(L.innerHTML=Kt),Ve=l(e),$=i(e,"P",{"data-svelte-h":!0}),s($)!=="svelte-1vcnqml"&&($.innerHTML=en),Ee=l(e),m(j.$$.fragment,e),ze=l(e),Z=i(e,"P",{"data-svelte-h":!0}),s(Z)!=="svelte-nb1hlt"&&(Z.innerHTML=tn),Qe=l(e),w=i(e,"IFRAME",{src:!0,frameborder:!0,width:!0,height:!0}),k(w).forEach(n),Se=l(e),B=i(e,"P",{"data-svelte-h":!0}),s(B)!=="svelte-uqytq6"&&(B.textContent=on),Ye=l(e),m(X.$$.fragment,e),qe=l(e),W=i(e,"P",{"data-svelte-h":!0}),s(W)!=="svelte-15hino8"&&(W.textContent=an),Ke=l(e),m(R.$$.fragment,e),et=l(e),G=i(e,"P",{"data-svelte-h":!0}),s(G)!=="svelte-c89cht"&&(G.textContent=ln),tt=l(e),F=i(e,"P",{"data-svelte-h":!0}),s(F)!=="svelte-rtzp3u"&&(F.innerHTML=rn),nt=l(e),A=i(e,"P",{"data-svelte-h":!0}),s(A)!=="svelte-13iawud"&&(A.innerHTML=sn),ot=l(e),H=i(e,"PRE",{"data-svelte-h":!0}),s(H)!=="svelte-1apoooa"&&(H.innerHTML=dn),at=l(e),m(V.$$.fragment,e),lt=l(e),E=i(e,"P",{"data-svelte-h":!0}),s(E)!=="svelte-10l7ydp"&&(E.innerHTML=mn),rt=l(e),m(z.$$.fragment,e),it=l(e),m(Q.$$.fragment,e),st=l(e),S=i(e,"P",{"data-svelte-h":!0}),s(S)!=="svelte-1odvb8y"&&(S.innerHTML=cn),dt=l(e),m(Y.$$.fragment,e),mt=l(e),m(q.$$.fragment,e),ct=l(e),K=i(e,"P",{"data-svelte-h":!0}),s(K)!=="svelte-spy2hy"&&(K.innerHTML=pn),pt=l(e),m(ee.$$.fragment,e),ht=l(e),te=i(e,"P",{"data-svelte-h":!0}),s(te)!=="svelte-1hvqa3l"&&(te.textContent=hn),ut=l(e),ne=i(e,"P",{"data-svelte-h":!0}),s(ne)!=="svelte-1hcdz34"&&(ne.innerHTML=un),gt=l(e),m(oe.$$.fragment,e),ft=l(e),ae=i(e,"P",{"data-svelte-h":!0}),s(ae)!=="svelte-18xtjxg"&&(ae.innerHTML=gn),_t=l(e),le=i(e,"P",{"data-svelte-h":!0}),s(le)!=="svelte-1v4wk0w"&&(le.innerHTML=fn),bt=l(e),m(re.$$.fragment,e),vt=l(e),m(ie.$$.fragment,e),wt=l(e),se=i(e,"P",{"data-svelte-h":!0}),s(se)!=="svelte-4j0b8n"&&(se.innerHTML=_n),yt=l(e),de=i(e,"UL",{"data-svelte-h":!0}),s(de)!=="svelte-4dof1d"&&(de.innerHTML=bn),Mt=l(e),m(me.$$.fragment,e),Tt=l(e),ce=i(e,"P",{"data-svelte-h":!0}),s(ce)!=="svelte-k5qvzm"&&(ce.innerHTML=vn),xt=l(e),m(pe.$$.fragment,e),Ct=l(e),he=i(e,"P",{"data-svelte-h":!0}),s(he)!=="svelte-yl0uf2"&&(he.textContent=wn),Ut=l(e),ue=i(e,"UL",{"data-svelte-h":!0}),s(ue)!=="svelte-12icmte"&&(ue.innerHTML=yn),kt=l(e),ge=i(e,"P",{"data-svelte-h":!0}),s(ge)!=="svelte-1fufp5p"&&(ge.textContent=Mn),Jt=l(e),m(fe.$$.fragment,e),Ot=l(e),f=i(e,"DIV",{class:!0});var M=k(f);m(_e.$$.fragment,M),Zt=l(M),Ce=i(M,"P",{"data-svelte-h":!0}),s(Ce)!=="svelte-v6j7a9"&&(Ce.textContent=Tn),Bt=l(M),C=i(M,"DIV",{class:!0});var $t=k(C);m(be.$$.fragment,$t),Xt=l($t),Ue=i($t,"P",{"data-svelte-h":!0}),s(Ue)!=="svelte-1cilnet"&&(Ue.textContent=xn),$t.forEach(n),Wt=l(M),y=i(M,"DIV",{class:!0});var De=k(y);m(ve.$$.fragment,De),Rt=l(De),ke=i(De,"P",{"data-svelte-h":!0}),s(ke)!=="svelte-r8h4ov"&&(ke.innerHTML=Cn),Gt=l(De),Je=i(De,"P",{"data-svelte-h":!0}),s(Je)!=="svelte-1e6bius"&&(Je.textContent=Un),De.forEach(n),Ft=l(M),U=i(M,"DIV",{class:!0});var jt=k(U);m(we.$$.fragment,jt),At=l(jt),Oe=i(jt,"P",{"data-svelte-h":!0}),s(Oe)!=="svelte-8tudwd"&&(Oe.innerHTML=kn),jt.forEach(n),M.forEach(n),Nt=l(e),m(ye.$$.fragment,e),Pt=l(e),_=i(e,"DIV",{class:!0});var T=k(_);m(Me.$$.fragment,T),Ht=l(T),Ne=i(T,"P",{"data-svelte-h":!0}),s(Ne)!=="svelte-1pdixmz"&&(Ne.innerHTML=Jn),Vt=l(T),Pe=i(T,"P",{"data-svelte-h":!0}),s(Pe)!=="svelte-36tp7i"&&(Pe.innerHTML=On),Et=l(T),Ie=i(T,"P",{"data-svelte-h":!0}),s(Ie)!=="svelte-ekuf1t"&&(Ie.innerHTML=Nn),zt=l(T),Te=i(T,"BLOCKQUOTE",{class:!0,"data-svelte-h":!0}),s(Te)!=="svelte-1aqodph"&&(Te.innerHTML=Pn),T.forEach(n),It=l(e),m(xe.$$.fragment,e),Dt=l(e),je=i(e,"P",{}),k(je).forEach(n),this.h()},h(){b(x,"name","hf:doc:metadata"),b(x,"content",Gn),Dn(w.src,nn="https://huggingface.co/datasets/trl-lib/ultrafeedback-prompt/embed/viewer/default/train?row=0")||b(w,"src",nn),b(w,"frameborder","0"),b(w,"width","100%"),b(w,"height","560px"),b(C,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),b(y,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),b(U,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),b(f,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),b(Te,"class","note"),b(_,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8")},m(e,t){c(document.head,x),o(e,Be,t),o(e,$e,t),o(e,Xe,t),p(J,e,t),o(e,We,t),p(O,e,t),o(e,Re,t),o(e,N,t),o(e,Ge,t),p(P,e,t),o(e,Fe,t),o(e,I,t),o(e,Ae,t),o(e,D,t),o(e,He,t),o(e,L,t),o(e,Ve,t),o(e,$,t),o(e,Ee,t),p(j,e,t),o(e,ze,t),o(e,Z,t),o(e,Qe,t),o(e,w,t),o(e,Se,t),o(e,B,t),o(e,Ye,t),p(X,e,t),o(e,qe,t),o(e,W,t),o(e,Ke,t),p(R,e,t),o(e,et,t),o(e,G,t),o(e,tt,t),o(e,F,t),o(e,nt,t),o(e,A,t),o(e,ot,t),o(e,H,t),o(e,at,t),p(V,e,t),o(e,lt,t),o(e,E,t),o(e,rt,t),p(z,e,t),o(e,it,t),p(Q,e,t),o(e,st,t),o(e,S,t),o(e,dt,t),p(Y,e,t),o(e,mt,t),p(q,e,t),o(e,ct,t),o(e,K,t),o(e,pt,t),p(ee,e,t),o(e,ht,t),o(e,te,t),o(e,ut,t),o(e,ne,t),o(e,gt,t),p(oe,e,t),o(e,ft,t),o(e,ae,t),o(e,_t,t),o(e,le,t),o(e,bt,t),p(re,e,t),o(e,vt,t),p(ie,e,t),o(e,wt,t),o(e,se,t),o(e,yt,t),o(e,de,t),o(e,Mt,t),p(me,e,t),o(e,Tt,t),o(e,ce,t),o(e,xt,t),p(pe,e,t),o(e,Ct,t),o(e,he,t),o(e,Ut,t),o(e,ue,t),o(e,kt,t),o(e,ge,t),o(e,Jt,t),p(fe,e,t),o(e,Ot,t),o(e,f,t),p(_e,f,null),c(f,Zt),c(f,Ce),c(f,Bt),c(f,C),p(be,C,null),c(C,Xt),c(C,Ue),c(f,Wt),c(f,y),p(ve,y,null),c(y,Rt),c(y,ke),c(y,Gt),c(y,Je),c(f,Ft),c(f,U),p(we,U,null),c(U,At),c(U,Oe),o(e,Nt,t),p(ye,e,t),o(e,Pt,t),o(e,_,t),p(Me,_,null),c(_,Ht),c(_,Ne),c(_,Vt),c(_,Pe),c(_,Et),c(_,Ie),c(_,zt),c(_,Te),o(e,It,t),p(xe,e,t),o(e,Dt,t),o(e,je,t),Lt=!0},p:Ln,i(e){Lt||(h(J.$$.fragment,e),h(O.$$.fragment,e),h(P.$$.fragment,e),h(j.$$.fragment,e),h(X.$$.fragment,e),h(R.$$.fragment,e),h(V.$$.fragment,e),h(z.$$.fragment,e),h(Q.$$.fragment,e),h(Y.$$.fragment,e),h(q.$$.fragment,e),h(ee.$$.fragment,e),h(oe.$$.fragment,e),h(re.$$.fragment,e),h(ie.$$.fragment,e),h(me.$$.fragment,e),h(pe.$$.fragment,e),h(fe.$$.fragment,e),h(_e.$$.fragment,e),h(be.$$.fragment,e),h(ve.$$.fragment,e),h(we.$$.fragment,e),h(ye.$$.fragment,e),h(Me.$$.fragment,e),h(xe.$$.fragment,e),Lt=!0)},o(e){u(J.$$.fragment,e),u(O.$$.fragment,e),u(P.$$.fragment,e),u(j.$$.fragment,e),u(X.$$.fragment,e),u(R.$$.fragment,e),u(V.$$.fragment,e),u(z.$$.fragment,e),u(Q.$$.fragment,e),u(Y.$$.fragment,e),u(q.$$.fragment,e),u(ee.$$.fragment,e),u(oe.$$.fragment,e),u(re.$$.fragment,e),u(ie.$$.fragment,e),u(me.$$.fragment,e),u(pe.$$.fragment,e),u(fe.$$.fragment,e),u(_e.$$.fragment,e),u(be.$$.fragment,e),u(ve.$$.fragment,e),u(we.$$.fragment,e),u(ye.$$.fragment,e),u(Me.$$.fragment,e),u(xe.$$.fragment,e),Lt=!1},d(e){e&&(n(Be),n($e),n(Xe),n(We),n(Re),n(N),n(Ge),n(Fe),n(I),n(Ae),n(D),n(He),n(L),n(Ve),n($),n(Ee),n(ze),n(Z),n(Qe),n(w),n(Se),n(B),n(Ye),n(qe),n(W),n(Ke),n(et),n(G),n(tt),n(F),n(nt),n(A),n(ot),n(H),n(at),n(lt),n(E),n(rt),n(it),n(st),n(S),n(dt),n(mt),n(ct),n(K),n(pt),n(ht),n(te),n(ut),n(ne),n(gt),n(ft),n(ae),n(_t),n(le),n(bt),n(vt),n(wt),n(se),n(yt),n(de),n(Mt),n(Tt),n(ce),n(xt),n(Ct),n(he),n(Ut),n(ue),n(kt),n(ge),n(Jt),n(Ot),n(f),n(Nt),n(Pt),n(_),n(It),n(Dt),n(je)),n(x),g(J,e),g(O,e),g(P,e),g(j,e),g(X,e),g(R,e),g(V,e),g(z,e),g(Q,e),g(Y,e),g(q,e),g(ee,e),g(oe,e),g(re,e),g(ie,e),g(me,e),g(pe,e),g(fe,e),g(_e),g(be),g(ve),g(we),g(ye,e),g(Me),g(xe,e)}}}const Gn='{"title":"Online DPO Trainer","local":"online-dpo-trainer","sections":[{"title":"Overview","local":"overview","sections":[],"depth":2},{"title":"Quick start","local":"quick-start","sections":[],"depth":2},{"title":"Expected dataset type","local":"expected-dataset-type","sections":[],"depth":2},{"title":"Usage tips","local":"usage-tips","sections":[{"title":"Encourage EOS token generation","local":"encourage-eos-token-generation","sections":[],"depth":3},{"title":"Logging Completions","local":"logging-completions","sections":[],"depth":3}],"depth":2},{"title":"Example script","local":"example-script","sections":[],"depth":2},{"title":"Logged metrics","local":"logged-metrics","sections":[],"depth":2},{"title":"Benchmark experiments","local":"benchmark-experiments","sections":[],"depth":2},{"title":"OnlineDPOTrainer","local":"trl.experimental.online_dpo.OnlineDPOTrainer","sections":[],"depth":2},{"title":"OnlineDPOConfig","local":"trl.experimental.online_dpo.OnlineDPOConfig","sections":[],"depth":2}],"depth":1}';function Fn(Qt){return $n(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class Qn extends jn{constructor(x){super(),Zn(this,x,Fn,Rn,In,{})}}export{Qn as component}; | |
Xet Storage Details
- Size:
- 69.1 kB
- Xet hash:
- 64544fa67f17961edc5c11277142869331ca72f25cdef7a1822c2a1139cf1a7c
·
Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.