Fine-tune your models with Bedrock
from portkey_ai import Portkey
# Initialize the Portkey client
portkey = Portkey(
api_key="PORTKEY_API_KEY", # Replace with your Portkey API key
virtual_key="VIRTUAL_KEY", # Add your provider's virtual key
fireworks_account_id="FIREWORKS_ACCOUNT_ID" # Add your fireworks's account id
)
fine_tune_job = portkey.fine_tuning.jobs.create(
training_file="file_id",
model="model_id",
hyperparameters={
"n_epochs": 1
},
validation_file="file_id",
suffix="finetuned_model_name",
)
print(fine_tune_job)
from portkey_ai import Portkey
# Initialize the Portkey client
portkey = Portkey(
api_key="PORTKEY_API_KEY", # Replace with your Portkey API key
virtual_key="VIRTUAL_KEY", # Add your provider's virtual key
fireworks_account_id="FIREWORKS_ACCOUNT_ID" # Add your fireworks's account id
)
# List all fine-tuning jobs
jobs = portkey.fine_tuning.jobs.list(
limit=10 # Optional: Number of jobs to retrieve (default: 20)
)
print(jobs)
from portkey_ai import Portkey
# Initialize the Portkey client
portkey = Portkey(
api_key="PORTKEY_API_KEY", # Replace with your Portkey API key
virtual_key="VIRTUAL_KEY", # Add your provider's virtual key
fireworks_account_id="FIREWORKS_ACCOUNT_ID" # Add your fireworks's account id
)
# Retrieve a specific fine-tuning job
job = portkey.fine_tuning.jobs.retrieve(
job_id="job_id" # The ID of the fine-tuning job to retrieve
)
print(job)
from portkey_ai import Portkey
# Initialize the Portkey client
portkey = Portkey(
api_key="PORTKEY_API_KEY", # Replace with your Portkey API key
virtual_key="VIRTUAL_KEY", # Add your provider's virtual key
fireworks_account_id="FIREWORKS_ACCOUNT_ID" # Add your fireworks's account id
)
# Cancel a fine-tuning job
cancelled_job = portkey.fine_tuning.jobs.cancel(
job_id="job_id" # The ID of the fine-tuning job to cancel
)
print(cancelled_job)
Was this page helpful?