Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove batch_kwargs #122

Closed
wants to merge 10 commits into from
6 changes: 4 additions & 2 deletions scripts/test_freeform_skills.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
# First Party
from src.instructlab.sdg import SDG
from src.instructlab.sdg.default_flows import SynthSkillsFlow
from src.instructlab.sdg.pipeline import Pipeline
from src.instructlab.sdg.pipeline import Pipeline, PipelineContext

# for vLLM endpoints, the api_key remains "EMPTY"
openai_api_key = "EMPTY"
Expand Down Expand Up @@ -49,7 +49,9 @@

ds = Dataset.from_list(samples)

skills_flow = SynthSkillsFlow(client, "mixtral", teacher_model, 1).get_flow()
ctx = PipelineContext(client, "mixtral", teacher_model, 1)

skills_flow = SynthSkillsFlow(ctx).get_flow()
skills_pipe = Pipeline(skills_flow)

sdg = SDG([skills_pipe])
Expand Down
6 changes: 4 additions & 2 deletions scripts/test_grounded_skills.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
# First Party
from src.instructlab.sdg import SDG
from src.instructlab.sdg.default_flows import SynthGroundedSkillsFlow
from src.instructlab.sdg.pipeline import Pipeline
from src.instructlab.sdg.pipeline import Pipeline, PipelineContext

# for vLLM endpoints, the api_key remains "EMPTY"
openai_api_key = "EMPTY"
Expand Down Expand Up @@ -97,7 +97,9 @@

ds = Dataset.from_list(samples)

skills_flow = SynthGroundedSkillsFlow(client, "mixtral", teacher_model, 10).get_flow()
ctx = PipelineContext(client, "mixtral", teacher_model, 10)

skills_flow = SynthGroundedSkillsFlow(ctx).get_flow()
skills_pipe = Pipeline(skills_flow)

sdg = SDG([skills_pipe])
Expand Down
13 changes: 7 additions & 6 deletions scripts/test_knowledge.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
# First Party
from src.instructlab.sdg import SDG
from src.instructlab.sdg.default_flows import MMLUBenchFlow, SynthKnowledgeFlow
from src.instructlab.sdg.pipeline import Pipeline
from src.instructlab.sdg.pipeline import Pipeline, PipelineContext

# Please don't add you vLLM endpoint key here
openai_api_key = "EMPTY"
Expand Down Expand Up @@ -38,12 +38,13 @@

ds = Dataset.from_list(samples)

mmlu_flow = MMLUBenchFlow(client, "mixtral", teacher_model, 1).get_flow()
knowledge_flow = SynthKnowledgeFlow(client, "mixtral", teacher_model, 1).get_flow()
knowledge_pipe = Pipeline(knowledge_flow)
mmlu_pipe = Pipeline(mmlu_flow)
ctx = PipelineContext(client, "mixtral", teacher_model, 1)

sdg = SDG([mmlu_pipe, knowledge_pipe])
mmlu_flow = MMLUBenchFlow(ctx).get_flow()
knowledge_flow = SynthKnowledgeFlow(ctx).get_flow()
knowledge_pipe = Pipeline(mmlu_flow + knowledge_flow)

sdg = SDG([knowledge_pipe])
mmlubench_data = sdg.generate(ds)

print(mmlubench_data)
Expand Down
9 changes: 8 additions & 1 deletion src/instructlab/sdg/block.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
from abc import ABC
from collections import ChainMap
from typing import Any, Dict, Union
import os.path

# Third Party
import yaml
Expand All @@ -14,7 +15,8 @@


class Block(ABC):
def __init__(self, block_name: str) -> None:
def __init__(self, ctx, block_name: str) -> None:
self.ctx = ctx
self.block_name = block_name

@staticmethod
Expand All @@ -41,8 +43,13 @@ def _load_config(self, config_path: str) -> Union[Dict[str, Any], None]:
"""
Load the configuration file for this block.

If the supplied configuration file is a relative path, it is assumed
to be part of this Python package.

:param config_path: The path to the configuration file.
:return: The loaded configuration.
"""
if not os.path.isabs(config_path):
config_path = os.path.join(self.ctx.sdg_base, config_path)
with open(config_path, "r", encoding="utf-8") as config_file:
return yaml.safe_load(config_file)
Loading