Closed Flesco closed 3 years ago
Instead of setting the start_image_path
of an instance of the Imagine class, feed it as an additional parameter to when you create an instance e.g. model = Imagine("This is a test", start_image_path="hot-dog.jpg")
Ok, the error is fixed, but it's ignoring the starting picture I provided. Sorry if there's an obvious mistake I'm making, I'm a noob. This is what the code looks like right now:
from tqdm.notebook import trange
from IPython.display import Image, display
from deep_daze import Imagine
TEXT = "test"
NUM_LAYERS = 32 #@param {type:"number"}
SAVE_EVERY = 5#@param {type:"number"}
IMAGE_WIDTH = 512 #@param {type:"number"}
SAVE_PROGRESS = True #@param {type:"boolean"}
LEARNING_RATE = 1e-5 #@param {type:"number"}
ITERATIONS = 1050 #@param {type:"number"}
START_IMAGE_PATH = '/content/test.jpg'
model = Imagine(text=TEXT, save_every=SAVE_EVERY, start_image_path=START_IMAGE_PATH)
for epoch in trange(20, desc = 'epochs'):
for i in trange(ITERATIONS, desc = 'iteration'):
model.train_step(epoch, i)
if i % model.save_every != 0:
continue
filename = TEXT.replace(' ', '_')
image = Image(f'./{filename}.jpg')
display(image)
There is only pre-training based on the starting image if the forward method of the Imagine class is used.
Instead of your for-loop, simply call model()
That worked, thank you!
Great, feel free to close this issue if you have no more questions! :)
Could you give a more beginner-friendly concrete example, or, Flesco, can you copy and paste the code you used? Thank you.
@nathanscomputerservice here's the notebook with my code: https://drive.google.com/file/d/1K18m1EbWGGWVBAwIAWBjLx0ifGYCi7N2/view?usp=sharing
I tried to add a start_image_path variable in the simplified notebook, but getting this error: AttributeError 'Imagine' object has no attribute 'start_image_path'