Support for 6gb cards

This commit is contained in:
Морозов Андрей 2022-09-24 12:03:40 +04:00
parent ed4d5f6c1b
commit dafa2c16bf
2 changed files with 95 additions and 93 deletions

View File

@ -24,8 +24,9 @@ c. Create a write token/Copy an existing Token key and enter in the cmd window.
5. You can find output files in .\\data\\out\\%Timestamp% folder. Jpeg contain commentaries in metadata with some settings used while generating. 5. You can find output files in .\\data\\out\\%Timestamp% folder. Jpeg contain commentaries in metadata with some settings used while generating.
## Requirements ## Requirements
* 11GB of free space. * 10GB of free space.
* Nvidia card with 8GB+ video memory. * Nvidia card with 6GB+ video memory.
* Currently min dalle can run in 6gb. Testing purpose
## Additional info ## Tests
Tested on RTX3070. One picture was making 12 - 14 seconds. RTX3070: 12 - 14 seconds per picture.
RTX2060_Laptop: 21 - 25 seconds per picture.

View File

@ -20,9 +20,9 @@ from diffusers import (
from diffusers import StableDiffusionImg2ImgPipeline from diffusers import StableDiffusionImg2ImgPipeline
t = torch.cuda.get_device_properties(0).total_memory t = torch.cuda.get_device_properties(0).total_memory
if t <=8500000000: if t<=6400000000:
print("Not enough GPU memory to generate pictures") print("Running with less than 6gb memory. Working is not garanted")
else:
file1 = open("prompt.txt","r+") file1 = open("prompt.txt","r+")
text = file1.read() text = file1.read()
print(text) print(text)
@ -43,7 +43,8 @@ else:
torch_dtype=torch.float16, torch_dtype=torch.float16,
use_auth_token=True use_auth_token=True
).to(device) ).to(device)
if t <= 10500000000: if t <= 11000000000:
print("Less then 11gb video memory. Running with attention slicing.")
pipe.enable_attention_slicing() pipe.enable_attention_slicing()
def dummy_checker(images, **kwargs): def dummy_checker(images, **kwargs):
@ -85,7 +86,7 @@ else:
counterr=0 counterr=0
allwork=0 allwork=0
directory="./data/out/" + strftime("%Y-%m-%d_%H-%M-%S", gmtime()) + "/" directory="./data/out/" + strftime("%Y-%m-%d_%H-%M-%S") + "/"
if not os.path.exists(directory): if not os.path.exists(directory):
os.makedirs(directory) os.makedirs(directory)
with open(directory+"prompt.txt", 'w') as f: with open(directory+"prompt.txt", 'w') as f: