create account

Research diaries #21: Open-source generative AI for videos with Comfy by mathowl

View this thread on: hive.blogpeakd.comecency.com
· @mathowl · (edited)
$12.97
Research diaries #21: Open-source generative AI for videos with Comfy
As AI is already outperforming many human tasks it can be disruptive for many communities. I think it would be hard to stop or significantly slow down its advancement. AI is definitely also creating new opportunities as many jobs are also being aided by AI tools. At least something that would be definitely damaging is if all the tech behind it becomes proprietary. So I think it is great that more ground breaking open-source AI tools are being developed. 


<center>
![AnimateDiff_00011.gif](https://files.peakd.com/file/peakd-hive/mathowl/23xp6QaGk7DeVaHq239dBHaWx6EFPdiVyke2dJfXmJT3BAtVWy5FV9i5eUdsPhiex3X99.gif)
*Attention grabber*
</center>


Although openAI is called open we cannot independently run their networks. Other platforms like Fooocus and Nvideas Chat with RTX provide locally run machines. However, these are limited in the sense that significantly tweaking them is hard. So today I want to write about the next best thing to coding your own networks.   

<center>
![image.png](https://files.peakd.com/file/peakd-hive/mathowl/23tGXuaFzAXr9eq25DmkEvRDCGYGNVeQJM5ofUN8kcMQ8AC7kmTw2jNF9JVR7CwD5rpF5.png)
*Comfy-UI architecture*
</center>

Coding neural nets has become a somewhat visual process as in a great number of architectures you are connecting neural network operators in a specific way to each other. When putting this down in code this connection is not that transparent anymore. However, UI-peeps have created a platform where the whole procedure becomes visual: Comfy-UI. https://github.com/comfyanonymous/ComfyUI

 
In Comfy-UI you can download neural network operators and connect them to each other to build a neural network architecture for generative tasks. Ordinarily you would have data on which you train a neural network. However, this is an expensive task requiring a high end GPU. Comfy takes this into account as it is mainly meant for pre-trained networks. These can for example be found on https://civitai.com/ or on https://huggingface.co/. A caveat here is that pre-trained networks are usually trained under certain conditions. For example the data images could be of a certain size, this means that for optimal results you would have to generate images of this specific size. 

Comfy-UI was originally intended just to generate images. Maybe this is not so impressive if you have played with DALL-E. The cooler thing is that you can use Comfy-UI for video generation. The prompt is frame based. So at a frame interval you specify a prompt. Let's go over the core of the architecture I built. 

<center>
![image.png](https://files.peakd.com/file/peakd-hive/mathowl/23swiDqCc31NzYtHxchzVLdjPVp5Ap92EWiTVa3HqkWD2pAwThuAQmcKRK3FmHyD48MHi.png)
*Zooming in on prompts and the sampler*
</center>

The green block is the prompt scheduler. The "x" indicates at which frame you want to see what.  

The animation here works via the pretrained networks of animatediff (https://github.com/guoyww/AnimateDiff). This is in no way perfect. Your model might suddenly get an extra hand or finger or you will see sudden things appear and vanish in the background. You can improve on this a bit by feeding it negative prompts. This is what the CLIP Text encode (Prompt) does. You could also implement this in Batch prompt scheduler if you want to do it scene based.

The two prompt blocks connect to the Ksampler. There is an underlying representation referred to as a latent which the Ksample distorts and then applies the prompts to. This yields a refined version following your directive. The Ksamplerhas many parameters you could tweak. There is no real guidance on how these will affect the generated video. It is mostly a trail-and-error process to find what works for your choice of pre-trained networks and architecture. But a good ground rule is to start as simple as possible. For example, there are many samplers to pick from but euler is the simplest.

Anyway maybe in a future post I will go through more of the details or add-ons to building a good workflow in Comfy-UI. And as always here is the cat tax.

<center>
**Cat tax**

![WhatsApp Image 2024-04-07 at 17.17.57_de1e3e65.jpg](https://files.peakd.com/file/peakd-hive/mathowl/23u62xKQFUD8scZ9VWPLJCFavtCMKt6XdY1MSvXUTn7sdAo1EsUmC1Ui5cSwTS7k8aq1i.jpg)

</center>
👍  , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , and 500 others
properties (23)
authormathowl
permlinkresearch-diaries-21-open-source-generative-ai-for-videos-with-comfy
categoryhive-196387
json_metadata{"app":"peakd/2024.4.1","format":"markdown","image":["https://files.peakd.com/file/peakd-hive/mathowl/23xp6QaGk7DeVaHq239dBHaWx6EFPdiVyke2dJfXmJT3BAtVWy5FV9i5eUdsPhiex3X99.gif","https://files.peakd.com/file/peakd-hive/mathowl/23tGXuaFzAXr9eq25DmkEvRDCGYGNVeQJM5ofUN8kcMQ8AC7kmTw2jNF9JVR7CwD5rpF5.png","https://files.peakd.com/file/peakd-hive/mathowl/23swiDqCc31NzYtHxchzVLdjPVp5Ap92EWiTVa3HqkWD2pAwThuAQmcKRK3FmHyD48MHi.png","https://files.peakd.com/file/peakd-hive/mathowl/23u62xKQFUD8scZ9VWPLJCFavtCMKt6XdY1MSvXUTn7sdAo1EsUmC1Ui5cSwTS7k8aq1i.jpg"],"image_ratios":[0.6666666666666666,1.7791601866251945,1.1725352112676057,0.75],"tags":["hive-196387","stem","ai","stemgeeks","neoxian","cat","blog","coding","waiv"],"type":"post","users":[]}
created2024-04-07 08:56:51
last_update2024-04-07 12:10:57
depth0
children7
last_payout2024-04-14 08:56:51
cashout_time1969-12-31 23:59:59
total_payout_value6.540 HBD
curator_payout_value6.433 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length4,258
author_reputation44,993,635,814,620
root_title"Research diaries #21: Open-source generative AI for videos with Comfy"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id132,669,436
net_rshares25,678,435,752,829
author_curate_reward""
vote details (564)
@beerlover ·
<div class='pull-right'>https://files.peakd.com/file/peakd-hive/beerlover/yiuU6bdf-beerlover20gives20BEER.gif<p><sup><a href='https://hive-engine.com/?p=market&t=BEER'>View or trade </a> <code>BEER</code>.</sup></p></div><center><br> <p>Hey @mathowl, here is a little bit of <code>BEER</code> from @isnochys for you. Enjoy it!</p> <p>Learn how to <a href='https://peakd.com/beer/@beerlover/what-is-proof-of-stake-with-beer'>earn <b>FREE BEER</b> each day </a> by staking your <code>BEER</code>.</p> </center><div></div>
properties (22)
authorbeerlover
permlinkre-mathowl-research-diaries-21-open-source-generative-ai-for-videos-with-comfy-20240407t212418232z
categoryhive-196387
json_metadata{"app":"beerlover/3.0","language":"rust","developer":"wehmoen"}
created2024-04-07 21:24:21
last_update2024-04-07 21:24:21
depth1
children0
last_payout2024-04-14 21:24:21
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length520
author_reputation24,770,396,872,031
root_title"Research diaries #21: Open-source generative AI for videos with Comfy"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id132,683,610
net_rshares0
@beerlover ·
<div class='pull-right'>https://files.peakd.com/file/peakd-hive/beerlover/yiuU6bdf-beerlover20gives20BEER.gif<p><sup><a href='https://hive-engine.com/?p=market&t=BEER'>View or trade </a> <code>BEER</code>.</sup></p></div><center><br> <p>Hey @mathowl, here is a little bit of <code>BEER</code> from @isnochys for you. Enjoy it!</p> <p>Did you know that <a href='https://dcity.io/city</b>you can use <b>BEER</b> at dCity game</a> to buy cards to rule the world.</p> </center><div></div>
properties (22)
authorbeerlover
permlinkre-mathowl-research-diaries-21-open-source-generative-ai-for-videos-with-comfy-20240414t210415840z
categoryhive-196387
json_metadata{"app":"beerlover/3.0","language":"rust","developer":"wehmoen"}
created2024-04-14 21:04:18
last_update2024-04-14 21:04:18
depth1
children0
last_payout2024-04-21 21:04:18
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length485
author_reputation24,770,396,872,031
root_title"Research diaries #21: Open-source generative AI for videos with Comfy"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id132,859,760
net_rshares0
@isnochys ·
Thank you for your [witness vote](https://hivesigner.com/sign/account-witness-vote?witness=isnochys&approve=1)!
 Have a !BEER on me!
To Opt-Out of my witness beer program just comment STOP below
properties (22)
authorisnochys
permlinkre-research-diaries-21-open-source-generative-ai-for-videos-with-comfy-20240407t212402z
categoryhive-196387
json_metadata"{"app": "beem/0.24.26"}"
created2024-04-07 21:24:03
last_update2024-04-07 21:24:03
depth1
children0
last_payout2024-04-14 21:24:03
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length194
author_reputation48,902,244,941,500
root_title"Research diaries #21: Open-source generative AI for videos with Comfy"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id132,683,602
net_rshares0
@isnochys ·
Thank you for your [witness vote](https://hivesigner.com/sign/account-witness-vote?witness=isnochys&approve=1)!
 Have a !BEER on me!
To Opt-Out of my witness beer program just comment STOP below
properties (22)
authorisnochys
permlinkre-research-diaries-21-open-source-generative-ai-for-videos-with-comfy-20240414t210356z
categoryhive-196387
json_metadata"{"app": "beem/0.24.26"}"
created2024-04-14 21:04:00
last_update2024-04-14 21:04:00
depth1
children0
last_payout2024-04-21 21:04:00
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length194
author_reputation48,902,244,941,500
root_title"Research diaries #21: Open-source generative AI for videos with Comfy"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id132,859,758
net_rshares0
@stemsocial ·
re-mathowl-research-diaries-21-open-source-generative-ai-for-videos-with-comfy-20240408t164602618z
<div class='text-justify'> <div class='pull-left'>
 <img src='https://stem.openhive.network/images/stemsocialsupport7.png'> </div>

Thanks for your contribution to the <a href='/trending/hive-196387'>STEMsocial community</a>. Feel free to join us on <a href='https://discord.gg/9c7pKVD'>discord</a> to get to know the rest of us!

Please consider delegating to the @stemsocial account (85% of the curation rewards are returned).

You may also include @stemsocial as a beneficiary of the rewards of this post to get a stronger support.&nbsp;<br />&nbsp;<br />
</div>
properties (22)
authorstemsocial
permlinkre-mathowl-research-diaries-21-open-source-generative-ai-for-videos-with-comfy-20240408t164602618z
categoryhive-196387
json_metadata{"app":"STEMsocial"}
created2024-04-08 16:46:03
last_update2024-04-08 16:46:03
depth1
children0
last_payout2024-04-15 16:46:03
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length565
author_reputation22,463,635,119,853
root_title"Research diaries #21: Open-source generative AI for videos with Comfy"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id132,702,765
net_rshares0