Skip to main content

Model Import

Describes the full workflow for importing a locally trained LoRA model from Alibaba Cloud OSS into Alibaba Cloud Model Studio, covering first-time OSS authorization, model file preparation, import form completion, imported model management, and common issue troubleshooting.

Overview

This page describes the full workflow for importing a locally trained LoRA model from Alibaba Cloud Object Storage Service (OSS) into Alibaba Cloud Model Studio, covering first-time OSS authorization, model file preparation, import form completion, model viewing, management and deletion, and common issue troubleshooting such as import failures and expired models. After a successful import, you can deploy the model. For deployment, scaling, and teardown operations, see Deployment and O&M. For API-based deployment and invocation, see Use API for model deployment. For deployment concepts and billing plan comparison, see Model deployment overview. This page together with those three forms a complete chain of concept, import, deployment, and invocation. The base model field on the import page is dynamically returned by the Model Studio interface with the list of base models currently supported for import, which may update with versions. Please refer to the console's selectable list. Currently supported base models are as follows:
The following list is dynamically returned by the backend interface and may be adjusted with version updates. Please refer to the actual selectable items in the console.

Model family

Model name

Qwen3

Qwen3-32B

Qwen3-14B

Qwen3-8B

Qwen3-4B-Instruct-2507

Qwen3-VL

Qwen3-VL-8B-Instruct

Qwen2.5

Qwen2.5-72B-Instruct

Qwen2.5-32B-Instruct

Qwen2.5-14B-Instruct

Qwen2.5-7B-Instruct

Qwen2.5-VL

Qwen2.5-VL-72B-Instruct

Qwen2.5-VL-7B-Instruct

The training method options depend on the selected base model's declaration. After selecting a base model, the training method field automatically renders options and selects the first one by default. The current version supports importing LoRA models; full-parameter fine-tuned models cannot be imported. The import source is "Import from OSS", selected by default in the form. Importing models from other sources is not supported.
  • Model name: Enter a display name for the model (up to 50 characters).
  • Base model: Select the base model corresponding to your LoRA model.
  • Training method: Select the training method used for the model. Options depend on the selected base model and appear automatically after selection.
  • Import source: Only "Import from OSS" is supported. This option is selected by default.
  • Bucket: Select the OSS bucket that stores your model files.
  • Model directory: Browse and select the directory in the chosen bucket that contains your model checkpoint.
  • Model encryption: To protect your data, the platform enables OSS server-side encryption (SSE-OSS) using fully managed keys. The encryption algorithm is AES256.
  1. After verifying the information, click OK to submit the import request. To cancel, click Cancel to return to the list page. The system validates the model file format and integrity. If validation passes, the import starts. After completion, view the imported model on the My Models page and deploy, fine-tune incrementally, or delete it. Imported model states include the following: Creating (importing), Created (import succeeded, ready to deploy), Creation Failed (import failed), and Expired (model file changed). The list page displays the following 6 columns: model name/ID (with copy button), base model, source, supported deployment methods, status, and operations. The top-right corner provides Import Model and Return to old version entry points. Use the search box at the top to filter models by name.

Prerequisites for completing OSS authorization before the first import

Before importing a model from OSS for the first time, you must complete the OSS service-linked role authorization and add an access tag to the target Bucket. Authorization is completed with one click on the import page. After authorization, the system automatically creates the service-linked role AliyunServiceLinkedRoleForSFMDataHubOSSImport (service name datahub.sfm.aliyuncs.com, permission policy AliyunServiceRolePolicyForSFMDataHubOSSImport), usually taking effect within seconds. For details on the service-linked role, see OSS service-linked role. For concepts and differences between Alibaba Cloud accounts and RAM users, see Permission Management. On the Import Model page, after selecting "Import from OSS" under Import source, if you have not authorized, the OSS field area shows "You have not authorized OSS" with a "Go to authorize" link, and the OK button is unavailable when unauthorized. The authorization path differs for Alibaba Cloud accounts and RAM users; choose by account type.
  • Using an Alibaba Cloud account
  • Using a RAM user
  1. After selecting "Import from OSS" under Import source on the Import Model page, the page shows "You have not authorized OSS". Click "Go to authorize" on the right side of the prompt.
  2. In the dialog box that appears, click "Confirm Authorization". The system automatically creates the service-linked role AliyunServiceLinkedRoleForSFMDataHubOSSImport, usually taking effect within seconds. It may be slightly delayed during peak hours.
  3. Add a tag to the target OSS Bucket: Go to the Bucket list in the OSS management console, find the target Bucket, hover over the icon in the Tag column and click "Go to edit" then "Create Tag", add tag name bailian-datahub-access with value read, and save.
  4. Return to the Import Model page, reselect the target Bucket and try importing again. Model Studio does not support accessing files in the Bucket root directory; you must select an existing subdirectory or create a new one.
After authorization, you must add a tag to the target OSS Bucket: tag name is bailian-datahub-access, tag value is read. This tag marks Buckets accessible by Model Studio. Buckets without this tag are not selectable in the dropdown. Go to the OSS management console to add the tag and reselect. OSS Bucket storage types do not support Archive, Cold Archive, or Deep Cold Archive. Server-side encryption supports OSS fully managed mode; other server-side encryption methods such as KMS-managed keys (SSE-KMS) are not supported. Private Buckets are supported. Model Studio does not support accessing files in the Bucket root directory; you must select an existing subdirectory or create a new one.

Old authorization method upgrade

If you previously used the old authorization method, the Bucket field on the import page shows "We recommend converting to the new Bucket authorization method to improve security" with a "Convert directly" link. Click it and a confirmation box appears; confirm to upgrade to the service-linked role authorization method. The upgrade does not affect existing data.

OSS product not activated

If the Alibaba Cloud account has not activated OSS, the import page shows "You have not activated OSS" with a link to purchase. The Alibaba Cloud account must go to the OSS console to activate OSS, then return to the import page to authorize again.

Prepare LoRA model files

Before importing, place the LoRA model files in a subdirectory of the OSS Bucket per the following requirements (the Bucket root directory is not supported), and pass the system's automatic validation before submission. The model files must be placed directly under the selected subdirectory; the system detects them automatically.
The current version supports importing LoRA models. Full-parameter fine-tuned models are not supported.

Required files and directory structure

The subdirectory must contain the following files: adapter_model.safetensors (LoRA adapter weights, SafeTensors format), adapter_config.json (configuration file containing rank, alpha, and other parameters), and config.json (base model configuration). After selecting a directory, the system automatically validates the format and completeness of these files.

Training parameter constraints

  • rank value: rank must be 8, 16, 32, or 64, and all LoRA layers of the same model must use the same rank value; otherwise the model cannot be imported.
  • Vocabulary cannot be modified: Models that added new tokens or modified the original vocabulary during training cannot be imported; the vocabulary must exactly match the base model's.
  • Chat template cannot be modified: Models that modified the chat_template during training cannot be imported; it must match the base model's default configuration. The chat_template is located in the chat_template field of config.json or tokenizer_config.json.
  • Vision models must freeze VIT: Vision-language models must freeze the Vision Transformer part. If the LoRA adapter contains visual-related weight parameters (i.e., VIT not frozen), the model cannot be imported.
You can run the following script before importing to check whether adapter_model.safetensors contains parameter keys starting with visual, to determine whether VIT is frozen.
from safetensors import safe_open
import argparse

def print_safetensor_structure(file_path):
    print(f"Loading safetensor file: {file_path}")
    print("="*80)

    with safe_open(file_path, framework="pt") as f:
        keys = f.keys()
        print(f"Found {len(keys)} tensors in the file:\n")

        for key in sorted(keys):
            tensor = f.get_tensor(key)
            shape = tuple(tensor.shape)
            dtype = str(tensor.dtype)
            device = tensor.device if hasattr(tensor, 'device') else 'cpu'

            lora_tag = " [LoRA]" if "lora_A" in key or "lora_B" in key else ""

            print(f"[{dtype:>14}] {shape} | {key} {lora_tag}")

if __name__ == "__main__":
    parser = argparse.ArgumentParser(description="Print structure of a .safetensors LoRA adapter.")
    parser.add_argument("filepath", type=str, help="Path to the .safetensors file")
    args = parser.parse_args()

    print_safetensor_structure(args.filepath)
Method: If the script output contains parameter keys starting with visual (such as visual.encoder.layer.0...), the VIT part is not frozen and the model cannot be imported; if it only contains LoRA-related keys such as lora_A and lora_B, the VIT is frozen and the model can be imported.

Pre-submission automatic validation

On the import page, after selecting a model directory, the system automatically calls the file validation interface to check the format and completeness of the model files in the directory. If validation fails, a red prompt appears below the directory field and blocks submission. Fix the files per the prompt before submitting. A common failure cause is missing required files, with error code AvailableModelFileNotFound.

Import LoRA model

After completing OSS authorization and preparing the model files, go to the Model Studio My Models page and click the "Import Model" button in the upper right corner to enter the creation page, then complete the import per the following steps.
  1. On the My Models page, click the "Import Model" button in the upper right corner to enter the import model creation page.
  2. Fill in the model information per the table below. The base model must match the base used for LoRA training, the Bucket must have the bailian-datahub-access=read tag added, and after selecting the model directory the system automatically validates the files.
  3. After confirming the information, click OK to submit. The system automatically validates the file format and completeness, and starts importing after validation passes; to cancel, click Cancel to return to the list page. After import, view the status at Managing imported models.
The fields of the import model form are as follows:

Field

Description

Constraint

Model name

Enter a display name for the model.

Required, up to 50 characters

Base model

Select the base model used for LoRA training; must match the training base.

Required, dropdown select

Training method

Options depend on the selected base model; automatically rendered after selection with the first option selected by default.

Required, dropdown select

Import source

Is "Import from OSS"; no other options.

Read-only, selected by default

Bucket

Select the OSS Bucket storing the model files; only Buckets with the bailian-datahub-access=read tag are listed.

Required, dropdown select

Model directory

Browse and select the subdirectory containing the model Checkpoint in the chosen Bucket; the Bucket root directory cannot be selected.

Required, tree select

Model encryption

Model Studio automatically enables OSS server-side encryption (SSE-OSS) for exported model files, using OSS fully managed keys with AES256 encryption.

Read-only, Model Studio-enforced

If you have not completed OSS authorization, the OK button is unavailable. You must first complete OSS authorization before the first import before submitting. After a successful import, the model can be deployed; for deployment operations, see Deployment and O&M. Imported model states include Creating (importing), Created (ready to deploy), Creation Failed (import failed), and Expired (source files changed).

Managing imported models

After submitting the import, you return to the My Models list page, where you can view and manage all imported models. The list shows model name, model ID (with copy button), base model, source, supported deployment methods, status, creation time, and the Actions column. The upper right corner provides the Import Model entry and a refresh button.

Status and flow

Model states include Creating, Created, Creation Failed, and Expired. Creating means importing is in progress; Created means the import is complete and deployable; Creation Failed means the import was unsuccessful; Expired means the OSS source model files changed after Created. The list silently auto-refreshes every 3 seconds for models in the Creating state, which is normal behavior, not an interface exception. The Creation Failed status has a "Details" link next to it; hover to view the failure error code (such as AvailableModelFileNotFound) and the corresponding oss://bucket/path, used to locate the failed file. The Expired status can be hovered to view a popup showing "Changes detected in the following files" and the list of changed source file names, indicating that re-import is required.

Actions column availability

  • Deploy: Only available for the Created state. Clicking it goes to the deployment creation page; for deployment operations, see Deployment and O&M. The button is unavailable for other states or when no deployment method is available.
  • Incremental training: Models imported from OSS do not support incremental training; the button is unavailable.
  • Delete: Models in the Creating state cannot be deleted; quantized models must be deleted on the model compression page.
After clicking Delete in the Actions column and confirming, only the Model Studio-side model record is removed; OSS source files are not affected. Deleting in other states calls the delete interface to clean up the record.
The delete operation is irreversible: it only removes the Model Studio-side model record; you must re-import to recover. It does not delete the source files in OSS.
The search box at the top of the list can filter models by name and supports clearing and resetting. The source column is rendered by import source: OSS import shows oss://bucket/path, training jobs show the source job ID (if deleted, shows "Training job deleted"), and tags full-parameter, LoRA, or quantization. For calling a deployed model via API, see Use API for model deployment. All operations are performed on a single model; batch delete or batch deploy is not supported.

FAQ

Common issues and handling during the import process.
This error means the model directory file validation did not pass (format or completeness issue); it is not solvable by simply re-uploading files. Check that the selected directory contains complete and compliant adapter_model.safetensors, adapter_config.json, and config.json, and confirm that the rank, vocabulary, chat_template, and other constraints are all met. Fix and reselect the directory to submit.
Expired means that after the model was Created, the OSS source model files changed. This is a normal detection behavior, not a fault. Hover over the Expired status to view the list of changed file names; you must re-import the model to restore availability.
This usually occurs because the Alibaba Cloud account has not activated OSS. The Alibaba Cloud account must go to the OSS console and activate OSS as instructed, then return to the Model Studio Import Model page and try authorizing again.
RAM user authorization failure is because the user lacks permission to create a service-linked role, not a true failure. The Alibaba Cloud account must first create a custom permission policy in the RAM console (action ram:CreateServiceLinkedRole, for service datahub.sfm.aliyuncs.com) and grant it to the RAM user, then the RAM user re-clicks authorize. For details on the OSS service-linked role, see OSS service-linked role.
This is an authorization requirement, not a fault. Under the new authorization method, Buckets without the bailian-datahub-access=read tag are not selectable in the dropdown. Go to the OSS management console to add the tag to the target Bucket, then return to the import page and reselect.
No. When the list detects models in the Creating state, it silently refreshes every 3 seconds to fetch the latest status, and stops automatically when no Creating state exists. This is normal behavior.
For inference parameter alignment, see API deployment guide.
No. Delete only removes the Model Studio-side model record; you must re-import to recover. OSS source files belong to you; Model Studio only reads them via the bailian-datahub-access=read tag, and deleting the model does not modify any files in OSS.
Token Plan
Model Playground
Fine-tuning
Model Compression
Statistics and Monitoring
Support