Created
July 23, 2024 15:41
-
-
Save satpalsr/e1bdf4312b672c176a1033168fb8796b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from dataformer.components.evol_instruct import EvolInstruct | |
from dataformer.llms import AsyncLLM | |
from datasets import load_dataset | |
# Take any sample dataset | |
dataset = load_dataset("dataformer/self-knowledge") | |
datasetsub = dataset["train"].select(range(2)) | |
instructions = [example["question"] for example in datasetsub] | |
llm = AsyncLLM(api_provider="together", | |
model="meta-llama/Meta-Llama-3.1-405B-Instruct-Turbo", | |
sampling_params={"temperature": 0.6, "top_p": 1}) | |
evol_instruct = EvolInstruct( | |
llm=llm, | |
num_evolutions=2, # Number of times to evolve each instruction | |
store_evolutions=True, # Store all evolutions | |
generate_answers=True, # Generate answers for the evolved instructions | |
# include_original_instruction=True # Include the original instruction in the results | |
) | |
results = evol_instruct.generate(instructions) | |
print(results) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment