From e4c3e1bdd2ceeb483f8c103df67640f7672fde00 Mon Sep 17 00:00:00 2001 From: Ravindra Marella Date: Sun, 27 Aug 2023 19:23:48 +0530 Subject: [PATCH] Fix ctransformers model unload (#3711) Add missing comma in model types list Fixes marella/ctransformers#111 --- modules/ctransformers_model.py | 8 ++++---- modules/loaders.py | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/modules/ctransformers_model.py b/modules/ctransformers_model.py index 60b34e72..70ce92f5 100644 --- a/modules/ctransformers_model.py +++ b/modules/ctransformers_model.py @@ -10,8 +10,8 @@ class CtransformersModel: pass @classmethod - def from_pretrained(self, path): - result = self() + def from_pretrained(cls, path): + result = cls() config = AutoConfig.from_pretrained( str(path), @@ -24,13 +24,13 @@ class CtransformersModel: mlock=shared.args.mlock ) - self.model = AutoModelForCausalLM.from_pretrained( + result.model = AutoModelForCausalLM.from_pretrained( str(result.model_dir(path) if result.model_type_is_auto() else path), model_type=(None if result.model_type_is_auto() else shared.args.model_type), config=config ) - logger.info(f'Using ctransformers model_type: {self.model.model_type} for {self.model.model_path}') + logger.info(f'Using ctransformers model_type: {result.model.model_type} for {result.model.model_path}') return result, result def model_type_is_auto(self): diff --git a/modules/loaders.py b/modules/loaders.py index b949c325..45a4e933 100644 --- a/modules/loaders.py +++ b/modules/loaders.py @@ -304,7 +304,7 @@ loaders_model_types = { "gptneox", "llama", "mpt", - "dollyv2" + "dollyv2", "replit", "starcoder", "gptbigcode",