Giter Site home page Giter Site logo

Comments (2)

0x3f3f3f3fun avatar 0x3f3f3f3fun commented on June 18, 2024 4

这个是传递的参数有问题~ 正确的代码如下:

@torch.no_grad()
def log_images(self, batch, sample_steps=50):
    log = dict()
    z, c = self.get_input(batch, self.first_stage_key)
    c_lq = c["lq"][0]
    c_latent = c["c_latent"][0]
    c_cat, c = c["c_concat"][0], c["c_crossattn"][0]

    log["hq"] = (self.decode_first_stage(z) + 1) / 2
    log["control"] = c_cat
    log["decoded_control"] = (self.decode_first_stage(c_latent) + 1) / 2
    log["lq"] = c_lq
    log["text"] = (log_txt_as_img((512, 512), batch[self.cond_stage_key], size=16) + 1) / 2
    log["samples"] = self.sample_log(
        cond_img=c_cat,            
        steps=sample_steps
    )
    return log

@torch.no_grad()
def sample_log(self, cond_img, steps):
    sampler = SpacedSampler(self)
    b, c, h, w = cond_img.shape
    shape = (b, self.channels, h // 8, w // 8)
    samples = sampler.sample(
        steps, shape, cond_img, positive_prompt="", negative_prompt="",
        cfg_scale=1.0, color_fix_type="wavelet"
    )
    return samples

最近有点忙,所以没时间更新代码,抱歉。

from diffbir.

yimingz1218 avatar yimingz1218 commented on June 18, 2024

我也碰到了这个问题,请问你找到了解决方法吗

from diffbir.

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.