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

Fix get_model

parent 531e1c74
......@@ -8,6 +8,7 @@ MODEL_CLASSES = {
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)
for model_class, model in MODEL_CLASSES.items():
if model_class in model_name:
return model.from_pretrained(model_name)
raise ValueError(f'Invalid model name: {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