翻篇收录说明
翻篇网页快照

Specialized Model Inference on Serverless - Fireworks AI Docs

https://docs.fireworks.ai/serverless/specialized-model-inference/overview

最近抓取:2026-12-04 03:45:20(北京时间)

最近内容变化:2026-12-04 03:45:20(北京时间)

这是最近一次有效抓取的文本快照,不含网页脚本、图片和动态交互内容。实际网页可能已更新。

访问原网页

页面简介

Serve your LoRA adapters on shared serverless GPUs, pay per token, and go from a dataset to a live adapter in three steps.

正文摘录

Preview Specialized Model Inference is in Preview and available on request. To request access, contact your account team or support@fireworks.ai. You can try the public adapter without access. How it works Specialized Model Inference runs your LoRA adapters on Fireworks’ shared serverless pool. You don’t create or pay for a deployment. You load an adapter, call it like any serverless model, and pay per token at the base model’s price. Supported models and limits Adapters must be trained on a supported model: ModelModel IDMax LoRA rankGLM 5.3 Flashaccounts/fireworks/models/glm-5p3-flash64 Adapters load on this serverless base model: Serverless base modelMax adapters loaded at a timeGLM 5.3 Flash Multi-LoRA3 We plan to support more base models over time. Adapters trained on any other base model can’t be loaded onto serverless - please use a dedicated deployment. Each account can load up to 3 LoRA adapters per base model at a time. Loading a fourth returns ResourceExhausted. Unload an adapter to free up a slot. If you need more slots, contact support@fireworks.ai or your account team. Get started Go from a dataset to a live adapter in three steps. You need firectl 1.8.15 or later. Setup: install firectl, sign in and set your variables1Install or upgrade firectlfirectl upgrade firectl version 2Sign infirectl signin firectl acts on the account you sign in to. If you belong to more than one account, pass -a <ACCOUNT_ID> on each command, or check which account is active before loading anything.3Set your variablesFill these in once. Every command below reads them.export FIREWORKS_API_KEY="fw_..." # an API key from the account that owns the adapter export ACCOUNT_ID="your-account-id" # the account that owns the adapter The examples name the adapter my-lora and train it on GLM 5.3 Flash (accounts/fireworks/models/glm-5p3-flash). Replace my-lora with your adapter’s ID wherever it appears. Step 1. Train a LoRA adapter on a supported model Skip this step if you already have an adapter in the READY state on a supported base model. Serverless Training API Import an adapterTrain on Fireworks’ shared serverless trainer pool with the Serverless Training API. You pay per token and don’t provision a trainer.1Install the cookbookgit clone https://github.com/fw-ai-external/cookbook pip install -e ./cookbook/training cd cookbook 2Run serverless SFTSave this as train_my_lora.py in the cookbook folder and point dataset at a chat-format JSONL file. serverless=True runs the job on the serverless trainer pool. lora_rank must be 64 or lower. When training finishes, output_model_id saves the adapter to your account as my-lora.from training.recipes import sft_loop if __name__ == "__main__": sft_loop.main(sft_loop.Config( serverless=True, base_model="accounts/fireworks/models/glm-5p3-flash", tokenizer_model="zai-org/GLM-5.3-Flash", renderer_name="glm53_flash", dataset="./train.jsonl", lora_rank=16, max_seq_len=4096, epochs=3, log_path="./my-lora-run", output_model_id="my-lora", )) python train_my_lora.py 3Check the adapterfirectl model get my-lora The adapter is ready to load when its state is READY.If you trained an adapter elsewhere, import it as a Hugging Face PEFT folder. The folder needs adapter_config.json and adapter_model.safetensors, and the rank must be between 4 and 64.firectl model create my-lora ./my_adapter/ \ --base-model accounts/fireworks/models/glm-5p3-flash Step 2. Deploy it on serverless firectl Console RESTfirectl model load-lora my-lora --serverless --wait Loading takes under 5 minutes. firectl waits for the adapter to deploy, then for the serving pods to pick it up, and prints LoRA model loaded successfully when it’s done:Check what’s loaded, on serverless and on any dedicated deployments:firectl deployed-model list textNAME MODEL SERVERLESS STATE DEFAULT accounts/my-account/deployedModels/my-lora-hnywzke6 accounts/my-account/models/my-lora true DEPLOYED true firectl model get my-lora shows the same copies under Deployed Model Refs. A trained adapter with no refs is READY but not loaded, and calls to it return 404.A copy can sit in DEPLOYING until it receives its first request. If the state hasn’t moved after the load command returned, send one request; the first call completes the load.Open the adapter in Custom Models, click Deploy, and choose Deploy to SMI.A progress card shows each step: checking the model, loading it onto the base model’s servers, warming up, and ready to call. Loading takes under 5 minutes, and you can leave the page while it runs. The badge next to the model’s name reads Deploying to SMI until it’s done.When loading finishes, the badge changes to On SMI and the page shows the code to call your model.curl -X POST "https://api.fireworks.ai/v1/accounts/$ACCOUNT_ID/deployedModels" \ -H "Authorization: Bearer $FIREWORKS_API_KEY" \ -H "Content-Type: application/json" \ -d "{\"model\": \"accounts/$ACCOUNT_ID/models/my-lora\", \"serverless\": true}" The response includes the deployed model’s ID. Save it, because you need it to unload over REST. Step 3. Call the serverless endpoint Expect the first call to take up to a minute. The first request after loading downloads the adapter onto a GPU, so it can take up to a minute to return. Later requests run at about the base model’s speed. load-lora --wait and the console’s Deploy to SMI both wait for the adapter to finish loading before they report it ready. If you loaded it over REST or ran load-lora without --wait, a call made before loading finishes can return 404. Wait a minute and retry the same request before you troubleshoot. See Latency. Send the same prompt to the base model and to the adapter, and compare the two replies. The example needs jq. PROMPT="paste a held-out example from your dataset here" for MODEL in accounts/fireworks/models/glm-5p3-flash accounts/$ACCOUNT_ID/models/my-lora; do echo "== $MODEL" curl -sS --fail-with-body https://api.fireworks.ai/inference/v1/chat/completions \ -H "Authorization: Bearer $FIREWORKS_API_KEY" \ -H "Content-Type: application/json" \ -d "$(jq -n --arg m "$MODEL" --arg p "$PROMPT" \ '{model: $m, messages: [{role: "user", content: $p}], max_tokens: 300, reasoning_effort: "low"}')" \ | jq -r '.choices[0].message.content // .' done GLM 5.3 Flash is a reasoning model and thinks at maximum effort unless you set reasoning_effort. Without it, a 300-token cap can be used up by the hidden reasoning and content comes back empty. Set reasoning_effort to low for an adapter trained on short answers, or raise max_tokens. Which model string to use There is no #serverless suffix. Use one of these: model stringGoes toaccounts/<ACCOUNT_ID>/models/<LORA_ID> (or the short form <ACCOUNT_ID>/<LORA_ID>)The default copy. The first copy you load becomes the default, whether it is serverless or dedicated. Change it with firectl deployed-model update <DEPLOYED_MODEL_ID> --default.accounts/<ACCOUNT_ID>/deployedModels/<DEPLOYED_MODEL_ID>That specific copy. Use this when the adapter is loaded on both serverless and a dedicated deployment.accounts/<ACCOUNT_ID>/models/<LORA_ID>#accounts/<ACCOUNT_ID>/deployments/<DEPLOYMENT_ID>Always that dedicated deployment. accounts/<ACCOUNT_ID>/models/<LORA_ID>#<ACCOUNT_ID>/<DEPLOYMENT_ID> is the short form. Clean up: unload the adapter Unloading frees one of your account’s 3 adapter slots for that base model. firectl takes the adapter ID; REST takes the deployed model ID. firectl RESTfirectl model unload-lora my-lora --serverless --wait --wait returns once the adapter is fully unloaded. Without it, the command returns right away and calls to the adapter can keep succeeding for a short time.REST unloads by the deployed model’s ID, not the adapter’s ID. If you didn’t save it from the load response, look it up (this needs jq):DEPLOYED_MODEL_ID=$(curl -s "https://api.fireworks.ai/v1/accounts/$ACCOUNT_ID/deployedModels" \ -H "Authorization: Bearer $FIREWORKS_API_KEY" | jq -r --arg m "accounts/$ACCOUNT_ID/models/my-lora" \ '.deployedModels[] | select(.model == $m and .serverless == true) | .name | split("/") | last') echo "$DEPLOYED_MODEL_ID" Then unload it:curl -X DELETE "https://api.fireworks.ai/v1/accounts/$ACCOUNT_ID/deployedModels/$DEPLOYED_MODEL_ID" \ -H "Authorization: Bearer $FIREWORKS_API_KEY" Try a public adapter Fireworks keeps a public adapter loaded on serverless. Any account can call it with an API key, and you don’t need to load it. accounts/fireworks/models/glm5p3-flash-us-caveman-lora is a rank-64 adapter on GLM 5.3 Flash, trained to answer in as few words as possible. curl Python (OpenAI client)PROMPT="Facts: Order #4821 shipped on May 3 via UPS. Expected delivery is May 7. The package weighs 2.4 kg. Question: When will my order arrive?" for MODEL in accounts/fireworks/models/glm5p3-flash-us-caveman-lora accounts/fireworks/models/glm-5p3-flash; do echo "== $MODEL" curl -sS --fail-with-body https://api.fireworks.ai/inference/v1/chat/completions \ -H "Authorization: Bearer $FIREWORKS_API_KEY" \ -H "Content-Type: application/json" \ -d "$(jq -n --arg m "$MODEL" --arg p "$PROMPT" \ '{model: $m, messages: [{role: "user", content: $p}], max_tokens: 300, reasoning_effort: "low"}')" \ | jq -r '.choices[0].message.content // .' done The example needs jq.import os from openai import OpenAI client = OpenAI( base_url="https://api.fireworks.ai/inference/v1", api_key=os.environ["FIREWORKS_API_KEY"], timeout=300, ) prompt = [{ "role": "user", "content": "Facts: Order #4821 shipped on May 3 via UPS. Expected delivery is May 7. " "The package weighs 2.4 kg. Question: When will my order arrive?", }] for model in ( "accounts/fireworks/models/glm5p3-flash-us-caveman-lora", "accounts/fireworks/models/glm-5p3-flash", ): response = client.chat.completions.create( model=model, messages=prompt, max_tokens=300, reasoning_effort="low", ) print(f"== {model}\n{response.choices[0].message.content}") text== accounts/fireworks/models/glm5p3-flash-us-caveman-lora May 7. == accounts/fireworks/models/glm-5p3-flash Your order #4