Empty cache on model reload
This commit is contained in:
@@ -2,6 +2,7 @@ from pathlib import Path
|
|||||||
|
|
||||||
import torch
|
import torch
|
||||||
from comfy.utils import ProgressBar
|
from comfy.utils import ProgressBar
|
||||||
|
from comfy.model_management import soft_empty_cache
|
||||||
from exllama.alt_generator import ExLlamaAltGenerator
|
from exllama.alt_generator import ExLlamaAltGenerator
|
||||||
from exllama.model import ExLlama, ExLlamaCache, ExLlamaConfig
|
from exllama.model import ExLlama, ExLlamaCache, ExLlamaConfig
|
||||||
from exllama.tokenizer import ExLlamaTokenizer
|
from exllama.tokenizer import ExLlamaTokenizer
|
||||||
@@ -73,6 +74,7 @@ class Loader:
|
|||||||
|
|
||||||
def load(self, model_dir, max_seq_len):
|
def load(self, model_dir, max_seq_len):
|
||||||
model_dir = Path(model_dir).expanduser()
|
model_dir = Path(model_dir).expanduser()
|
||||||
|
soft_empty_cache()
|
||||||
|
|
||||||
config = ExLlamaConfig(model_dir / "config.json")
|
config = ExLlamaConfig(model_dir / "config.json")
|
||||||
config.model_path = model_dir.glob("*.safetensors")
|
config.model_path = model_dir.glob("*.safetensors")
|
||||||
|
|||||||
Reference in New Issue
Block a user