question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Recent commit results in higher VRAM usage

See original GitHub issue

The commit in question is ed91ab4a30ffdcf7e8773e6b434816f79f5fead8. My system has 8GB of VRAM and is using Torch with ROCm support.

Here are my results with that commit and another from the one before it:

$ python image_from_text.py --text="alien life" --mega --torch --seed 100
Namespace(mega=True, torch=True, text='alien life', seed=100, image_path='generated', sample_token_count=256)
reading files from pretrained/dalle_bart_mega
initializing MinDalleTorch
loading encoder
loading decoder
Traceback (most recent call last):
  File "/home/user/min-dalle/image_from_text.py", line 68, in <module>
    generate_image(
  File "/home/user/min-dalle/image_from_text.py", line 48, in generate_image
    image_generator = MinDalleTorch(is_mega, sample_token_count)
  File "/home/user/min-dalle/min_dalle/min_dalle_torch.py", line 60, in __init__
    self.decoder = self.decoder.cuda()
  File "/home/user/.local/lib/python3.10/site-packages/torch/nn/modules/module.py", line 706, in cuda
    return self._apply(lambda t: t.cuda(device))
  File "/home/user/.local/lib/python3.10/site-packages/torch/nn/modules/module.py", line 595, in _apply
    module._apply(fn)
  File "/home/user/.local/lib/python3.10/site-packages/torch/nn/modules/module.py", line 595, in _apply
    module._apply(fn)
  File "/home/user/.local/lib/python3.10/site-packages/torch/nn/modules/module.py", line 595, in _apply
    module._apply(fn)
  [Previous line repeated 1 more time]
  File "/home/user/.local/lib/python3.10/site-packages/torch/nn/modules/module.py", line 618, in _apply
    param_applied = fn(param)
  File "/home/user/.local/lib/python3.10/site-packages/torch/nn/modules/module.py", line 706, in <lambda>
    return self._apply(lambda t: t.cuda(device))
RuntimeError: HIP out of memory. Tried to allocate 32.00 MiB (GPU 0; 7.98 GiB total capacity; 7.92 GiB already allocated; 58.00 MiB free; 7.93 GiB reserved in total by PyTorch) If reserved memory is >> allocated memory try setting max_split_size_mb to avoid fragmentation.  See documentation for Memory Management and PYTORCH_HIP_ALLOC_CONF
$ git checkout 1ef9b0b
Previous HEAD position was ed91ab4 refactored to load models once and run multiple times
HEAD is now at 1ef9b0b added mega to colab
$ python image_from_text.py --text="alien life" --mega --torch --seed 100
Namespace(mega=True, torch=True, text='alien life', seed=100, image_path='generated', image_token_count=256)
parsing metadata from ./pretrained/dalle_bart_mega
tokenizing text
['Ġalien']
['Ġlife']
text tokens [0, 8925, 742, 2]
loading torch encoder
encoding text tokens
loading torch decoder
sampling image tokens
detokenizing image
MIOpen(HIP): Warning [SQLiteBase] Missing system database file: gfx900_64.kdb Performance may degrade. Please follow instructions to install: https://github.com/ROCmSoftwarePlatform/MIOpen#installing-miopen-kernels-package
saving image to generated.png

Issue Analytics

  • State:closed
  • Created a year ago
  • Reactions:1
  • Comments:10 (8 by maintainers)

github_iconTop GitHub Comments

1reaction
EeveeTeacommented, Jun 30, 2022

Works flawlessly, and looks to be faster too. Thanks for looking into it!

0reactions
kuprelcommented, Jun 30, 2022

Yeah if you’re generating images in a loop you should initialize the model once with MinDalleTorch and then call its method generate_image with a seed and text each time you want another image. The command line script is inefficient to loop over because it loads the entire model every time. The colab shows how to initialize the model then generate

Read more comments on GitHub >

github_iconTop Results From Across the Web

Task Manager Has Shown VRAM USED not ALLOCATED ...
The sum of the memory used by all processes may be higher than the overall GPU memory because graphics memory can be shared...
Read more >
Running Stable Diffusion on Your GPU with Less Than 10Gb ...
I suspect the pricing for the higher-end services is less a money-making scheme, as at some point, free is no longer sustainable (and...
Read more >
Are You Running Out of Video Memory? Detecting Video ...
Video-memory overcommittement is one of the most common causes of stuttering. Now, you may suspect that some stutter could be caused by video- ......
Read more >
VRAM Usage EASY FIX! Fix Crashes, Stutters, Fps ... - YouTube
VRAM Usage EASY FIX! Fix Crashes, Stutters, Fps Drops! (Warzone)- In this Video I show you How to Fix VRAM Usage !
Read more >
MYTH Behind VRAM -- Real VRAM Usage in GAMES - YouTube
0:00 · New ! Watch ads now so you can enjoy fewer interruptions. Got it ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found