Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 8 additions & 5 deletions src/fairseq2/recipes/lm/_online_finetune/_recipe.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
# Copyright (c) Meta Platforms, Inc. and affiliates.
# All rights reserved.
#
Expand Down Expand Up @@ -252,11 +252,14 @@

vocab_size = tokenizer.vocab_info.size

# initialize ray and vllm actors
ray.init(
address=f"ray://{config.vllm.ray_cluster_ip_address}:10001",
namespace="vllm_workers",
)
if gangs.root.rank == 0:
# initialize ray and vllm actors
ray.init(
address=f"ray://{config.vllm.ray_cluster_ip_address}:10001",
namespace="vllm_workers",
)

gangs.root.barrier()

vllm_actors = {}
# go over actor configs and initialize all of them
Expand Down
7 changes: 7 additions & 0 deletions src/fairseq2/recipes/lm/_online_finetune/_rewards.py
Original file line number Diff line number Diff line change
Expand Up @@ -477,6 +477,13 @@ def prepare_preference_batch(
reference_score_rejected=None,
)

prompt_lengths = [
l
for idx, l in enumerate(prompt_batch.prompt_lengths)
if idx not in dummy_batch_ids
]
reward_output["prompt_lengths"] = prompt_lengths

return batch, is_bad_batch, reward_output


Expand Down
Loading