File size: 52,556 Bytes
9d978ef
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
{
  "cells": [
    {
      "cell_type": "code",
      "execution_count": 1,
      "metadata": {
        "colab": {
          "base_uri": "https://localhost:8080/"
        },
        "id": "t0gCc4zNO0-J",
        "outputId": "cb8cfaad-d4f1-4c26-92a6-644eb1bc9039"
      },
      "outputs": [
        {
          "name": "stdout",
          "output_type": "stream",
          "text": [
            "Requirement already satisfied: wandb in c:\\users\\texas\\anaconda3\\envs\\animatediff\\lib\\site-packages (0.16.0)\n",
            "Requirement already satisfied: Click!=8.0.0,>=7.1 in c:\\users\\texas\\anaconda3\\envs\\animatediff\\lib\\site-packages (from wandb) (8.1.7)\n",
            "Requirement already satisfied: GitPython!=3.1.29,>=1.0.0 in c:\\users\\texas\\anaconda3\\envs\\animatediff\\lib\\site-packages (from wandb) (3.1.40)\n",
            "Requirement already satisfied: requests<3,>=2.0.0 in c:\\users\\texas\\anaconda3\\envs\\animatediff\\lib\\site-packages (from wandb) (2.31.0)\n",
            "Requirement already satisfied: psutil>=5.0.0 in c:\\users\\texas\\anaconda3\\envs\\animatediff\\lib\\site-packages (from wandb) (5.9.5)\n",
            "Requirement already satisfied: sentry-sdk>=1.0.0 in c:\\users\\texas\\anaconda3\\envs\\animatediff\\lib\\site-packages (from wandb) (1.35.0)\n",
            "Requirement already satisfied: docker-pycreds>=0.4.0 in c:\\users\\texas\\anaconda3\\envs\\animatediff\\lib\\site-packages (from wandb) (0.4.0)\n",
            "Requirement already satisfied: PyYAML in c:\\users\\texas\\anaconda3\\envs\\animatediff\\lib\\site-packages (from wandb) (6.0.1)\n",
            "Requirement already satisfied: setproctitle in c:\\users\\texas\\anaconda3\\envs\\animatediff\\lib\\site-packages (from wandb) (1.3.3)\n",
            "Requirement already satisfied: setuptools in c:\\users\\texas\\anaconda3\\envs\\animatediff\\lib\\site-packages (from wandb) (68.2.2)\n",
            "Requirement already satisfied: appdirs>=1.4.3 in c:\\users\\texas\\anaconda3\\envs\\animatediff\\lib\\site-packages (from wandb) (1.4.4)\n",
            "Requirement already satisfied: protobuf!=4.21.0,<5,>=3.19.0 in c:\\users\\texas\\anaconda3\\envs\\animatediff\\lib\\site-packages (from wandb) (4.25.0)\n",
            "Requirement already satisfied: colorama in c:\\users\\texas\\anaconda3\\envs\\animatediff\\lib\\site-packages (from Click!=8.0.0,>=7.1->wandb) (0.4.6)\n",
            "Requirement already satisfied: six>=1.4.0 in c:\\users\\texas\\anaconda3\\envs\\animatediff\\lib\\site-packages (from docker-pycreds>=0.4.0->wandb) (1.16.0)\n",
            "Requirement already satisfied: gitdb<5,>=4.0.1 in c:\\users\\texas\\anaconda3\\envs\\animatediff\\lib\\site-packages (from GitPython!=3.1.29,>=1.0.0->wandb) (4.0.11)\n",
            "Requirement already satisfied: charset-normalizer<4,>=2 in c:\\users\\texas\\anaconda3\\envs\\animatediff\\lib\\site-packages (from requests<3,>=2.0.0->wandb) (3.3.2)\n",
            "Requirement already satisfied: idna<4,>=2.5 in c:\\users\\texas\\anaconda3\\envs\\animatediff\\lib\\site-packages (from requests<3,>=2.0.0->wandb) (3.4)\n",
            "Requirement already satisfied: urllib3<3,>=1.21.1 in c:\\users\\texas\\anaconda3\\envs\\animatediff\\lib\\site-packages (from requests<3,>=2.0.0->wandb) (2.1.0)\n",
            "Requirement already satisfied: certifi>=2017.4.17 in c:\\users\\texas\\anaconda3\\envs\\animatediff\\lib\\site-packages (from requests<3,>=2.0.0->wandb) (2023.7.22)\n",
            "Requirement already satisfied: smmap<6,>=3.0.1 in c:\\users\\texas\\anaconda3\\envs\\animatediff\\lib\\site-packages (from gitdb<5,>=4.0.1->GitPython!=3.1.29,>=1.0.0->wandb) (5.0.1)\n"
          ]
        },
        {
          "name": "stderr",
          "output_type": "stream",
          "text": [
            "wandb: ERROR Find detailed error logs at: C:\\Users\\texas\\AppData\\Local\\Temp\\debug-cli.texas.log\n",
            "Error: api_key not configured (no-tty). call wandb login [your_api_key]\n"
          ]
        }
      ],
      "source": [
        "!pip install wandb\n",
        "!wandb login"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": 3,
      "metadata": {
        "colab": {
          "base_uri": "https://localhost:8080/"
        },
        "id": "UGH2QZ4tDlzw",
        "outputId": "0e2339d0-78b3-4a23-eddf-589c805adcc8"
      },
      "outputs": [
        {
          "name": "stdout",
          "output_type": "stream",
          "text": [
            "Requirement already satisfied: huggingface_hub in /usr/local/lib/python3.10/dist-packages (0.19.4)\n",
            "Requirement already satisfied: filelock in /usr/local/lib/python3.10/dist-packages (from huggingface_hub) (3.13.1)\n",
            "Requirement already satisfied: fsspec>=2023.5.0 in /usr/local/lib/python3.10/dist-packages (from huggingface_hub) (2023.6.0)\n",
            "Requirement already satisfied: requests in /usr/local/lib/python3.10/dist-packages (from huggingface_hub) (2.31.0)\n",
            "Requirement already satisfied: tqdm>=4.42.1 in /usr/local/lib/python3.10/dist-packages (from huggingface_hub) (4.66.1)\n",
            "Requirement already satisfied: pyyaml>=5.1 in /usr/local/lib/python3.10/dist-packages (from huggingface_hub) (6.0.1)\n",
            "Requirement already satisfied: typing-extensions>=3.7.4.3 in /usr/local/lib/python3.10/dist-packages (from huggingface_hub) (4.5.0)\n",
            "Requirement already satisfied: packaging>=20.9 in /usr/local/lib/python3.10/dist-packages (from huggingface_hub) (23.2)\n",
            "Requirement already satisfied: charset-normalizer<4,>=2 in /usr/local/lib/python3.10/dist-packages (from requests->huggingface_hub) (3.3.2)\n",
            "Requirement already satisfied: idna<4,>=2.5 in /usr/local/lib/python3.10/dist-packages (from requests->huggingface_hub) (3.4)\n",
            "Requirement already satisfied: urllib3<3,>=1.21.1 in /usr/local/lib/python3.10/dist-packages (from requests->huggingface_hub) (2.0.7)\n",
            "Requirement already satisfied: certifi>=2017.4.17 in /usr/local/lib/python3.10/dist-packages (from requests->huggingface_hub) (2023.7.22)\n",
            "\n",
            "    _|    _|  _|    _|    _|_|_|    _|_|_|  _|_|_|  _|      _|    _|_|_|      _|_|_|_|    _|_|      _|_|_|  _|_|_|_|\n",
            "    _|    _|  _|    _|  _|        _|          _|    _|_|    _|  _|            _|        _|    _|  _|        _|\n",
            "    _|_|_|_|  _|    _|  _|  _|_|  _|  _|_|    _|    _|  _|  _|  _|  _|_|      _|_|_|    _|_|_|_|  _|        _|_|_|\n",
            "    _|    _|  _|    _|  _|    _|  _|    _|    _|    _|    _|_|  _|    _|      _|        _|    _|  _|        _|\n",
            "    _|    _|    _|_|      _|_|_|    _|_|_|  _|_|_|  _|      _|    _|_|_|      _|        _|    _|    _|_|_|  _|_|_|_|\n",
            "\n",
            "    To login, `huggingface_hub` requires a token generated from https://huggingface.co/settings/tokens .\n",
            "Token: \n",
            "Add token as git credential? (Y/n) Y\n",
            "Token is valid (permission: write).\n",
            "\u001b[1m\u001b[31mCannot authenticate through git-credential as no helper is defined on your machine.\n",
            "You might have to re-authenticate when pushing to the Hugging Face Hub.\n",
            "Run the following command in your terminal in case you want to set the 'store' credential helper as default.\n",
            "\n",
            "git config --global credential.helper store\n",
            "\n",
            "Read https://git-scm.com/book/en/v2/Git-Tools-Credential-Storage for more details.\u001b[0m\n",
            "Token has not been saved to git credential helper.\n",
            "Your token has been saved to /root/.cache/huggingface/token\n",
            "Login successful\n"
          ]
        }
      ],
      "source": [
        "!pip install huggingface_hub\n",
        "# You already have it if you installed transformers or datasets\n",
        "\n",
        "!huggingface-cli login"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": 10,
      "metadata": {
        "colab": {
          "base_uri": "https://localhost:8080/",
          "height": 1000
        },
        "id": "iPDlxLC9PFzV",
        "outputId": "076dead2-d2da-42bf-a867-1a0d59e0b3c2"
      },
      "outputs": [
        {
          "name": "stdout",
          "output_type": "stream",
          "text": [
            "Requirement already satisfied: einops in c:\\users\\texas\\anaconda3\\envs\\animatediff\\lib\\site-packages (0.7.0)\n",
            "Requirement already satisfied: omegaconf in c:\\users\\texas\\anaconda3\\envs\\animatediff\\lib\\site-packages (2.3.0)\n",
            "Requirement already satisfied: decord in c:\\users\\texas\\anaconda3\\envs\\animatediff\\lib\\site-packages (0.6.0)\n",
            "Requirement already satisfied: safetensors in c:\\users\\texas\\anaconda3\\envs\\animatediff\\lib\\site-packages (0.4.0)\n",
            "Requirement already satisfied: diffusers==0.11.1 in c:\\users\\texas\\anaconda3\\envs\\animatediff\\lib\\site-packages (from diffusers[torch]==0.11.1) (0.11.1)\n",
            "Requirement already satisfied: transformers in c:\\users\\texas\\anaconda3\\envs\\animatediff\\lib\\site-packages (4.25.1)\n",
            "Requirement already satisfied: xformers in c:\\users\\texas\\anaconda3\\envs\\animatediff\\lib\\site-packages (0.0.16)\n",
            "Requirement already satisfied: triton==2.0.0 in c:\\users\\texas\\anaconda3\\envs\\animatediff\\lib\\site-packages (2.0.0)\n",
            "Collecting mediapy\n",
            "  Downloading mediapy-1.1.9-py3-none-any.whl.metadata (4.8 kB)\n",
            "Requirement already satisfied: imageio[pyav] in c:\\users\\texas\\anaconda3\\envs\\animatediff\\lib\\site-packages (2.27.0)\n",
            "Requirement already satisfied: importlib-metadata in c:\\users\\texas\\anaconda3\\envs\\animatediff\\lib\\site-packages (from diffusers==0.11.1->diffusers[torch]==0.11.1) (6.8.0)\n",
            "Requirement already satisfied: filelock in c:\\users\\texas\\anaconda3\\envs\\animatediff\\lib\\site-packages (from diffusers==0.11.1->diffusers[torch]==0.11.1) (3.13.1)\n",
            "Requirement already satisfied: huggingface-hub>=0.10.0 in c:\\users\\texas\\anaconda3\\envs\\animatediff\\lib\\site-packages (from diffusers==0.11.1->diffusers[torch]==0.11.1) (0.19.4)\n",
            "Requirement already satisfied: numpy in c:\\users\\texas\\anaconda3\\envs\\animatediff\\lib\\site-packages (from diffusers==0.11.1->diffusers[torch]==0.11.1) (1.26.0)\n",
            "Requirement already satisfied: regex!=2019.12.17 in c:\\users\\texas\\anaconda3\\envs\\animatediff\\lib\\site-packages (from diffusers==0.11.1->diffusers[torch]==0.11.1) (2023.10.3)\n",
            "Requirement already satisfied: requests in c:\\users\\texas\\anaconda3\\envs\\animatediff\\lib\\site-packages (from diffusers==0.11.1->diffusers[torch]==0.11.1) (2.31.0)\n",
            "Requirement already satisfied: Pillow in c:\\users\\texas\\anaconda3\\envs\\animatediff\\lib\\site-packages (from diffusers==0.11.1->diffusers[torch]==0.11.1) (10.1.0)\n",
            "Requirement already satisfied: cmake in c:\\users\\texas\\anaconda3\\envs\\animatediff\\lib\\site-packages (from triton==2.0.0) (3.27.7)\n",
            "Requirement already satisfied: torch in c:\\users\\texas\\anaconda3\\envs\\animatediff\\lib\\site-packages (from triton==2.0.0) (1.13.1)\n",
            "Collecting accelerate>=0.11.0 (from diffusers[torch]==0.11.1)\n",
            "  Downloading accelerate-0.24.1-py3-none-any.whl.metadata (18 kB)\n",
            "Requirement already satisfied: antlr4-python3-runtime==4.9.* in c:\\users\\texas\\anaconda3\\envs\\animatediff\\lib\\site-packages (from omegaconf) (4.9.3)\n",
            "Requirement already satisfied: PyYAML>=5.1.0 in c:\\users\\texas\\anaconda3\\envs\\animatediff\\lib\\site-packages (from omegaconf) (6.0.1)\n",
            "Requirement already satisfied: packaging>=20.0 in c:\\users\\texas\\anaconda3\\envs\\animatediff\\lib\\site-packages (from transformers) (23.2)\n",
            "Requirement already satisfied: tokenizers!=0.11.3,<0.14,>=0.11.1 in c:\\users\\texas\\anaconda3\\envs\\animatediff\\lib\\site-packages (from transformers) (0.13.3)\n",
            "Requirement already satisfied: tqdm>=4.27 in c:\\users\\texas\\anaconda3\\envs\\animatediff\\lib\\site-packages (from transformers) (4.66.1)\n",
            "Requirement already satisfied: pyre-extensions==0.0.23 in c:\\users\\texas\\anaconda3\\envs\\animatediff\\lib\\site-packages (from xformers) (0.0.23)\n",
            "Requirement already satisfied: typing-inspect in c:\\users\\texas\\anaconda3\\envs\\animatediff\\lib\\site-packages (from pyre-extensions==0.0.23->xformers) (0.9.0)\n",
            "Requirement already satisfied: typing-extensions in c:\\users\\texas\\anaconda3\\envs\\animatediff\\lib\\site-packages (from pyre-extensions==0.0.23->xformers) (4.8.0)\n",
            "Collecting av (from imageio[pyav])\n",
            "  Downloading av-11.0.0-cp310-cp310-win_amd64.whl.metadata (4.7 kB)\n",
            "Requirement already satisfied: ipython in c:\\users\\texas\\anaconda3\\envs\\animatediff\\lib\\site-packages (from mediapy) (8.17.2)\n",
            "Requirement already satisfied: matplotlib in c:\\users\\texas\\anaconda3\\envs\\animatediff\\lib\\site-packages (from mediapy) (3.8.1)\n",
            "Requirement already satisfied: psutil in c:\\users\\texas\\anaconda3\\envs\\animatediff\\lib\\site-packages (from accelerate>=0.11.0->diffusers[torch]==0.11.1) (5.9.5)\n",
            "Requirement already satisfied: fsspec>=2023.5.0 in c:\\users\\texas\\anaconda3\\envs\\animatediff\\lib\\site-packages (from huggingface-hub>=0.10.0->diffusers==0.11.1->diffusers[torch]==0.11.1) (2023.10.0)\n",
            "Requirement already satisfied: colorama in c:\\users\\texas\\anaconda3\\envs\\animatediff\\lib\\site-packages (from tqdm>=4.27->transformers) (0.4.6)\n",
            "Requirement already satisfied: zipp>=0.5 in c:\\users\\texas\\anaconda3\\envs\\animatediff\\lib\\site-packages (from importlib-metadata->diffusers==0.11.1->diffusers[torch]==0.11.1) (3.17.0)\n",
            "Requirement already satisfied: decorator in c:\\users\\texas\\anaconda3\\envs\\animatediff\\lib\\site-packages (from ipython->mediapy) (5.1.1)\n",
            "Requirement already satisfied: jedi>=0.16 in c:\\users\\texas\\anaconda3\\envs\\animatediff\\lib\\site-packages (from ipython->mediapy) (0.19.1)\n",
            "Requirement already satisfied: matplotlib-inline in c:\\users\\texas\\anaconda3\\envs\\animatediff\\lib\\site-packages (from ipython->mediapy) (0.1.6)\n",
            "Requirement already satisfied: prompt-toolkit!=3.0.37,<3.1.0,>=3.0.30 in c:\\users\\texas\\anaconda3\\envs\\animatediff\\lib\\site-packages (from ipython->mediapy) (3.0.41)\n",
            "Requirement already satisfied: pygments>=2.4.0 in c:\\users\\texas\\anaconda3\\envs\\animatediff\\lib\\site-packages (from ipython->mediapy) (2.16.1)\n",
            "Requirement already satisfied: stack-data in c:\\users\\texas\\anaconda3\\envs\\animatediff\\lib\\site-packages (from ipython->mediapy) (0.6.2)\n",
            "Requirement already satisfied: traitlets>=5 in c:\\users\\texas\\anaconda3\\envs\\animatediff\\lib\\site-packages (from ipython->mediapy) (5.13.0)\n",
            "Requirement already satisfied: exceptiongroup in c:\\users\\texas\\anaconda3\\envs\\animatediff\\lib\\site-packages (from ipython->mediapy) (1.1.3)\n",
            "Requirement already satisfied: contourpy>=1.0.1 in c:\\users\\texas\\anaconda3\\envs\\animatediff\\lib\\site-packages (from matplotlib->mediapy) (1.2.0)\n",
            "Requirement already satisfied: cycler>=0.10 in c:\\users\\texas\\anaconda3\\envs\\animatediff\\lib\\site-packages (from matplotlib->mediapy) (0.12.1)\n",
            "Requirement already satisfied: fonttools>=4.22.0 in c:\\users\\texas\\anaconda3\\envs\\animatediff\\lib\\site-packages (from matplotlib->mediapy) (4.44.3)\n",
            "Requirement already satisfied: kiwisolver>=1.3.1 in c:\\users\\texas\\anaconda3\\envs\\animatediff\\lib\\site-packages (from matplotlib->mediapy) (1.4.5)\n",
            "Requirement already satisfied: pyparsing>=2.3.1 in c:\\users\\texas\\anaconda3\\envs\\animatediff\\lib\\site-packages (from matplotlib->mediapy) (3.1.1)\n",
            "Requirement already satisfied: python-dateutil>=2.7 in c:\\users\\texas\\anaconda3\\envs\\animatediff\\lib\\site-packages (from matplotlib->mediapy) (2.8.2)\n",
            "Requirement already satisfied: charset-normalizer<4,>=2 in c:\\users\\texas\\anaconda3\\envs\\animatediff\\lib\\site-packages (from requests->diffusers==0.11.1->diffusers[torch]==0.11.1) (3.3.2)\n",
            "Requirement already satisfied: idna<4,>=2.5 in c:\\users\\texas\\anaconda3\\envs\\animatediff\\lib\\site-packages (from requests->diffusers==0.11.1->diffusers[torch]==0.11.1) (3.4)\n",
            "Requirement already satisfied: urllib3<3,>=1.21.1 in c:\\users\\texas\\anaconda3\\envs\\animatediff\\lib\\site-packages (from requests->diffusers==0.11.1->diffusers[torch]==0.11.1) (2.1.0)\n",
            "Requirement already satisfied: certifi>=2017.4.17 in c:\\users\\texas\\anaconda3\\envs\\animatediff\\lib\\site-packages (from requests->diffusers==0.11.1->diffusers[torch]==0.11.1) (2023.7.22)\n",
            "Requirement already satisfied: parso<0.9.0,>=0.8.3 in c:\\users\\texas\\anaconda3\\envs\\animatediff\\lib\\site-packages (from jedi>=0.16->ipython->mediapy) (0.8.3)\n",
            "Requirement already satisfied: wcwidth in c:\\users\\texas\\anaconda3\\envs\\animatediff\\lib\\site-packages (from prompt-toolkit!=3.0.37,<3.1.0,>=3.0.30->ipython->mediapy) (0.2.10)\n",
            "Requirement already satisfied: six>=1.5 in c:\\users\\texas\\anaconda3\\envs\\animatediff\\lib\\site-packages (from python-dateutil>=2.7->matplotlib->mediapy) (1.16.0)\n",
            "Requirement already satisfied: executing>=1.2.0 in c:\\users\\texas\\anaconda3\\envs\\animatediff\\lib\\site-packages (from stack-data->ipython->mediapy) (2.0.1)\n",
            "Requirement already satisfied: asttokens>=2.1.0 in c:\\users\\texas\\anaconda3\\envs\\animatediff\\lib\\site-packages (from stack-data->ipython->mediapy) (2.4.1)\n",
            "Requirement already satisfied: pure-eval in c:\\users\\texas\\anaconda3\\envs\\animatediff\\lib\\site-packages (from stack-data->ipython->mediapy) (0.2.2)\n",
            "Requirement already satisfied: mypy-extensions>=0.3.0 in c:\\users\\texas\\anaconda3\\envs\\animatediff\\lib\\site-packages (from typing-inspect->pyre-extensions==0.0.23->xformers) (1.0.0)\n",
            "Downloading mediapy-1.1.9-py3-none-any.whl (25 kB)\n",
            "Downloading accelerate-0.24.1-py3-none-any.whl (261 kB)\n",
            "   ---------------------------------------- 0.0/261.4 kB ? eta -:--:--\n",
            "   -------------- ------------------------- 92.2/261.4 kB 2.6 MB/s eta 0:00:01\n",
            "   ---------------------------------------  256.0/261.4 kB 4.0 MB/s eta 0:00:01\n",
            "   ---------------------------------------- 261.4/261.4 kB 2.7 MB/s eta 0:00:00\n",
            "Downloading av-11.0.0-cp310-cp310-win_amd64.whl (25.9 MB)\n",
            "   ---------------------------------------- 0.0/25.9 MB ? eta -:--:--\n",
            "    --------------------------------------- 0.6/25.9 MB 12.0 MB/s eta 0:00:03\n",
            "   -- ------------------------------------- 1.5/25.9 MB 11.9 MB/s eta 0:00:03\n",
            "   --- ------------------------------------ 2.0/25.9 MB 11.7 MB/s eta 0:00:03\n",
            "   --- ------------------------------------ 2.2/25.9 MB 9.5 MB/s eta 0:00:03\n",
            "   ---- ----------------------------------- 3.0/25.9 MB 10.8 MB/s eta 0:00:03\n",
            "   ----- ---------------------------------- 3.5/25.9 MB 11.1 MB/s eta 0:00:03\n",
            "   ------ --------------------------------- 4.2/25.9 MB 11.2 MB/s eta 0:00:02\n",
            "   ------ --------------------------------- 4.3/25.9 MB 11.4 MB/s eta 0:00:02\n",
            "   -------- ------------------------------- 5.4/25.9 MB 11.4 MB/s eta 0:00:02\n",
            "   --------- ------------------------------ 5.9/25.9 MB 11.5 MB/s eta 0:00:02\n",
            "   ---------- ----------------------------- 6.6/25.9 MB 11.6 MB/s eta 0:00:02\n",
            "   ---------- ----------------------------- 7.1/25.9 MB 11.7 MB/s eta 0:00:02\n",
            "   ----------- ---------------------------- 7.7/25.9 MB 11.7 MB/s eta 0:00:02\n",
            "   ------------ --------------------------- 8.3/25.9 MB 11.8 MB/s eta 0:00:02\n",
            "   ------------- -------------------------- 8.8/25.9 MB 11.8 MB/s eta 0:00:02\n",
            "   -------------- ------------------------- 9.5/25.9 MB 11.9 MB/s eta 0:00:02\n",
            "   --------------- ------------------------ 10.3/25.9 MB 11.9 MB/s eta 0:00:02\n",
            "   ---------------- ----------------------- 10.9/25.9 MB 12.4 MB/s eta 0:00:02\n",
            "   ----------------- ---------------------- 11.5/25.9 MB 12.1 MB/s eta 0:00:02\n",
            "   ------------------ --------------------- 12.1/25.9 MB 12.1 MB/s eta 0:00:02\n",
            "   ------------------- -------------------- 12.5/25.9 MB 12.8 MB/s eta 0:00:02\n",
            "   ------------------- -------------------- 12.9/25.9 MB 12.1 MB/s eta 0:00:02\n",
            "   ------------------- -------------------- 12.9/25.9 MB 11.5 MB/s eta 0:00:02\n",
            "   --------------------- ------------------ 13.7/25.9 MB 11.3 MB/s eta 0:00:02\n",
            "   --------------------- ------------------ 14.1/25.9 MB 11.1 MB/s eta 0:00:02\n",
            "   ---------------------- ----------------- 14.5/25.9 MB 11.9 MB/s eta 0:00:01\n",
            "   ----------------------- ---------------- 15.0/25.9 MB 11.3 MB/s eta 0:00:01\n",
            "   ----------------------- ---------------- 15.3/25.9 MB 10.9 MB/s eta 0:00:01\n",
            "   ------------------------ --------------- 15.8/25.9 MB 10.7 MB/s eta 0:00:01\n",
            "   ------------------------ --------------- 16.1/25.9 MB 10.6 MB/s eta 0:00:01\n",
            "   ------------------------- -------------- 16.6/25.9 MB 10.4 MB/s eta 0:00:01\n",
            "   -------------------------- ------------- 17.0/25.9 MB 10.2 MB/s eta 0:00:01\n",
            "   -------------------------- ------------- 17.4/25.9 MB 10.1 MB/s eta 0:00:01\n",
            "   --------------------------- ------------ 18.0/25.9 MB 9.9 MB/s eta 0:00:01\n",
            "   ---------------------------- ----------- 18.6/25.9 MB 9.9 MB/s eta 0:00:01\n",
            "   ----------------------------- ---------- 19.1/25.9 MB 9.9 MB/s eta 0:00:01\n",
            "   ------------------------------ --------- 19.7/25.9 MB 9.9 MB/s eta 0:00:01\n",
            "   ------------------------------- -------- 20.3/25.9 MB 9.9 MB/s eta 0:00:01\n",
            "   -------------------------------- ------- 20.9/25.9 MB 9.9 MB/s eta 0:00:01\n",
            "   --------------------------------- ------ 21.4/25.9 MB 9.9 MB/s eta 0:00:01\n",
            "   ---------------------------------- ----- 22.0/25.9 MB 9.8 MB/s eta 0:00:01\n",
            "   ---------------------------------- ----- 22.5/25.9 MB 9.8 MB/s eta 0:00:01\n",
            "   ----------------------------------- ---- 23.1/25.9 MB 10.9 MB/s eta 0:00:01\n",
            "   ------------------------------------ --- 23.8/25.9 MB 10.7 MB/s eta 0:00:01\n",
            "   ------------------------------------- -- 24.3/25.9 MB 10.7 MB/s eta 0:00:01\n",
            "   -------------------------------------- - 24.9/25.9 MB 11.1 MB/s eta 0:00:01\n",
            "   ---------------------------------------  25.3/25.9 MB 10.9 MB/s eta 0:00:01\n",
            "   ---------------------------------------  25.9/25.9 MB 11.1 MB/s eta 0:00:01\n",
            "   ---------------------------------------  25.9/25.9 MB 10.9 MB/s eta 0:00:01\n",
            "   ---------------------------------------  25.9/25.9 MB 10.9 MB/s eta 0:00:01\n",
            "   ---------------------------------------  25.9/25.9 MB 10.9 MB/s eta 0:00:01\n",
            "   ---------------------------------------  25.9/25.9 MB 10.9 MB/s eta 0:00:01\n",
            "   ---------------------------------------  25.9/25.9 MB 10.9 MB/s eta 0:00:01\n",
            "   ---------------------------------------  25.9/25.9 MB 10.9 MB/s eta 0:00:01\n",
            "   ---------------------------------------  25.9/25.9 MB 10.9 MB/s eta 0:00:01\n",
            "   ---------------------------------------  25.9/25.9 MB 10.9 MB/s eta 0:00:01\n",
            "   ---------------------------------------  25.9/25.9 MB 10.9 MB/s eta 0:00:01\n",
            "   ---------------------------------------  25.9/25.9 MB 10.9 MB/s eta 0:00:01\n",
            "   ---------------------------------------  25.9/25.9 MB 10.9 MB/s eta 0:00:01\n",
            "   ---------------------------------------  25.9/25.9 MB 10.9 MB/s eta 0:00:01\n",
            "   ---------------------------------------  25.9/25.9 MB 10.9 MB/s eta 0:00:01\n",
            "   ---------------------------------------  25.9/25.9 MB 10.9 MB/s eta 0:00:01\n",
            "   ---------------------------------------  25.9/25.9 MB 10.9 MB/s eta 0:00:01\n",
            "   ---------------------------------------  25.9/25.9 MB 10.9 MB/s eta 0:00:01\n",
            "   ---------------------------------------  25.9/25.9 MB 10.9 MB/s eta 0:00:01\n",
            "   ---------------------------------------  25.9/25.9 MB 10.9 MB/s eta 0:00:01\n",
            "   ---------------------------------------  25.9/25.9 MB 10.9 MB/s eta 0:00:01\n",
            "   ---------------------------------------  25.9/25.9 MB 10.9 MB/s eta 0:00:01\n",
            "   ---------------------------------------  25.9/25.9 MB 10.9 MB/s eta 0:00:01\n",
            "   ---------------------------------------  25.9/25.9 MB 10.9 MB/s eta 0:00:01\n",
            "   ---------------------------------------  25.9/25.9 MB 10.9 MB/s eta 0:00:01\n",
            "   ---------------------------------------  25.9/25.9 MB 10.9 MB/s eta 0:00:01\n",
            "   ---------------------------------------  25.9/25.9 MB 10.9 MB/s eta 0:00:01\n",
            "   ---------------------------------------  25.9/25.9 MB 10.9 MB/s eta 0:00:01\n",
            "   ---------------------------------------  25.9/25.9 MB 10.9 MB/s eta 0:00:01\n",
            "   ---------------------------------------  25.9/25.9 MB 10.9 MB/s eta 0:00:01\n",
            "   ---------------------------------------  25.9/25.9 MB 10.9 MB/s eta 0:00:01\n",
            "   ---------------------------------------  25.9/25.9 MB 10.9 MB/s eta 0:00:01\n",
            "   ---------------------------------------  25.9/25.9 MB 10.9 MB/s eta 0:00:01\n",
            "   ---------------------------------------  25.9/25.9 MB 10.9 MB/s eta 0:00:01\n",
            "   ---------------------------------------- 25.9/25.9 MB 3.9 MB/s eta 0:00:00\n",
            "Installing collected packages: av, accelerate, mediapy\n",
            "Successfully installed accelerate-0.24.1 av-11.0.0 mediapy-1.1.9\n"
          ]
        }
      ],
      "source": [
        "!pip install einops omegaconf decord safetensors diffusers[torch]==0.11.1 transformers xformers triton==2.0.0 imageio[pyav] mediapy"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": 6,
      "metadata": {
        "id": "0jsTnJgXVjC6"
      },
      "outputs": [],
      "source": [
        "# !pip install -U \"jax[cuda12_pip]\" -f https://storage.googleapis.com/jax-releases/jax_cuda_releases.html"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": 7,
      "metadata": {
        "colab": {
          "base_uri": "https://localhost:8080/"
        },
        "id": "ePPaNOhFZFgH",
        "outputId": "e116c509-8495-4c8b-edda-a47d8754c462"
      },
      "outputs": [
        {
          "name": "stdout",
          "output_type": "stream",
          "text": [
            "The following additional packages will be installed:\n",
            "  libaria2-0 libc-ares2\n",
            "The following NEW packages will be installed:\n",
            "  aria2 libaria2-0 libc-ares2\n",
            "0 upgraded, 3 newly installed, 0 to remove and 10 not upgraded.\n",
            "Need to get 1,513 kB of archives.\n",
            "After this operation, 5,441 kB of additional disk space will be used.\n",
            "Selecting previously unselected package libc-ares2:amd64.\n",
            "(Reading database ... 120880 files and directories currently installed.)\n",
            "Preparing to unpack .../libc-ares2_1.18.1-1ubuntu0.22.04.2_amd64.deb ...\n",
            "Unpacking libc-ares2:amd64 (1.18.1-1ubuntu0.22.04.2) ...\n",
            "Selecting previously unselected package libaria2-0:amd64.\n",
            "Preparing to unpack .../libaria2-0_1.36.0-1_amd64.deb ...\n",
            "Unpacking libaria2-0:amd64 (1.36.0-1) ...\n",
            "Selecting previously unselected package aria2.\n",
            "Preparing to unpack .../aria2_1.36.0-1_amd64.deb ...\n",
            "Unpacking aria2 (1.36.0-1) ...\n",
            "Setting up libc-ares2:amd64 (1.18.1-1ubuntu0.22.04.2) ...\n",
            "Setting up libaria2-0:amd64 (1.36.0-1) ...\n",
            "Setting up aria2 (1.36.0-1) ...\n",
            "Processing triggers for man-db (2.10.2-1) ...\n",
            "Processing triggers for libc-bin (2.35-0ubuntu3.4) ...\n",
            "/sbin/ldconfig.real: /usr/local/lib/libtbbbind_2_0.so.3 is not a symbolic link\n",
            "\n",
            "/sbin/ldconfig.real: /usr/local/lib/libtbbmalloc.so.2 is not a symbolic link\n",
            "\n",
            "/sbin/ldconfig.real: /usr/local/lib/libtbbbind_2_5.so.3 is not a symbolic link\n",
            "\n",
            "/sbin/ldconfig.real: /usr/local/lib/libtbb.so.12 is not a symbolic link\n",
            "\n",
            "/sbin/ldconfig.real: /usr/local/lib/libtbbmalloc_proxy.so.2 is not a symbolic link\n",
            "\n",
            "/sbin/ldconfig.real: /usr/local/lib/libtbbbind.so.3 is not a symbolic link\n",
            "\n",
            "\u001b[0m\n",
            "Download Results:\n",
            "gid   |stat|avg speed  |path/URI\n",
            "======+====+===========+=======================================================\n",
            "401ea6|\u001b[1;32mOK\u001b[0m  |   168MiB/s|/content/AnimateDiff-SceneFusion/models/DreamBooth_LoRA/toonyou_beta3.safetensors\n",
            "\n",
            "Status Legend:\n",
            "(OK):download completed.\n"
          ]
        }
      ],
      "source": [
        "!apt -y install -qq aria2\n",
        "!aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://huggingface.co/camenduru/AnimateDiff/resolve/main/toonyou_beta3.safetensors -d /content/AnimateDiff-SceneFusion/models/DreamBooth_LoRA -o toonyou_beta3.safetensors"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": 8,
      "metadata": {
        "colab": {
          "base_uri": "https://localhost:8080/"
        },
        "id": "jXBHQRi1LKnb",
        "outputId": "10219ae9-e50d-4a31-fa6f-37f8cccc1fb3"
      },
      "outputs": [
        {
          "name": "stdout",
          "output_type": "stream",
          "text": [
            "Collecting ffmpeg\n",
            "  Downloading ffmpeg-1.4.tar.gz (5.1 kB)\n",
            "  Preparing metadata (setup.py) ... \u001b[?25l\u001b[?25hdone\n",
            "Building wheels for collected packages: ffmpeg\n",
            "  Building wheel for ffmpeg (setup.py) ... \u001b[?25l\u001b[?25hdone\n",
            "  Created wheel for ffmpeg: filename=ffmpeg-1.4-py3-none-any.whl size=6082 sha256=289c2192632ef676cb1b88a59f16c39dd96bd8cf3a7c2cf8f661d5b4d0481c1d\n",
            "  Stored in directory: /root/.cache/pip/wheels/8e/7a/69/cd6aeb83b126a7f04cbe7c9d929028dc52a6e7d525ff56003a\n",
            "Successfully built ffmpeg\n",
            "Installing collected packages: ffmpeg\n",
            "Successfully installed ffmpeg-1.4\n"
          ]
        }
      ],
      "source": [
        "!pip install ffmpeg"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": 9,
      "metadata": {
        "colab": {
          "base_uri": "https://localhost:8080/"
        },
        "id": "Hdx9PUJXG-d_",
        "outputId": "c102aafb-7572-447c-bf13-84709c21c65d"
      },
      "outputs": [
        {
          "name": "stdout",
          "output_type": "stream",
          "text": [
            "/content/AnimateDiff-SceneFusion\n"
          ]
        }
      ],
      "source": [
        "%cd AnimateDiff-SceneFusion\n",
        "# !pip install -r requirements.txt"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": 8,
      "metadata": {
        "colab": {
          "base_uri": "https://localhost:8080/"
        },
        "id": "n581MT-dIxAh",
        "outputId": "5bf3af95-bec0-4888-b983-aebb2d7efd32"
      },
      "outputs": [
        {
          "name": "stderr",
          "output_type": "stream",
          "text": [
            "Cloning into 'models/StableDiffusion'...\n",
            "Updating files:  47% (8/17)\n",
            "Updating files:  52% (9/17)\n",
            "Updating files:  58% (10/17)\n",
            "Updating files:  64% (11/17)\n",
            "Updating files:  70% (12/17)\n",
            "Updating files:  76% (13/17)\n",
            "Updating files:  82% (14/17)\n",
            "Updating files:  88% (15/17)\n",
            "Updating files:  94% (16/17)\n",
            "Updating files: 100% (17/17)\n",
            "Updating files: 100% (17/17), done.\n",
            "Filtering content:  50% (2/4), 394.42 MiB | 17.74 MiB/s\n",
            "Filtering content:  50% (2/4), 974.35 MiB | 10.32 MiB/s\n",
            "Filtering content:  75% (3/4), 974.35 MiB | 10.32 MiB/s\n",
            "Filtering content:  75% (3/4), 2.55 GiB | 6.73 MiB/s   \n",
            "Filtering content: 100% (4/4), 2.55 GiB | 6.73 MiB/s\n",
            "Filtering content: 100% (4/4), 2.55 GiB | 5.89 MiB/s, done.\n"
          ]
        }
      ],
      "source": [
        "# %cd /content/AnimateDiff-SceneFusion\n",
        "\n",
        "# import huggingface_hub\n",
        "\n",
        "# files = [\"config.json\", \"diffusion_pytorch_model.bin\", \"diffusion_pytorch_model.fp16.bin\", \"diffusion_pytorch_model.fp16.safetensors\", \"diffusion_pytorch_model.non_ema.bin\", \"diffusion_pytorch_model.non_ema.safetensors\", \"diffusion_pytorch_model.safetensors\"]\n",
        "\n",
        "# for file in files:\n",
        "#     huggingface_hub.hf_hub_download(\"runwayml/stable-diffusion-v1-5\", file, subfolder=\"unet\", local_dir=\"unet\")\n",
        "\n",
        "\n",
        "!git clone -b fp16 https://huggingface.co/runwayml/stable-diffusion-v1-5 models/StableDiffusion/"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": 3,
      "metadata": {
        "colab": {
          "base_uri": "https://localhost:8080/"
        },
        "id": "RLuAKqD3I2pv",
        "outputId": "37bccf0c-bb76-4d0e-e668-f91254d4f3a3"
      },
      "outputs": [
        {
          "name": "stdout",
          "output_type": "stream",
          "text": [
            "Access denied with the following error:\n",
            "Access denied with the following error:\n"
          ]
        },
        {
          "name": "stderr",
          "output_type": "stream",
          "text": [
            "\n",
            " \tToo many users have viewed or downloaded this file recently. Please\n",
            "\ttry accessing the file again later. If the file you are trying to\n",
            "\taccess is particularly large or is shared with many people, it may\n",
            "\ttake up to 24 hours to be able to view or download the file. If you\n",
            "\tstill can't access a file after 24 hours, contact your domain\n",
            "\tadministrator. \n",
            "\n",
            "You may still be able to access the file from the browser:\n",
            "\n",
            "\t https://drive.google.com/uc?id=1RqkQuGPaCO5sGZ6V6KZ-jUWmsRu48Kdq \n",
            "\n",
            "\n",
            " \tToo many users have viewed or downloaded this file recently. Please\n",
            "\ttry accessing the file again later. If the file you are trying to\n",
            "\taccess is particularly large or is shared with many people, it may\n",
            "\ttake up to 24 hours to be able to view or download the file. If you\n",
            "\tstill can't access a file after 24 hours, contact your domain\n",
            "\tadministrator. \n",
            "\n",
            "You may still be able to access the file from the browser:\n",
            "\n",
            "\t https://drive.google.com/uc?id=1ql0g_Ys4UCz2RnokYlBjyOYPbttbIpbu \n",
            "\n"
          ]
        }
      ],
      "source": [
        "# %cd AnimateDiff-SceneFusion\n",
        "!bash download_bashscripts/0-MotionModule.sh"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": 12,
      "metadata": {
        "id": "1VUbuB4M2UhZ"
      },
      "outputs": [],
      "source": [
        "%load_ext autoreload\n",
        "%autoreload 2"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": 9,
      "metadata": {
        "cellView": "form",
        "colab": {
          "base_uri": "https://localhost:8080/"
        },
        "id": "VZ-CXYNhKXuy",
        "outputId": "88d9be57-67dc-4c4b-a6cc-b39623118d2a"
      },
      "outputs": [
        {
          "name": "stdout",
          "output_type": "stream",
          "text": [
            "[*] Weights will be saved at models/Motion_Module/test\n"
          ]
        },
        {
          "name": "stderr",
          "output_type": "stream",
          "text": [
            "The syntax of the command is incorrect.\n"
          ]
        }
      ],
      "source": [
        "# @title TRAINING CONFIG\n",
        "# %cd /content/AnimateDiff-SceneFusion\n",
        "\n",
        "# @markdown ## Config\n",
        "\n",
        "PROJECT = \"test\" # @param{\"type\":\"string\"}\n",
        "\n",
        "OUTPUT_DIR = \"models/Motion_Module/%s\" % PROJECT\n",
        "\n",
        "print(f\"[*] Weights will be saved at {OUTPUT_DIR}\")\n",
        "\n",
        "!mkdir -p $OUTPUT_DIR\n",
        "\n",
        "# @markdown ## Model\n",
        "\n",
        "MODEL_NAME = \"models/StableDiffusion/\" # @param{\"type\":\"string\"}\n",
        "\n",
        "# @markdown ## Train\n",
        "\n",
        "CONFIG_NAME = f\"configs/{PROJECT}.yaml\" #@param {type:\"string\"}\n",
        "MOTION_MODULE_NAME=\"models/Motion_Module/mm_sd_v15.ckpt\" #@param{\"type\":\"string\"}\n",
        "\n",
        "train_video_folder = f\"data/output\" #@param {type:\"string\"}\n",
        "train_csv_path = f\"data/output.csv\" #@param {type:\"string\"}\n",
        "train_prompt = \"camera panning right to left, a bird's eye view of a row of buildings in a city with trees in the foreground, masterpiece, best quality\" #@param {type:\"string\"}\n",
        "video_length = 5 #@param {type:\"number\"}\n",
        "sample_size = 256 #@param {type:\"number\"}\n",
        "learning_rate = 3e-4 #@param {type:\"number\"}\n",
        "train_steps = 1 #@param {type:\"number\"}\n",
        "validation_steps = 1 #@param {type:\"number\"}\n",
        "\n",
        "\n",
        "# @markdown ## Infer\n",
        "LORA_DREAMBOOTH_PATH=\"models/DreamBooth_LoRA/toonyou_beta3.safetensors\" #@param{\"type\":\"string\"}\n",
        "\n",
        "\n",
        "from omegaconf import OmegaConf\n",
        "\n",
        "\n",
        "config = {\n",
        "  \"pretrained_model_path\": \"models/StableDiffusion/\",\n",
        "  \"motion_module\": MOTION_MODULE_NAME,\n",
        "  \"output_dir\": OUTPUT_DIR,\n",
        "  \"train_data\": {\n",
        "    \"video_folder\": train_video_folder,\n",
        "    \"csv_path\": train_csv_path,\n",
        "    \"sample_n_frames\": video_length,\n",
        "    \"sample_stride\": 100,\n",
        "    \"sample_size\": sample_size\n",
        "  },\n",
        "  \"validation_data\": {\n",
        "    \"prompts\": [\n",
        "      f\"{train_prompt}\",\n",
        "    ],\n",
        "    \"video_length\": video_length,\n",
        "    \"width\": sample_size,\n",
        "    \"height\": sample_size,\n",
        "    \"num_inference_steps\": 20,\n",
        "    \"guidance_scale\": 12.5,\n",
        "    \"temporal_context\": 24,\n",
        "    \"use_inv_latent\": True,\n",
        "    \"num_inv_steps\": 50,\n",
        "  },\n",
        "  \"learning_rate\": learning_rate,\n",
        "  \"train_batch_size\": 1,\n",
        "  \"max_train_steps\": train_steps,\n",
        "  \"checkpointing_steps\": 100,\n",
        "  \"validation_steps\": validation_steps,\n",
        "  \"trainable_modules\": [\n",
        "    \"to_q\",\n",
        "  ],\n",
        "  \"seed\": 33,\n",
        "  \"mixed_precision\": \"fp16\",\n",
        "  \"use_8bit_adam\": False,\n",
        "  \"gradient_checkpointing\": True,\n",
        "  \"enable_xformers_memory_efficient_attention\": True,\n",
        "}\n",
        "\n",
        "OmegaConf.save(config, CONFIG_NAME)"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": 12,
      "metadata": {
        "colab": {
          "base_uri": "https://localhost:8080/"
        },
        "id": "kpUetphRI9D3",
        "outputId": "d0bba9b2-b93c-476a-9909-94e9f7d5239b"
      },
      "outputs": [],
      "source": [
        "# %cd /content/AnimateDiff-SceneFusion\n",
        "# !python -m torch.distributed.run --nnodes=1 --nproc_per_node=1 train.py --config configs/training/training.yaml\n",
        "\n",
        "# !accelerate launch train.py --config=configs/training/training.yaml\n",
        "!accelerate launch  train.py --config=configs/{PROJECT}.yaml --python={3.10}"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": 6,
      "metadata": {
        "colab": {
          "base_uri": "https://localhost:8080/",
          "height": 365
        },
        "id": "IZ2U776S06Gn",
        "outputId": "bae1ea5f-55e6-4a20-8b53-7c641b4ebba5"
      },
      "outputs": [
        {
          "name": "stderr",
          "output_type": "stream",
          "text": [
            "c:\\Users\\texas\\anaconda3\\envs\\animatediff\\lib\\site-packages\\tqdm\\auto.py:21: TqdmWarning: IProgress not found. Please update jupyter and ipywidgets. See https://ipywidgets.readthedocs.io/en/stable/user_install.html\n",
            "  from .autonotebook import tqdm as notebook_tqdm\n"
          ]
        },
        {
          "ename": "OSError",
          "evalue": "Error no file named pytorch_model.bin, tf_model.h5, model.ckpt.index or flax_model.msgpack found in directory models/StableDiffusion/.",
          "output_type": "error",
          "traceback": [
            "\u001b[1;31m---------------------------------------------------------------------------\u001b[0m",
            "\u001b[1;31mOSError\u001b[0m                                   Traceback (most recent call last)",
            "\u001b[1;32mc:\\Users\\texas\\Desktop\\School\\SceneFusion\\AnimateDiff-SceneFusion\\AnimatedDiff_Colab.ipynb Cell 13\u001b[0m line \u001b[0;36m2\n\u001b[0;32m     <a href='vscode-notebook-cell:/c%3A/Users/texas/Desktop/School/SceneFusion/AnimateDiff-SceneFusion/AnimatedDiff_Colab.ipynb#X20sZmlsZQ%3D%3D?line=24'>25</a>\u001b[0m \u001b[39m### >>> create validation pipeline >>> ###\u001b[39;00m\n\u001b[0;32m     <a href='vscode-notebook-cell:/c%3A/Users/texas/Desktop/School/SceneFusion/AnimateDiff-SceneFusion/AnimatedDiff_Colab.ipynb#X20sZmlsZQ%3D%3D?line=25'>26</a>\u001b[0m tokenizer    \u001b[39m=\u001b[39m CLIPTokenizer\u001b[39m.\u001b[39mfrom_pretrained(model_path, subfolder\u001b[39m=\u001b[39m\u001b[39m\"\u001b[39m\u001b[39mtokenizer\u001b[39m\u001b[39m\"\u001b[39m)\n\u001b[1;32m---> <a href='vscode-notebook-cell:/c%3A/Users/texas/Desktop/School/SceneFusion/AnimateDiff-SceneFusion/AnimatedDiff_Colab.ipynb#X20sZmlsZQ%3D%3D?line=26'>27</a>\u001b[0m text_encoder \u001b[39m=\u001b[39m CLIPTextModel\u001b[39m.\u001b[39;49mfrom_pretrained(model_path, subfolder\u001b[39m=\u001b[39;49m\u001b[39m\"\u001b[39;49m\u001b[39mtext_encoder\u001b[39;49m\u001b[39m\"\u001b[39;49m)\n\u001b[0;32m     <a href='vscode-notebook-cell:/c%3A/Users/texas/Desktop/School/SceneFusion/AnimateDiff-SceneFusion/AnimatedDiff_Colab.ipynb#X20sZmlsZQ%3D%3D?line=27'>28</a>\u001b[0m vae          \u001b[39m=\u001b[39m AutoencoderKL\u001b[39m.\u001b[39mfrom_pretrained(model_path, subfolder\u001b[39m=\u001b[39m\u001b[39m\"\u001b[39m\u001b[39mvae\u001b[39m\u001b[39m\"\u001b[39m)\n\u001b[0;32m     <a href='vscode-notebook-cell:/c%3A/Users/texas/Desktop/School/SceneFusion/AnimateDiff-SceneFusion/AnimatedDiff_Colab.ipynb#X20sZmlsZQ%3D%3D?line=28'>29</a>\u001b[0m unet         \u001b[39m=\u001b[39m UNet3DConditionModel\u001b[39m.\u001b[39mfrom_pretrained_2d(model_path, subfolder\u001b[39m=\u001b[39m\u001b[39m\"\u001b[39m\u001b[39munet\u001b[39m\u001b[39m\"\u001b[39m, unet_additional_kwargs\u001b[39m=\u001b[39mOmegaConf\u001b[39m.\u001b[39mto_container(inference_config\u001b[39m.\u001b[39munet_additional_kwargs))\n",
            "File \u001b[1;32mc:\\Users\\texas\\anaconda3\\envs\\animatediff\\lib\\site-packages\\transformers\\modeling_utils.py:2093\u001b[0m, in \u001b[0;36mPreTrainedModel.from_pretrained\u001b[1;34m(cls, pretrained_model_name_or_path, *model_args, **kwargs)\u001b[0m\n\u001b[0;32m   2087\u001b[0m         \u001b[39mraise\u001b[39;00m \u001b[39mEnvironmentError\u001b[39;00m(\n\u001b[0;32m   2088\u001b[0m             \u001b[39mf\u001b[39m\u001b[39m\"\u001b[39m\u001b[39mError no file named \u001b[39m\u001b[39m{\u001b[39;00mWEIGHTS_NAME\u001b[39m}\u001b[39;00m\u001b[39m found in directory \u001b[39m\u001b[39m{\u001b[39;00mpretrained_model_name_or_path\u001b[39m}\u001b[39;00m\u001b[39m but \u001b[39m\u001b[39m\"\u001b[39m\n\u001b[0;32m   2089\u001b[0m             \u001b[39m\"\u001b[39m\u001b[39mthere is a file for Flax weights. Use `from_flax=True` to load this model from those \u001b[39m\u001b[39m\"\u001b[39m\n\u001b[0;32m   2090\u001b[0m             \u001b[39m\"\u001b[39m\u001b[39mweights.\u001b[39m\u001b[39m\"\u001b[39m\n\u001b[0;32m   2091\u001b[0m         )\n\u001b[0;32m   2092\u001b[0m     \u001b[39melse\u001b[39;00m:\n\u001b[1;32m-> 2093\u001b[0m         \u001b[39mraise\u001b[39;00m \u001b[39mEnvironmentError\u001b[39;00m(\n\u001b[0;32m   2094\u001b[0m             \u001b[39mf\u001b[39m\u001b[39m\"\u001b[39m\u001b[39mError no file named \u001b[39m\u001b[39m{\u001b[39;00mWEIGHTS_NAME\u001b[39m}\u001b[39;00m\u001b[39m, \u001b[39m\u001b[39m{\u001b[39;00mTF2_WEIGHTS_NAME\u001b[39m}\u001b[39;00m\u001b[39m, \u001b[39m\u001b[39m{\u001b[39;00mTF_WEIGHTS_NAME\u001b[39m \u001b[39m\u001b[39m+\u001b[39m\u001b[39m \u001b[39m\u001b[39m'\u001b[39m\u001b[39m.index\u001b[39m\u001b[39m'\u001b[39m\u001b[39m}\u001b[39;00m\u001b[39m or \u001b[39m\u001b[39m\"\u001b[39m\n\u001b[0;32m   2095\u001b[0m             \u001b[39mf\u001b[39m\u001b[39m\"\u001b[39m\u001b[39m{\u001b[39;00mFLAX_WEIGHTS_NAME\u001b[39m}\u001b[39;00m\u001b[39m found in directory \u001b[39m\u001b[39m{\u001b[39;00mpretrained_model_name_or_path\u001b[39m}\u001b[39;00m\u001b[39m.\u001b[39m\u001b[39m\"\u001b[39m\n\u001b[0;32m   2096\u001b[0m         )\n\u001b[0;32m   2097\u001b[0m \u001b[39melif\u001b[39;00m os\u001b[39m.\u001b[39mpath\u001b[39m.\u001b[39misfile(os\u001b[39m.\u001b[39mpath\u001b[39m.\u001b[39mjoin(subfolder, pretrained_model_name_or_path)):\n\u001b[0;32m   2098\u001b[0m     archive_file \u001b[39m=\u001b[39m pretrained_model_name_or_path\n",
            "\u001b[1;31mOSError\u001b[0m: Error no file named pytorch_model.bin, tf_model.h5, model.ckpt.index or flax_model.msgpack found in directory models/StableDiffusion/."
          ]
        }
      ],
      "source": [
        "# %cd /content/AnimateDiff-SceneFusion\n",
        "\n",
        "from animatediff.pipelines.pipeline_animation import AnimationPipeline\n",
        "from diffusers import AutoencoderKL, DDPMScheduler, DDIMScheduler\n",
        "from transformers import CLIPTextModel, CLIPTokenizer\n",
        "from omegaconf import OmegaConf\n",
        "from animatediff.models.unet import UNet3DConditionModel\n",
        "from animatediff.pipelines.pipeline_animation import AnimationPipeline\n",
        "from animatediff.utils.util import save_videos_grid\n",
        "from animatediff.utils.util import load_weights\n",
        "from diffusers.utils.import_utils import is_xformers_available\n",
        "from typing import Any\n",
        "import torch\n",
        "from einops import rearrange\n",
        "import torchvision\n",
        "\n",
        "import numpy as np\n",
        "\n",
        "\n",
        "model_path = \"models/StableDiffusion/\"\n",
        "inference_config_path = \"configs/inference/inference-v3.yaml\"\n",
        "motion_module = \"models/Motion_Module/mm_sd_v15.ckpt\"\n",
        "\n",
        "inference_config = OmegaConf.load(inference_config_path)\n",
        "### >>> create validation pipeline >>> ###\n",
        "tokenizer    = CLIPTokenizer.from_pretrained(model_path, subfolder=\"tokenizer\")\n",
        "text_encoder = CLIPTextModel.from_pretrained(model_path, subfolder=\"text_encoder\")\n",
        "vae          = AutoencoderKL.from_pretrained(model_path, subfolder=\"vae\")\n",
        "unet         = UNet3DConditionModel.from_pretrained_2d(model_path, subfolder=\"unet\", unet_additional_kwargs=OmegaConf.to_container(inference_config.unet_additional_kwargs))\n",
        "\n",
        "if is_xformers_available(): unet.enable_xformers_memory_efficient_attention()\n",
        "else: assert False\n",
        "\n",
        "pipeline = AnimationPipeline(\n",
        "    vae=vae, text_encoder=text_encoder, tokenizer=tokenizer, unet=unet,\n",
        "    scheduler=DDIMScheduler(**OmegaConf.to_container(inference_config.noise_scheduler_kwargs.DDIMScheduler)),\n",
        ").to(\"cuda\")\n",
        "\n",
        "pipeline = load_weights(\n",
        "    pipeline,\n",
        "    # motion module\n",
        "    motion_module_path         = motion_module,\n",
        "    motion_module_lora_configs = [],\n",
        "    # image layers\n",
        "    dreambooth_model_path      = \"\",\n",
        "    lora_model_path            = \"\",\n",
        "    lora_alpha                 = 0.8,\n",
        ").to(\"cuda\")\n",
        "\n"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": 5,
      "metadata": {
        "id": "VnDjPeeq1Sdx"
      },
      "outputs": [],
      "source": [
        "pipeline.save_config(\"./\")"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": null,
      "metadata": {
        "id": "nzn0gZA8F4Pk"
      },
      "outputs": [],
      "source": [
        "# prompt: save model to huggingface repo\n",
        "\n",
        "!git lfs install\n",
        "# !git clone https://huggingface.co/bluestarburst/AnimateDiff-SceneFusion /content/huggingface\n"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": null,
      "metadata": {
        "id": "H_OhGJrCPjYb"
      },
      "outputs": [],
      "source": [
        "!cp /content/AnimateDiff-SceneFusion/animatediff/pipelines/pipeline_animation.py /content/AnimateDiff-SceneFusion/pipeline.py"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": null,
      "metadata": {
        "id": "qvK9PwJlSUCg"
      },
      "outputs": [],
      "source": [
        "%cd /content/\n",
        "!huggingface-cli upload AnimateDiff-SceneFusion"
      ]
    }
  ],
  "metadata": {
    "accelerator": "GPU",
    "colab": {
      "gpuType": "T4",
      "machine_shape": "hm",
      "provenance": []
    },
    "kernelspec": {
      "display_name": "Python 3",
      "name": "python3"
    },
    "language_info": {
      "codemirror_mode": {
        "name": "ipython",
        "version": 3
      },
      "file_extension": ".py",
      "mimetype": "text/x-python",
      "name": "python",
      "nbconvert_exporter": "python",
      "pygments_lexer": "ipython3",
      "version": "3.10.13"
    }
  },
  "nbformat": 4,
  "nbformat_minor": 0
}