lora-inference icon indicating copy to clipboard operation
lora-inference copied to clipboard

gradual degrading of imagery?

Open anotherjesse opened this issue 2 years ago • 4 comments

This issue is investigating the gradual change in generated imagery as loras are loaded/unloaded through normal use:

First, the assumption:

Using the same inputs (seed / prompt / lora URL / lora scale) should always result in the same output.

If this assumption is accurate, then:

steps:

  1. setup an instance of lora-inference as a stand-alone cog HTTP server
  2. use it to generate images using patterns of inputs (alternating between two different lora_urls)
  3. evaluate if there is any change over time

Expectation:

We would expect the 1st and the 1000th generation of an image with the same inputs to be the same.

anotherjesse avatar May 04 '23 14:05 anotherjesse

To test this, I'm running inference on my dev machine with:

docker run -ti -p 5000:5000 --gpus=all r8.im/cloneofsimo/lora@sha256:fce477182f407ffd66b94b08e761424cabd13b82b518754b83080bc75ad32466

alternatively I could run a dev version using cog + checkout:

cog run python -m cog.server.http

And then alternating between 1000 andreas/zeke to generate images:

import base64
import requests
import sys


def gen(output_fn, **kwargs):
    print("Generating", output_fn)
    url = "http://localhost:5000/predictions"
    response = requests.post(url, json={"input": kwargs})
    data = response.json()

    try:
        datauri = data["output"][0]
        base64_encoded_data = datauri.split(",")[1]
        data = base64.b64decode(base64_encoded_data)
    except:
        print("Error!")
        print("input:", kwargs)
        print(data['logs'])
        sys.exit(1)
 
    with open(output_fn, "wb") as f:
        f.write(data)


def main():
    for i in range(1000):
        for name, url in {'zeke':'https://replicate.delivery/pbxt/IzbeguwVsW3PcC1gbiLy5SeALwk4sGgWroHagcYIn9I960bQA/tmpjlodd7vazekezip.safetensors',
            'andreas': 'https://replicate.delivery/pbxt/tLNfiG3fK2jZo0CrBG4cNTJNhEi7r117ANUBjWrLTkQRMraQA/tmpg9tq4is5me.safetensors'}.items():

            gen(
                "%04d.%s.png" % (i, name),
                prompt="photo of <1>, detailed faces, highres, RAW photo 8k uhd, dslr",
                lora_urls=url,
                lora_scales='0.5',
                seed=42
            )


if __name__ == "__main__":
    main()

anotherjesse avatar May 04 '23 16:05 anotherjesse

Andreas 0:

0000 andreas

Andreas 100:

0100 andreas

Andreas 999:

0999 andreas

anotherjesse avatar May 04 '23 16:05 anotherjesse

Zeke 0:

0000 zeke

Zeke 100:

0100 zeke

Zeke 999:

0999 zeke

anotherjesse avatar May 04 '23 16:05 anotherjesse

@cloneofsimo I have all 1000 pngs of zeke/andreas if this is useful.

anotherjesse avatar May 04 '23 16:05 anotherjesse