Skip to content

Commit e830108

Browse files
committed
Fix test
Signed-off-by: Rashid Kaleem <230885705+arekay-nv@users.noreply.github.com>
1 parent 5838a69 commit e830108

4 files changed

Lines changed: 15 additions & 10 deletions

File tree

‎src/inference_endpoint/dataset_manager/dataloader.py‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ def __init__(
163163
if parser is None:
164164
# TODO : remove this default implementation
165165
def extract_text_input(row):
166-
return row.text_input
166+
return {"prompt": row["text_input"]} | (self.metadata or {})
167167

168168
self.parser = extract_text_input
169169

@@ -195,7 +195,7 @@ def load(self, force: bool = False):
195195
# note that while we are appending, which is slower, the data may not be sequential and may
196196
# have gaps
197197
self.text_inputs.append(self.parser(data.to_dict()))
198-
198+
199199
self.loaded = True
200200

201201
def num_samples(self):

‎tests/conftest.py‎

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -193,10 +193,7 @@ def ds_pickle_reader(ds_pickle_dataset_path):
193193
"""
194194

195195
def parser(row):
196-
ret = {}
197-
for column in row.index.to_list():
198-
ret[column] = row[column]
199-
return ret
196+
return row
200197

201198
return PickleReader(ds_pickle_dataset_path, parser=parser)
202199

@@ -358,7 +355,7 @@ def parser(x):
358355
Returns:
359356
dict: A dictionary with 'prompt' and 'output' keys derived from the input sample.
360357
"""
361-
return {"prompt": x.text_input, "output": x.ref_output}
358+
return {"prompt": x["text_input"], "output": x["ref_output"]}
362359

363360
self.parser = parser
364361
data_loader = DeepSeekR1ChatCompletionDataLoader(

‎tests/integration/test_end_to_end_oracle.py‎

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,11 @@ async def _run_load_generator_full_run_url(
121121
url, dataset_path, tmp_path, clean_sample_event_hooks, hf_model_name
122122
):
123123
def parser(x):
124-
res = {"prompt": x.text_input, "output": x.ref_output, "model": hf_model_name}
124+
res = {
125+
"prompt": x["text_input"],
126+
"output": x["ref_output"],
127+
"model": hf_model_name,
128+
}
125129
return res
126130

127131
dummy_dataloader = DeepSeekR1ChatCompletionDataLoader(dataset_path, parser)
@@ -181,7 +185,11 @@ async def test_load_generator_full_run_mock_http_oracle_server(
181185
hf_model_name,
182186
):
183187
def parser(x):
184-
res = {"prompt": x.text_input, "output": x.ref_output, "model": hf_model_name}
188+
res = {
189+
"prompt": x["text_input"],
190+
"output": x["ref_output"],
191+
"model": hf_model_name,
192+
}
185193
return res
186194

187195
dummy_dataloader = DeepSeekR1ChatCompletionDataLoader(

‎tests/integration/test_server_roundtrip.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ async def test_ds_chat_completion_data_loader_with_oracle_server(
4040
"""
4141

4242
def parser(x):
43-
return {"prompt": x.text_input, "output": x.ref_output}
43+
return {"prompt": x["text_input"], "output": x["ref_output"]}
4444

4545
ds_chat_completion_data_loader = DeepSeekR1ChatCompletionDataLoader(
4646
ds_pickle_dataset_path, parser=parser

0 commit comments

Comments
 (0)