sgl-project / sglang

SGLang is a fast serving framework for large language models and vision language models.
https://sgl-project.github.io/
Apache License 2.0
6.1k stars 509 forks source link

Loading a BNB 4 bit model + adapter #374

Closed timothelaborie closed 3 months ago

timothelaborie commented 7 months ago

After doing QLoRA with a training library (unsloth) and saving the adapter, is there a way to load the 4 bit bnb model and the un-merged adapter for use with sglang? Last time I tried loading a model from an hf repo that has only the adapter, sglang complained about how it's not a valid model

timothelaborie commented 6 months ago

To be more specific, I have a file called adapter_config.json:

{
  "alpha_pattern": {},
  "auto_mapping": null,
  "base_model_name_or_path": "unsloth/tinyllama-bnb-4bit",
  "bias": "none",
  "fan_in_fan_out": false,
  "inference_mode": true,
  "init_lora_weights": true,
  "layers_pattern": null,
  "layers_to_transform": null,
  "loftq_config": {},
  "lora_alpha": 16,
  "lora_dropout": 0,
  "megatron_config": null,
  "megatron_core": "megatron.core",
  "modules_to_save": null,
  "peft_type": "LORA",
  "r": 16,
  "rank_pattern": {},
  "revision": "unsloth",
  "target_modules": [
    "v_proj",
    "o_proj",
    "q_proj",
    "k_proj",
    "down_proj",
    "gate_proj",
    "up_proj"
  ],
  "task_type": "CAUSAL_LM",
  "use_rslora": true
}

When I try to load it with SGL it says: lora_model does not appear to have a file named config.json.

github-actions[bot] commented 3 months ago

This issue has been automatically closed due to inactivity. Please feel free to reopen it if needed.