Giter Site home page Giter Site logo

CUDA out of memory. about stytr-2 HOT 11 OPEN

Jamie-Cheung avatar Jamie-Cheung commented on July 29, 2024
CUDA out of memory.

from stytr-2.

Comments (11)

diyiiyiii avatar diyiiyiii commented on July 29, 2024

You can reduce the content size and style size in the training process. But I am not sure if it will affect the stylization effect.

from stytr-2.

yuchen202 avatar yuchen202 commented on July 29, 2024

can you test it now? can we communicate?

from stytr-2.

Jamie-Cheung avatar Jamie-Cheung commented on July 29, 2024

can you test it now? can we communicate?

I can't test successfully and i don't know why.

from stytr-2.

yuchen202 avatar yuchen202 commented on July 29, 2024

can you test it now? can we communicate?

I can't test successfully and i don't know why.

my wechat is c319186779.Can we communicate more?

from stytr-2.

55jun avatar 55jun commented on July 29, 2024

Hallo, can you test successfully now? How to slove the error tuple object has no attribute cpu

from stytr-2.

Jamie-Cheung avatar Jamie-Cheung commented on July 29, 2024

Hallo, can you test successfully now? How to slove the error tuple object has no attribute cpu

for content_path in content_paths:
for style_path in style_paths:
print(content_path)

    content_tf1 = content_transform()
    content = content_tf(Image.open(content_path).convert("RGB"))

    h, w, c = np.shape(content)
    style_tf1 = style_transform(h, w)
    style = style_tf(Image.open(style_path).convert("RGB"))

    style = style.to(device).unsqueeze(0)
    content = content.to(device).unsqueeze(0)

    with torch.no_grad():
        output = network(content, style)
        # output = output.cuda()
        output = output

    output_name = '{:s}/{:s}_stylized_{:s}{:s}'.format(
        output_path, splitext(basename(content_path))[0],
        splitext(basename(style_path))[0], save_ext
    )
    save_image(output[0], output_name)

You can copy this code to replace corresponding code on test.py

from stytr-2.

phhandong avatar phhandong commented on July 29, 2024

Hallo, can you test successfully now? How to slove the error tuple object has no attribute cpu

for content_path in content_paths: for style_path in style_paths: print(content_path)

    content_tf1 = content_transform()
    content = content_tf(Image.open(content_path).convert("RGB"))

    h, w, c = np.shape(content)
    style_tf1 = style_transform(h, w)
    style = style_tf(Image.open(style_path).convert("RGB"))

    style = style.to(device).unsqueeze(0)
    content = content.to(device).unsqueeze(0)

    with torch.no_grad():
        output = network(content, style)
        # output = output.cuda()
        output = output

    output_name = '{:s}/{:s}_stylized_{:s}{:s}'.format(
        output_path, splitext(basename(content_path))[0],
        splitext(basename(style_path))[0], save_ext
    )
    save_image(output[0], output_name)

You can copy this code to replace corresponding code on test.py

Did you successfully test it?I editted the code as yours but in vain, may you share your environment?

from stytr-2.

Shenyve0101 avatar Shenyve0101 commented on July 29, 2024

Hallo, can you test successfully now? How to slove the error tuple object has no attribute cpu

for content_path in content_paths: for style_path in style_paths: print(content_path)

    content_tf1 = content_transform()
    content = content_tf(Image.open(content_path).convert("RGB"))

    h, w, c = np.shape(content)
    style_tf1 = style_transform(h, w)
    style = style_tf(Image.open(style_path).convert("RGB"))

    style = style.to(device).unsqueeze(0)
    content = content.to(device).unsqueeze(0)

    with torch.no_grad():
        output = network(content, style)
        # output = output.cuda()
        output = output

    output_name = '{:s}/{:s}_stylized_{:s}{:s}'.format(
        output_path, splitext(basename(content_path))[0],
        splitext(basename(style_path))[0], save_ext
    )
    save_image(output[0], output_name)

You can copy this code to replace corresponding code on test.py

Did you successfully test it?I editted the code as yours but in vain, may you share your environment?

Maybe you can try the following code:

        style = style.to(device).unsqueeze(0)
        content = content.to(device).unsqueeze(0)

        #with torch.no_grad():
        #    output= network(content,style)       
        #output = output.cpu()

        with torch.no_grad():
            output = network(content, style)
        output = output[0].cpu()
                
        output_name = '{:s}/{:s}_stylized_{:s}{:s}'.format(
            output_path, splitext(basename(content_path))[0],
            splitext(basename(style_path))[0], save_ext
        )
 
        save_image(output, output_name)

from stytr-2.

phhandong avatar phhandong commented on July 29, 2024

Hallo, can you test successfully now? How to slove the error tuple object has no attribute cpu

for content_path in content_paths: for style_path in style_paths: print(content_path)

    content_tf1 = content_transform()
    content = content_tf(Image.open(content_path).convert("RGB"))

    h, w, c = np.shape(content)
    style_tf1 = style_transform(h, w)
    style = style_tf(Image.open(style_path).convert("RGB"))

    style = style.to(device).unsqueeze(0)
    content = content.to(device).unsqueeze(0)

    with torch.no_grad():
        output = network(content, style)
        # output = output.cuda()
        output = output

    output_name = '{:s}/{:s}_stylized_{:s}{:s}'.format(
        output_path, splitext(basename(content_path))[0],
        splitext(basename(style_path))[0], save_ext
    )
    save_image(output[0], output_name)

You can copy this code to replace corresponding code on test.py

Did you successfully test it?I editted the code as yours but in vain, may you share your environment?

Maybe you can try the following code:

        style = style.to(device).unsqueeze(0)
        content = content.to(device).unsqueeze(0)

        #with torch.no_grad():
        #    output= network(content,style)       
        #output = output.cpu()

        with torch.no_grad():
            output = network(content, style)
        output = output[0].cpu()
                
        output_name = '{:s}/{:s}_stylized_{:s}{:s}'.format(
            output_path, splitext(basename(content_path))[0],
            splitext(basename(style_path))[0], save_ext
        )
 
        save_image(output, output_name)

Thank u so much!It works perfectly,and I found a mistake in the version of cuda,the code can only run on the cuda 10.x or lower.

from stytr-2.

Link-32 avatar Link-32 commented on July 29, 2024

Have you solved your problem? I tried to run this code in RTX3080 with 10G memory and got "CUDA OUT OF MEMORY". I can only run this code when the batch size is 1. Once the batch size is greater than 1, even if iters is 1, it will report an error.

from stytr-2.

yuchen202 avatar yuchen202 commented on July 29, 2024

from stytr-2.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.