[Minor] more code cleanup (#4077)

This commit is contained in:
Lianmin Zheng
2025-03-04 21:23:47 -08:00
committed by GitHub
parent 4725e3f652
commit e074d84e5b
15 changed files with 123 additions and 31 deletions

View File

@@ -39,6 +39,7 @@ from transformers import (
)
AIOHTTP_TIMEOUT = aiohttp.ClientTimeout(total=6 * 60 * 60)
ASSISTANT_SUFFIX = "Assistant:"
global args
@@ -635,7 +636,11 @@ def sample_sharegpt_requests(
# Tokenize the prompts and completions.
prompt = dataset[i][0]
if prompt_suffix:
prompt = prompt
prompt = (
remove_suffix(prompt, ASSISTANT_SUFFIX)
+ prompt_suffix
+ ASSISTANT_SUFFIX
)
if apply_chat_template:
prompt = tokenizer.apply_chat_template(