Commit fffa2e1f authored by Woosuk Kwon's avatar Woosuk Kwon
Browse files

Add model_utils

parent bb59a3e7
from cacheflow.worker.models.opt import OPTForCausalLM from cacheflow.worker.models.model_utils import get_model
__all__ = [ __all__ = [
'OPTForCausalLM', 'get_model',
] ]
import torch.nn as nn
from cacheflow.worker.models.opt import OPTForCausalLM
MODEL_CLASSES = {
'opt': OPTForCausalLM,
}
def get_model(model_name: str) -> nn.Module:
if model_name not in MODEL_CLASSES:
raise ValueError(f'Invalid model name: {model_name}')
return MODEL_CLASSES[model_name].from_pretrained(model_name)
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment