Skip to content

Commit 6a86399

Browse files
committedMar 14, 2025
Update base model to "meta-llama/Meta-Llama-3.1-8B-Instruct" across files
1 parent 42ac430 commit 6a86399

File tree

6 files changed

+268
-39
lines changed

6 files changed

+268
-39
lines changed
 

‎README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ python run.py --openpipe-api-key=opk-your-api-key
4646
- `--openpipe-api-key`: Your OpenPipe API key (required if not set as environment variable)
4747
- `--dataset-name`: Name for the OpenPipe dataset (default: "zenml_dataset")
4848
- `--model-name`: Name for the fine-tuned model (default: "zenml_finetuned_model")
49-
- `--base-model`: Base model to fine-tune (default: "meta-llama/Meta-Llama-3-8B-Instruct")
49+
- `--base-model`: Base model to fine-tune (default: "meta-llama/Meta-Llama-3.1-8B-Instruct")
5050
- `--system-prompt`: System prompt to use for all examples (default: "You are a helpful assistant")
5151
- `--wait-for-completion/--no-wait-for-completion`: Whether to wait for the fine-tuning job to complete (default: wait)
5252
- `--no-cache`: Disable caching for the pipeline run

‎configs/openpipe_finetuning.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ metadata_columns: ["product"]
2222
# openPipe parameters
2323
dataset_name: "ultra_customer_service"
2424
model_name: "customer_service_assistant"
25-
base_model: "meta-llama/Meta-Llama-3-8B-Instruct"
25+
base_model: "meta-llama/Meta-Llama-3.1-8B-Instruct"
2626
enable_sft: true
2727
enable_preference_tuning: false
2828
learning_rate_multiplier: 1.0

‎pipelines/openpipe_finetuning.py

+48-21
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
openpipe_data_converter,
2626
openpipe_dataset_creator,
2727
openpipe_finetuning_starter,
28+
openpipe_finetuning_starter_sdk,
2829
)
2930

3031
logger = get_logger(__name__)
@@ -49,7 +50,7 @@ def openpipe_finetuning(
4950

5051
# Fine-tuning parameters
5152
model_name: str = "zenml_finetuned_model",
52-
base_model: str = "meta-llama/Meta-Llama-3-8B-Instruct",
53+
base_model: str = "meta-llama/Meta-Llama-3.1-8B-Instruct",
5354
enable_sft: bool = True,
5455
enable_preference_tuning: bool = False,
5556
learning_rate_multiplier: float = 1.0,
@@ -61,6 +62,9 @@ def openpipe_finetuning(
6162
verbose_logs: bool = True,
6263
auto_rename: bool = True,
6364
force_overwrite: bool = False,
65+
66+
# Implementation options
67+
use_sdk: bool = False,
6468
):
6569
"""
6670
OpenPipe fine-tuning pipeline.
@@ -93,6 +97,7 @@ def openpipe_finetuning(
9397
verbose_logs: Whether to log detailed model information during polling
9498
auto_rename: If True, automatically append a timestamp to model name if it already exists
9599
force_overwrite: If True, delete existing model with the same name before creating new one
100+
use_sdk: If True, use the Python OpenPipe SDK instead of direct API calls
96101
97102
Returns:
98103
A dictionary with details about the fine-tuning job, including model information
@@ -122,24 +127,46 @@ def openpipe_finetuning(
122127
base_url=base_url,
123128
)
124129

125-
# Start fine-tuning and monitor progress
126-
finetuning_result = openpipe_finetuning_starter(
127-
dataset_id=dataset_id,
128-
model_name=model_name,
129-
base_model=base_model,
130-
openpipe_api_key=openpipe_api_key,
131-
base_url=base_url,
132-
enable_sft=enable_sft,
133-
enable_preference_tuning=enable_preference_tuning,
134-
learning_rate_multiplier=learning_rate_multiplier,
135-
num_epochs=num_epochs,
136-
batch_size=batch_size,
137-
default_temperature=default_temperature,
138-
wait_for_completion=wait_for_completion,
139-
timeout_minutes=timeout_minutes,
140-
verbose_logs=verbose_logs,
141-
auto_rename=auto_rename,
142-
force_overwrite=force_overwrite,
143-
)
130+
# Choose between SDK and direct API implementation
131+
if use_sdk:
132+
# Use the SDK implementation
133+
finetuning_result = openpipe_finetuning_starter_sdk(
134+
dataset_id=dataset_id,
135+
model_name=model_name,
136+
base_model=base_model,
137+
openpipe_api_key=openpipe_api_key,
138+
base_url=base_url,
139+
enable_sft=enable_sft,
140+
enable_preference_tuning=enable_preference_tuning,
141+
learning_rate_multiplier=learning_rate_multiplier,
142+
num_epochs=num_epochs,
143+
batch_size=batch_size,
144+
default_temperature=default_temperature,
145+
wait_for_completion=wait_for_completion,
146+
timeout_minutes=timeout_minutes,
147+
verbose_logs=verbose_logs,
148+
auto_rename=auto_rename,
149+
force_overwrite=force_overwrite,
150+
)
151+
else:
152+
# Use the original direct API implementation
153+
finetuning_result = openpipe_finetuning_starter(
154+
dataset_id=dataset_id,
155+
model_name=model_name,
156+
base_model=base_model,
157+
openpipe_api_key=openpipe_api_key,
158+
base_url=base_url,
159+
enable_sft=enable_sft,
160+
enable_preference_tuning=enable_preference_tuning,
161+
learning_rate_multiplier=learning_rate_multiplier,
162+
num_epochs=num_epochs,
163+
batch_size=batch_size,
164+
default_temperature=default_temperature,
165+
wait_for_completion=wait_for_completion,
166+
timeout_minutes=timeout_minutes,
167+
verbose_logs=verbose_logs,
168+
auto_rename=auto_rename,
169+
force_overwrite=force_overwrite,
170+
)
144171

145-
return finetuning_result
172+
return finetuning_result

‎run.py

+11-2
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@
7979
)
8080
@click.option(
8181
"--base-model",
82-
default="meta-llama/Meta-Llama-3-8B-Instruct",
82+
default="meta-llama/Meta-Llama-3.1-8B-Instruct",
8383
type=click.STRING,
8484
help="Base model to fine-tune.",
8585
)
@@ -141,11 +141,17 @@
141141
default=False,
142142
help="Disable caching for the pipeline run.",
143143
)
144+
@click.option(
145+
"--use-sdk",
146+
is_flag=True,
147+
default=False,
148+
help="Use the Python OpenPipe SDK instead of direct API calls.",
149+
)
144150
def main(
145151
openpipe_api_key: Optional[str] = None,
146152
dataset_name: str = "ultra_customer_service",
147153
model_name: str = "customer_service_assistant",
148-
base_model: str = "meta-llama/Meta-Llama-3-8B-Instruct",
154+
base_model: str = "meta-llama/Meta-Llama-3.1-8B-Instruct",
149155
system_prompt: str = "You are a helpful customer service assistant for Ultra electronics products.",
150156
data_source: str = "toy",
151157
sample_size: int = 30,
@@ -156,6 +162,7 @@ def main(
156162
force_overwrite: bool = False,
157163
fetch_details_only: bool = False,
158164
no_cache: bool = False,
165+
use_sdk: bool = False,
159166
):
160167
"""Main entry point for the OpenPipe fine-tuning pipeline.
161168
@@ -176,6 +183,7 @@ def main(
176183
force_overwrite: If True, delete existing model with the same name before creating new one.
177184
fetch_details_only: Only fetch model details without running the fine-tuning pipeline.
178185
no_cache: If `True` cache will be disabled.
186+
use_sdk: If `True` use the Python OpenPipe SDK instead of direct API calls.
179187
"""
180188
client = Client()
181189

@@ -269,6 +277,7 @@ def main(
269277
"auto_rename": auto_rename,
270278
"force_overwrite": force_overwrite,
271279
"openpipe_api_key": openpipe_api_key,
280+
"use_sdk": use_sdk,
272281
}
273282

274283
# Run the pipeline

‎steps/__init__.py

+1
Original file line numberDiff line numberDiff line change
@@ -26,4 +26,5 @@
2626
)
2727
from .openpipe_finetuning_starter import (
2828
openpipe_finetuning_starter,
29+
openpipe_finetuning_starter_sdk,
2930
)

0 commit comments

Comments
 (0)