RAM optimizations and faster launch

This commit is contained in:
DeepBeepMeep
2025-03-25 00:14:14 +01:00
parent 7576ccc6ba
commit 1949b61a20
10 changed files with 103 additions and 55 deletions

View File

@@ -519,8 +519,11 @@ class CLIPModel:
device=device)
self.model = self.model.eval().requires_grad_(False)
logging.info(f'loading {checkpoint_path}')
self.model.load_state_dict(
torch.load(checkpoint_path, map_location='cpu'), assign= True)
from mmgp import offload
# self.model.load_state_dict(
# torch.load(checkpoint_path, map_location='cpu'), assign= True)
offload.load_model_data(self.model, checkpoint_path.replace(".pth", "-bf16.safetensors"), writable_tensors= False)
# init tokenizer
self.tokenizer = HuggingfaceTokenizer(