in evolve-instruct/evolve.py [0:0]
def __call__(self, dataset):
"""
Passes dataset to LLM and returns the responses.
:param dataset: Hugging Face dataset containing a 'text' column with prompts.
:return: list of strings with responses.
"""
ret = []
for i, out in enumerate(tqdm(
self.pipeline(
KeyDataset(dataset, "text"),
max_new_tokens=self.max_new_tokens,
batch_size=self.batch_size,
)
)):
# remove input in case pipeline is using completion/plain prompt
response = out[0]["generated_text"]
response = response.replace(dataset[i]['text'], '').strip()
ret.append(response)
return ret