Skip to content

Commit

Permalink
be more chill about the leading whitespace
Browse files Browse the repository at this point in the history
  • Loading branch information
rizar committed Dec 20, 2024
1 parent b3b54dd commit 36f23ef
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
1 change: 1 addition & 0 deletions examples/rl_gsm8k/orchestrate_rl.py
Original file line number Diff line number Diff line change
Expand Up @@ -357,6 +357,7 @@ def main(cfg: DictConfig):
logger.info("Removing leading white space from the model. This is necessary for DeepSeek models")

while state["iteration"] < cfg.max_iterations:
logger.info(f"Starting iteration {state['iteration']}")
start_iteration = time.time()
if os.path.exists(finetune_path / "current"):
assistant_model_path = str(finetune_path / "current")
Expand Down
6 changes: 4 additions & 2 deletions tapeagents/llms.py
Original file line number Diff line number Diff line change
Expand Up @@ -580,8 +580,10 @@ def _generate(self, prompt: Prompt) -> Generator[LLMEvent, None, None]:
content = data["choices"][0]["message"]["content"]
if self.remove_leading_white_space:
# vllm sometimes adds a whitespace at the beginning of the completion
assert content[0] == " "
content = content[1:]
if content[0] == " ":
content = content[1:]
else:
logger.error(f"Expected leading white space in completion: \n{content}")
if not content:
logger.warning(f"Empty completion {data}")

Expand Down

0 comments on commit 36f23ef

Please sign in to comment.