Skip to content

Commit

Permalink
fix: Allow using unsupported base models without adapter loading (#76)
Browse files Browse the repository at this point in the history
  • Loading branch information
tgaddair authored Nov 28, 2023
1 parent ec19332 commit 90b2362
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
4 changes: 2 additions & 2 deletions launcher/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -74,10 +74,10 @@ impl std::fmt::Display for Dtype {
struct Args {
/// The name of the model to load.
/// Can be a MODEL_ID as listed on <https://hf.co/models> like
/// `gpt2` or `OpenAssistant/oasst-sft-1-pythia-12b`.
/// `gpt2` or `mistralai/Mistral-7B-Instruct-v0.1`.
/// Or it can be a local directory containing the necessary files
/// as saved by `save_pretrained(...)` methods of transformers
#[clap(default_value = "bigscience/bloom-560m", long, env)]
#[clap(default_value = "mistralai/Mistral-7B-Instruct-v0.1", long, env)]
model_id: String,

/// The name of the adapter to load.
Expand Down
8 changes: 7 additions & 1 deletion server/lorax_server/models/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,11 @@

from abc import ABC, abstractmethod
from typing import List, Tuple, Optional, TypeVar, Type
from transformers import PreTrainedTokenizerBase, PretrainedConfig
from transformers import PreTrainedTokenizerBase

from lorax_server.models.types import Batch, GeneratedText
from lorax_server.pb.generate_pb2 import InfoResponse
from lorax_server.utils.adapter import BASE_MODEL_ADAPTER_ID

B = TypeVar("B", bound=Batch)

Expand Down Expand Up @@ -101,3 +102,8 @@ def check_initialized(self):
raise RuntimeError(
f"found uninitialized parameters in model {self.__class__.__name__}: {uninitialized_parameters}"
)

def load_adapter(self, adapter_id, adapter_source, adapter_index):
if adapter_id == BASE_MODEL_ADAPTER_ID:
return
raise ValueError("This model does not support adapter loading.")

0 comments on commit 90b2362

Please sign in to comment.