Skip to content

Commit c3700a2

Browse files
committed
going back with request_id approach
1 parent eb1f241 commit c3700a2

File tree

1 file changed

+2
-18
lines changed

1 file changed

+2
-18
lines changed

src/guidellm/dataset/synthetic.py

Lines changed: 2 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -193,9 +193,9 @@ def _create_prompt(self, prompt_tokens: int, start_index: int, request_id: int)
193193
Generated prompt string with unique prefix
194194
"""
195195
if prompt_tokens <= 0:
196-
return self._create_unique_prefix(request_id)
196+
return f"{request_id}: "
197197

198-
unique_prefix = self._create_unique_prefix(request_id)
198+
unique_prefix = f"{request_id}: "
199199

200200
# Calculate how many tokens the prefix uses
201201
prefix_tokens = len(self.processor.tokenize(unique_prefix))
@@ -222,22 +222,6 @@ def _create_prompt(self, prompt_tokens: int, start_index: int, request_id: int)
222222
base_text = self.text_creator.create_text(start_index, left - start_index)
223223
return unique_prefix + base_text
224224

225-
def _create_unique_prefix(self, request_id: int) -> str:
226-
"""
227-
Create a unique prefix that will never match any other request.
228-
"""
229-
230-
# microseconds
231-
timestamp = int(time.time() * 1000000)
232-
random.seed(request_id + timestamp)
233-
random_component = random.randint(100000, 999999)
234-
235-
prefix_parts = [
236-
f"{random_component}",
237-
]
238-
239-
return f"{'_'.join(prefix_parts)}: "
240-
241225

242226
class SyntheticDatasetCreator(DatasetCreator):
243227
@classmethod

0 commit comments

Comments
 (0)