mmgp 3.6.5__tar.gz → 3.6.6__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of mmgp might be problematic. Click here for more details.

@@ -1,2 +1,2 @@
1
- GNU GENERAL PUBLIC LICENSE
1
+ GNU GENERAL PUBLIC LICENSE
2
2
  Version 3, 29 June 2007
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: mmgp
3
- Version: 3.6.5
3
+ Version: 3.6.6
4
4
  Summary: Memory Management for the GPU Poor
5
5
  Author-email: deepbeepmeep <deepbeepmeep@yahoo.com>
6
6
  Requires-Python: >=3.10
@@ -15,7 +15,7 @@ Dynamic: license-file
15
15
 
16
16
 
17
17
  <p align="center">
18
- <H2>Memory Management 3.6.5 for the GPU Poor by DeepBeepMeep</H2>
18
+ <H2>Memory Management 3.6.4 for the GPU Poor by DeepBeepMeep</H2>
19
19
  </p>
20
20
 
21
21
 
@@ -1,6 +1,6 @@
1
1
 
2
2
  <p align="center">
3
- <H2>Memory Management 3.6.5 for the GPU Poor by DeepBeepMeep</H2>
3
+ <H2>Memory Management 3.6.4 for the GPU Poor by DeepBeepMeep</H2>
4
4
  </p>
5
5
 
6
6
 
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "mmgp"
3
- version = "3.6.5"
3
+ version = "3.6.6"
4
4
  authors = [
5
5
  { name = "deepbeepmeep", email = "deepbeepmeep@yahoo.com" },
6
6
  ]
@@ -1,4 +1,4 @@
1
- # ------------------ Memory Management 3.6.5 for the GPU Poor by DeepBeepMeep (mmgp)------------------
1
+ # ------------------ Memory Management 3.6.6 for the GPU Poor by DeepBeepMeep (mmgp)------------------
2
2
  #
3
3
  # This module contains multiples optimisations so that models such as Flux (and derived), Mochi, CogView, HunyuanVideo, ... can run smoothly on a 24 GB GPU limited card.
4
4
  # This a replacement for the accelerate library that should in theory manage offloading, but doesn't work properly with models that are loaded / unloaded several
@@ -63,7 +63,7 @@ import json
63
63
  import psutil
64
64
  import builtins
65
65
  from accelerate import init_empty_weights
66
-
66
+ from functools import wraps
67
67
  import functools
68
68
  import types
69
69
 
@@ -86,6 +86,14 @@ class QEmbedding(QModuleMixin, torch.nn.Embedding):
86
86
 
87
87
 
88
88
 
89
+ def cudacontext(device):
90
+ def decorator(func):
91
+ @wraps(func)
92
+ def wrapper(*args, **kwargs):
93
+ with torch.device(device):
94
+ return func(*args, **kwargs)
95
+ return wrapper
96
+ return decorator
89
97
 
90
98
 
91
99
  shared_state = {}
@@ -689,7 +697,7 @@ def _welcome():
689
697
  if welcome_displayed:
690
698
  return
691
699
  welcome_displayed = True
692
- print(f"{BOLD}{HEADER}************ Memory Management for the GPU Poor (mmgp 3.6.5) by DeepBeepMeep ************{ENDC}{UNBOLD}")
700
+ print(f"{BOLD}{HEADER}************ Memory Management for the GPU Poor (mmgp 3.6.6) by DeepBeepMeep ************{ENDC}{UNBOLD}")
693
701
 
694
702
  def change_dtype(model, new_dtype, exclude_buffers = False):
695
703
  for submodule_name, submodule in model.named_modules():
@@ -1421,7 +1429,6 @@ def fast_load_transformers_model(model_path: str, do_quantize = False, quantiza
1421
1429
  model = transfomer_class.from_config(transformer_config )
1422
1430
 
1423
1431
 
1424
- torch.set_default_device('cpu')
1425
1432
  model.eval().requires_grad_(False)
1426
1433
 
1427
1434
  model._config = transformer_config
@@ -1432,6 +1439,7 @@ def fast_load_transformers_model(model_path: str, do_quantize = False, quantiza
1432
1439
 
1433
1440
 
1434
1441
 
1442
+ @cudacontext("cpu")
1435
1443
  def load_model_data(model, file_path, do_quantize = False, quantizationType = qint8, pinToMemory = False, partialPinning = False, modelPrefix = None, writable_tensors = True, preprocess_sd = None, postprocess_sd = None, modules = None, return_shared_modules = None, default_dtype = torch.bfloat16, ignore_unused_weights = False, verboseLevel = -1):
1436
1444
  """
1437
1445
  Load a model, detect if it has been previously quantized using quanto and do the extra setup if necessary
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: mmgp
3
- Version: 3.6.5
3
+ Version: 3.6.6
4
4
  Summary: Memory Management for the GPU Poor
5
5
  Author-email: deepbeepmeep <deepbeepmeep@yahoo.com>
6
6
  Requires-Python: >=3.10
@@ -15,7 +15,7 @@ Dynamic: license-file
15
15
 
16
16
 
17
17
  <p align="center">
18
- <H2>Memory Management 3.6.5 for the GPU Poor by DeepBeepMeep</H2>
18
+ <H2>Memory Management 3.6.4 for the GPU Poor by DeepBeepMeep</H2>
19
19
  </p>
20
20
 
21
21
 
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes