Skip to main content
SynapsAI Cloud launches complete models: a Hugging Face repo or a model artifact that holds the full weights. A LoRA adapter on its own (the small adapter_model.safetensors file and adapter_config.json) is not a complete model, so it cannot be launched directly. To use an adapter, merge it into the base model it was trained on. The result is a normal model directory with Safetensors weights. You then upload it as an artifact or push it to the Hub, and launch it like any other model.
Merging bakes the adapter into the weights. The merged model runs at the same speed and cost as the base model, with no adapter overhead at inference time. Each merged adapter is its own model, so it is its own artifact and its own deployment.

Before you start

  • The exact base model. An adapter only works with the model it was trained on. Open the adapter’s adapter_config.json and read base_model_name_or_path. Use that repo and revision.
  • An adapter in PEFT format. The directory contains adapter_config.json and adapter_model.safetensors (or adapter_model.bin). This is what peft and most fine-tuning tools (TRL, Axolotl, Unsloth, LLaMA-Factory) produce. The adapter can be local or on the Hub.
  • Enough memory. Merging loads the full base model. Plan for roughly the size of the model in 16-bit weights (about 2 GB per billion parameters) in CPU RAM or on a GPU. A GPU is faster, but CPU works.
  • Disk space for the base model, the adapter, and the merged output.
  • A Hugging Face token if the base model is gated or private.

Merge with PEFT

This example merges an adapter into a text generation model. It loads the base model in 16-bit, applies the adapter, folds it into the weights, and saves the result.
merge_and_unload() returns a plain Transformers model with no PEFT wrappers, so the saved directory has the same layout as the base model.

Tips

Load the base in the precision you want to serve, usually torch.bfloat16 or torch.float16. Merged weights are stored in that precision. If you want a smaller or cheaper deployment, merge in 16-bit first, then pick a quantization in the launch wizard.
Do not merge into a 4-bit or 8-bit base. Rounding errors from the quantized weights end up in the merged model. Load the base in full 16-bit precision (as in the example above), apply the adapter, and merge there. QLoRA adapters merge fine this way.
If you added special tokens during fine-tuning, the adapter directory contains its own tokenizer files. Load the tokenizer from the adapter directory instead of the base, and resize the embeddings before applying the adapter:
Adapters that also trained embed_tokens or lm_head (listed under modules_to_save in adapter_config.json) are handled by the same steps.
Use the Auto class that matches the base model’s task and architecture, for example AutoModelForSequenceClassification for classification or AutoModelForSpeechSeq2Seq for speech recognition. For vision-language models and other models with a processor, also save it with AutoProcessor.from_pretrained(base_id).save_pretrained(output_dir). For diffusion models, merge the adapter into the pipeline component it targets (usually the UNet or transformer) and save the full pipeline.
adapter_path can be a Hub repo id such as your-org/my-adapter. Run huggingface-cli login first if it is private.

Check the merged model

Before you upload, confirm the output is complete and behaves like your fine-tuned model. 1. Check the files
You should see config.json, one or more .safetensors files (plus model.safetensors.index.json when sharded), generation_config.json, and the tokenizer files. There should be no adapter_config.json and no adapter_model.safetensors. 2. Run a quick generation
Compare the output with what you saw from the adapter during fine-tuning. If the output looks like the plain base model, see Troubleshooting below.

Upload and launch

You have two options. Both end in the same launch wizard.

Option 1: Upload as a model artifact

Use this for private weights or when you do not want to publish to the Hub. Create the artifact with the text-generation pipeline (or the pipeline that matches your model) and upload the merged directory:
Or with the CLI, once the artifact exists:
When the status is ready, open the launch wizard and select the artifact as the model source. See Model artifacts for the full upload API.

Option 2: Push to Hugging Face

Add a pipeline_tag to the repo’s README.md (for example pipeline_tag: text-generation), then launch it from the wizard. Private repos need a Hugging Face token in the wizard. See Hugging Face setup for the full repository checklist.

Call the merged model

After launch, call it like any other deployment. The model field is your deployment id:
See Call the API for the SDK and OpenAI-compatible client examples.

Troubleshooting

Next steps

Model artifacts

Upload the merged weights and select them at launch.

Launch a model

Set workers, precision, and pricing for the deployment.

Convert to Safetensors

Convert .bin or .pt weights if your adapter or base uses them.

Optimizing costs

Quantize the merged model and tune context length.