LLM()
classLLM
class and
calling a single function. Here’s an example of how to instantiate the latest
Llama 4 Maverick model using the Build SDK.
LLM()
constructor to take full advantage of all of Fireworks’ customization options.
Dataset
object and then calling the .create_supervised_fine_tuning_job()
method on the LLM
object.
Dataset
object and upload the dataset to Fireworks by using from_file()
, from_string()
, or from_list()
, and pass it to the .create_supervised_fine_tuning_job()
method on the LLM
object as we did above.
FIREWORKS_SDK_DEBUG=True
environment variable.
LLM
- Represents a model running on a deploymentDataset
- Represents a dataset used to create a fine-tuning jobSupervisedFineTuningJob
- Represents a fine-tuning jobserverless
hosting is enabled for some commonly-used state of the art models. The pricing for these models is per-token, i.e. you only pay for the tokens you use, and subject to rate limits.on-demand
hosting is enabled for all other models. The pricing for these models is per GPU-second. This hosting is required for models that are not available serverlessly or workloads that exceed serverless rate limits.LLM()
by passing either "serverless"
or "on-demand"
as the deployment_type
parameter to the constructor. If the model is not available for the deployment type you selected, the SDK will throw an error. The SDK can also decide the best deployment strategy on your behalf, just pass deployment_type="auto"
. If the model is available serverlessly, the SDK will use serverless hosting, otherwise the SDK will create an on-demand deployment.
deployment_type="on-demand"
or deployment_type="on-demand-lora"
, you must call .apply()
to apply the deployment configuration to Fireworks. This is not required for serverless deployments. When using deployment_type="auto"
, the SDK will automatically handle deployment creation, but if it falls back to on-demand deployment, you may need to call .apply()
explicitly. If you do not call .apply()
, you are expected to set up the deployment through the deployment page at https://app.fireworks.ai/dashboard/deployments.deployment_type
parameter, especially for "auto"
and "on-demand"
deployments. While the SDK will try to make the most cost effective choice for you and put sensible autoscaling policies in place, it is possible to unintentionally create many deployments that lead to unwanted spend, especially when working with non-serverless models.deployment_type="on-demand"
, you must provide an id
parameter to uniquely identify your deployment. This is required to prevent accidental creation of multiple deployments.deployment_type="serverless"
will try to deploy the finetuned model to serverless hosting, deployment_type="on-demand"
will create an on-demand deployment of your base model and merge in your LoRA weights, deployment_type="on-demand-lora"
will create an on-demand deployment with Multi-LoRA enabled, and deployment_type="auto"
will try to use serverless
if available, otherwise fall back to on-demand-lora
.
deployment_type="on-demand"
, you need to provide:
model
- Your fine-tuned model ID (e.g., "accounts/your-account/models/your-fine-tuned-model-id"
)id
- A unique deployment identifier (can be any simple string like "my-fine-tuned-deployment"
)id
parameter can be any simple string - it does not need to follow the format "accounts/account_id/deployments/model_id"
.Resource | Signature |
---|---|
LLM | id |
Dataset | hash(data) and filename |
SupervisedFineTuningJob | name and model |
LLM
resources, the resource signature is based on the id
parameter. When using deployment_type="on-demand"
, you must provide a unique id
to identify your deployment.
For Dataset
resources, the resource signature is derived from the filename
of your dataset (if created via from_file()
) and the hash of the data itself.
For SupervisedFineTuningJob
resources, you are required to pass a name
when creating the resource.
Resource | Created by SDK if… |
---|---|
LLM | You pass a unique id to the constructor |
Dataset | You change the filename of the data or modify the data itself |
SupervisedFineTuningJob | You pass a unique name when creating the fine-tuning job or use a unique model |