nateraw / stable-diffusion-videos

Create 🔥 videos with Stable Diffusion by exploring the latent space and morphing between text prompts
Apache License 2.0
4.4k stars 421 forks source link

Colab - Use walk programatically : TypeError: walk() got an unexpected keyword argument 'num_interpolation_steps' #64

Closed billybailey47 closed 1 year ago

billybailey47 commented 1 year ago

Hi, I'm experiencing an issue when using walk programmatically. I'm doing this as I'd like to use three prompts, rather than the strict two allowed with Gradio.

Here's my config:

from stable_diffusion_videos import walk

video_path = walk(['Prompt1', 'Prompt2', 'Prompt3'], 
    seeds=[4332, 1337, 692671],
    name='trippy',            
    guidance_scale=17.5,   
    num_interpolation_steps=200,     
    num_inference_steps=50,     
    scheduler='ddim',           
    disable_tqdm=False,        
    make_video=True,           
    use_lerp_for_text=True,   
    do_loop=True,             
    upsample=True, 
)
visualize_video_colab(video_path)

The below error is thrown:

TypeError                                 Traceback (most recent call last)
[<ipython-input-24-548d897a7e61>](https://localhost:8080/#) in <module>
     12     use_lerp_for_text=True,     # Use lerp for text embeddings instead of slerp
     13     do_loop=True,              # Change to True if you want last prompt to loop back to first prompt
---> 14     upsample=True,
     15 )
     16 visualize_video_colab(video_path)

TypeError: walk() got an unexpected keyword argument 'num_interpolation_steps'

I've also tried using replacing num_interpolation_steps with num_walk_steps but that didn't work!

Screenshot 2022-10-06 at 19 12 43

Any help would be greatly appreciated as I've just got Colab access back & I'm itching to make some animations!

billybailey47 commented 1 year ago

Just realized it's num_steps.

Closing.

nateraw commented 1 year ago

whoops I need to make a PyPI release then the colab will work out of the box. thanks for letting me know

nateraw commented 1 year ago

Release made. It's now num_interpolation_steps not num_steps

billybailey47 commented 1 year ago

No problem @nateraw! Always happy to help. Quick question as I can't see a way to message you.

I'm struggling to leave seeds empty. It throws errors whatever I do. Albeit my knowledge of Python is limited.

It does say it's an optional argument & you can leave it blank if using the UI interface.

Any pointers would be appreciated!

nateraw commented 1 year ago

ah yea you need to pass them to the interface for now. the programatic interface is same way. I usually do this to get some randomly generated seeds

import random

prompts = ['a cat', 'a dog']
seeds = [random.choice(list(range(0, 9999999))) for _ in range(len(prompts))]
billybailey47 commented 1 year ago

Thank you @nateraw ,

One last query.

Are there plans to improve NSFW? Not saying I want to make NSFW content, I'm primarily a visionary/psychedelic artist.

My prompts do NOT include any suggestive words & I'm including fully clothed, no nudity but a large number of pictures get flagged wrecking the animation.

Screenshot 2022-10-06 at 23 54 05

I've tried re-rolling, different seeds but not much improvement.

It would be cool if these could be automatically deleted or re-run!

Thanks again for your time.

nateraw commented 1 year ago

My prompts do NOT include any suggestive words & I'm including fully clothed, no nudity but a large number of pictures get flagged wrecking the animation.

Yea I've been having same issues. So I added something to help, but am not advertising it outside of issues/prs.

from stable_diffusion_videos import StableDiffusionPipeline, NoCheck, interface

pipeline = StableDiffusionPipeline(...) # init as you normally would
pipeline.safety_checker = NoCheck().cuda()

# If using interface
interface.launch()
billybailey47 commented 1 year ago

@nateraw thank you so much for showing me this & I hope your having a good Friday.

I've just re-gained access to collab and get the below error:

Cannot assign member "safety_checker" for type "ModuleType"
  Member "safety_checker" is unknown(reportGeneralTypeIssues)
safety_checker: Unknown | Any

Does this suggestion work in collab or only locally?

Any tips on how to get this running via collab would be great. Apologies for all the questions. This is a great piece of kit!

Here's what I've got:

from stable_diffusion_videos import StableDiffusionPipeline, NoCheck, interface, walk pipeline = StableDiffusionPipeline() pipeline.safety_checker = NoCheck().cuda()

walk( prompts=['prompt1', 'prompt2','Prompt3'],

seeds=[423946, 13452537, 6926731],
name='trippy',
fps=60,            
guidance_scale=16.5,   
num_interpolation_steps=220,     
num_inference_steps=50,     
scheduler='ddim',           
disable_tqdm=False,        
make_video=True,           
use_lerp_for_text=True,   
do_loop=True,             
upsample=True, 

)

The below error is thrown:

TypeError                                 Traceback (most recent call last)
[<ipython-input-7-ab50988cb2d1>](https://localhost:8080/#) in <module>
      1 from stable_diffusion_videos import StableDiffusionPipeline, NoCheck, interface, walk
      2 
----> 3 pipeline = StableDiffusionPipeline()
      4 pipeline.safety_checker = NoCheck().cuda()
      5 

TypeError: __init__() missing 7 required positional arguments: 'vae', 'text_encoder', 'tokenizer', 'unet', 'scheduler', 'safety_checker', and 'feature_extractor'
billybailey47 commented 1 year ago

Ah, got it working. Sorry I work in QA and really should try more things before reaching out! This worked. Well, it's at least running!

from stable_diffusion_videos import NoCheck, walk
safety_checker = NoCheck().cuda()

walk(
    prompts=[

'hypercomplex image of floating head made out of reflective blocks and some blocks are broken and falling by alex grey, lisa frank, ayami, kojima, amano, karol bak, greg hildebrandt, mark brooks, beksinski, takato yamamoto', 

'detailed realistic beautiful water storm goddess portrait by jean delville, gustave dore, iris van herpen and marco mazzoni, art forms of nature by ernst haeckel, art nouveau, symbolist, visionary, gothic, neo - gothic, pre - raphaelite, fractal lace, intricate alien botanical biodiversity, surreality, hyperdetailed ultrasharp octane render',

 'hyperrealistic portrait of melting hippies - epic cinematic mushrooms with psychedelic field of flowers, highly detailed smooth digital art masterpiece, pablo amaringo dramatic low light, ground angle uhd 8 k, sharp focus'],

    seeds=[423946, 13452537, 6926731],
    name='trippy',
    fps=60,            
    guidance_scale=16.5,   
    num_interpolation_steps=220,     
    num_inference_steps=50,     
    scheduler='ddim',           
    disable_tqdm=False,        
    make_video=True,           
    use_lerp_for_text=True,   
    do_loop=True,             
    upsample=True, 
)

Have a great day!