mmgp 3.4.2__py3-none-any.whl → 3.4.3__py3-none-any.whl

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.

mmgp/offload.py CHANGED
@@ -1,4 +1,4 @@
1
- # ------------------ Memory Management 3.4.2 for the GPU Poor by DeepBeepMeep (mmgp)------------------
1
+ # ------------------ Memory Management 3.4.3 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
@@ -619,7 +619,7 @@ def _welcome():
619
619
  if welcome_displayed:
620
620
  return
621
621
  welcome_displayed = True
622
- print(f"{BOLD}{HEADER}************ Memory Management for the GPU Poor (mmgp 3.4.1) by DeepBeepMeep ************{ENDC}{UNBOLD}")
622
+ print(f"{BOLD}{HEADER}************ Memory Management for the GPU Poor (mmgp 3.4.3) by DeepBeepMeep ************{ENDC}{UNBOLD}")
623
623
 
624
624
  def change_dtype(model, new_dtype, exclude_buffers = False):
625
625
  for submodule_name, submodule in model.named_modules():
@@ -1749,7 +1749,7 @@ class offload:
1749
1749
  @torch.compiler.disable()
1750
1750
  def gpu_unload_blocks(self, model_id, blocks_name):
1751
1751
  # cl = clock.start()
1752
- if blocks_name != None:
1752
+ if blocks_name != None and blocks_name == self.loaded_blocks[model_id]:
1753
1753
  self.loaded_blocks[model_id] = None
1754
1754
 
1755
1755
 
@@ -1805,7 +1805,13 @@ class offload:
1805
1805
 
1806
1806
  loaded_block = self.loaded_blocks[model_id]
1807
1807
  if loaded_block != None:
1808
- self.gpu_unload_blocks(model_id, loaded_block)
1808
+ self.gpu_unload_blocks(model_id, loaded_block)
1809
+ entry_name = model_id + "/" + loaded_block
1810
+ next_blocks_entry = self.next_blocks_names[entry_name] if entry_name in self.next_blocks_names else None
1811
+ if next_blocks_entry != None:
1812
+ pos = next_blocks_entry.rfind("/")
1813
+ torch.cuda.synchronize()
1814
+ self.gpu_unload_blocks(model_id, next_blocks_entry[pos+1:])
1809
1815
  self.loaded_blocks[model_id] = None
1810
1816
 
1811
1817
  self.active_models = []
@@ -2297,6 +2303,8 @@ def all(pipe_or_dict_of_modules, pinnedMemory = False, pinnedPEFTLora = False, p
2297
2303
  if model_dtype== None:
2298
2304
  model_dtype = dtype
2299
2305
  else:
2306
+ if model_dtype != dtype:
2307
+ pass
2300
2308
  assert model_dtype == dtype
2301
2309
  current_model_size += torch.numel(p.data) * p.data.element_size()
2302
2310
  current_model._dtype = model_dtype
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: mmgp
3
- Version: 3.4.2
3
+ Version: 3.4.3
4
4
  Summary: Memory Management for the GPU Poor
5
5
  Author-email: deepbeepmeep <deepbeepmeep@yahoo.com>
6
6
  License: GNU GENERAL PUBLIC LICENSE
@@ -17,7 +17,7 @@ Dynamic: license-file
17
17
 
18
18
 
19
19
  <p align="center">
20
- <H2>Memory Management 3.4.1 for the GPU Poor by DeepBeepMeep</H2>
20
+ <H2>Memory Management 3.4.3 for the GPU Poor by DeepBeepMeep</H2>
21
21
  </p>
22
22
 
23
23
 
@@ -0,0 +1,9 @@
1
+ __init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
2
+ mmgp/__init__.py,sha256=A9qBwyQMd1M7vshSTOBnFGP1MQvS2hXmTcTCMUcmyzE,509
3
+ mmgp/offload.py,sha256=fR6ACUxT4rVIbfxM8p-bkKCbNYwZi6061yyfjzCEnlM,114769
4
+ mmgp/safetensors2.py,sha256=GFbyNrQpvtV1RTen6_iUl47LC3jtM0PMtB9dsERTElY,18355
5
+ mmgp-3.4.3.dist-info/licenses/LICENSE.md,sha256=HjzvY2grdtdduZclbZ46B2M-XpT4MDCxFub5ZwTWq2g,93
6
+ mmgp-3.4.3.dist-info/METADATA,sha256=PXvefWGCj1dt5XmXvP5NXoq6W7wuDaZaCkuyp_i_2tY,16350
7
+ mmgp-3.4.3.dist-info/WHEEL,sha256=0CuiUZ_p9E4cD6NyLD6UG80LBXYyiSYZOKDm5lp32xk,91
8
+ mmgp-3.4.3.dist-info/top_level.txt,sha256=waGaepj2qVfnS2yAOkaMu4r9mJaVjGbEi6AwOUogU_U,14
9
+ mmgp-3.4.3.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: setuptools (80.3.0)
2
+ Generator: setuptools (80.3.1)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
5
 
@@ -1,9 +0,0 @@
1
- __init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
2
- mmgp/__init__.py,sha256=A9qBwyQMd1M7vshSTOBnFGP1MQvS2hXmTcTCMUcmyzE,509
3
- mmgp/offload.py,sha256=WG2yJEBTZ8BBdutJN5_eUUby_eGEUky68pwNH1p4-PU,114217
4
- mmgp/safetensors2.py,sha256=GFbyNrQpvtV1RTen6_iUl47LC3jtM0PMtB9dsERTElY,18355
5
- mmgp-3.4.2.dist-info/licenses/LICENSE.md,sha256=HjzvY2grdtdduZclbZ46B2M-XpT4MDCxFub5ZwTWq2g,93
6
- mmgp-3.4.2.dist-info/METADATA,sha256=THPFQEc2FzUzAcm8WpW_CuO0IPJThvisNMeq-oJO2CQ,16350
7
- mmgp-3.4.2.dist-info/WHEEL,sha256=GHB6lJx2juba1wDgXDNlMTyM13ckjBMKf-OnwgKOCtA,91
8
- mmgp-3.4.2.dist-info/top_level.txt,sha256=waGaepj2qVfnS2yAOkaMu4r9mJaVjGbEi6AwOUogU_U,14
9
- mmgp-3.4.2.dist-info/RECORD,,