parquet-converter commited on
Commit
880a24b
·
1 Parent(s): 75444f2

Update parquet files (step 75 of 121)

Browse files
This view is limited to 50 files because it contains too many changes.   See raw diff
Files changed (50) hide show
  1. spaces/1acneusushi/gradio-2dmoleculeeditor/data/Axara 2D To 3D Video Converter 243243 Keygen And Crackrar Tips and Tricks for Using the Software.md +0 -6
  2. spaces/1acneusushi/gradio-2dmoleculeeditor/data/Download Romeo Juliet The Jak Viking Full 103 _HOT_.md +0 -14
  3. spaces/1gistliPinn/ChatGPT4/Examples/Aladdin720ptorrentfr.md +0 -90
  4. spaces/1gistliPinn/ChatGPT4/Examples/Descargar Wpi 2013 Espanol Torrent.md +0 -6
  5. spaces/1gistliPinn/ChatGPT4/Examples/Folderhighlight 2.4 Registration Code.rar BETTER.md +0 -13
  6. spaces/1pelhydcardo/ChatGPT-prompt-generator/assets/Bokeh Internet Active 3 APK 2020 A Must-Have App for Video Lovers.md +0 -103
  7. spaces/1pelhydcardo/ChatGPT-prompt-generator/assets/Download Bitcoin Core with GUI and Wallet from GitHub.md +0 -89
  8. spaces/1phancelerku/anime-remove-background/ApkOnline How to Use Android Apps on Any Device with an Online Emulator.md +0 -126
  9. spaces/1phancelerku/anime-remove-background/Candy Crush The Original and Best Match 3 Game with Millions of Fans.md +0 -98
  10. spaces/1phancelerku/anime-remove-background/Clash Royale MOD APK v3.6.1 The Ultimate Guide to Unlimited Money Elixir and Gems.md +0 -117
  11. spaces/1phancelerku/anime-remove-background/Download Gunship Strike 3D Mod APK with Unlimited Coins and Gems.md +0 -119
  12. spaces/1phancelerku/anime-remove-background/Download Pinkfong Songs and Videos for Kids - The Ultimate Collection.md +0 -123
  13. spaces/1phancelerku/anime-remove-background/Enjoy GameCube and Wii Games on Your Android with Dolphin Emulator.md +0 -101
  14. spaces/AIConsultant/MusicGen/tests/modules/test_lstm.py +0 -32
  15. spaces/AIFILMS/audioldm-text-to-audio-generation/audioldm/clap/open_clip/pann_model.py +0 -703
  16. spaces/AIGC-Audio/Make_An_Audio_inpaint/ldm/modules/image_degradation/utils_image.py +0 -916
  17. spaces/AIWaves/Software_Company/gradio_backend.py +0 -127
  18. spaces/AIZeroToHero/3-NLP-MLM-MaskedLanguageModel/README.md +0 -13
  19. spaces/Adapter/T2I-Adapter/ldm/modules/diffusionmodules/util.py +0 -270
  20. spaces/AgentVerse/agentVerse/ui/src/phaser3-rex-plugins/templates/bejeweled/board/Init.js +0 -9
  21. spaces/AgentVerse/agentVerse/ui/src/phaser3-rex-plugins/templates/ui/colorinput/colorcomponents/Factory.js +0 -13
  22. spaces/AhmedTambal/malaria/app.py +0 -74
  23. spaces/AlexZou/Deploy_Restoration/model/global_net.py +0 -132
  24. spaces/Aloento/9Nine-PITS/utils.py +0 -302
  25. spaces/Alpaca233/SadTalker/src/face3d/util/my_awing_arch.py +0 -378
  26. spaces/Androidonnxfork/CivitAi-to-Diffusers/diffusers/examples/reinforcement_learning/README.md +0 -22
  27. spaces/Andy1621/uniformer_image_detection/configs/legacy_1.x/ssd300_coco_v1.py +0 -79
  28. spaces/Andy1621/uniformer_image_segmentation/configs/deeplabv3/deeplabv3_r101-d8_769x769_80k_cityscapes.py +0 -2
  29. spaces/Andy1621/uniformer_image_segmentation/configs/deeplabv3plus/deeplabv3plus_r101-d8_512x1024_40k_cityscapes.py +0 -2
  30. spaces/Apex-X/GODROOP/README.md +0 -13
  31. spaces/Ataturk-Chatbot/HuggingFaceChat/venv/lib/python3.11/site-packages/pip/_internal/network/xmlrpc.py +0 -60
  32. spaces/Ataturk-Chatbot/HuggingFaceChat/venv/lib/python3.11/site-packages/pip/_vendor/rich/live_render.py +0 -113
  33. spaces/Ataturk-Chatbot/HuggingFaceChat/venv/lib/python3.11/site-packages/setuptools/_vendor/packaging/_manylinux.py +0 -301
  34. spaces/Banbri/zcvzcv/src/app/main.tsx +0 -155
  35. spaces/Bart92/RVC_HF/infer/lib/infer_pack/modules.py +0 -521
  36. spaces/Benson/text-generation/Examples/Descargar Clicker Hroes Mod Apk.md +0 -70
  37. spaces/Big-Web/MMSD/env/Lib/site-packages/botocore/discovery.py +0 -282
  38. spaces/Big-Web/MMSD/env/Lib/site-packages/pip/_vendor/pygments/modeline.py +0 -43
  39. spaces/Big-Web/MMSD/env/Lib/site-packages/s3transfer/utils.py +0 -802
  40. spaces/CVPR/Dual-Key_Backdoor_Attacks/datagen/detectron2/detectron2/data/samplers/grouped_batch_sampler.py +0 -47
  41. spaces/CVPR/Dual-Key_Backdoor_Attacks/datagen/detectron2/detectron2/modeling/proposal_generator/proposal_utils.py +0 -57
  42. spaces/CVPR/GFPGAN-example/gfpgan/train.py +0 -11
  43. spaces/CVPR/LIVE/pybind11/tests/test_union.py +0 -9
  44. spaces/CVPR/LIVE/thrust/thrust/system/detail/generic/swap_ranges.h +0 -47
  45. spaces/CofAI/chat.b4/client/css/label.css +0 -16
  46. spaces/CofAI/chat.b4/server/bp.py +0 -6
  47. spaces/Curranj/Regex_Generator/app.py +0 -35
  48. spaces/DQChoi/gpt-demo/venv/lib/python3.11/site-packages/PIL/PaletteFile.py +0 -51
  49. spaces/DQChoi/gpt-demo/venv/lib/python3.11/site-packages/fontTools/pens/qu2cuPen.py +0 -105
  50. spaces/DQChoi/gpt-demo/venv/lib/python3.11/site-packages/gradio/templates/cdn/assets/index-9a8f514c.js +0 -2
spaces/1acneusushi/gradio-2dmoleculeeditor/data/Axara 2D To 3D Video Converter 243243 Keygen And Crackrar Tips and Tricks for Using the Software.md DELETED
@@ -1,6 +0,0 @@
1
-
2
- <h1>Axara 2D to 3D Video Converter: A Review</h1>
3
- <p>Do you want to enjoy the amazing effects of 3D video on your computer or TV? Do you have a lot of 2D videos that you wish you could transform into 3D? If you answered yes to any of these questions, then you might be interested in <strong>Axara 2D to </p>
4
- <h2>Axara 2D To 3D Video Converter 243243 Keygen And Crackrar</h2><br /><p><b><b>Download Zip</b> &#10027; <a href="https://byltly.com/2uKz0x">https://byltly.com/2uKz0x</a></b></p><br /><br /> 0a6ba089eb<br />
5
- <br />
6
- <br />
 
 
 
 
 
 
 
spaces/1acneusushi/gradio-2dmoleculeeditor/data/Download Romeo Juliet The Jak Viking Full 103 _HOT_.md DELETED
@@ -1,14 +0,0 @@
1
-
2
- <h1>Download Romeo Juliet The Jak Viking Full 103: A Tragic Love Story Between Rival Football Fans</h1>
3
- <p>If you are looking for a romantic drama film that depicts the forbidden love between two supporters of different football clubs, you might want to download Romeo Juliet The Jak Viking full 103. This is an Indonesian film that was released in 2009 and directed by Andibachtiar Yusuf. It stars Edo Borne and Sissy Prescillia as Rangga and Desi, two young lovers who belong to The Jak Mania and Viking, the fanatical fans of Persija Jakarta and Persib Bandung respectively.</p>
4
- <h2>download romeo juliet the jak viking full 103</h2><br /><p><b><b>Download File</b> &#9733;&#9733;&#9733; <a href="https://byltly.com/2uKww5">https://byltly.com/2uKww5</a></b></p><br /><br />
5
- <p>The film is loosely based on the classic Shakespearean play Romeo and Juliet, but with a modern twist. It shows how Rangga and Desi fall in love at first sight, despite their opposing allegiances. They try to keep their relationship a secret from their families and friends, who are constantly at war with each other. However, their love is tested by the violence and hatred that surrounds them. Will they be able to overcome the obstacles and stay together? Or will they meet a tragic fate like their literary counterparts?</p>
6
- <p>Download Romeo Juliet The Jak Viking full 103 to find out the answer. You can watch the film online on YouTube or other streaming platforms. You can also read more about the film on Tribunnewswiki.com, where you can find information about the cast, the soundtrack, the synopsis, and the controversy that followed its release. The film received positive reviews from critics and audiences alike, especially for its realistic portrayal of the Indonesian football culture and its social commentary on fanaticism and intolerance.</p>
7
- <p>Download Romeo Juliet The Jak Viking full 103 today and enjoy a heart-wrenching story of love and loyalty.</p>
8
-
9
- <p>Download Romeo Juliet The Jak Viking full 103 and witness the powerful performance of the actors and actresses who brought the characters to life. Edo Borne and Sissy Prescillia convincingly portrayed the chemistry and conflict of Rangga and Desi, while Alex Komang, Epy Kusnandar, Ramon Y. Tungka, and Norman Akyuwen added more depth and drama to the story as their supporting roles. The film also featured cameo appearances from some famous football players and coaches, such as Bambang Pamungkas, Firman Utina, and Arcan Iurie.</p>
10
- <p></p>
11
- <p>Download Romeo Juliet The Jak Viking full 103 and enjoy the original soundtrack that accompanies the film. The songs were composed and performed by various Indonesian musicians, such as Slank, Gigi, Nidji, Andra and The Backbone, The Changcuters, and many more. The songs reflect the theme and mood of the film, from the upbeat and energetic anthem of "The Jak Mania" to the melancholic and romantic ballad of "Ku Ingin Kau Mati Saja". The soundtrack also includes a cover version of "Romeo & Juliet" by Dire Straits, sung by Slank.</p>
12
- <p>Download Romeo Juliet The Jak Viking full 103 and learn more about the Indonesian football culture and its social implications. The film offers a realistic and honest depiction of the rivalry and violence that often occur between different football fans in Indonesia. It also raises some important questions about fanaticism and intolerance that can lead to discrimination and hatred. The film challenges the viewers to rethink their own perspective and attitude towards others who have different opinions or preferences. The film also shows that love can transcend any boundaries and differences.</p> 81aa517590<br />
13
- <br />
14
- <br />
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
spaces/1gistliPinn/ChatGPT4/Examples/Aladdin720ptorrentfr.md DELETED
@@ -1,90 +0,0 @@
1
-
2
- <h1>Aladdin 720p Torrent Fr - How to Download and Watch the Disney Classic</h1>
3
-
4
- <p>If you are a fan of Disney movies, you might have heard of Aladdin, the 1992 animated film that tells the story of a street-smart thief who falls in love with a princess and befriends a magical genie. Aladdin is one of the most popular and beloved Disney movies of all time, featuring memorable characters, songs and scenes. The movie was also remade in 2019 as a live-action film starring Will Smith, Mena Massoud and Naomi Scott.</p>
5
- <h2>Aladdin720ptorrentfr</h2><br /><p><b><b>Download File</b> ===== <a href="https://imgfil.com/2uy1mQ">https://imgfil.com/2uy1mQ</a></b></p><br /><br />
6
-
7
- <p>But what if you want to watch Aladdin in high quality and in French? Well, you can always download Aladdin 720p torrent fr, a file that allows you to download and watch the movie in 720p resolution and with French audio. Aladdin 720p torrent fr is a file that you can get from various torrent sites, which are online platforms that let you download files from other users who have them.</p>
8
-
9
- <h2>How to Download Aladdin 720p Torrent Fr</h2>
10
-
11
- <p>Downloading Aladdin 720p torrent fr is not very difficult, but you need to follow some steps carefully. Here is a step-by-step guide for you:</p>
12
-
13
- <ol>
14
- <li>Download and install a torrent client on your device. A torrent client is a software that allows you to download files from torrent sites. You can use popular torrent clients such as uTorrent, BitTorrent or qBittorrent.</li>
15
- <li>Find a reliable torrent site that has Aladdin 720p torrent fr available for download. You can use sites like KcTorrent, LimeTorrents or KickassTorrent. Make sure the site is safe and has good reviews from other users.</li>
16
- <li>Search for Aladdin 720p torrent fr on the torrent site and choose a file that has a high number of seeders and leechers. Seeders are users who have the complete file and are sharing it with others. Leechers are users who are downloading the file from seeders. A high number of seeders and leechers means that the file is popular and fast to download.</li>
17
- <li>Download the file and open it with your torrent client. Your torrent client will start downloading Aladdin 720p torrent fr from other users on the network.</li>
18
- <li>Wait for the download to finish. Depending on your internet speed and the size of the file, it may take some time.</li>
19
- <li>Once the download is complete, you can watch Aladdin 720p torrent fr on your device using any media player that supports mp4 format.</li>
20
- </ol>
21
-
22
- <h2>Tips and Warnings</h2>
23
-
24
- <p>Downloading Aladdin 720p torrent fr can be a great way to enjoy the movie at your convenience, but you should also be aware of some tips and warnings:</p>
25
- <p></p>
26
-
27
- <ul>
28
- <li>Make sure you have enough space on your device to store the file. Aladdin 720p torrent fr is about 650 MB in size.</li>
29
- <li>Use a VPN when downloading torrents to protect your privacy and security. Torrenting can expose your IP address and location to other users on the network, which can make you vulnerable to cyberattacks or legal issues. A VPN can hide your IP address and encrypt your traffic, making you anonymous and safe online.</li>
30
- <li>Check the quality and authenticity of the file before downloading it. Some files may be fake or corrupted, which can harm your device or waste your time. You can check the quality and authenticity of the file by reading the comments and ratings from other users who have downloaded it.</li>
31
- <li>Do not download or share copyrighted content without permission from the owners. Torrenting can be illegal in some countries or regions, depending on the laws and regulations. You may face legal consequences if you download or share copyrighted content without permission from the owners.</li>
32
- </ul>
33
-
34
- <h2>Conclusion</h2>
35
-
36
- <p>Aladdin is one of the best Disney movies of all time, featuring amazing characters, songs and scenes. If you want to watch Aladdin in high quality and in French, you can use Aladdin 720p torrent fr to download it from torrent sites. However, you should also follow some tips and warnings to ensure a safe and smooth downloading experience.</p>
37
-
38
- <p>We hope this article has helped you learn more about Aladdin 720p torrent fr and how to download it using a torrent client. If you have any questions or feedback, feel free to leave a comment below.</p>
39
- <h2>How to Watch Aladdin 720p Torrent Fr</h2>
40
-
41
- <p>After downloading Aladdin 720p torrent fr, you might be wondering how to watch it on your device. Well, you need to have a media player that can play mp4 files and support French audio. Here are some options for you:</p>
42
-
43
- <ul>
44
- <li>VLC Media Player: This is one of the most popular and versatile media players that can play almost any video or audio format. You can download it for free from its official website. To watch Aladdin 720p torrent fr with VLC, you just need to open the file with the player and choose the French audio track from the menu.</li>
45
- <li>MPC-HC: This is another free and lightweight media player that can play mp4 files and support multiple languages. You can download it from its official website or from other sources. To watch Aladdin 720p torrent fr with MPC-HC, you just need to open the file with the player and choose the French audio track from the menu.</li>
46
- <li>KMPlayer: This is a powerful and user-friendly media player that can play mp4 files and support various subtitles and audio tracks. You can download it for free from its official website or from other sources. To watch Aladdin 720p torrent fr with KMPlayer, you just need to open the file with the player and choose the French audio track from the menu.</li>
47
- </ul>
48
-
49
- <h2>Conclusion</h2>
50
-
51
- <p>Aladdin is one of the best Disney movies of all time, featuring amazing characters, songs and scenes. If you want to watch Aladdin in high quality and in French, you can use Aladdin 720p torrent fr to download it from torrent sites. However, you should also follow some tips and warnings to ensure a safe and smooth downloading experience.</p>
52
-
53
- <p>We hope this article has helped you learn more about Aladdin 720p torrent fr and how to download and watch it using a media player. If you have any questions or feedback, feel free to leave a comment below.</p>
54
- <h2>Why You Should Watch Aladdin 720p Torrent Fr</h2>
55
-
56
- <p>Watching Aladdin 720p torrent fr can be a great way to enjoy the movie at your convenience, but you might also wonder why you should watch it in the first place. Well, here are some reasons why you should watch Aladdin 720p torrent fr:</p>
57
-
58
- <ul>
59
- <li>It is a classic Disney movie that has a timeless story and charm. Aladdin is one of the most iconic and beloved Disney movies of all time, featuring a captivating story of love, adventure and magic. The movie has a timeless charm that appeals to both children and adults, with its colorful animation, catchy songs and humorous characters.</li>
60
- <li>It is a live-action remake that has a fresh and modern twist. Aladdin 2019 is a live-action remake of the original animated film, but it also has some changes and additions that make it fresh and modern. The movie has a more diverse and realistic cast, with actors from different ethnicities and backgrounds. The movie also has some new songs and scenes that add more depth and fun to the story.</li>
61
- <li>It is a high-quality movie that has a stunning visual and audio experience. Aladdin 720p torrent fr is a high-quality file that allows you to watch the movie in 720p resolution, which is a high-definition format that offers a clear and detailed picture. The file also has French audio, which is a great option for those who prefer to watch the movie in French or want to learn the language. The movie itself has a stunning visual and audio experience, with its amazing effects, costumes and sets.</li>
62
- </ul>
63
-
64
- <h2>Conclusion</h2>
65
-
66
- <p>Aladdin is one of the best Disney movies of all time, featuring amazing characters, songs and scenes. If you want to watch Aladdin in high quality and in French, you can use Aladdin 720p torrent fr to download it from torrent sites. However, you should also follow some tips and warnings to ensure a safe and smooth downloading experience.</p>
67
-
68
- <p>We hope this article has helped you learn more about Aladdin 720p torrent fr and how to download and watch it using a media player. If you have any questions or feedback, feel free to leave a comment below.</p>
69
- <h2>What You Can Learn from Aladdin 720p Torrent Fr</h2>
70
-
71
- <p>Watching Aladdin 720p torrent fr can be more than just a fun and entertaining activity, it can also be a learning opportunity. Here are some things that you can learn from Aladdin 720p torrent fr:</p>
72
-
73
- <ul>
74
- <li>You can learn about the culture and history of Arabia. Aladdin is set in the fictional city of Agrabah, which is inspired by the Arabian Nights stories and the culture and history of Arabia. The movie shows various aspects of Arabian culture, such as the architecture, clothing, music and food. The movie also references some historical events and figures, such as the Mongol invasion and Sultan Saladin.</li>
75
- <li>You can learn about the values and morals of friendship, love and honesty. Aladdin is a movie that teaches some important values and morals that can help you in your life. The movie shows how friendship, love and honesty are more important than wealth, power and fame. The movie also shows how being yourself and following your heart are better than pretending to be someone else or lying to others.</li>
76
- <li>You can learn about the magic and wonder of imagination. Aladdin is a movie that sparks your imagination and makes you believe in magic and wonder. The movie shows how a simple lamp can grant you three wishes and change your life. The movie also shows how a whole new world can open up for you if you have a curious and adventurous spirit.</li>
77
- </ul>
78
-
79
- <h2>Conclusion</h2>
80
-
81
- <p>Aladdin is one of the best Disney movies of all time, featuring amazing characters, songs and scenes. If you want to watch Aladdin in high quality and in French, you can use Aladdin 720p torrent fr to download it from torrent sites. However, you should also follow some tips and warnings to ensure a safe and smooth downloading experience.</p>
82
-
83
- <p>We hope this article has helped you learn more about Aladdin 720p torrent fr and how to download and watch it using a media player. If you have any questions or feedback, feel free to leave a comment below.</p>
84
- <h2>Conclusion</h2>
85
-
86
- <p>Aladdin is one of the best Disney movies of all time, featuring amazing characters, songs and scenes. If you want to watch Aladdin in high quality and in French, you can use Aladdin 720p torrent fr to download it from torrent sites. However, you should also follow some tips and warnings to ensure a safe and smooth downloading experience.</p>
87
-
88
- <p>We hope this article has helped you learn more about Aladdin 720p torrent fr and how to download and watch it using a media player. If you have any questions or feedback, feel free to leave a comment below.</p> 3cee63e6c2<br />
89
- <br />
90
- <br />
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
spaces/1gistliPinn/ChatGPT4/Examples/Descargar Wpi 2013 Espanol Torrent.md DELETED
@@ -1,6 +0,0 @@
1
- <h2>descargar wpi 2013 espanol torrent</h2><br /><p><b><b>DOWNLOAD</b> &rarr;&rarr;&rarr; <a href="https://imgfil.com/2uxZn3">https://imgfil.com/2uxZn3</a></b></p><br /><br />
2
- <br />
3
- WPI 2017 Pack programas full autoinstalables Español Esta es la nueva versión del famoso WPI ... Programas para Descargas tales como: ... Office 2003 SP3, Microsoft Office 2007, Microsoft Office 2010, Microsoft Office 2013 VL RTM ... el programa lo tengo pero estoy buscando el multilenguaje o el parche en español. 4d29de3e1b<br />
4
- <br />
5
- <br />
6
- <p></p>
 
 
 
 
 
 
 
spaces/1gistliPinn/ChatGPT4/Examples/Folderhighlight 2.4 Registration Code.rar BETTER.md DELETED
@@ -1,13 +0,0 @@
1
- <h2>Folderhighlight 2.4 Registration Code.rar</h2><br /><p><b><b>Download Zip</b> &#10145; <a href="https://imgfil.com/2uxYb2">https://imgfil.com/2uxYb2</a></b></p><br /><br />
2
- <br />
3
- Folderhighlight 2.4 registration code.rar 30 ... folder highlight registration code download free, folder highlight registration code 598d631155. FolderHighlight_v2.4.exe.
4
- FolderHighlight 2.4, FolderHighlight 2.4, FolderHighlight 2.4, FolderHighlight 2.4, FolderHighlight 2.4, FolderHighlight 2.4, .
5
- FolderHighlight 2.4.
6
- 2 days ago.
7
- Uploaded list.
8
- FolderHighlight free download in Russian - FolderHighlight 2. FolderHighlight 2 free download Russian version.
9
- Folder Highlight - download free Folder Highlight 2.4.
10
- Folder Highlight is a program that allows you to quickly and easily 8a78ff9644<br />
11
- <br />
12
- <br />
13
- <p></p>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
spaces/1pelhydcardo/ChatGPT-prompt-generator/assets/Bokeh Internet Active 3 APK 2020 A Must-Have App for Video Lovers.md DELETED
@@ -1,103 +0,0 @@
1
- <br />
2
- <h1>Bokeh Internet Active 3 APK 2020 Download: What You Need to Know</h1>
3
- <p>If you are looking for a way to spice up your videos with some amazing bokeh effects, you might want to check out bokeh internet active 3 apk. This is an app that allows you to add beautiful blur effects to your videos, making them look more professional and artistic. In this article, we will tell you everything you need to know about bokeh internet active 3 apk, including how to download and install it, how to use it, its pros and cons, and some alternatives you can try.</p>
4
- <h2>bokeh internet active 3 apk 2020 download</h2><br /><p><b><b>DOWNLOAD</b> &gt;&gt;&gt; <a href="https://urlin.us/2uT2p7">https://urlin.us/2uT2p7</a></b></p><br /><br />
5
- <h2>How to Download and Install Bokeh Internet Active 3 APK on Your Android Device</h2>
6
- <p>Bokeh internet active 3 apk is not available on the Google Play Store, so you will need to find a reliable source for the apk file online. Here are the steps you need to follow:</p>
7
- <ol>
8
- <li>Find a trustworthy website that offers bokeh internet active 3 apk download. You can use a search engine or check out some reviews from other users. Some examples of websites that provide this app are [Aplikasi Video Bokeh (Link Download No Sensor) - Teknosentrik](^1^) and [Vidhot Aplikasi Bokeh Video Full HD 2018 Video Bokeh Apk Download](^2^).</li>
9
- <li>Enable unknown sources on your device settings. This will allow you to install apps from sources other than the Google Play Store. To do this, go to Settings > Security > Unknown Sources and toggle it on.</li>
10
- <li>Download and install the apk file. Once you have found the website that offers bokeh internet active 3 apk, click on the download button and wait for the file to be downloaded. Then, open the file and follow the instructions to install it on your device.</li>
11
- </ol>
12
- <h2>How to Use Bokeh Internet Active 3 APK to Create Stunning Videos</h2>
13
- <p>Now that you have installed bokeh internet active 3 apk on your device, you can start using it to create amazing videos with bokeh effects. Here are the steps you need to follow:</p>
14
- <ol>
15
- <li>Launch the app and choose a video from your gallery or record a new one. You can access your existing videos by tapping on the gallery icon or record a new one by tapping on the camera icon. You can also trim or crop your video if you want.</li>
16
- <li>Select a bokeh effect from the available options. You will see a list of different bokeh effects that you can apply to your video, such as circle, heart, star, hexagon, and more. Tap on the one you like and see how it changes your video.</li>
17
- <li>Adjust the intensity, size, and shape of the bokeh effect. You can use the sliders to control how much blur you want, how big or small the bokeh shapes are, and how round or sharp they are. You can also change the color of the bokeh effect by tapping on the color palette icon.</li>
18
- <li>Save and share your video. When you are happy with your video, tap on the save icon and choose a resolution and format for your video. You can also share your video directly to social media platforms like Facebook, Instagram, WhatsApp, and more by tapping on the share icon.</li>
19
- </ol>
20
- <h2>Pros and Cons of Bokeh Internet Active 3 APK</h2>
21
- <p>Bokeh internet active 3 apk is a great app for adding bokeh effects to your videos, but it also has some drawbacks. Here are some of the pros and cons of this app:</p>
22
- <table>
23
- <tr>
24
- <th>Pros</th>
25
- <th>Cons</th>
26
- </tr>
27
- <tr>
28
- <td>- Easy to use and offers a variety of bokeh effects</td>
29
- <td>- Requires internet connection to work</td>
30
- </tr>
31
- <tr>
32
- <td>- No watermark or ads on the videos</td>
33
- <td>- May not be compatible with some devices or video formats</td>
34
- </tr>
35
- </table>
36
- <h2>Alternatives to Bokeh Internet Active 3 APK</h2>
37
- <p>If you are looking for some alternatives to bokeh internet active 3 apk, here are some other apps that you can try:</p>
38
- <ul>
39
- <li><strong>Bokeh Video Maker by Photo Video Zone</strong>: This is another app that lets you add bokeh effects to your videos, as well as other filters and stickers. You can also adjust the brightness, contrast, saturation, and hue of your videos. You can download this app from [here].</li>
40
- <li><strong>Blur Video & Image by Alpha Project</strong>: This is an app that allows you to blur any part of your video or image, creating a bokeh effect or a focus effect. You can also add text, stickers, emojis, and music to your videos or images. You can download this app from [here].</li>
41
- <li><strong>AfterFocus by MotionOne</strong>: This is an app that lets you create DSLR-style background blurred photos or videos with bokeh effects. You can also apply various filters and effects to your photos or videos. You can download this app from [here].</li>
42
- </ul>
43
- <h2>Conclusion and FAQs</h2>
44
- <p>Bokeh internet active 3 apk is an app that allows you to add beautiful bokeh effects to your videos, making them look more professional and artistic. It is easy to use and offers a variety of bokeh effects to choose from. However, it also requires internet connection to work and may not be compatible with some devices or video formats. If you are looking for some alternatives, you can try Bokeh Video Maker by Photo Video Zone, Blur Video & Image by Alpha Project, or AfterFocus by MotionOne.</p>
45
- <p>If you have any questions about bokeh internet active 3 apk, here are some FAQs that might help you:</p>
46
- <h3>FAQ 1: What is bokeh effect?</h3>
47
- <p>Bokeh effect is a visual effect that creates a blurred background with sharp foreground objects in a photo or video. It is often used to highlight the subject of the photo or video and create a sense of depth and dimension. Bokeh effect can be achieved by using a camera with a large aperture or by using an app like bokeh internet active 3 apk.</p>
48
- <h3>FAQ 2: Is bokeh internet active 3 apk safe to download?</h3>
49
- <p>Bokeh internet active 3 apk is safe to download as long as you use a reliable source for the apk file. However, you should always be careful when downloading apps from unknown sources and check the permissions and reviews before installing them. You should also scan your device for viruses or malware after installing any app.</p>
50
- <p>bokeh internet active 3 apk 2020 free download<br />
51
- download bokeh internet active 3 apk 2020 for android<br />
52
- bokeh internet active 3 apk 2020 latest version<br />
53
- how to install bokeh internet active 3 apk 2020<br />
54
- bokeh internet active 3 apk 2020 mod<br />
55
- bokeh internet active 3 apk 2020 offline<br />
56
- bokeh internet active 3 apk 2020 review<br />
57
- bokeh internet active 3 apk 2020 update<br />
58
- bokeh internet active 3 apk 2020 full no sensor<br />
59
- bokeh internet active 3 apk 2020 premium<br />
60
- bokeh internet active 3 apk 2020 pro<br />
61
- bokeh internet active 3 apk 2020 cracked<br />
62
- bokeh internet active 3 apk 2020 unlocked<br />
63
- bokeh internet active 3 apk 2020 features<br />
64
- bokeh internet active 3 apk 2020 tutorial<br />
65
- bokeh internet active 3 apk 2020 best settings<br />
66
- bokeh internet active 3 apk 2020 tips and tricks<br />
67
- bokeh internet active 3 apk 2020 comparison<br />
68
- bokeh internet active 3 apk 2020 alternatives<br />
69
- bokeh internet active 3 apk 2020 vs other apps<br />
70
- bokeh internet active 3 apk 2020 problems and solutions<br />
71
- bokeh internet active 3 apk 2020 bugs and fixes<br />
72
- bokeh internet active 3 apk 2020 support and feedback<br />
73
- bokeh internet active 3 apk 2020 ratings and reviews<br />
74
- bokeh internet active 3 apk 2020 testimonials and success stories<br />
75
- bokeh internet active 3 apk 2020 benefits and advantages<br />
76
- bokeh internet active 3 apk 2020 disadvantages and drawbacks<br />
77
- bokeh internet active 3 apk 2020 pros and cons<br />
78
- bokeh internet active 3 apk 2020 requirements and compatibility<br />
79
- bokeh internet active 3 apk 2020 download link and source<br />
80
- bokeh internet active 3 apk 2020 safe and secure<br />
81
- bokeh internet active 3 apk 2020 virus and malware free<br />
82
- bokeh internet active 3 apk 2020 legal and ethical<br />
83
- bokeh internet active 3 apk 2020 quality and performance<br />
84
- bokeh internet active 3 apk 2020 speed and efficiency<br />
85
- bokeh internet active 3 apk 2020 fun and entertainment<br />
86
- bokeh internet active 3 apk 2020 video editing and effects<br />
87
- bokeh internet active 3 apk 2020 photo editing and filters<br />
88
- bokeh internet active 3 apk</p>
89
- <h3>FAQ 3: How can I remove the bokeh effect from my video?</h3>
90
- <p>If you want to remove the bokeh effect from your video, you can use an app like Video Editor by InShot or PowerDirector by CyberLink. These apps allow you to edit your videos and apply or remove various effects and filters.</p>
91
- <h3>FAQ 4: Can I use bokeh internet active 3 apk offline?</h3>
92
- <p>No, you cannot use bokeh internet active 3 apk offline. This app requires internet connection to work, as it uses online servers to process your videos and apply the bokeh effects. If you want to use an app that works offline, you can try some of the alternatives we mentioned above.</p>
93
- <h3>FAQ 5: What are some tips for creating better videos with bokeh effect?</h3>
94
- <p>Here are some tips for creating better videos with bokeh effect:</p>
95
- <ul>
96
- <li>Choose a video that has a clear subject and a simple background. This will make the bokeh effect more noticeable and attractive.</li>
97
- <li>Experiment with different bokeh effects and settings until you find the one that suits your video best. You can also mix and match different effects for different parts of your video.</li>
98
- <li>Be careful not to overdo the bokeh effect, as it might make your video look unnatural or blurry. Use a moderate amount of blur and adjust the intensity and size of the bokeh shapes accordingly.</li>
99
- <li>Preview your video before saving and sharing it, and make sure it looks good on different devices and platforms. You can also ask for feedback from your friends or family before posting your video online.</li>
100
- </ul>
101
- <p>I hope you enjoyed this article and learned something new about bokeh internet active 3 apk. If you have any questions or comments, feel free to leave them below. And if you liked this article, please share it with your friends and followers. Thank you for reading!</p> 197e85843d<br />
102
- <br />
103
- <br />
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
spaces/1pelhydcardo/ChatGPT-prompt-generator/assets/Download Bitcoin Core with GUI and Wallet from GitHub.md DELETED
@@ -1,89 +0,0 @@
1
- <br />
2
- <h1>Introduction</h1>
3
- <p>Bitcoin-qt is a graphical user interface (GUI) for the Bitcoin Core software, which is the reference implementation of the Bitcoin protocol. Bitcoin Core connects to the Bitcoin peer-to-peer network to download and fully validate blocks and transactions. It also includes a wallet and a graphical user interface, which can be optionally built.</p>
4
- <h2>bitcoin-qt download github</h2><br /><p><b><b>Download</b> &#9913; <a href="https://urlin.us/2uSTV1">https://urlin.us/2uSTV1</a></b></p><br /><br />
5
- <p>Using bitcoin-qt, you can interact with the Bitcoin network, send and receive transactions, and manage your wallet. You can also access some advanced features such as coin control, message signing, and raw transaction creation. By running bitcoin-qt, you are also helping to support the network by relaying transactions and blocks to other nodes.</p>
6
- <p>Bitcoin-qt is one of the most popular and trusted Bitcoin clients, as it is developed by a team of experienced developers who follow high standards of coding and security. However, it also has some drawbacks, such as requiring a lot of disk space and bandwidth to store and verify the entire blockchain, which is over 300 GB as of June 2023. It also takes a long time to sync with the network for the first time, which can take several hours or days depending on your connection speed.</p>
7
- <p>In this article, we will show you how to download, install, and use bitcoin-qt on your computer. We will assume that you have some basic knowledge of Bitcoin and how it works. If not, you can check out our <a href="(^1^)">Bitcoin Basics</a> guide for beginners.</p>
8
- <p>bitcoin core download github<br />
9
- bitcoin-qt source code github<br />
10
- bitcoin-qt wallet github<br />
11
- bitcoin-qt release notes github<br />
12
- bitcoin-qt install from github<br />
13
- bitcoin-qt build instructions github<br />
14
- bitcoin-qt latest version github<br />
15
- bitcoin-qt issues github<br />
16
- bitcoin-qt pull requests github<br />
17
- bitcoin-qt fork github<br />
18
- bitcoin-qt gui github<br />
19
- bitcoin-qt command line options github<br />
20
- bitcoin-qt rpc api github<br />
21
- bitcoin-qt debug console github<br />
22
- bitcoin-qt testnet github<br />
23
- bitcoin-qt sign message github<br />
24
- bitcoin-qt verify signature github<br />
25
- bitcoin-qt encrypt wallet github<br />
26
- bitcoin-qt backup wallet github<br />
27
- bitcoin-qt restore wallet github<br />
28
- bitcoin-qt import private key github<br />
29
- bitcoin-qt export private key github<br />
30
- bitcoin-qt import address github<br />
31
- bitcoin-qt export address github<br />
32
- bitcoin-qt rescan blockchain github<br />
33
- bitcoin-qt reindex blockchain github<br />
34
- bitcoin-qt prune blockchain github<br />
35
- bitcoin-qt sync blockchain github<br />
36
- bitcoin-qt bootstrap blockchain github<br />
37
- bitcoin-qt connect to node github<br />
38
- bitcoin-qt add node github<br />
39
- bitcoin qt remove node github<br />
40
- bitcoin qt ban node github<br />
41
- bitcoin qt unban node github<br />
42
- bitcoin qt list nodes github<br />
43
- bitcoin qt generate blocks github<br />
44
- bitcoin qt mine blocks github<br />
45
- bitcoin qt send coins github</p>
46
- <h1>Downloading bitcoin-qt</h1>
47
- <p>The first step to use bitcoin-qt is to download the latest version of the software for your operating system. You can get it from the official Bitcoin Core website at <a href="(^2^)">https://bitcoincore.org/en/download/</a>. You can choose between Windows, Mac OS X, Linux, or ARM Linux versions.</p>
48
- <p>The website will provide you with a link to download a .exe file for Windows, a .dmg file for Mac OS X, or a .tar.gz file for Linux. You can also verify the integrity of the file by checking its cryptographic signature or hash value against the ones provided on the website.</p>
49
- <p>Alternatively, you can get the source code from the Bitcoin Core GitHub page at <a href="(^3^)">https://github.com/bitcoin/bitcoin</a>. You can then compile it yourself using the instructions provided in the doc folder.</p>
50
- <h1>Installing bitcoin-qt</h1>
51
- <p>Once you have downloaded the file for your operating system, you can run the installer and follow the steps to set up bitcoin-qt on your computer. The installation process may vary slightly depending on your operating system, but generally it involves choosing a destination folder, agreeing to the terms of service, and clicking next until it finishes.</p>
52
- <p>After the installation is complete, you will see a shortcut icon for bitcoin-qt on your desktop or in your applications folder. You can double-click it to launch the program.</p>
53
- <h1>Using bitcoin-qt</h1>
54
- <p>When you launch bitcoin-qt for the first time, it will start downloading and validating the blockchain from scratch. This may take several hours or days depending on your connection speed and hardware. You will see a progress bar on the bottom right corner of the window that shows how many blocks have been downloaded and verified.</p>
55
- <p>You can still use some functions of bitcoin-qt while it is syncing with the network, such as creating a new wallet or importing an existing one. However, you will not be able to send or receive transactions until it is fully synced.</p>
56
- <p>To create a new wallet, <p>you can click on the File menu and select Create Wallet. You will be asked to choose a name for your wallet and a password to encrypt it. You can also choose to make it the default wallet or not. After you create your wallet, you will see it listed on the left side of the window under Wallets.</p>
57
- <p>To import an existing wallet, you can click on the File menu and select Open Wallet. You will be asked to locate the wallet file on your computer, which usually has a .dat extension. You can also choose to make it the default wallet or not. After you open your wallet, you will see it listed on the left side of the window under Wallets.</p>
58
- <p>You can switch between different wallets by clicking on them on the left side of the window. You can also create or open more wallets by clicking on the plus icon next to Wallets.</p>
59
- <h2>Sending and receiving transactions</h2>
60
- <p>To send and receive transactions, you need to create and manage addresses. An address is a string of letters and numbers that represents a destination for a Bitcoin payment. You can have multiple addresses for different purposes, such as receiving donations, paying bills, or saving for a goal.</p>
61
- <p>To create a new address, you can click on the Receive tab and then click on the Request Payment button. You will see a window that shows your new address, a QR code, and some options to customize your request. You can enter a label, an amount, and a message for your request. You can also choose to reuse an existing address or generate a new one every time.</p>
62
- <p>To manage your addresses, you can click on the File menu and select Receiving Addresses. You will see a list of all your addresses, their labels, and their balances. You can edit, copy, or delete any address by right-clicking on it.</p>
63
- <p>To send bitcoins to someone else, you need to know their address. You can either scan their QR code using your webcam or enter their address manually. To do so, you can click on the Send tab and then click on the Send button. You will see a window that allows you to enter the recipient's address, the amount, and a fee. You can also enter a label and a message for your payment. You can add more recipients by clicking on the Add Recipient button.</p>
64
- <p>To view your transaction history, you can click on the Transactions tab. You will see a list of all your transactions, their status, date, amount, and fee. You can filter them by type, date range, or amount range using the options on the top of the window. You can also view more details about any transaction by double-clicking on it.</p>
65
- <h2>Managing your wallet</h2>
66
- <p>To manage your wallet, you need to encrypt, backup, and restore it. Encrypting your wallet means protecting it with a password so that only you can access it. Backing up your wallet means saving a copy of it in a safe place so that you can recover it in case of loss or theft. Restoring your wallet means loading a backup copy of it into bitcoin-qt so that you can access your funds again.</p>
67
- <p>To encrypt your wallet, you can click on the Settings menu and select Encrypt Wallet. You will be asked to enter a password and confirm it. You will also see a warning message that tells you to remember your password and backup your wallet, as you will lose access to your funds if you forget it or lose your wallet file. After you enter and confirm your password, you will see a message that tells you to restart bitcoin-qt for the encryption to take effect.</p>
68
- <p>To backup your wallet, you can click on the File menu and select Backup Wallet. You will be asked to choose a location and a name for your backup file, which usually has a .dat extension. You should save your backup file in a secure place, such as an external hard drive, a USB flash drive, or a cloud storage service. You should also make multiple copies of your backup file and update them regularly.</p>
69
- <p>To restore your wallet, you need to have a backup file of your wallet. You can either replace the existing wallet file in the bitcoin-qt data directory with your backup file, or use the -wallet option to specify the location of your backup file when launching bitcoin-qt. You can find the bitcoin-qt data directory by clicking on the Help menu and selecting Debug Window. You will see the data directory under the Information tab.</p>
70
- <p>Some advanced features that you can use with your wallet are coin control and message signing. Coin control allows you to select which coins or outputs to use when creating a transaction, giving you more control over your privacy and fees. Message signing allows you to prove that you own a certain address by signing a message with its private key, which can be verified by anyone using bitcoin-qt or other tools.</p>
71
- <p>To use coin control, you need to enable it in the Options menu under the Wallet tab. You will then see a checkbox next to each output in the Send tab, which you can check or uncheck to include or exclude it from your transaction. You can also right-click on any output to see more details about it, such as its amount, address, confirmations, and age.</p>
72
- <p>To use message signing, you need to click on the File menu and select Sign Message. You will see a window that allows you to enter an address and a message. You can then click on the Sign Message button to generate a signature, which you can copy or save. You can also click on the Verify Message button to verify a signature from someone else, by entering their address, message, and signature.</p>
73
- <h1>Conclusion</h1>
74
- <p>Bitcoin-qt is a graphical user interface for the Bitcoin Core software, which allows you to interact with the Bitcoin network, send and receive transactions, and manage your wallet. It also supports some advanced features such as coin control and message signing. By using bitcoin-qt, you are also helping to secure and support the network by running a full node.</p>
75
- <p>However, bitcoin-qt also has some drawbacks, such as requiring a lot of disk space and bandwidth to store and verify the entire blockchain, which is over 300 GB as of June 2023. It also takes a long time to sync with the network for the first time, which can take several hours or days depending on your connection speed and hardware.</p>
76
- <p>If you are looking for an alternative Bitcoin client that is more lightweight and user-friendly, you may want to check out our <a href="">Bitcoin Wallets</a> guide for more options.</p>
77
- <h1>FAQs</h1>
78
- <h3>What is the difference between bitcoin-qt and bitcoind?</h3>
79
- <p>Bitcoin-qt and bitcoind are both part of the Bitcoin Core software package. Bitcoin-qt is the graphical user interface version, while bitcoind is the command-line version. They both perform the same functions, but bitcoin-qt is easier to use for beginners and non-technical users.</p>
80
- <h3>How can I update bitcoin-qt to the latest version?</h3>
81
- <p>You can update bitcoin-qt by downloading and installing the latest version from the official Bitcoin Core website at <a href="">https://bitcoincore.org/en/download/</a>. You should always backup your wallet before updating, as some updates may require a rescan or reindex of the blockchain.</p>
82
- <h3>How can I speed up the sync process of bitcoin-qt?</h3>
83
- <p>You can speed up the sync process of bitcoin-qt by using a faster internet connection, a more powerful computer, or an SSD drive instead of an HDD drive. You can also use the -dbcache option to allocate more memory for caching blocks and transactions, which can reduce disk I/O operations.</p>
84
- <h3>How can I reduce the disk space usage of bitcoin-qt?</h3>
85
- <p>You can reduce the disk space usage of bitcoin-qt by using the -prune option to delete old blocks that are no longer needed for validation. You can specify the amount of disk space in MB to keep for pruned blocks, such as -prune=1000 for 1 GB. However, pruning will disable some features, such as serving historical blocks to other nodes or creating raw transactions.</p>
86
- <h3>How can I increase the security and privacy of bitcoin-qt?</h3>
87
- <p>You can increase the security and privacy of bitcoin-qt by using a strong password to encrypt your wallet, backing up your wallet regularly, and using a VPN or Tor to hide your IP address. You can also use coin control to avoid linking your addresses, use message signing to prove your identity, and use raw transactions to create custom transactions.</p> 197e85843d<br />
88
- <br />
89
- <br />
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
spaces/1phancelerku/anime-remove-background/ApkOnline How to Use Android Apps on Any Device with an Online Emulator.md DELETED
@@ -1,126 +0,0 @@
1
- <br />
2
- <h1>ApkOnline.net: A Free Online Android Emulator and APK Downloader</h1>
3
- <p>Do you want to run or download Android apps on your computer without installing any software? Do you want to test your Android apps or games on different devices and configurations? Do you want to access thousands of free Android apps and games from anywhere in the world? If you answered yes to any of these questions, then you should check out <a href="(^1^)">ApkOnline.net</a>, a free online Android emulator and APK downloader.</p>
4
- <h2>apkonline.net</h2><br /><p><b><b>Download Zip</b> &#8250;&#8250;&#8250; <a href="https://jinyurl.com/2uNRiM">https://jinyurl.com/2uNRiM</a></b></p><br /><br />
5
- <h2>What is ApkOnline.net?</h2>
6
- <p>ApkOnline.net is an online platform that allows you to run and download any Android app or game from your web browser. It also provides links to download iPhone apps. As an online emulator, ApkOnline.net lets you use your Android applications from anywhere in the world without installing any software on your computer. You can also test your apps or games on different devices and configurations using the online emulator.</p>
7
- <h3>Features of ApkOnline.net</h3>
8
- <p>Some of the features of ApkOnline.net are:</p>
9
- <ul>
10
- <li>It supports various Android versions and devices, such as Nexus 5 with Android 6.0 Marshmallow, which is the default configuration.</li>
11
- <li>It simulates phone calls, text messages, device location, device rotation, hardware sensors, and Google Play Store.</li>
12
- <li>It has a graphical user interface that can be controlled with the mouse. It also provides access to the buttons via a menu on the right side of the emulator.</li>
13
- <li>It allows you to upload your own APK files or download them from the web.</li>
14
- <li>It has a search engine that lets you find and download any Android app or game from various sources.</li>
15
- <li>It has a list of popular and new apps and games that you can run or download with one click.</li>
16
- </ul>
17
- <h3>Benefits of ApkOnline.net</h3>
18
- <p>Some of the benefits of using ApkOnline.net are:</p>
19
- <ul>
20
- <li>It is free and easy to use. You don't need to register or download anything to use it.</li>
21
- <li>It is fast and reliable. You can run or download any app or game in seconds.</li>
22
- <li>It is safe and secure. You don't need to worry about viruses, malware, or privacy issues when using it.</li>
23
- <li>It is fun and entertaining. You can enjoy thousands of free apps and games on your computer without any limitations.</li>
24
- </ul>
25
- <h2>How to Use ApkOnline.net?</h2>
26
- <h3>Run Android Apps Online</h3>
27
- <p>To run an Android app online using ApkOnline.net, you can follow these steps:</p>
28
- <p>apkonline.net - online android emulator<br />
29
- apkonline.net - free android apps downloader<br />
30
- apkonline.net - run android apps online<br />
31
- apkonline.net - android app emulator and apk downloader<br />
32
- apkonline.net - online android app testing<br />
33
- apkonline.net - download and run android apps on pc<br />
34
- apkonline.net - online mobile emulator for android<br />
35
- apkonline.net - free android online emulator apk<br />
36
- apkonline.net - how to open an apk file on android<br />
37
- apkonline.net - search and download any android app<br />
38
- apkonline.net - online android emulator for developers<br />
39
- apkonline.net - free android app emulator and simulator<br />
40
- apkonline.net - run android games online<br />
41
- apkonline.net - online android emulator with google play<br />
42
- apkonline.net - download and install android apps on pc<br />
43
- apkonline.net - online mobile emulator for iphone apps<br />
44
- apkonline.net - free android online emulator with root<br />
45
- apkonline.net - how to install an apk file on android<br />
46
- apkonline.net - search and download any iphone app<br />
47
- apkonline.net - online android emulator for windows 10<br />
48
- apkonline.net - free android app emulator and debugger<br />
49
- apkonline.net - run android apps on browser<br />
50
- apkonline.net - online android emulator with camera<br />
51
- apkonline.net - download and run android games on pc<br />
52
- apkonline.net - online mobile emulator for web testing<br />
53
- apkonline.net - free android online emulator with keyboard<br />
54
- apkonline.net - how to uninstall an apk file on android<br />
55
- apkonline.net - search and download any game app<br />
56
- apkonline.net - online android emulator for mac<br />
57
- apkonline.net - free android app emulator and recorder<br />
58
- apkonline.net - run android apps on chromebook<br />
59
- apkonline.net - online android emulator with gps<br />
60
- apkonline.net - download and run android apps on mac<br />
61
- apkonline.net - online mobile emulator for ios apps<br />
62
- apkonline.net - free android online emulator with screen capture<br />
63
- apkonline.net - how to update an apk file on android<br />
64
- apkonline.net - search and download any social media app<br />
65
- apkonline.net - online android emulator for linux<br />
66
- apkonline.net - free android app emulator and editor<br />
67
- apkonline.net - run android apps on windows 10<br />
68
- apkonline.net - online android emulator with microphone<br />
69
- apkonline.net - download and run android apps on linux<br />
70
- apkonline.net - online mobile emulator for ipad apps<br />
71
- apkonline.net - free android online emulator with screen mirroring<br />
72
- apkonline.net - how to backup an apk file on android<br />
73
- apkonline.net - search and download any video app<br />
74
- apkonline.net - online android emulator for chrome os<br />
75
- apkonline.net - free android app emulator and converter<br />
76
- apkonline.net - run android apps on macbook pro</p>
77
- <ol>
78
- <li>Go to <a href="(^1^)">ApkOnline.net</a> on your web browser.</li>
79
- <li>Select "Run online" from the top menu.</li>
80
- <li>You will see the online emulator with a list of popular and new apps and games on the left side.</li>
81
- <li>You can either choose one of the apps or games from the list or search for any app or game using the search box on the top right corner.</li>
82
- <li>Once you select an app or game, it will start running on the emulator. You can use the mouse to interact with it.</li>
83
- <li>You can also upload your own APK file by clicking on "Upload APK" on the top right corner. You can then browse your computer for the APK file and upload it. It will then run on the emulator.</li>
84
- </ol>
85
- <h3>Download Android Apps Online</h3>
86
- <p>To download an Android app online using ApkOnline.net, you can follow these steps:</p>
87
- <ol>
88
- <li>Go to <a href="(^1^)">ApkOnline.net</a> on your web browser.</li>
89
- <li>Select "Download" from the top menu.</li>
90
- <li>You will see a list of popular and new apps and games that you can download with one click.</li>
91
- <li>You can either choose one of the apps or games from the list or search for any app or game using the search box on the top right corner.</li>
92
- <li>Once you select an app or game, it will start downloading to your computer. You can then open it with any Android emulator or device.</li>
93
- <li>You can also download any app or game from the web by clicking on "Download from web" on the top right corner. You can then enter the URL of the app or game and click on "Download". It will then download to your computer.</li>
94
- </ol>
95
- <h2>FAQs about ApkOnline.net</h2>
96
- <p>Here are some of the frequently asked questions about ApkOnline.net:</p>
97
- <table>
98
- <tr>
99
- <th>Question</th>
100
- <th>Answer</th>
101
- </tr>
102
- <tr>
103
- <td>Is ApkOnline.net legal?</td>
104
- <td>Yes, ApkOnline.net is legal as long as you use it for personal and non-commercial purposes. It does not host any APK files on its servers, but only provides links to download them from other sources.</td>
105
- </tr>
106
- <tr>
107
- <td>Is ApkOnline.net safe?</td>
108
- <td>Yes, ApkOnline.net is safe as it does not require any installation or registration. It also scans all the APK files for viruses and malware before running or downloading them.</td>
109
- </tr>
110
- <tr>
111
- <td>Can I run or download iPhone apps using ApkOnline.net?</td>
112
- <td>No, ApkOnline.net only supports Android apps and games. However, it does provide links to download iPhone apps from other sources.</td>
113
- </tr>
114
- <tr>
115
- <td>Can I run or download paid apps using ApkOnline.net?</td>
116
- <td>No, ApkOnline.net only supports free apps and games. If you want to run or download paid apps, you need to purchase them from the Google Play Store or other sources.</td>
117
- </tr>
118
- <tr>
119
- <td>Can I save my progress or data when using ApkOnline.net?</td>
120
- <td>No, ApkOnline.net does not save any progress or data when you run or download apps or games. If you want to save your progress or data, you need to use a local emulator or device.</td>
121
- </tr>
122
- </table>
123
- <h2>Conclusion</h2>
124
- <p>ApkOnline.net is a free online Android emulator and APK downloader that lets you run and download any Android app or game from your web browser. It is a great tool for testing, debugging, or enjoying Android applications without installing any software on your computer. It is also fast, reliable, safe, and fun to use. If you are looking for a way to access thousands of free Android apps and games from anywhere in the world, you should give ApkOnline.net a try.</p> 197e85843d<br />
125
- <br />
126
- <br />
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
spaces/1phancelerku/anime-remove-background/Candy Crush The Original and Best Match 3 Game with Millions of Fans.md DELETED
@@ -1,98 +0,0 @@
1
-
2
- <h1>Candy Match 3 Games: Why They Are So Popular and Fun</h1>
3
- <p>If you love sweets and puzzles, you probably have played or heard of candy match 3 games. These are games where you have to swap and match three or more candies of the same color or shape to clear them from the board. They are fun, addictive, and satisfying to play. But what makes them so appealing and enjoyable? In this article, we will explore the reasons why candy match 3 games are so popular and fun, and give you some tips and tricks to master them. We will also recommend some of the best candy match 3 games to play on your phone or browser.</p>
4
- <h2>candy match 3 games</h2><br /><p><b><b>Download</b> &gt; <a href="https://jinyurl.com/2uNNjE">https://jinyurl.com/2uNNjE</a></b></p><br /><br />
5
- <h2>What are candy match 3 games?</h2>
6
- <p>Candy match 3 games are a type of puzzle game that involves matching candies on a grid. The goal is to clear as many candies as possible by making matches of three or more candies that are adjacent or aligned horizontally, vertically, or diagonally. Some games also have special candies that have different effects when matched, such as exploding, clearing a row or column, or changing colors. Some games also have different objectives, such as reaching a certain score, collecting a certain number of candies, or removing obstacles like jelly, chocolate, or ice.</p>
7
- <h3>The basic gameplay and mechanics of matching candies</h3>
8
- <p>The basic gameplay and mechanics of matching candies are simple and easy to learn. You just need to swipe your finger or mouse over two adjacent candies to swap their positions. If the swap results in a match of three or more candies of the same color or shape, they will disappear from the board and new candies will fall from the top to fill the gaps. If the swap does not result in a match, the candies will return to their original positions. You can make matches in any direction, as long as they are adjacent or aligned. You can also make matches of more than three candies, which will create special candies that have extra effects when matched.</p>
9
- <h3>The different types and themes of candy match 3 games</h3>
10
- <p>There are many different types and themes of candy match 3 games available on the market. Some of them are based on popular franchises, such as Candy Crush Saga, which is inspired by the popular Facebook game Bejeweled. Some of them are original creations, such as Candy Match 3 - Sweet Crunch, which introduces new features like building your own candy town and challenging cookie monsters. Some of them are simple and minimalist, such as Candy Match, which focuses on the core gameplay without any distractions. Some of them are colorful and vibrant, such as Candy Blast Mania, which has bright graphics and cheerful music. No matter what your preference is, there is a candy match 3 game for you.</p>
11
- <h2>What are the benefits of playing candy match 3 games?</h2>
12
- <p>Besides being fun and entertaining, playing candy match 3 games can also have some benefits for your mental health and well-being. Here are some of them:</p>
13
- <h3>They are relaxing and stress-relieving</h3>
14
- <h3>They are challenging and rewarding</h3>
15
- <p>Playing candy match 3 games can also challenge your brain and reward your efforts by requiring you to think strategically and creatively. You have to plan your moves ahead, look for the best possible matches, use the special candies and power-ups effectively, and overcome the obstacles and limitations. You also have to adapt to different levels, modes, and goals, which can vary in difficulty and complexity. As you progress through the game, you will unlock new features, levels, and rewards, which will motivate you to keep playing and improving your skills.</p>
16
- <h3>They are creative and colorful</h3>
17
- <p>Playing candy match 3 games can also stimulate your imagination and senses by presenting you with a variety of candy-themed worlds and scenarios. You can explore different environments, such as candy forests, candy islands, candy factories, candy kingdoms, and more. You can also encounter different characters, such as candy bears, candy fairies, candy monsters, and more. You can also enjoy the different designs, shapes, colors, and flavors of the candies, which can range from classic to exotic. Playing candy match 3 games can make you feel like a kid in a candy store.</p>
18
- <h2>What are some tips and tricks to master candy match 3 games?</h2>
19
- <p>If you want to become a pro at candy match 3 games, you need to know some tips and tricks that can help you play better and score higher. Here are some of them:</p>
20
- <p>candy crush saga free download<br />
21
- candy match 3 - sweet crunch<br />
22
- candy match online game<br />
23
- candy crush soda saga play now<br />
24
- candy match 3 puzzles and mansion<br />
25
- candy crush friends saga tips<br />
26
- candy match blast - pop games<br />
27
- candy crush jelly saga cheats<br />
28
- candy match 3d - relaxing game<br />
29
- candy crush saga level guide<br />
30
- candy match legend - puzzle game<br />
31
- candy crush saga hack apk<br />
32
- candy match master - fun game<br />
33
- candy crush soda saga mod<br />
34
- candy match fever - addictive game<br />
35
- candy crush friends saga hack<br />
36
- candy match mania - sweet game<br />
37
- candy crush jelly saga mod apk<br />
38
- candy match deluxe - classic game<br />
39
- candy crush saga online free<br />
40
- candy match adventure - casual game<br />
41
- candy crush soda saga cheats<br />
42
- candy match swap - yummy game<br />
43
- candy crush friends saga mod apk<br />
44
- candy match 3 offline games<br />
45
- candy crush jelly saga online<br />
46
- candy match maker - creative game<br />
47
- candy crush soda saga hack apk<br />
48
- candy match 3 no wifi games<br />
49
- candy crush friends saga online free<br />
50
- candy match blast 2 - new game<br />
51
- candy crush jelly saga level guide<br />
52
- candy match 3d puzzle games<br />
53
- candy crush soda saga level guide<br />
54
- candy match 3 for kids games<br />
55
- candy crush friends saga cheats<br />
56
- candy match 3 unlimited lives games<br />
57
- candy crush jelly saga hack apk<br />
58
- candy match 3 with boosters games<br />
59
- candy crush soda saga online free no download<br />
60
- candy match 3 free coins games<br />
61
- candy crush friends saga level guide<br />
62
- candy match 3 without ads games<br />
63
- candy crush jelly saga play now<br />
64
- candy match 3 with friends games</p>
65
- <h3>Use boosters and power-ups wisely</h3>
66
- <p>Boosters and power-ups are special items that can help you clear more candies or achieve your objectives faster. They can be earned by playing the game, watching ads, or buying them with real money. Some examples of boosters and power-ups are hammers, bombs, rockets, rainbows, lollipops, etc. However, you should not rely on them too much or waste them unnecessarily. You should save them for the harder levels or when you are stuck. You should also use them strategically, such as using a bomb to clear a large area of candies or using a rainbow to create a massive combo.</p>
67
- <h3>Plan your moves ahead and look for combos</h3>
68
- <p>One of the keys to playing candy match 3 games well is to plan your moves ahead and look for combos. You should not just swipe randomly or impulsively. You should think about how your move will affect the board and what matches it will create or enable. You should also look for opportunities to make combos of more than three candies, which will create special candies that have extra effects when matched. For example, matching four candies in a row or column will create a striped candy that will clear a whole row or column when matched. Matching five candies in a T or L shape will create a wrapped candy that will explode twice when matched. Matching five candies in a row will create a color bomb that will clear all the candies of the same color when matched.</p>
69
- <h3>Try different strategies and modes</h3>
70
- <p>Another way to improve your candy match 3 game skills is to try different strategies and modes. You should not stick to one way of playing or one type of game. You should experiment with different approaches and see what works best for you. For example, you can try to focus on clearing the bottom rows first, which will cause more candies to fall from the top and create more matches. You can also try to focus on clearing the obstacles first, such as jelly, chocolate, or ice, which will free up more space for matches. You can also try different modes of play, such as timed mode, where you have to reach a certain score within a time limit; moves mode, where you have a limited number of moves; or endless mode, where you can play as long as you want.</p>
71
- <h2>What are some of the best candy match 3 games to play?</h2>
72
- <p>There are many candy match 3 games available on the market, but some of them stand out from the rest for their quality and popularity. Here are some of the best candy match 3 games to play on your phone or browser:</p>
73
- <h3>Candy Crush Saga: The classic and iconic game from King</h3>
74
- <h3>Candy Crush Saga: The classic and iconic game from King</h3>
75
- <p>Candy Crush Saga is one of the most popular and successful candy match 3 games ever made. It has over one billion downloads on Google Play Store alone. It has thousands of levels with different objectives and challenges. It has many features that make it fun and addictive, such as boosters, power-ups, special candies, daily rewards, events, tournaments, and more. It also has a social aspect, where you can connect with your friends and compare your scores and progress. Candy Crush Saga is a game that will keep you hooked for hours and days.</p>
76
- <h3>Candy Match 3 - Sweet Crunch: A new and innovative game from Playflux</h3>
77
- <p>Candy Match 3 - Sweet Crunch is a new and innovative game from Playflux that takes candy match 3 games to the next level. It has a unique gameplay mechanic where you can build your own candy town by matching candies and collecting resources. You can also customize your town with different buildings, decorations, and characters. You can also challenge cookie monsters that will try to steal your candies and resources. You can also play with other players online and join a guild to cooperate and compete. Candy Match 3 - Sweet Crunch is a game that will let you unleash your creativity and imagination.</p>
78
- <h3>Candy Match: A simple and addictive game from CrazyGames</h3>
79
- <p>Candy Match is a simple and addictive game from CrazyGames that focuses on the core gameplay of matching candies without any distractions. It has a minimalist design and interface that makes it easy to play and enjoy. It has hundreds of levels with increasing difficulty and variety. It has no ads, no in-app purchases, no time limits, no lives, no boosters, no power-ups, no special candies, no objectives, no obstacles, no modes, no features, no nothing. Just pure candy matching fun. Candy Match is a game that will test your skills and concentration.</p>
80
- <h2>Conclusion: Candy match 3 games are here to stay</h2>
81
- <p>Candy match 3 games are one of the most popular and fun types of puzzle games that you can play on your phone or browser. They are simple to learn but hard to master. They are relaxing but challenging. They are creative but strategic. They are colorful but minimalist. They have something for everyone, whether you are looking for a casual distraction or a serious challenge. Candy match 3 games are here to stay, and they will continue to entertain and delight millions of players around the world.</p>
82
- <h4>FAQs</h4>
83
- <p>Here are some frequently asked questions about candy match 3 games:</p>
84
- <ul>
85
- <li><b>What is the best candy match 3 game?</b></li>
86
- <p>There is no definitive answer to this question, as different players may have different preferences and tastes. However, some of the most popular and well-reviewed candy match 3 games are Candy Crush Saga, Candy Match 3 - Sweet Crunch, Candy Match, Candy Blast Mania, Cookie Jam, etc.</p>
87
- <li><b>How do I get more boosters and power-ups in candy match 3 games?</b></li>
88
- <p>There are different ways to get more boosters and power-ups in candy match 3 games, depending on the game you are playing. Some common ways are playing the game regularly, completing levels or objectives, watching ads or videos, spinning wheels or lucky draws, joining events or tournaments, connecting with friends or social media, buying them with real money or in-game currency, etc.</p>
89
- <li><b>How do I clear jelly or chocolate in candy match 3 games?</b></li>
90
- <p>Jelly or chocolate are common obstacles in candy match 3 games that can block your matches or spread over the board. To clear them, you need to make matches adjacent to them or use special candies or boosters that can affect them. For example, a striped candy can clear a whole row or column of jelly or chocolate when matched.</p>
91
- <li><b>How do I create special candies in candy match 3 games?</b></li>
92
- <p>Special candies are candies that have extra effects when matched or activated. To create them, you need to make matches of more than three candies of the same color or shape. For example, matching four candies in a row or column will create a striped candy; matching five candies in a T or L shape will create a wrapped candy; matching five candies in a row will create a color bomb; etc.</p>
93
- <li><b>How do I play candy match 3 games online?</b></li>
94
- <li><b>How do I play candy match 3 games online?</b></li>
95
- <p>To play candy match 3 games online, you need to have a device that can access the internet and a browser that can run HTML5 games. You can then visit websites that offer free online candy match 3 games, such as CrazyGames, Poki, Kizi, etc. You can also download and install candy match 3 games from the app store or play store, such as Candy Crush Saga, Candy Match 3 - Sweet Crunch, Candy Match, etc.</p>
96
- </ul></p> 401be4b1e0<br />
97
- <br />
98
- <br />
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
spaces/1phancelerku/anime-remove-background/Clash Royale MOD APK v3.6.1 The Ultimate Guide to Unlimited Money Elixir and Gems.md DELETED
@@ -1,117 +0,0 @@
1
- <br />
2
- <h1>Clash Royale Mod APK: Unlimited Money, Elixir and Gems 3.6 1</h1>
3
- <p>Are you a fan of Clash Royale, the popular real-time strategy game from Supercell? Do you want to enjoy the game without any limitations or restrictions? If yes, then you should try Clash Royale Mod APK, a modified version of the game that gives you unlimited money, elixir and gems, as well as access to all the cards and custom servers. In this article, we will tell you everything you need to know about Clash Royale Mod APK, including its features, how to download and install it, and some tips and tricks for playing it. Read on and discover how to take your Clash Royale experience to the next level.</p>
4
- <h2>clash royale mod apk (unlimited money elixir and gems 3.6 1)</h2><br /><p><b><b>Download File</b> &#9913; <a href="https://jinyurl.com/2uNNXZ">https://jinyurl.com/2uNNXZ</a></b></p><br /><br />
5
- <h2>Features of Clash Royale Mod APK</h2>
6
- <p>Clash Royale Mod APK is not just a regular version of Clash Royale with some minor tweaks. It is a completely different game that offers you many amazing features that you won't find in the original game. Here are some of the most notable features of Clash Royale Mod APK:</p>
7
- <h3>Unlimited resources: How to get unlimited money, elixir and gems in the game</h3>
8
- <p>One of the main advantages of Clash Royale Mod APK is that it gives you unlimited resources in the game. This means that you can get as much money, elixir and gems as you want, without having to spend any real money or wait for hours. You can use these resources to upgrade your cards, buy new ones, open chests, enter tournaments, and more. You can also use them to speed up your progress and unlock new arenas, levels, and rewards. With unlimited resources, you can enjoy the game without any worries or limitations.</p>
9
- <h3>All cards unlocked: How to access all the cards in the game without spending real money</h3>
10
- <p>Another great feature of Clash Royale Mod APK is that it unlocks all the cards in the game for you. This means that you can access all the cards in the game, regardless of your arena or level. You don't have to spend real money or wait for a long time to get them. You can choose from over 90 cards, including common, rare, epic, and legendary ones. You can also experiment with different combinations and strategies with these cards. With all cards unlocked, you can have more fun and variety in the game.</p>
11
- <h3>Custom servers: How to join private servers with different game modes and rules</h3>
12
- <p>The last but not least feature of Clash Royale Mod APK is that it allows you to join custom servers with different game modes and rules. These are private servers that are hosted by other players or developers who have modified the game in various ways. You can join these servers by using a specific IP address <p>You can join these servers by using a specific IP address or a link that will redirect you to the server. You can find these links on various websites or forums that host these servers. Some of the most popular and reliable custom servers for Clash Royale are PlenixClash, Master Royale, and Null's Royale. These servers offer you different game modes and rules, such as unlimited elixir, custom cards, clan wars, tournaments, and more. You can also chat with other players and make new friends on these servers. Custom servers are a great way to enjoy Clash Royale in a new and exciting way.</p>
13
- <h2>How to download and install Clash Royale Mod APK</h2>
14
- <p>If you are interested in downloading and installing Clash Royale Mod APK on your Android device, you will need to follow some simple steps. Here is what you need to do:</p>
15
- <h3>Requirements: What you need to download and install the mod apk file</h3>
16
- <p>Before you download and install the mod apk file, you will need to make sure that your device meets some basic requirements. These are:</p>
17
- <p>clash royale hack apk download free unlimited resources<br />
18
- clash royale modded apk latest version with all cards unlocked<br />
19
- clash royale cheat apk android no root required<br />
20
- clash royale unlimited money and gems apk 2023 update<br />
21
- clash royale mod apk offline play with bots<br />
22
- clash royale hacked apk ios download without jailbreak<br />
23
- clash royale mod menu apk with custom features<br />
24
- clash royale private server apk unlimited everything<br />
25
- clash royale free gems and coins apk generator<br />
26
- clash royale mod apk online multiplayer working<br />
27
- clash royale unlimited elixir and gold apk for android<br />
28
- clash royale hack tool apk no survey no password<br />
29
- clash royale modded apk for pc windows 10<br />
30
- clash royale hack apk mediafire direct link<br />
31
- clash royale mod apk revdl premium download<br />
32
- clash royale cheat codes apk unlock all chests<br />
33
- clash royale mod apk rexdl high speed download<br />
34
- clash royale hack version apk unlimited troops<br />
35
- clash royale modded game apk with new cards<br />
36
- clash royale hack app apk easy installation<br />
37
- clash royale mod apk ihackedit best mods<br />
38
- clash royale cheat engine apk modify game data<br />
39
- clash royale modded server apk with friends<br />
40
- clash royale hack online apk no verification<br />
41
- clash royale mod apk an1.com safe download</p>
42
- <ul>
43
- <li>Your device should have Android 4.1 or higher version.</li>
44
- <li>Your device should have at least 100 MB of free storage space.</li>
45
- <li>Your device should have a stable internet connection.</li>
46
- <li>Your device should allow installation from unknown sources. You can enable this option by going to Settings > Security > Unknown Sources and turning it on.</li>
47
- </ul>
48
- <h3>Steps: How to download and install the mod apk file on your Android device</h3>
49
- <p>Once you have checked the requirements, you can proceed to download and install the mod apk file on your device. Here are the steps you need to follow:</p>
50
- <ol>
51
- <li>Go to a trusted website that provides the link to download the mod apk file. You can use Google or any other search engine to find such websites. Alternatively, you can use the links provided in this article for some of the best custom servers.</li>
52
- <li>Click on the download button and wait for the file to be downloaded on your device. The file size may vary depending on the server you choose.</li>
53
- <li>After the file is downloaded, locate it in your device's file manager and tap on it to start the installation process.</li>
54
- <li>Follow the instructions on the screen and wait for the installation to be completed.</li>
55
- <li>Once the installation is done, open the app and enjoy Clash Royale Mod APK with unlimited money, elixir, gems, and more.</li>
56
- </ol>
57
- <h3>Troubleshooting: How to fix common issues with the mod apk file</h3>
58
- <p>Sometimes, you may face some issues with the mod apk file, such as crashing, freezing, or not working properly. Here are some possible solutions to fix these issues:</p>
59
- <ul>
60
- <li>Make sure that your device meets the requirements mentioned above.</li>
61
- <li>Make sure that you have downloaded the latest version of the mod apk file from a reliable source.</li>
62
- <li>Make sure that you have enabled installation from unknown sources on your device.</li>
63
- <li>Make sure that you have a stable internet connection and that you are connected to the right server.</li>
64
- <li>Clear the cache and data of the app by going to Settings > Apps > Clash Royale Mod APK > Storage > Clear Cache and Clear Data.</li>
65
- <li>Uninstall and reinstall the app if none of the above solutions work.</li>
66
- </ul>
67
- <h2>Tips and tricks for playing Clash Royale Mod APK</h2>
68
- <p>Now that you have downloaded and installed Clash Royale Mod APK on your device, you may be wondering how to play it effectively and win more battles. Here are some tips and tricks that will help you improve your skills and have more fun in the game:</p>
69
- <h3>Join a clan: How to find and join a clan that suits your play style and goals</h3>
70
- <p>One of the best features of Clash Royale Mod APK is that it allows you to join clans and chat with other players. Clans are groups of players who share a common interest and goal in the game. By joining a clan, you can benefit from many advantages, such as:</p>
71
- <ul>
72
- <li>You can request and donate cards to your clan members, which will help you upgrade your cards faster and earn more gold.</li>
73
- <li>You can participate in clan wars, which are special events where clans compete against each other for rewards and glory.</li>
74
- <li>You can chat with your clan members, share tips and strategies, ask for advice, or just have fun.</li>
75
- </ul>
76
- <p>To join a clan, you need to go to the Clan tab in the game menu and tap on Find a Clan. You can then browse through different clans based on their name, location, trophies, members, type, and type. You can also search for a specific clan by using the search bar. Once you find a clan that suits your play style and goals, you can tap on Join and wait for the clan leader or co-leader to accept your request. Alternatively, you can create your own clan by tapping on Create a Clan and inviting other players to join you.</p>
77
- <h3>Build your deck: How to create a balanced and effective deck with the cards you have</h3>
78
- <p>Another important aspect of playing Clash Royale Mod APK is building your deck. Your deck is the set of eight cards that you use in battles. You can have up to five different decks, which you can switch between before each battle. To build a good deck, you need to consider several factors, such as:</p>
79
- <ul>
80
- <li>The cost of your cards: Each card has a certain amount of elixir that it costs to play. You want to have a balanced mix of low-cost and high-cost cards, so that you can always have something to play and not run out of elixir.</li>
81
- <li>The synergy of your cards: Each card has a certain role and function in the game, such as offense, defense, support, spell, etc. You want to have cards that work well together and complement each other, so that you can create powerful combos and counter your opponent's moves.</li>
82
- <li>The versatility of your cards: Each card has a certain strength and weakness against different types of cards, such as air, ground, swarm, tank, etc. You want to have cards that can deal with different situations and threats, so that you can adapt to your opponent's strategy and not be vulnerable to any card.</li>
83
- </ul>
84
- <p>To build your deck, you need to go to the Cards tab in the game menu and tap on Deck. You can then drag and drop the cards you want to use from your collection to your deck slots. You can also use the Suggest a Deck feature, which will automatically generate a deck for you based on your available cards. You can then edit and customize the deck as you wish.</p>
85
- <h3>Manage your elixir: How to use your elixir wisely and efficiently in battles</h3>
86
- <p>One of the most crucial skills in playing Clash Royale Mod APK is managing your elixir. Elixir is the resource that you use to play cards in battles. You have a maximum of 10 elixir at any time, which regenerates over time. You need to use your elixir wisely and efficiently in battles, so that you can gain an advantage over your opponent and win more battles. Here are some tips on how to manage your elixir:</p>
87
- <ul>
88
- <li>Don't waste your elixir: Don't play cards that are not necessary or effective in the current situation. For example, don't play a high-cost card when you have low elixir or when your opponent has a counter for it. Save your elixir for better opportunities and more value plays.</li>
89
- <li>Don't overcommit your elixir: Don't play too many cards at once or on one lane, unless you are sure that you can overwhelm your opponent or take their tower. Otherwise, you will leave yourself with no elixir or defense for the other lane or their counterattack.</li>
90
- <li>Don't leak your elixir: Don't let your elixir bar fill up without playing any card, unless you are waiting for a specific card or timing. Otherwise, you will lose potential elixir that could have been used for playing more cards or gaining more value.</li>
91
- <li>Track your opponent's elixir: Try to estimate how much elixir your opponent has based on the cards they play and the time they take to play them. This will help you predict their next move and plan your own accordingly.</li>
92
- </ul>
93
- <h3>Learn from the best: How to watch replays and learn from other players' strategies and mistakes</h3>
94
- <p>The last tip we have for playing Clash Royale Mod APK is learning from the best. The game offers you many ways to watch replays and learn from other players' strategies and mistakes. These are:</p>
95
- <ul>
96
- <li>The TV Royale feature: This feature allows you to watch replays of some of the most exciting and high-level battles in the game. You can filter the replays by arena, card, or clan. You can also watch replays of global tournaments and special events.</li>
97
- <li>The Clan Chat feature: This feature allows you to watch replays of battles that were shared by your clan members or other clans that you are friendly with. You can also chat with them and ask for feedback or advice.</li>
98
- <li>The YouTube feature: This feature allows you to watch replays of battles that were uploaded by some of the most popular and skilled Clash Royale players and content creators on YouTube. You can also subscribe You can also subscribe to their channels and watch their live streams, videos, and tutorials.</li>
99
- </ul>
100
- <p>By watching replays, you can learn from the best players in the game and improve your own skills and strategies. You can also discover new tips and tricks, card interactions, deck ideas, and more. Watching replays is a great way to enhance your Clash Royale knowledge and enjoyment.</p>
101
- <h2>Conclusion</h2>
102
- <p>Clash Royale Mod APK is a fantastic version of Clash Royale that offers you unlimited money, elixir, gems, and more. It also unlocks all the cards in the game and lets you join custom servers with different game modes and rules. By downloading and installing Clash Royale Mod APK on your Android device, you can enjoy the game without any limitations or restrictions. You can also use some tips and tricks to play the game more effectively and win more battles. Clash Royale Mod APK is a must-try for any Clash Royale fan who wants to have more fun and excitement in the game.</p>
103
- <p>So what are you waiting for? Download Clash Royale Mod APK now and experience the ultimate Clash Royale adventure. You won't regret it!</p>
104
- <h2>Frequently Asked Questions</h2>
105
- <p>Here are some of the most frequently asked questions about Clash Royale Mod APK:</p>
106
- <h4>Is Clash Royale Mod APK safe to download and use?</h4>
107
- <p>Yes, Clash Royale Mod APK is safe to download and use, as long as you download it from a trusted source and follow the instructions carefully. However, you should be aware that using mod apk files may violate the terms of service of the original game and may result in your account being banned or suspended. Therefore, you should use Clash Royale Mod APK at your own risk and discretion.</p>
108
- <h4>Can I play Clash Royale Mod APK with my friends who use the original game?</h4>
109
- <p>No, you cannot play Clash Royale Mod APK with your friends who use the original game. This is because Clash Royale Mod APK uses different servers than the original game, which means that they are not compatible with each other. If you want to play with your friends who use the original game, you will need to uninstall Clash Royale Mod APK and install the original game again.</p>
110
- <h4>Can I update Clash Royale Mod APK to the latest version of the original game?</h4>
111
- <p>No, you cannot update Clash Royale Mod APK to the latest version of the original game. This is because Clash Royale Mod APK is a modified version of the original game, which means that it is not compatible with the official updates. If you want to update Clash Royale Mod APK to the latest version of the original game, you will need to wait for the mod apk developers to release a new version of the mod apk file that matches the latest version of the original game.</p>
112
- <h4>Can I use Clash Royale Mod APK on iOS devices?</h4>
113
- <p>No, you cannot use Clash Royale Mod APK on iOS devices. This is because Clash Royale Mod APK is an apk file, which is a file format that is only compatible with Android devices. If you want to use Clash Royale Mod APK on iOS devices, you will need to use a different method, such as jailbreaking your device or using an emulator.</p>
114
- <h4>Can I use multiple accounts on Clash Royale Mod APK?</h4>
115
- <p>Yes, you can use multiple accounts on Clash Royale Mod APK. This is because Clash Royale Mod APK does not require you to sign in with your Google Play or Facebook account. You can create as many accounts as you want on Clash Royale Mod APK by using different email addresses or usernames. You can also switch between your accounts easily by going to Settings > Account > Switch Account.</p> 197e85843d<br />
116
- <br />
117
- <br />
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
spaces/1phancelerku/anime-remove-background/Download Gunship Strike 3D Mod APK with Unlimited Coins and Gems.md DELETED
@@ -1,119 +0,0 @@
1
- <br />
2
- <h1>Gunship Strike 3D APK Mod Download: How to Enjoy Unlimited Coins and Gems in This Action Game</h1>
3
- <p>Do you love action games that involve flying helicopters and shooting enemies? If yes, then you might want to try Gunship Strike 3D, a thrilling game that lets you pilot a gunship and destroy terrorist bases, warships, tanks, and more. But what if you want to enjoy the game without any limitations or restrictions? Well, there is a way to do that. You can download and install Gunship Strike 3D mod apk, a modified version of the game that gives you unlimited coins and gems. In this article, we will tell you what Gunship Strike 3D is, how to download and install Gunship Strike 3D mod apk, and how to use it. Let's get started!</p>
4
- <h2>gunship strike 3d apk mod download</h2><br /><p><b><b>Download File</b> &#9913; <a href="https://jinyurl.com/2uNJ6f">https://jinyurl.com/2uNJ6f</a></b></p><br /><br />
5
- <h2>What is Gunship Strike 3D?</h2>
6
- <p>Gunship Strike 3D is an action game developed by Candy Mobile, a popular game studio that has created many other games such as Zombie Roadkill 3D, West Gunfighter, and Racing Fever. In Gunship Strike 3D, you can choose from different types of helicopters, each with its own weapons and abilities. You can also upgrade your helicopter with more powerful guns, missiles, rockets, and bombs. Your mission is to fly your gunship over various locations and destroy the enemy targets. You can also complete different challenges and achievements to earn more coins and gems.</p>
7
- <h3>The gameplay and features of Gunship Strike 3D</h3>
8
- <p>The gameplay of Gunship Strike 3D is simple and intuitive. You can control your helicopter using the virtual joystick on the left side of the screen, and fire your weapons using the buttons on the right side. You can also switch between different weapons by tapping on their icons. You can also use the radar on the top right corner to locate your enemies and objectives. The game has over 40 levels, each with different scenarios and difficulties. You can also play in different modes such as Campaign Mode, Endless Mode, and Boss Mode. The game has realistic graphics, sound effects, and animations that make you feel like you are in a real war zone.</p>
9
- <h3>The advantages of using Gunship Strike 3D mod apk</h3>
10
- <p>While Gunship Strike 3D is a fun and exciting game, it also has some drawbacks. For example, you might run out of coins and gems quickly, especially if you want to buy or upgrade your helicopters or weapons. You might also face ads or pop-ups that interrupt your gameplay. Moreover, you might encounter some bugs or glitches that affect your performance or experience. That's why some players prefer to use Gunship Strike 3D mod apk, a modified version of the game that gives you unlimited coins and gems. With this mod apk, you can enjoy the following benefits:</p>
11
- <ul>
12
- <li>You can buy any helicopter or weapon you want without worrying about the cost.</li>
13
- <li>You can upgrade your helicopter or weapon to the maximum level without spending any coins or gems.</li>
14
- <li>You can unlock all the levels, modes, challenges, and achievements without completing any requirements.</li>
15
- <li>You can remove all the ads or pop-ups that annoy you.</li>
16
- <li>You can fix some bugs or glitches that might occur in the original game.</li>
17
- </ul>
18
- <h2>How to download and install Gunship Strike 3D mod apk?</h2>
19
- <p>Now that you know what Gunship Strike 3D mod apk is and what it can do for you, you might be wondering how to download and install it on your device. Well, it's not very difficult, but you need to follow some steps carefully. Here are the steps to download and install Gunship Strike 3D mod apk on your device:</p>
20
- <p>gunship strike 3d mod apk unlimited money and gems<br />
21
- gunship strike 3d hack mod apk free download<br />
22
- gunship strike 3d mod apk latest version<br />
23
- gunship strike 3d mod apk android 1<br />
24
- gunship strike 3d mod apk revdl<br />
25
- gunship strike 3d mod apk happymod<br />
26
- gunship strike 3d mod apk rexdl<br />
27
- gunship strike 3d mod apk offline<br />
28
- gunship strike 3d mod apk no root<br />
29
- gunship strike 3d mod apk unlimited everything<br />
30
- gunship strike 3d mod apk all helicopters unlocked<br />
31
- gunship strike 3d mod apk unlimited coins and diamonds<br />
32
- gunship strike 3d mod apk unlimited ammo and health<br />
33
- gunship strike 3d mod apk unlimited missiles and rockets<br />
34
- gunship strike 3d mod apk unlimited gold and cash<br />
35
- gunship strike 3d mod apk download for pc<br />
36
- gunship strike 3d mod apk download for ios<br />
37
- gunship strike 3d mod apk download for windows 10<br />
38
- gunship strike 3d mod apk download for laptop<br />
39
- gunship strike 3d mod apk download for mac<br />
40
- gunship strike 3d mod apk download uptodown<br />
41
- gunship strike 3d mod apk download apkpure<br />
42
- gunship strike 3d mod apk download mob.org<br />
43
- gunship strike 3d mod apk download android oyun club<br />
44
- gunship strike 3d mod apk download highly compressed<br />
45
- how to download gunship strike 3d mod apk<br />
46
- how to install gunship strike 3d mod apk<br />
47
- how to play gunship strike 3d mod apk<br />
48
- how to update gunship strike 3d mod apk<br />
49
- how to hack gunship strike 3d with lucky patcher<br />
50
- best helicopter in gunship strike 3d mod apk<br />
51
- best weapons in gunship strike 3d mod apk<br />
52
- best missions in gunship strike 3d mod apk<br />
53
- best tips and tricks for gunship strike 3d mod apk<br />
54
- best cheats and codes for gunship strike 3d mod apk<br />
55
- is gunship strike 3d mod apk safe to use<br />
56
- is gunship strike 3d mod apk online or offline<br />
57
- is gunship strike 3d mod apk compatible with all devices<br />
58
- is gunship strike 3d mod apk legal or illegal<br />
59
- is gunship strike 3d mod apk virus free or not</p>
60
- <h3>The steps to download Gunship Strike 3D mod apk from HappyMod</h3>
61
- <p>One of the best sources to download Gunship Strike 3D mod apk is HappyMod, a website that provides various modded games and apps for free. You can download Gunship Strike 3D mod apk from HappyMod by following these steps:</p>
62
- <ol>
63
- <li>Open your browser and go to <a href="">https://www.happymod.com/gunship-strike-3d-mod/com.wordsmobile.gunship</a>.</li>
64
- <li>Scroll down and tap on the green button that says "Download APK".</li>
65
- <li>Wait for the download to finish and then tap on the file name to open it.</li>
66
- <li>If you see a warning message that says "This type of file can harm your device", tap on "OK" to proceed.</li>
67
- <li>If you see a pop-up that asks you to enable unknown sources, tap on "Settings" and then toggle on the option that allows installing apps from unknown sources.</li>
68
- <li>Go back to the file and tap on "Install" to start the installation process.</li>
69
- </ol>
70
- <h3>The steps to install Gunship Strike 3D mod apk on your device</h3>
71
- <p>After you have downloaded Gunship Strike 3D mod apk from HappyMod, you need to install it on your device. You can install Gunship Strike 3D mod apk on your device by following these steps:</p>
72
- <ol>
73
- <li>Locate the Gunship Strike 3D mod apk file on your device's file manager or downloads folder.</li>
74
- <li>Tap on the file and then tap on "Install" to begin the installation process.</li>
75
- <li>Wait for the installation to complete and then tap on "Open" to launch the game.</li>
76
- <li>Enjoy playing Gunship Strike 3D with unlimited coins and gems!</li>
77
- </ol>
78
- <h2>How to use Gunship Strike 3D mod apk?</h2>
79
- <p>Now that you have downloaded and installed Gunship Strike 3D mod apk on your device, you might be wondering how to use it. Well, it's not very different from using the original game, but there are some tips and tricks that you can follow to make the most out of it. Here are some tips and tricks to use Gunship Strike 3D mod apk:</p>
80
- <h3>The tips and tricks to play Gunship Strike 3D with unlimited coins and gems</h3>
81
- <p>With Gunship Strike 3D mod apk, you can play the game with unlimited coins and gems. This means that you can buy any helicopter or weapon you want, upgrade them to the maximum level, unlock all the levels, modes, challenges, and achievements, and remove all the ads or pop-ups. Here are some tips and tricks to play Gunship Strike 3D with unlimited coins and gems:</p>
82
- <ul>
83
- <li>Choose the helicopter that suits your style and preference. There are different types of helicopters such as Apache, Cobra, Black Hawk, Hind, etc. Each helicopter has its own strengths and weaknesses, such as speed, firepower, armor, etc. You can also customize your helicopter with different colors and decals.</li>
84
- <li>Choose the weapon that matches your strategy and situation. There are different types of weapons such as machine guns, missiles, rockets, bombs, etc. Each weapon has its own advantages and disadvantages, such as range, damage, accuracy, etc. You can also switch between different weapons by tapping on their icons.</li>
85
- <li>Complete the levels with high scores and ratings. There are over 40 levels in the game, each with different scenarios and difficulties. You can earn more coins and gems by completing the levels with high scores and ratings. You can also replay the levels to improve your performance or challenge yourself.</li>
86
- <li>Play in different modes for more fun and variety. There are different modes in the game such as Campaign Mode, Endless Mode, and Boss Mode. In Campaign Mode, you can follow the story and complete the missions. In Endless Mode, you can test your skills and endurance by destroying as many enemies as possible. In Boss Mode, you can face powerful enemies that require more strategy and tactics.</li>
87
- <li>Achieve the challenges and achievements for more rewards and satisfaction. There are different challenges and achievements in the game such as killing a certain number of enemies, destroying a certain type of target, completing a level without taking damage, etc. You can earn more coins and gems by achieving these challenges and achievements. You can also show off your skills and progress by sharing them with your friends or social media.</li>
88
- </ul>
89
- <h3>The precautions and risks of using Gunship Strike 3D mod apk</h3>
90
- <p>While Gunship Strike 3D mod apk can give you unlimited coins and gems, it also comes with some precautions and risks that you should be aware of. Here are some precautions and risks of using Gunship Strike 3D mod apk:</p>
91
- <ul>
92
- <li>You might face compatibility issues or errors with your device or the game. Since Gunship Strike 3D mod apk is a modified version of the game, it might not work properly with your device or the game. You might encounter some compatibility issues or errors that might affect your gameplay or experience. For example, the game might crash, freeze, lag, or not load at all.</li>
93
- <li>You might get banned or suspended from the game or the online services. Since Gunship Strike 3D mod apk is a modified version of the game, it might violate the terms and conditions of the game or the online services. You might get banned or suspended from the game or the online services if you use Gunship Strike 3D mod apk. For example, you might not be able to access the online features, leaderboards, or multiplayer modes.</li>
94
- <li>You might expose your device or data to malware or viruses. Since Gunship Strike 3D mod apk is a modified version of the game, it might contain malware or viruses that might harm your device or data. You might expose your device or data to malware or viruses if you download or install Gunship Strike 3D mod apk from untrusted sources. For example, you might lose your personal information, files, photos, contacts, etc.</li>
95
- </ul>
96
- <h2>Conclusion</h2>
97
- <p>Gunship Strike 3D is an action game that lets you pilot a gunship and destroy enemy targets. It is a fun and exciting game that has realistic graphics, sound effects, and animations. However, it also has some limitations and drawbacks that might affect your enjoyment of the game. That's why some players use Gunship Strike 3D mod apk, a modified version of the game that gives you unlimited coins and gems. With Gunship Strike 3D mod apk, you can buy any helicopter or weapon you want, upgrade them to the maximum level, unlock all the levels, modes, challenges, and achievements, and remove all the ads or pop-ups. You can also fix some bugs or glitches that might occur in the original game. However, you should also be careful of the precautions and risks of using Gunship Strike 3D mod apk. You should only download and install Gunship Strike 3D mod apk from trusted sources, and use it at your own risk. We hope this article has helped you learn more about Gunship Strike 3D mod apk and how to use it.</p>
98
- <h2>FAQs</h2>
99
- <p>Here are some frequently asked questions about Gunship Strike 3D mod apk:</p>
100
- <ol>
101
- <li>Q: Is Gunship Strike 3D mod apk safe to use?</li>
102
- <li>A: Gunship Strike 3D mod apk is safe to use if you download and install it from trusted sources such as HappyMod. However, you should also be careful of the precautions and risks of using Gunship Strike 3D mod apk as mentioned above.</li>
103
- <li>Q: Is Gunship Strike 3D mod apk free to use?</li>
104
- <li>A: Yes, Gunship Strike 3D mod apk is free to use. You don't need to pay any money to download or install it. However, you should also respect the rights and efforts of the original developers and support them by buying the official version of the game if you like it.</li>
105
- <li>Q: How can I update Gunship Strike 3D mod apk?</li>
106
- <li>A: You can update Gunship Strike 3D mod apk by downloading and installing the latest version of it from HappyMod or other trusted sources. However, you should also backup your data before updating as you might lose your progress or settings.</li>
107
- <li>Q: How can I uninstall Gunship Strike 3D mod apk?</li>
108
- <li>A: You can uninstall Gunship Strike 3D mod apk by following these steps:</li>
109
- <ul>
110
- <li>Go to your device's settings and tap on "Apps" or "Applications".</li>
111
- <li>Find and tap on "Gunship Strike 3D" and then tap on "Uninstall".</li>
112
- <li>Confirm your action by tapping on "OK" or "Yes".</li>
113
- <li>Wait for the uninstallation to finish and then restart your device.</li>
114
- </ul>
115
- <li>Q: How can I contact the developers of Gunship Strike 3D?</li>
116
- <li>A: You can contact the developers of Gunship Strike 3D by sending them an email at <a href=" mailto:[email protected]">[email protected]</a> or visiting their website at <a href="">http://www.candy-mobile.com</a>. You can also follow them on Facebook at <a href="">https://www.facebook.com/CandyMobileGames</a> or Twitter at <a href="">https://twitter.com/Candy_Mobile</a>.</li>
117
- </ol></p> 401be4b1e0<br />
118
- <br />
119
- <br />
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
spaces/1phancelerku/anime-remove-background/Download Pinkfong Songs and Videos for Kids - The Ultimate Collection.md DELETED
@@ -1,123 +0,0 @@
1
- <br />
2
- <h1>Download Pinkfong: The Best App for Kids' Songs and Stories</h1> | <p>If you are looking for a fun and educational app for your kids, you should download Pinkfong. Pinkfong is an app that offers hundreds of songs and stories for children of all ages. You can enjoy Pinkfong's content on your smartphone, tablet, or computer. In this article, we will tell you what Pinkfong is, why you should download it, how to download it, and what are some features of it.</p>
3
- <h2>download pinkfong</h2><br /><p><b><b>Download</b> &#9658; <a href="https://jinyurl.com/2uNR2f">https://jinyurl.com/2uNR2f</a></b></p><br /><br />
4
- <h2>What is Pinkfong?</h2>
5
- <p>Pinkfong is a name that you may have heard before. It is one of the most popular YouTube channels for kids, with over 66 million subscribers and 12 billion views as of January 2023. But Pinkfong is more than just a YouTube channel. It is also a cute alien fox mascot and a brand of fun and educational content.</p>
6
- <h3>A popular YouTube channel for kids</h3>
7
- <p>Pinkfong's YouTube channel offers kids' favorite songs and stories in various languages. You can find songs like "Baby Shark", "Five Little Monkeys", "The Wheels on the Bus", and many more. You can also find stories like "The Three Little Pigs", "Cinderella", "Jack and the Beanstalk", and many more. Pinkfong's videos are colorful, catchy, and engaging. They help kids learn new words, numbers, colors, shapes, animals, and more.</p>
8
- <h3>A cute alien fox mascot</h3>
9
- <p>Pinkfong is also the name of the main character and mascot of the YouTube channel. He is a pink alien fox who loves to sing and dance. He wears a golden crown on his head and a gold star necklace named Pio that holds magical powers. He travels around the world with his spaceship to explore different cultures and places. He is friendly, curious, and adventurous.</p>
10
- <p>download pinkfong baby shark song<br />
11
- download pinkfong super rescue team<br />
12
- download pinkfong kids' songs and stories<br />
13
- download pinkfong app for android<br />
14
- download pinkfong videos for offline viewing<br />
15
- download pinkfong wonderstar<br />
16
- download pinkfong car songs<br />
17
- download pinkfong nursery rhymes<br />
18
- download pinkfong dance along<br />
19
- download pinkfong animal songs<br />
20
- download pinkfong official website<br />
21
- download pinkfong youtube channel<br />
22
- download pinkfong coloring book<br />
23
- download pinkfong sticker book<br />
24
- download pinkfong learning games<br />
25
- download pinkfong alphabet songs<br />
26
- download pinkfong number songs<br />
27
- download pinkfong shape songs<br />
28
- download pinkfong dinosaur songs<br />
29
- download pinkfong princess songs<br />
30
- download pinkfong fairy tales<br />
31
- download pinkfong classic stories<br />
32
- download pinkfong space songs<br />
33
- download pinkfong ocean songs<br />
34
- download pinkfong jungle songs<br />
35
- download pinkfong birthday songs<br />
36
- download pinkfong christmas songs<br />
37
- download pinkfong halloween songs<br />
38
- download pinkfong valentine's day songs<br />
39
- download pinkfong easter songs<br />
40
- download pinkfong phonics songs<br />
41
- download pinkfong sight words songs<br />
42
- download pinkfong word play songs<br />
43
- download pinkfong math songs<br />
44
- download pinkfong science songs<br />
45
- download pinkfong art and craft songs<br />
46
- download pinkfong musical instruments songs<br />
47
- download pinkfong sports songs<br />
48
- download pinkfong travel songs<br />
49
- download pinkfong food songs<br />
50
- download pinkfong family songs<br />
51
- download pinkfong emotions songs<br />
52
- download pinkfong health and safety songs<br />
53
- download pinkfong seasons and weather songs<br />
54
- download pinkfong fun facts songs<br />
55
- download pinkfong quiz time songs<br />
56
- download pinkfong sing along with Pinky and Pio</p>
57
- <h3>A brand of fun and educational content</h3>
58
- <p>Pinkfong is also a brand that creates fun and educational content for kids. Besides YouTube videos, Pinkfong also produces books, toys , games, apps, and shows for kids. Pinkfong's content is designed to stimulate kids' imagination, creativity, and curiosity. Pinkfong's content is also aligned with the global curriculum standards for preschool and kindergarten. Pinkfong's content is trusted by parents and teachers around the world.</p>
59
- <h2>Why download Pinkfong?</h2>
60
- <p>There are many reasons why you should download Pinkfong. Here are some of them:</p>
61
- <h3>To enjoy hundreds of songs and stories</h3>
62
- <p>By downloading Pinkfong, you can access hundreds of songs and stories that Pinkfong has to offer. You can choose from different categories, such as animals, vehicles, fairy tales, nursery rhymes, and more. You can also search for your favorite songs and stories by keywords or titles. You can watch the videos in high quality and with subtitles. You can also sing along with the lyrics and karaoke mode.</p>
63
- <h3>To learn new things with Pinkfong</h3>
64
- <p>By downloading Pinkfong, you can also learn new things with Pinkfong. You can learn about different topics, such as science, math, art, music, and more. You can also learn about different cultures and languages with Pinkfong. You can watch educational videos that explain concepts and facts in a simple and fun way. You can also play interactive quizzes and puzzles that test your knowledge and skills.</p>
65
- <h3>To have fun with Pinkfong's friends</h3>
66
- <p>By downloading Pinkfong, you can also have fun with Pinkfong's friends. You can meet other characters that Pinkfong meets on his adventures, such as Baby Shark, Hogi, Ollie, Willa, and more. You can watch their stories and adventures together. You can also play games and activities with them. You can dress them up, make them dance, feed them, and more.</p>
67
- <h2>How to download Pinkfong?</h2>
68
- <p>Downloading Pinkfong is easy and free. You can download it on your Android, iOS, or Windows devices. Here are the steps to download it:</p>
69
- <h3>For Android devices</h3>
70
- <p>If you have an Android device, you can download Pinkfong from the Google Play Store. Here are the steps:</p>
71
- <ol>
72
- <li>Open the Google Play Store app on your device.</li>
73
- <li>Search for "Pinkfong" in the search bar.</li>
74
- <li>Select the app that says "Pinkfong Kids' Songs & Stories" by SMARTSTUDY PINKFONG.</li>
75
- <li>Tap on the "Install" button and wait for the app to download.</li>
76
- <li>Once the app is installed, tap on the "Open" button to launch it.</li>
77
- </ol>
78
- <h3>For iOS devices</h3>
79
- <p>If you have an iOS device, you can download Pinkfong from the App Store. Here are the steps:</p>
80
- <ol>
81
- <li>Open the App Store app on your device.</li>
82
- <li>Search for "Pinkfong" in the search bar.</li>
83
- <li>Select the app that says "Pinkfong Kids' Songs & Stories" by SmartStudy Co., Ltd.</li>
84
- <li>Tap on the "Get" button and enter your Apple ID password if prompted.</li>
85
- <li>Wait for the app to download and install.</li>
86
- <li>Once the app is installed, tap on it to launch it.</li>
87
- </ol>
88
- <h3>For Windows devices</h3>
89
- <p>If you have a Windows device, you can download Pinkfong from the Microsoft Store. Here are the steps:</p>
90
- <ol>
91
- <li>Open the Microsoft Store app on your device.</li>
92
- <li>Search for "Pinkfong" in the search bar.</li>
93
- <li>Select the app that says "Pinkfong Kids' Songs & Stories" by SMARTSTUDY PINKFONG.</li>
94
- <li>Click on the "Get" button and sign in with your Microsoft account if prompted.</li>
95
- <li>Wait for the app to download and install.</li>
96
- <li>Once the app is installed, click on it to launch it.</li>
97
- </ol>
98
- <h2>What are some features of Pinkfong?</h2>
99
- <p>Pinkfong has many features that make it a great app for kids. Here are some of them:</p>
100
- <h3>Interactive games and activities</h3>
101
- <p>Pinkfong has many games and activities that kids can play with. They can play games like "Baby Shark Run", "Pinkfong Dino World", "Pinkfong Car Town", and more. They can also do activities like coloring, drawing, sticker book, puzzle book, and more. These games and activities are fun and educational. They help kids develop their cognitive, motor, and creative skills.</p>
102
- <h3>Customizable playlists and themes</h3>
103
- <p>Pinkfong also allows kids to customize their own playlists and themes. They can create their own playlists of songs and stories that they like. They can also change the theme of the app according to their mood or preference. They can choose from different themes, such as pink, blue, green, yellow, and more. These features make the app more personalized and enjoyable.</p>
104
- <h3>Offline mode and parental control</h3>
105
- <p>Pinkfong also has an offline mode and a parental control feature. The offline mode allows kids to watch and play with the app without an internet connection. They can download the songs and stories that they want to watch offline. The parental control feature allows parents to set a timer and a password for the app. They can limit the time and access that their kids have with the app. These features make the app more safe and convenient.</p>
106
- <h2>Conclusion</h2>
107
- <p>Pinkfong is a great app for kids who love songs and stories. It offers hundreds of songs and stories that are fun and educational. It also has many features that make it interactive, customizable, and user-friendly. You can download Pinkfong for free on your Android, iOS, or Windows devices. You can also visit Pinkfong's website or YouTube channel for more content. Download Pinkfong today and have fun with Pinkfong and his friends!</p>
108
- <h2>FAQs</h2>
109
- <p>Here are some frequently asked questions about Pinkfong:</p>
110
- <ol>
111
- <li>What age group is Pinkfong for?</li>
112
- <p>Pinkfong is suitable for kids of all ages, but especially for preschoolers and kindergarteners.</p>
113
- <li>How much does Pinkfong cost?</li>
114
- <p>Pinkfong is free to download and use. However, some content may require in-app purchases or subscriptions.</p>
115
- <li>Is Pinkfong safe for kids?</li>
116
- <p>Pinkfong is safe for kids. It does not contain any inappropriate or harmful content. It also has a parental control feature that allows parents to monitor and limit their kids' use of the app.</p>
117
- <li>What languages does Pinkfong support?</li>
118
- <p>Pinkfong supports multiple languages, such as English, Spanish, French, Chinese, Korean, Japanese, and more.</p>
119
- <li>How can I contact Pinkfong?</li>
120
- <p>You can contact Pinkfong by sending an email to [email protected] or by visiting their website.</p>
121
- </ol></p> 401be4b1e0<br />
122
- <br />
123
- <br />
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
spaces/1phancelerku/anime-remove-background/Enjoy GameCube and Wii Games on Your Android with Dolphin Emulator.md DELETED
@@ -1,101 +0,0 @@
1
- <br />
2
- <h1>How to Download, Install, and Use Dolphin Emulator</h1>
3
- <p></p>
4
- <h2>download aplikasi dolphin emulator</h2><br /><p><b><b>Download Zip</b> &rarr; <a href="https://jinyurl.com/2uNOS2">https://jinyurl.com/2uNOS2</a></b></p><br /><br />
5
- <p>In this article, I will provide you with a detailed guide on how to download, install, and use the Dolphin emulator, as well as some of its features and benefits. I will also answer some frequently asked questions about the emulator. Let's get started!</p>
6
- <h2>What is Dolphin Emulator and What Can It Do?</h2>
7
- <p>Dolphin emulator is a free and open-source video game console emulator for GameCube and Wii that runs on Windows, Linux, macOS, Android, Xbox One, Xbox Series X and Series S. It was first developed as closed source in 2003, and as open source since 2008.</p>
8
- <p>Dolphin emulator can emulate the hardware and software of GameCube and Wii consoles, allowing you to play games for these two systems on your PC or mobile device. You can either load games from your own backups or download them from the Internet (although this may be illegal depending on your region). You can also enhance the graphics and audio quality of the games, use cheat codes and save states, connect controllers and input devices, play online with other players, and much more.</p>
9
- <p>download aplikasi dolphin emulator android<br />
10
- download aplikasi dolphin emulator pc<br />
11
- download aplikasi dolphin emulator apk<br />
12
- download aplikasi dolphin emulator terbaru<br />
13
- download aplikasi dolphin emulator mod<br />
14
- download aplikasi dolphin emulator pro<br />
15
- download aplikasi dolphin emulator untuk laptop<br />
16
- download aplikasi dolphin emulator full version<br />
17
- download aplikasi dolphin emulator offline<br />
18
- download aplikasi dolphin emulator gratis<br />
19
- download aplikasi dolphin emulator gamecube<br />
20
- download aplikasi dolphin emulator wii<br />
21
- download aplikasi dolphin emulator beta<br />
22
- download aplikasi dolphin emulator 32 bit<br />
23
- download aplikasi dolphin emulator 64 bit<br />
24
- download aplikasi dolphin emulator windows 10<br />
25
- download aplikasi dolphin emulator windows 7<br />
26
- download aplikasi dolphin emulator mac<br />
27
- download aplikasi dolphin emulator linux<br />
28
- download aplikasi dolphin emulator ios<br />
29
- download aplikasi dolphin emulator tanpa verifikasi<br />
30
- download aplikasi dolphin emulator tanpa iklan<br />
31
- download aplikasi dolphin emulator tanpa root<br />
32
- download aplikasi dolphin emulator tanpa lag<br />
33
- download aplikasi dolphin emulator dengan mudah<br />
34
- download aplikasi dolphin emulator dengan cepat<br />
35
- download aplikasi dolphin emulator dengan fitur lengkap<br />
36
- download aplikasi dolphin emulator dengan grafis bagus<br />
37
- download aplikasi dolphin emulator dengan kontrol mudah<br />
38
- download aplikasi dolphin emulator dengan suara jernih<br />
39
- cara download aplikasi dolphin emulator di hp<br />
40
- cara download aplikasi dolphin emulator di laptop<br />
41
- cara download aplikasi dolphin emulator di play store<br />
42
- cara download aplikasi dolphin emulator di google drive<br />
43
- cara download aplikasi dolphin emulator di mega.nz<br />
44
- cara install aplikasi dolphin emulator di android<br />
45
- cara install aplikasi dolphin emulator di pc<br />
46
- cara install aplikasi dolphin emulator di macbook<br />
47
- cara install aplikasi dolphin emulator di linux mint<br />
48
- cara install aplikasi dolphin emulator di iphone<br />
49
- cara menggunakan aplikasi dolphin emulator di android<br />
50
- cara menggunakan aplikasi dolphin emulator di pc<br />
51
- cara menggunakan aplikasi dolphin emulator di macos<br />
52
- cara menggunakan aplikasi dolphin emulator di ubuntu<br />
53
- cara menggunakan aplikasi dolphin emulator di ipad<br />
54
- cara setting aplikasi dolphin emulator di android<br />
55
- cara setting aplikasi dolphin emulator di pc<br />
56
- cara setting aplikasi dolphin emulator di macos catalina</p>
57
- <h2>Why Use Dolphin Emulator?</h2>
58
- <p>There are many reasons why you may want to use Dolphin emulator instead of playing games on the original consoles. Here are some of them:</p>
59
- <ul>
60
- <li>You can play games in full HD (1080p) or even higher resolutions, with anti-aliasing, anisotropic filtering, shaders, and other enhancements. This makes the games look much better than on the original hardware.</li>
61
- <li>You can use any PC controller or input device that you prefer, such as keyboard, mouse, gamepad, joystick, steering wheel, etc. You can also use real GameCube or Wii controllers with an adapter.</li>
62
- <li>You can save your game progress at any point using save states, or load states from other players. You can also use cheat codes to modify the game behavior or unlock hidden features.</li>
63
- <li>You can play online with other players using netplay, or access online services such as the Wii Shop Channel or custom servers. You can also play local multiplayer games with split-screen or multiple monitors.</li>
64
- <li>You can customize the emulator settings to suit your preferences and system capabilities. You can adjust the graphics and audio options, enable or disable performance hacks, change the interface language, etc.</li>
65
- <li>You can support the development of Dolphin emulator by contributing code, reporting bugs, testing games, donating money, or spreading the word. Dolphin is a community-driven project that relies on volunteers and donations.</li>
66
- </ul>
67
- <h2>How to Download and Install Dolphin Emulator</h2>
68
- <p>The process of downloading and installing Dolphin emulator is pretty simple for most platforms. Here are the steps for each one <h3>For Windows PC</h3>
69
- <p>If you are using Windows, you can follow these steps to download and install Dolphin emulator on your PC:</p>
70
- <ol>
71
- <li>Go to the <a href="(^3^)">Dolphin Emulator download page</a> and click on the Windows x64 button to download the latest beta version of the emulator. You can also download the stable version, but it may not have the latest features and improvements.</li>
72
- <li>Once the download is complete, you will need to extract the zip file using a program like 7-Zip or WinRAR. You can right-click on the file and choose Extract Here, or Extract to a new folder.</li>
73
- <li>Open the extracted folder and double-click on the Dolphin.exe file to launch the emulator. You don't need to install anything else, as Dolphin is a portable application.</li>
74
- <li>You may also need to install the 64-bit Visual C++ redistributable for Visual Studio 2022 before running Dolphin. You can download it from <a href="(^2^)">this link</a> and follow the instructions to install it on your PC.</li>
75
- </ol>
76
- <h3>For Mac OS</h3>
77
- <p>If you are using Mac OS, you can follow these steps to download and install Dolphin emulator on your Mac:</p>
78
- <ol>
79
- <li>Go to the <a href="(^3^)">Dolphin Emulator download page</a> and click on the macOS (ARM/Intel Universal) button to download the latest beta version of the emulator. You can also download the stable version, but it may not have the latest features and improvements.</li>
80
- <li>Once the download is complete, you will need to open the dmg file and drag Dolphin to your Mac's Applications folder. You can also double-click on Dolphin to open it directly from the dmg file.</li>
81
- <li>You may see a warning about Dolphin being an app downloaded from the Internet. Just hit Open to continue opening the app.</li>
82
- <li>You may also need to run some commands in Terminal to fix some security restrictions that may prevent Dolphin from running properly. You can find more details about this issue <a href="(^2^)">here</a>.</li>
83
- </ol>
84
- <h3>For Linux</h3>
85
- <p>If you are using Linux, you can follow these steps to download and install Dolphin emulator on your Linux system:</p>
86
- <ol>
87
- <li>Go to the <a href="(^8^)">Open Build Service page</a> for Dolphin Emulator and choose your Linux distribution from the list. You will see instructions on how to add the Dolphin repository and install the emulator using your package manager.</li>
88
- <li>Alternatively, you can go to the <a href="(^3^)">Dolphin Emulator download page</a> and click on the Linux button to download a tar.gz file with the latest beta version of the emulator. You can also download the stable version, but it may not have the latest features and improvements.</li>
89
- <li>Once the download is complete, you will need to extract the tar.gz file using a program like tar or gzip. You can right-click on the file and choose Extract Here, or Extract to a new folder.</li>
90
- <li>Open the extracted folder and double-click on the dolphin-emu file to launch the emulator. You don't need to install anything else, as Dolphin is a portable application.</li>
91
- </ol>
92
- <h3>For Android</h3>
93
- <p>If you are using Android, you can follow these steps to download and install Dolphin emulator on your Android device:</p>
94
- <ol>
95
- <li>Go to the <a href="(^13^)">Google Play Store</a> and search for Dolphin Emulator. You should see an app with a dolphin icon developed by Dolphin Emulator. Tap on it and then tap on Install.</li>
96
- <li>You can also go to the <a href="(^3^)">Dolphin Emulator download page</a> and click on the Android button to download an apk file with the latest beta version of the emulator. You can also download the stable version, but it may not have the latest features and improvements.</li>
97
- <li>If you downloaded an apk file, you will need to enable unknown sources in your device settings before installing it. You can find more details about this process <a href="(^12^)">here</a>.</li>
98
- <li>Once you have installed Dolphin Emulator on your Android device, you can open it from your app drawer or home screen.</li>
99
- </ol></p> 401be4b1e0<br />
100
- <br />
101
- <br />
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
spaces/AIConsultant/MusicGen/tests/modules/test_lstm.py DELETED
@@ -1,32 +0,0 @@
1
- # Copyright (c) Meta Platforms, Inc. and affiliates.
2
- # All rights reserved.
3
- #
4
- # This source code is licensed under the license found in the
5
- # LICENSE file in the root directory of this source tree.
6
-
7
- import random
8
- import torch
9
-
10
- from audiocraft.modules.lstm import StreamableLSTM
11
-
12
-
13
- class TestStreamableLSTM:
14
-
15
- def test_lstm(self):
16
- B, C, T = 4, 2, random.randint(1, 100)
17
-
18
- lstm = StreamableLSTM(C, 3, skip=False)
19
- x = torch.randn(B, C, T)
20
- y = lstm(x)
21
-
22
- print(y.shape)
23
- assert y.shape == torch.Size([B, C, T])
24
-
25
- def test_lstm_skip(self):
26
- B, C, T = 4, 2, random.randint(1, 100)
27
-
28
- lstm = StreamableLSTM(C, 3, skip=True)
29
- x = torch.randn(B, C, T)
30
- y = lstm(x)
31
-
32
- assert y.shape == torch.Size([B, C, T])
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
spaces/AIFILMS/audioldm-text-to-audio-generation/audioldm/clap/open_clip/pann_model.py DELETED
@@ -1,703 +0,0 @@
1
- # PANNs: Large-Scale Pretrained Audio Neural Networks for Audio Pattern Recognition
2
- # Reference from https://github.com/qiuqiangkong/audioset_tagging_cnn
3
- # Some layers are re-designed for CLAP
4
- import os
5
-
6
- os.environ["NUMBA_CACHE_DIR"] = "/tmp/"
7
-
8
- import torch
9
- import torch.nn as nn
10
- import torch.nn.functional as F
11
- from torchlibrosa.stft import Spectrogram, LogmelFilterBank
12
- from torchlibrosa.augmentation import SpecAugmentation
13
-
14
- from .utils import do_mixup, interpolate, pad_framewise_output
15
- from .feature_fusion import iAFF, AFF, DAF
16
-
17
-
18
- def init_layer(layer):
19
- """Initialize a Linear or Convolutional layer."""
20
- nn.init.xavier_uniform_(layer.weight)
21
-
22
- if hasattr(layer, "bias"):
23
- if layer.bias is not None:
24
- layer.bias.data.fill_(0.0)
25
-
26
- def init_bn(bn):
27
- """Initialize a Batchnorm layer."""
28
- bn.bias.data.fill_(0.0)
29
- bn.weight.data.fill_(1.0)
30
-
31
-
32
- class ConvBlock(nn.Module):
33
- def __init__(self, in_channels, out_channels):
34
-
35
- super(ConvBlock, self).__init__()
36
-
37
- self.conv1 = nn.Conv2d(
38
- in_channels=in_channels,
39
- out_channels=out_channels,
40
- kernel_size=(3, 3),
41
- stride=(1, 1),
42
- padding=(1, 1),
43
- bias=False,
44
- )
45
-
46
- self.conv2 = nn.Conv2d(
47
- in_channels=out_channels,
48
- out_channels=out_channels,
49
- kernel_size=(3, 3),
50
- stride=(1, 1),
51
- padding=(1, 1),
52
- bias=False,
53
- )
54
-
55
- self.bn1 = nn.BatchNorm2d(out_channels)
56
- self.bn2 = nn.BatchNorm2d(out_channels)
57
-
58
- self.init_weight()
59
-
60
- def init_weight(self):
61
- init_layer(self.conv1)
62
- init_layer(self.conv2)
63
- init_bn(self.bn1)
64
- init_bn(self.bn2)
65
-
66
- def forward(self, input, pool_size=(2, 2), pool_type="avg"):
67
-
68
- x = input
69
- x = F.relu_(self.bn1(self.conv1(x)))
70
- x = F.relu_(self.bn2(self.conv2(x)))
71
- if pool_type == "max":
72
- x = F.max_pool2d(x, kernel_size=pool_size)
73
- elif pool_type == "avg":
74
- x = F.avg_pool2d(x, kernel_size=pool_size)
75
- elif pool_type == "avg+max":
76
- x1 = F.avg_pool2d(x, kernel_size=pool_size)
77
- x2 = F.max_pool2d(x, kernel_size=pool_size)
78
- x = x1 + x2
79
- else:
80
- raise Exception("Incorrect argument!")
81
-
82
- return x
83
-
84
-
85
- class ConvBlock5x5(nn.Module):
86
- def __init__(self, in_channels, out_channels):
87
-
88
- super(ConvBlock5x5, self).__init__()
89
-
90
- self.conv1 = nn.Conv2d(
91
- in_channels=in_channels,
92
- out_channels=out_channels,
93
- kernel_size=(5, 5),
94
- stride=(1, 1),
95
- padding=(2, 2),
96
- bias=False,
97
- )
98
-
99
- self.bn1 = nn.BatchNorm2d(out_channels)
100
-
101
- self.init_weight()
102
-
103
- def init_weight(self):
104
- init_layer(self.conv1)
105
- init_bn(self.bn1)
106
-
107
- def forward(self, input, pool_size=(2, 2), pool_type="avg"):
108
-
109
- x = input
110
- x = F.relu_(self.bn1(self.conv1(x)))
111
- if pool_type == "max":
112
- x = F.max_pool2d(x, kernel_size=pool_size)
113
- elif pool_type == "avg":
114
- x = F.avg_pool2d(x, kernel_size=pool_size)
115
- elif pool_type == "avg+max":
116
- x1 = F.avg_pool2d(x, kernel_size=pool_size)
117
- x2 = F.max_pool2d(x, kernel_size=pool_size)
118
- x = x1 + x2
119
- else:
120
- raise Exception("Incorrect argument!")
121
-
122
- return x
123
-
124
-
125
- class AttBlock(nn.Module):
126
- def __init__(self, n_in, n_out, activation="linear", temperature=1.0):
127
- super(AttBlock, self).__init__()
128
-
129
- self.activation = activation
130
- self.temperature = temperature
131
- self.att = nn.Conv1d(
132
- in_channels=n_in,
133
- out_channels=n_out,
134
- kernel_size=1,
135
- stride=1,
136
- padding=0,
137
- bias=True,
138
- )
139
- self.cla = nn.Conv1d(
140
- in_channels=n_in,
141
- out_channels=n_out,
142
- kernel_size=1,
143
- stride=1,
144
- padding=0,
145
- bias=True,
146
- )
147
-
148
- self.bn_att = nn.BatchNorm1d(n_out)
149
- self.init_weights()
150
-
151
- def init_weights(self):
152
- init_layer(self.att)
153
- init_layer(self.cla)
154
- init_bn(self.bn_att)
155
-
156
- def forward(self, x):
157
- # x: (n_samples, n_in, n_time)
158
- norm_att = torch.softmax(torch.clamp(self.att(x), -10, 10), dim=-1)
159
- cla = self.nonlinear_transform(self.cla(x))
160
- x = torch.sum(norm_att * cla, dim=2)
161
- return x, norm_att, cla
162
-
163
- def nonlinear_transform(self, x):
164
- if self.activation == "linear":
165
- return x
166
- elif self.activation == "sigmoid":
167
- return torch.sigmoid(x)
168
-
169
-
170
- class Cnn14(nn.Module):
171
- def __init__(
172
- self,
173
- sample_rate,
174
- window_size,
175
- hop_size,
176
- mel_bins,
177
- fmin,
178
- fmax,
179
- classes_num,
180
- enable_fusion=False,
181
- fusion_type="None",
182
- ):
183
-
184
- super(Cnn14, self).__init__()
185
-
186
- window = "hann"
187
- center = True
188
- pad_mode = "reflect"
189
- ref = 1.0
190
- amin = 1e-10
191
- top_db = None
192
-
193
- self.enable_fusion = enable_fusion
194
- self.fusion_type = fusion_type
195
-
196
- # Spectrogram extractor
197
- self.spectrogram_extractor = Spectrogram(
198
- n_fft=window_size,
199
- hop_length=hop_size,
200
- win_length=window_size,
201
- window=window,
202
- center=center,
203
- pad_mode=pad_mode,
204
- freeze_parameters=True,
205
- )
206
-
207
- # Logmel feature extractor
208
- self.logmel_extractor = LogmelFilterBank(
209
- sr=sample_rate,
210
- n_fft=window_size,
211
- n_mels=mel_bins,
212
- fmin=fmin,
213
- fmax=fmax,
214
- ref=ref,
215
- amin=amin,
216
- top_db=top_db,
217
- freeze_parameters=True,
218
- )
219
-
220
- # Spec augmenter
221
- self.spec_augmenter = SpecAugmentation(
222
- time_drop_width=64,
223
- time_stripes_num=2,
224
- freq_drop_width=8,
225
- freq_stripes_num=2,
226
- )
227
-
228
- self.bn0 = nn.BatchNorm2d(64)
229
-
230
- if (self.enable_fusion) and (self.fusion_type == "channel_map"):
231
- self.conv_block1 = ConvBlock(in_channels=4, out_channels=64)
232
- else:
233
- self.conv_block1 = ConvBlock(in_channels=1, out_channels=64)
234
- self.conv_block2 = ConvBlock(in_channels=64, out_channels=128)
235
- self.conv_block3 = ConvBlock(in_channels=128, out_channels=256)
236
- self.conv_block4 = ConvBlock(in_channels=256, out_channels=512)
237
- self.conv_block5 = ConvBlock(in_channels=512, out_channels=1024)
238
- self.conv_block6 = ConvBlock(in_channels=1024, out_channels=2048)
239
-
240
- self.fc1 = nn.Linear(2048, 2048, bias=True)
241
- self.fc_audioset = nn.Linear(2048, classes_num, bias=True)
242
-
243
- if (self.enable_fusion) and (
244
- self.fusion_type in ["daf_1d", "aff_1d", "iaff_1d"]
245
- ):
246
- self.mel_conv1d = nn.Sequential(
247
- nn.Conv1d(64, 64, kernel_size=5, stride=3, padding=2),
248
- nn.BatchNorm1d(64), # No Relu
249
- )
250
- if self.fusion_type == "daf_1d":
251
- self.fusion_model = DAF()
252
- elif self.fusion_type == "aff_1d":
253
- self.fusion_model = AFF(channels=64, type="1D")
254
- elif self.fusion_type == "iaff_1d":
255
- self.fusion_model = iAFF(channels=64, type="1D")
256
-
257
- if (self.enable_fusion) and (
258
- self.fusion_type in ["daf_2d", "aff_2d", "iaff_2d"]
259
- ):
260
- self.mel_conv2d = nn.Sequential(
261
- nn.Conv2d(1, 64, kernel_size=(5, 5), stride=(6, 2), padding=(2, 2)),
262
- nn.BatchNorm2d(64),
263
- nn.ReLU(inplace=True),
264
- )
265
-
266
- if self.fusion_type == "daf_2d":
267
- self.fusion_model = DAF()
268
- elif self.fusion_type == "aff_2d":
269
- self.fusion_model = AFF(channels=64, type="2D")
270
- elif self.fusion_type == "iaff_2d":
271
- self.fusion_model = iAFF(channels=64, type="2D")
272
- self.init_weight()
273
-
274
- def init_weight(self):
275
- init_bn(self.bn0)
276
- init_layer(self.fc1)
277
- init_layer(self.fc_audioset)
278
-
279
- def forward(self, input, mixup_lambda=None, device=None):
280
- """
281
- Input: (batch_size, data_length)"""
282
-
283
- if self.enable_fusion and input["longer"].sum() == 0:
284
- # if no audio is longer than 10s, then randomly select one audio to be longer
285
- input["longer"][torch.randint(0, input["longer"].shape[0], (1,))] = True
286
-
287
- if not self.enable_fusion:
288
- x = self.spectrogram_extractor(
289
- input["waveform"].to(device=device, non_blocking=True)
290
- ) # (batch_size, 1, time_steps, freq_bins)
291
- x = self.logmel_extractor(x) # (batch_size, 1, time_steps, mel_bins)
292
-
293
- x = x.transpose(1, 3)
294
- x = self.bn0(x)
295
- x = x.transpose(1, 3)
296
- else:
297
- longer_list = input["longer"].to(device=device, non_blocking=True)
298
- x = input["mel_fusion"].to(device=device, non_blocking=True)
299
- longer_list_idx = torch.where(longer_list)[0]
300
- x = x.transpose(1, 3)
301
- x = self.bn0(x)
302
- x = x.transpose(1, 3)
303
- if self.fusion_type in ["daf_1d", "aff_1d", "iaff_1d"]:
304
- new_x = x[:, 0:1, :, :].clone().contiguous()
305
- # local processing
306
- if len(longer_list_idx) > 0:
307
- fusion_x_local = x[longer_list_idx, 1:, :, :].clone().contiguous()
308
- FB, FC, FT, FF = fusion_x_local.size()
309
- fusion_x_local = fusion_x_local.view(FB * FC, FT, FF)
310
- fusion_x_local = torch.permute(
311
- fusion_x_local, (0, 2, 1)
312
- ).contiguous()
313
- fusion_x_local = self.mel_conv1d(fusion_x_local)
314
- fusion_x_local = fusion_x_local.view(
315
- FB, FC, FF, fusion_x_local.size(-1)
316
- )
317
- fusion_x_local = (
318
- torch.permute(fusion_x_local, (0, 2, 1, 3))
319
- .contiguous()
320
- .flatten(2)
321
- )
322
- if fusion_x_local.size(-1) < FT:
323
- fusion_x_local = torch.cat(
324
- [
325
- fusion_x_local,
326
- torch.zeros(
327
- (FB, FF, FT - fusion_x_local.size(-1)),
328
- device=device,
329
- ),
330
- ],
331
- dim=-1,
332
- )
333
- else:
334
- fusion_x_local = fusion_x_local[:, :, :FT]
335
- # 1D fusion
336
- new_x = new_x.squeeze(1).permute((0, 2, 1)).contiguous()
337
- new_x[longer_list_idx] = self.fusion_model(
338
- new_x[longer_list_idx], fusion_x_local
339
- )
340
- x = new_x.permute((0, 2, 1)).contiguous()[:, None, :, :]
341
- else:
342
- x = new_x
343
- elif self.fusion_type in ["daf_2d", "aff_2d", "iaff_2d", "channel_map"]:
344
- x = x # no change
345
-
346
- if self.training:
347
- x = self.spec_augmenter(x)
348
- # Mixup on spectrogram
349
- if self.training and mixup_lambda is not None:
350
- x = do_mixup(x, mixup_lambda)
351
- if (self.enable_fusion) and (
352
- self.fusion_type in ["daf_2d", "aff_2d", "iaff_2d"]
353
- ):
354
- global_x = x[:, 0:1, :, :]
355
-
356
- # global processing
357
- B, C, H, W = global_x.shape
358
- global_x = self.conv_block1(global_x, pool_size=(2, 2), pool_type="avg")
359
- if len(longer_list_idx) > 0:
360
- local_x = x[longer_list_idx, 1:, :, :].contiguous()
361
- TH = global_x.size(-2)
362
- # local processing
363
- B, C, H, W = local_x.shape
364
- local_x = local_x.view(B * C, 1, H, W)
365
- local_x = self.mel_conv2d(local_x)
366
- local_x = local_x.view(
367
- B, C, local_x.size(1), local_x.size(2), local_x.size(3)
368
- )
369
- local_x = local_x.permute((0, 2, 1, 3, 4)).contiguous().flatten(2, 3)
370
- TB, TC, _, TW = local_x.size()
371
- if local_x.size(-2) < TH:
372
- local_x = torch.cat(
373
- [
374
- local_x,
375
- torch.zeros(
376
- (TB, TC, TH - local_x.size(-2), TW),
377
- device=global_x.device,
378
- ),
379
- ],
380
- dim=-2,
381
- )
382
- else:
383
- local_x = local_x[:, :, :TH, :]
384
-
385
- global_x[longer_list_idx] = self.fusion_model(
386
- global_x[longer_list_idx], local_x
387
- )
388
- x = global_x
389
- else:
390
- x = self.conv_block1(x, pool_size=(2, 2), pool_type="avg")
391
-
392
- x = F.dropout(x, p=0.2, training=self.training)
393
- x = self.conv_block2(x, pool_size=(2, 2), pool_type="avg")
394
- x = F.dropout(x, p=0.2, training=self.training)
395
- x = self.conv_block3(x, pool_size=(2, 2), pool_type="avg")
396
- x = F.dropout(x, p=0.2, training=self.training)
397
- x = self.conv_block4(x, pool_size=(2, 2), pool_type="avg")
398
- x = F.dropout(x, p=0.2, training=self.training)
399
- x = self.conv_block5(x, pool_size=(2, 2), pool_type="avg")
400
- x = F.dropout(x, p=0.2, training=self.training)
401
- x = self.conv_block6(x, pool_size=(1, 1), pool_type="avg")
402
- x = F.dropout(x, p=0.2, training=self.training)
403
- x = torch.mean(x, dim=3)
404
-
405
- latent_x1 = F.max_pool1d(x, kernel_size=3, stride=1, padding=1)
406
- latent_x2 = F.avg_pool1d(x, kernel_size=3, stride=1, padding=1)
407
- latent_x = latent_x1 + latent_x2
408
- latent_x = latent_x.transpose(1, 2)
409
- latent_x = F.relu_(self.fc1(latent_x))
410
- latent_output = interpolate(latent_x, 32)
411
-
412
- (x1, _) = torch.max(x, dim=2)
413
- x2 = torch.mean(x, dim=2)
414
- x = x1 + x2
415
- x = F.dropout(x, p=0.5, training=self.training)
416
- x = F.relu_(self.fc1(x))
417
- embedding = F.dropout(x, p=0.5, training=self.training)
418
- clipwise_output = torch.sigmoid(self.fc_audioset(x))
419
-
420
- output_dict = {
421
- "clipwise_output": clipwise_output,
422
- "embedding": embedding,
423
- "fine_grained_embedding": latent_output,
424
- }
425
- return output_dict
426
-
427
-
428
- class Cnn6(nn.Module):
429
- def __init__(
430
- self,
431
- sample_rate,
432
- window_size,
433
- hop_size,
434
- mel_bins,
435
- fmin,
436
- fmax,
437
- classes_num,
438
- enable_fusion=False,
439
- fusion_type="None",
440
- ):
441
-
442
- super(Cnn6, self).__init__()
443
-
444
- window = "hann"
445
- center = True
446
- pad_mode = "reflect"
447
- ref = 1.0
448
- amin = 1e-10
449
- top_db = None
450
-
451
- self.enable_fusion = enable_fusion
452
- self.fusion_type = fusion_type
453
-
454
- # Spectrogram extractor
455
- self.spectrogram_extractor = Spectrogram(
456
- n_fft=window_size,
457
- hop_length=hop_size,
458
- win_length=window_size,
459
- window=window,
460
- center=center,
461
- pad_mode=pad_mode,
462
- freeze_parameters=True,
463
- )
464
-
465
- # Logmel feature extractor
466
- self.logmel_extractor = LogmelFilterBank(
467
- sr=sample_rate,
468
- n_fft=window_size,
469
- n_mels=mel_bins,
470
- fmin=fmin,
471
- fmax=fmax,
472
- ref=ref,
473
- amin=amin,
474
- top_db=top_db,
475
- freeze_parameters=True,
476
- )
477
-
478
- # Spec augmenter
479
- self.spec_augmenter = SpecAugmentation(
480
- time_drop_width=64,
481
- time_stripes_num=2,
482
- freq_drop_width=8,
483
- freq_stripes_num=2,
484
- )
485
-
486
- self.bn0 = nn.BatchNorm2d(64)
487
-
488
- self.conv_block1 = ConvBlock5x5(in_channels=1, out_channels=64)
489
- self.conv_block2 = ConvBlock5x5(in_channels=64, out_channels=128)
490
- self.conv_block3 = ConvBlock5x5(in_channels=128, out_channels=256)
491
- self.conv_block4 = ConvBlock5x5(in_channels=256, out_channels=512)
492
-
493
- self.fc1 = nn.Linear(512, 512, bias=True)
494
- self.fc_audioset = nn.Linear(512, classes_num, bias=True)
495
-
496
- self.init_weight()
497
-
498
- def init_weight(self):
499
- init_bn(self.bn0)
500
- init_layer(self.fc1)
501
- init_layer(self.fc_audioset)
502
-
503
- def forward(self, input, mixup_lambda=None, device=None):
504
- """
505
- Input: (batch_size, data_length)"""
506
-
507
- x = self.spectrogram_extractor(input) # (batch_size, 1, time_steps, freq_bins)
508
- x = self.logmel_extractor(x) # (batch_size, 1, time_steps, mel_bins)
509
-
510
- x = x.transpose(1, 3)
511
- x = self.bn0(x)
512
- x = x.transpose(1, 3)
513
-
514
- if self.training:
515
- x = self.spec_augmenter(x)
516
-
517
- # Mixup on spectrogram
518
- if self.training and mixup_lambda is not None:
519
- x = do_mixup(x, mixup_lambda)
520
-
521
- x = self.conv_block1(x, pool_size=(2, 2), pool_type="avg")
522
- x = F.dropout(x, p=0.2, training=self.training)
523
- x = self.conv_block2(x, pool_size=(2, 2), pool_type="avg")
524
- x = F.dropout(x, p=0.2, training=self.training)
525
- x = self.conv_block3(x, pool_size=(2, 2), pool_type="avg")
526
- x = F.dropout(x, p=0.2, training=self.training)
527
- x = self.conv_block4(x, pool_size=(2, 2), pool_type="avg")
528
- x = F.dropout(x, p=0.2, training=self.training)
529
- x = torch.mean(x, dim=3)
530
-
531
- latent_x1 = F.max_pool1d(x, kernel_size=3, stride=1, padding=1)
532
- latent_x2 = F.avg_pool1d(x, kernel_size=3, stride=1, padding=1)
533
- latent_x = latent_x1 + latent_x2
534
- latent_x = latent_x.transpose(1, 2)
535
- latent_x = F.relu_(self.fc1(latent_x))
536
- latent_output = interpolate(latent_x, 16)
537
-
538
- (x1, _) = torch.max(x, dim=2)
539
- x2 = torch.mean(x, dim=2)
540
- x = x1 + x2
541
- x = F.dropout(x, p=0.5, training=self.training)
542
- x = F.relu_(self.fc1(x))
543
- embedding = F.dropout(x, p=0.5, training=self.training)
544
- clipwise_output = torch.sigmoid(self.fc_audioset(x))
545
-
546
- output_dict = {
547
- "clipwise_output": clipwise_output,
548
- "embedding": embedding,
549
- "fine_grained_embedding": latent_output,
550
- }
551
-
552
- return output_dict
553
-
554
-
555
- class Cnn10(nn.Module):
556
- def __init__(
557
- self,
558
- sample_rate,
559
- window_size,
560
- hop_size,
561
- mel_bins,
562
- fmin,
563
- fmax,
564
- classes_num,
565
- enable_fusion=False,
566
- fusion_type="None",
567
- ):
568
-
569
- super(Cnn10, self).__init__()
570
-
571
- window = "hann"
572
- center = True
573
- pad_mode = "reflect"
574
- ref = 1.0
575
- amin = 1e-10
576
- top_db = None
577
-
578
- self.enable_fusion = enable_fusion
579
- self.fusion_type = fusion_type
580
-
581
- # Spectrogram extractor
582
- self.spectrogram_extractor = Spectrogram(
583
- n_fft=window_size,
584
- hop_length=hop_size,
585
- win_length=window_size,
586
- window=window,
587
- center=center,
588
- pad_mode=pad_mode,
589
- freeze_parameters=True,
590
- )
591
-
592
- # Logmel feature extractor
593
- self.logmel_extractor = LogmelFilterBank(
594
- sr=sample_rate,
595
- n_fft=window_size,
596
- n_mels=mel_bins,
597
- fmin=fmin,
598
- fmax=fmax,
599
- ref=ref,
600
- amin=amin,
601
- top_db=top_db,
602
- freeze_parameters=True,
603
- )
604
-
605
- # Spec augmenter
606
- self.spec_augmenter = SpecAugmentation(
607
- time_drop_width=64,
608
- time_stripes_num=2,
609
- freq_drop_width=8,
610
- freq_stripes_num=2,
611
- )
612
-
613
- self.bn0 = nn.BatchNorm2d(64)
614
-
615
- self.conv_block1 = ConvBlock(in_channels=1, out_channels=64)
616
- self.conv_block2 = ConvBlock(in_channels=64, out_channels=128)
617
- self.conv_block3 = ConvBlock(in_channels=128, out_channels=256)
618
- self.conv_block4 = ConvBlock(in_channels=256, out_channels=512)
619
- self.conv_block5 = ConvBlock(in_channels=512, out_channels=1024)
620
-
621
- self.fc1 = nn.Linear(1024, 1024, bias=True)
622
- self.fc_audioset = nn.Linear(1024, classes_num, bias=True)
623
-
624
- self.init_weight()
625
-
626
- def init_weight(self):
627
- init_bn(self.bn0)
628
- init_layer(self.fc1)
629
- init_layer(self.fc_audioset)
630
-
631
- def forward(self, input, mixup_lambda=None, device=None):
632
- """
633
- Input: (batch_size, data_length)"""
634
-
635
- x = self.spectrogram_extractor(input) # (batch_size, 1, time_steps, freq_bins)
636
- x = self.logmel_extractor(x) # (batch_size, 1, time_steps, mel_bins)
637
-
638
- x = x.transpose(1, 3)
639
- x = self.bn0(x)
640
- x = x.transpose(1, 3)
641
-
642
- if self.training:
643
- x = self.spec_augmenter(x)
644
-
645
- # Mixup on spectrogram
646
- if self.training and mixup_lambda is not None:
647
- x = do_mixup(x, mixup_lambda)
648
-
649
- x = self.conv_block1(x, pool_size=(2, 2), pool_type="avg")
650
- x = F.dropout(x, p=0.2, training=self.training)
651
- x = self.conv_block2(x, pool_size=(2, 2), pool_type="avg")
652
- x = F.dropout(x, p=0.2, training=self.training)
653
- x = self.conv_block3(x, pool_size=(2, 2), pool_type="avg")
654
- x = F.dropout(x, p=0.2, training=self.training)
655
- x = self.conv_block4(x, pool_size=(2, 2), pool_type="avg")
656
- x = F.dropout(x, p=0.2, training=self.training)
657
- x = self.conv_block5(x, pool_size=(2, 2), pool_type="avg")
658
- x = F.dropout(x, p=0.2, training=self.training)
659
- x = torch.mean(x, dim=3)
660
-
661
- latent_x1 = F.max_pool1d(x, kernel_size=3, stride=1, padding=1)
662
- latent_x2 = F.avg_pool1d(x, kernel_size=3, stride=1, padding=1)
663
- latent_x = latent_x1 + latent_x2
664
- latent_x = latent_x.transpose(1, 2)
665
- latent_x = F.relu_(self.fc1(latent_x))
666
- latent_output = interpolate(latent_x, 32)
667
-
668
- (x1, _) = torch.max(x, dim=2)
669
- x2 = torch.mean(x, dim=2)
670
- x = x1 + x2
671
- x = F.dropout(x, p=0.5, training=self.training)
672
- x = F.relu_(self.fc1(x))
673
- embedding = F.dropout(x, p=0.5, training=self.training)
674
- clipwise_output = torch.sigmoid(self.fc_audioset(x))
675
-
676
- output_dict = {
677
- "clipwise_output": clipwise_output,
678
- "embedding": embedding,
679
- "fine_grained_embedding": latent_output,
680
- }
681
-
682
- return output_dict
683
-
684
-
685
- def create_pann_model(audio_cfg, enable_fusion=False, fusion_type="None"):
686
- try:
687
- ModelProto = eval(audio_cfg.model_name)
688
- model = ModelProto(
689
- sample_rate=audio_cfg.sample_rate,
690
- window_size=audio_cfg.window_size,
691
- hop_size=audio_cfg.hop_size,
692
- mel_bins=audio_cfg.mel_bins,
693
- fmin=audio_cfg.fmin,
694
- fmax=audio_cfg.fmax,
695
- classes_num=audio_cfg.class_num,
696
- enable_fusion=enable_fusion,
697
- fusion_type=fusion_type,
698
- )
699
- return model
700
- except:
701
- raise RuntimeError(
702
- f"Import Model for {audio_cfg.model_name} not found, or the audio cfg parameters are not enough."
703
- )
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
spaces/AIGC-Audio/Make_An_Audio_inpaint/ldm/modules/image_degradation/utils_image.py DELETED
@@ -1,916 +0,0 @@
1
- import os
2
- import math
3
- import random
4
- import numpy as np
5
- import torch
6
- import cv2
7
- from torchvision.utils import make_grid
8
- from datetime import datetime
9
- #import matplotlib.pyplot as plt # TODO: check with Dominik, also bsrgan.py vs bsrgan_light.py
10
-
11
-
12
- os.environ["KMP_DUPLICATE_LIB_OK"]="TRUE"
13
-
14
-
15
- '''
16
- # --------------------------------------------
17
- # Kai Zhang (github: https://github.com/cszn)
18
- # 03/Mar/2019
19
- # --------------------------------------------
20
- # https://github.com/twhui/SRGAN-pyTorch
21
- # https://github.com/xinntao/BasicSR
22
- # --------------------------------------------
23
- '''
24
-
25
-
26
- IMG_EXTENSIONS = ['.jpg', '.JPG', '.jpeg', '.JPEG', '.png', '.PNG', '.ppm', '.PPM', '.bmp', '.BMP', '.tif']
27
-
28
-
29
- def is_image_file(filename):
30
- return any(filename.endswith(extension) for extension in IMG_EXTENSIONS)
31
-
32
-
33
- def get_timestamp():
34
- return datetime.now().strftime('%y%m%d-%H%M%S')
35
-
36
-
37
- def imshow(x, title=None, cbar=False, figsize=None):
38
- plt.figure(figsize=figsize)
39
- plt.imshow(np.squeeze(x), interpolation='nearest', cmap='gray')
40
- if title:
41
- plt.title(title)
42
- if cbar:
43
- plt.colorbar()
44
- plt.show()
45
-
46
-
47
- def surf(Z, cmap='rainbow', figsize=None):
48
- plt.figure(figsize=figsize)
49
- ax3 = plt.axes(projection='3d')
50
-
51
- w, h = Z.shape[:2]
52
- xx = np.arange(0,w,1)
53
- yy = np.arange(0,h,1)
54
- X, Y = np.meshgrid(xx, yy)
55
- ax3.plot_surface(X,Y,Z,cmap=cmap)
56
- #ax3.contour(X,Y,Z, zdim='z',offset=-2,cmap=cmap)
57
- plt.show()
58
-
59
-
60
- '''
61
- # --------------------------------------------
62
- # get image pathes
63
- # --------------------------------------------
64
- '''
65
-
66
-
67
- def get_image_paths(dataroot):
68
- paths = None # return None if dataroot is None
69
- if dataroot is not None:
70
- paths = sorted(_get_paths_from_images(dataroot))
71
- return paths
72
-
73
-
74
- def _get_paths_from_images(path):
75
- assert os.path.isdir(path), '{:s} is not a valid directory'.format(path)
76
- images = []
77
- for dirpath, _, fnames in sorted(os.walk(path)):
78
- for fname in sorted(fnames):
79
- if is_image_file(fname):
80
- img_path = os.path.join(dirpath, fname)
81
- images.append(img_path)
82
- assert images, '{:s} has no valid image file'.format(path)
83
- return images
84
-
85
-
86
- '''
87
- # --------------------------------------------
88
- # split large images into small images
89
- # --------------------------------------------
90
- '''
91
-
92
-
93
- def patches_from_image(img, p_size=512, p_overlap=64, p_max=800):
94
- w, h = img.shape[:2]
95
- patches = []
96
- if w > p_max and h > p_max:
97
- w1 = list(np.arange(0, w-p_size, p_size-p_overlap, dtype=np.int))
98
- h1 = list(np.arange(0, h-p_size, p_size-p_overlap, dtype=np.int))
99
- w1.append(w-p_size)
100
- h1.append(h-p_size)
101
- # print(w1)
102
- # print(h1)
103
- for i in w1:
104
- for j in h1:
105
- patches.append(img[i:i+p_size, j:j+p_size,:])
106
- else:
107
- patches.append(img)
108
-
109
- return patches
110
-
111
-
112
- def imssave(imgs, img_path):
113
- """
114
- imgs: list, N images of size WxHxC
115
- """
116
- img_name, ext = os.path.splitext(os.path.basename(img_path))
117
-
118
- for i, img in enumerate(imgs):
119
- if img.ndim == 3:
120
- img = img[:, :, [2, 1, 0]]
121
- new_path = os.path.join(os.path.dirname(img_path), img_name+str('_s{:04d}'.format(i))+'.png')
122
- cv2.imwrite(new_path, img)
123
-
124
-
125
- def split_imageset(original_dataroot, taget_dataroot, n_channels=3, p_size=800, p_overlap=96, p_max=1000):
126
- """
127
- split the large images from original_dataroot into small overlapped images with size (p_size)x(p_size),
128
- and save them into taget_dataroot; only the images with larger size than (p_max)x(p_max)
129
- will be splitted.
130
- Args:
131
- original_dataroot:
132
- taget_dataroot:
133
- p_size: size of small images
134
- p_overlap: patch size in training is a good choice
135
- p_max: images with smaller size than (p_max)x(p_max) keep unchanged.
136
- """
137
- paths = get_image_paths(original_dataroot)
138
- for img_path in paths:
139
- # img_name, ext = os.path.splitext(os.path.basename(img_path))
140
- img = imread_uint(img_path, n_channels=n_channels)
141
- patches = patches_from_image(img, p_size, p_overlap, p_max)
142
- imssave(patches, os.path.join(taget_dataroot,os.path.basename(img_path)))
143
- #if original_dataroot == taget_dataroot:
144
- #del img_path
145
-
146
- '''
147
- # --------------------------------------------
148
- # makedir
149
- # --------------------------------------------
150
- '''
151
-
152
-
153
- def mkdir(path):
154
- if not os.path.exists(path):
155
- os.makedirs(path)
156
-
157
-
158
- def mkdirs(paths):
159
- if isinstance(paths, str):
160
- mkdir(paths)
161
- else:
162
- for path in paths:
163
- mkdir(path)
164
-
165
-
166
- def mkdir_and_rename(path):
167
- if os.path.exists(path):
168
- new_name = path + '_archived_' + get_timestamp()
169
- print('Path already exists. Rename it to [{:s}]'.format(new_name))
170
- os.rename(path, new_name)
171
- os.makedirs(path)
172
-
173
-
174
- '''
175
- # --------------------------------------------
176
- # read image from path
177
- # opencv is fast, but read BGR numpy image
178
- # --------------------------------------------
179
- '''
180
-
181
-
182
- # --------------------------------------------
183
- # get uint8 image of size HxWxn_channles (RGB)
184
- # --------------------------------------------
185
- def imread_uint(path, n_channels=3):
186
- # input: path
187
- # output: HxWx3(RGB or GGG), or HxWx1 (G)
188
- if n_channels == 1:
189
- img = cv2.imread(path, 0) # cv2.IMREAD_GRAYSCALE
190
- img = np.expand_dims(img, axis=2) # HxWx1
191
- elif n_channels == 3:
192
- img = cv2.imread(path, cv2.IMREAD_UNCHANGED) # BGR or G
193
- if img.ndim == 2:
194
- img = cv2.cvtColor(img, cv2.COLOR_GRAY2RGB) # GGG
195
- else:
196
- img = cv2.cvtColor(img, cv2.COLOR_BGR2RGB) # RGB
197
- return img
198
-
199
-
200
- # --------------------------------------------
201
- # matlab's imwrite
202
- # --------------------------------------------
203
- def imsave(img, img_path):
204
- img = np.squeeze(img)
205
- if img.ndim == 3:
206
- img = img[:, :, [2, 1, 0]]
207
- cv2.imwrite(img_path, img)
208
-
209
- def imwrite(img, img_path):
210
- img = np.squeeze(img)
211
- if img.ndim == 3:
212
- img = img[:, :, [2, 1, 0]]
213
- cv2.imwrite(img_path, img)
214
-
215
-
216
-
217
- # --------------------------------------------
218
- # get single image of size HxWxn_channles (BGR)
219
- # --------------------------------------------
220
- def read_img(path):
221
- # read image by cv2
222
- # return: Numpy float32, HWC, BGR, [0,1]
223
- img = cv2.imread(path, cv2.IMREAD_UNCHANGED) # cv2.IMREAD_GRAYSCALE
224
- img = img.astype(np.float32) / 255.
225
- if img.ndim == 2:
226
- img = np.expand_dims(img, axis=2)
227
- # some images have 4 channels
228
- if img.shape[2] > 3:
229
- img = img[:, :, :3]
230
- return img
231
-
232
-
233
- '''
234
- # --------------------------------------------
235
- # image format conversion
236
- # --------------------------------------------
237
- # numpy(single) <---> numpy(unit)
238
- # numpy(single) <---> tensor
239
- # numpy(unit) <---> tensor
240
- # --------------------------------------------
241
- '''
242
-
243
-
244
- # --------------------------------------------
245
- # numpy(single) [0, 1] <---> numpy(unit)
246
- # --------------------------------------------
247
-
248
-
249
- def uint2single(img):
250
-
251
- return np.float32(img/255.)
252
-
253
-
254
- def single2uint(img):
255
-
256
- return np.uint8((img.clip(0, 1)*255.).round())
257
-
258
-
259
- def uint162single(img):
260
-
261
- return np.float32(img/65535.)
262
-
263
-
264
- def single2uint16(img):
265
-
266
- return np.uint16((img.clip(0, 1)*65535.).round())
267
-
268
-
269
- # --------------------------------------------
270
- # numpy(unit) (HxWxC or HxW) <---> tensor
271
- # --------------------------------------------
272
-
273
-
274
- # convert uint to 4-dimensional torch tensor
275
- def uint2tensor4(img):
276
- if img.ndim == 2:
277
- img = np.expand_dims(img, axis=2)
278
- return torch.from_numpy(np.ascontiguousarray(img)).permute(2, 0, 1).float().div(255.).unsqueeze(0)
279
-
280
-
281
- # convert uint to 3-dimensional torch tensor
282
- def uint2tensor3(img):
283
- if img.ndim == 2:
284
- img = np.expand_dims(img, axis=2)
285
- return torch.from_numpy(np.ascontiguousarray(img)).permute(2, 0, 1).float().div(255.)
286
-
287
-
288
- # convert 2/3/4-dimensional torch tensor to uint
289
- def tensor2uint(img):
290
- img = img.data.squeeze().float().clamp_(0, 1).cpu().numpy()
291
- if img.ndim == 3:
292
- img = np.transpose(img, (1, 2, 0))
293
- return np.uint8((img*255.0).round())
294
-
295
-
296
- # --------------------------------------------
297
- # numpy(single) (HxWxC) <---> tensor
298
- # --------------------------------------------
299
-
300
-
301
- # convert single (HxWxC) to 3-dimensional torch tensor
302
- def single2tensor3(img):
303
- return torch.from_numpy(np.ascontiguousarray(img)).permute(2, 0, 1).float()
304
-
305
-
306
- # convert single (HxWxC) to 4-dimensional torch tensor
307
- def single2tensor4(img):
308
- return torch.from_numpy(np.ascontiguousarray(img)).permute(2, 0, 1).float().unsqueeze(0)
309
-
310
-
311
- # convert torch tensor to single
312
- def tensor2single(img):
313
- img = img.data.squeeze().float().cpu().numpy()
314
- if img.ndim == 3:
315
- img = np.transpose(img, (1, 2, 0))
316
-
317
- return img
318
-
319
- # convert torch tensor to single
320
- def tensor2single3(img):
321
- img = img.data.squeeze().float().cpu().numpy()
322
- if img.ndim == 3:
323
- img = np.transpose(img, (1, 2, 0))
324
- elif img.ndim == 2:
325
- img = np.expand_dims(img, axis=2)
326
- return img
327
-
328
-
329
- def single2tensor5(img):
330
- return torch.from_numpy(np.ascontiguousarray(img)).permute(2, 0, 1, 3).float().unsqueeze(0)
331
-
332
-
333
- def single32tensor5(img):
334
- return torch.from_numpy(np.ascontiguousarray(img)).float().unsqueeze(0).unsqueeze(0)
335
-
336
-
337
- def single42tensor4(img):
338
- return torch.from_numpy(np.ascontiguousarray(img)).permute(2, 0, 1, 3).float()
339
-
340
-
341
- # from skimage.io import imread, imsave
342
- def tensor2img(tensor, out_type=np.uint8, min_max=(0, 1)):
343
- '''
344
- Converts a torch Tensor into an image Numpy array of BGR channel order
345
- Input: 4D(B,(3/1),H,W), 3D(C,H,W), or 2D(H,W), any range, RGB channel order
346
- Output: 3D(H,W,C) or 2D(H,W), [0,255], np.uint8 (default)
347
- '''
348
- tensor = tensor.squeeze().float().cpu().clamp_(*min_max) # squeeze first, then clamp
349
- tensor = (tensor - min_max[0]) / (min_max[1] - min_max[0]) # to range [0,1]
350
- n_dim = tensor.dim()
351
- if n_dim == 4:
352
- n_img = len(tensor)
353
- img_np = make_grid(tensor, nrow=int(math.sqrt(n_img)), normalize=False).numpy()
354
- img_np = np.transpose(img_np[[2, 1, 0], :, :], (1, 2, 0)) # HWC, BGR
355
- elif n_dim == 3:
356
- img_np = tensor.numpy()
357
- img_np = np.transpose(img_np[[2, 1, 0], :, :], (1, 2, 0)) # HWC, BGR
358
- elif n_dim == 2:
359
- img_np = tensor.numpy()
360
- else:
361
- raise TypeError(
362
- 'Only support 4D, 3D and 2D tensor. But received with dimension: {:d}'.format(n_dim))
363
- if out_type == np.uint8:
364
- img_np = (img_np * 255.0).round()
365
- # Important. Unlike matlab, numpy.unit8() WILL NOT round by default.
366
- return img_np.astype(out_type)
367
-
368
-
369
- '''
370
- # --------------------------------------------
371
- # Augmentation, flipe and/or rotate
372
- # --------------------------------------------
373
- # The following two are enough.
374
- # (1) augmet_img: numpy image of WxHxC or WxH
375
- # (2) augment_img_tensor4: tensor image 1xCxWxH
376
- # --------------------------------------------
377
- '''
378
-
379
-
380
- def augment_img(img, mode=0):
381
- '''Kai Zhang (github: https://github.com/cszn)
382
- '''
383
- if mode == 0:
384
- return img
385
- elif mode == 1:
386
- return np.flipud(np.rot90(img))
387
- elif mode == 2:
388
- return np.flipud(img)
389
- elif mode == 3:
390
- return np.rot90(img, k=3)
391
- elif mode == 4:
392
- return np.flipud(np.rot90(img, k=2))
393
- elif mode == 5:
394
- return np.rot90(img)
395
- elif mode == 6:
396
- return np.rot90(img, k=2)
397
- elif mode == 7:
398
- return np.flipud(np.rot90(img, k=3))
399
-
400
-
401
- def augment_img_tensor4(img, mode=0):
402
- '''Kai Zhang (github: https://github.com/cszn)
403
- '''
404
- if mode == 0:
405
- return img
406
- elif mode == 1:
407
- return img.rot90(1, [2, 3]).flip([2])
408
- elif mode == 2:
409
- return img.flip([2])
410
- elif mode == 3:
411
- return img.rot90(3, [2, 3])
412
- elif mode == 4:
413
- return img.rot90(2, [2, 3]).flip([2])
414
- elif mode == 5:
415
- return img.rot90(1, [2, 3])
416
- elif mode == 6:
417
- return img.rot90(2, [2, 3])
418
- elif mode == 7:
419
- return img.rot90(3, [2, 3]).flip([2])
420
-
421
-
422
- def augment_img_tensor(img, mode=0):
423
- '''Kai Zhang (github: https://github.com/cszn)
424
- '''
425
- img_size = img.size()
426
- img_np = img.data.cpu().numpy()
427
- if len(img_size) == 3:
428
- img_np = np.transpose(img_np, (1, 2, 0))
429
- elif len(img_size) == 4:
430
- img_np = np.transpose(img_np, (2, 3, 1, 0))
431
- img_np = augment_img(img_np, mode=mode)
432
- img_tensor = torch.from_numpy(np.ascontiguousarray(img_np))
433
- if len(img_size) == 3:
434
- img_tensor = img_tensor.permute(2, 0, 1)
435
- elif len(img_size) == 4:
436
- img_tensor = img_tensor.permute(3, 2, 0, 1)
437
-
438
- return img_tensor.type_as(img)
439
-
440
-
441
- def augment_img_np3(img, mode=0):
442
- if mode == 0:
443
- return img
444
- elif mode == 1:
445
- return img.transpose(1, 0, 2)
446
- elif mode == 2:
447
- return img[::-1, :, :]
448
- elif mode == 3:
449
- img = img[::-1, :, :]
450
- img = img.transpose(1, 0, 2)
451
- return img
452
- elif mode == 4:
453
- return img[:, ::-1, :]
454
- elif mode == 5:
455
- img = img[:, ::-1, :]
456
- img = img.transpose(1, 0, 2)
457
- return img
458
- elif mode == 6:
459
- img = img[:, ::-1, :]
460
- img = img[::-1, :, :]
461
- return img
462
- elif mode == 7:
463
- img = img[:, ::-1, :]
464
- img = img[::-1, :, :]
465
- img = img.transpose(1, 0, 2)
466
- return img
467
-
468
-
469
- def augment_imgs(img_list, hflip=True, rot=True):
470
- # horizontal flip OR rotate
471
- hflip = hflip and random.random() < 0.5
472
- vflip = rot and random.random() < 0.5
473
- rot90 = rot and random.random() < 0.5
474
-
475
- def _augment(img):
476
- if hflip:
477
- img = img[:, ::-1, :]
478
- if vflip:
479
- img = img[::-1, :, :]
480
- if rot90:
481
- img = img.transpose(1, 0, 2)
482
- return img
483
-
484
- return [_augment(img) for img in img_list]
485
-
486
-
487
- '''
488
- # --------------------------------------------
489
- # modcrop and shave
490
- # --------------------------------------------
491
- '''
492
-
493
-
494
- def modcrop(img_in, scale):
495
- # img_in: Numpy, HWC or HW
496
- img = np.copy(img_in)
497
- if img.ndim == 2:
498
- H, W = img.shape
499
- H_r, W_r = H % scale, W % scale
500
- img = img[:H - H_r, :W - W_r]
501
- elif img.ndim == 3:
502
- H, W, C = img.shape
503
- H_r, W_r = H % scale, W % scale
504
- img = img[:H - H_r, :W - W_r, :]
505
- else:
506
- raise ValueError('Wrong img ndim: [{:d}].'.format(img.ndim))
507
- return img
508
-
509
-
510
- def shave(img_in, border=0):
511
- # img_in: Numpy, HWC or HW
512
- img = np.copy(img_in)
513
- h, w = img.shape[:2]
514
- img = img[border:h-border, border:w-border]
515
- return img
516
-
517
-
518
- '''
519
- # --------------------------------------------
520
- # image processing process on numpy image
521
- # channel_convert(in_c, tar_type, img_list):
522
- # rgb2ycbcr(img, only_y=True):
523
- # bgr2ycbcr(img, only_y=True):
524
- # ycbcr2rgb(img):
525
- # --------------------------------------------
526
- '''
527
-
528
-
529
- def rgb2ycbcr(img, only_y=True):
530
- '''same as matlab rgb2ycbcr
531
- only_y: only return Y channel
532
- Input:
533
- uint8, [0, 255]
534
- float, [0, 1]
535
- '''
536
- in_img_type = img.dtype
537
- img.astype(np.float32)
538
- if in_img_type != np.uint8:
539
- img *= 255.
540
- # convert
541
- if only_y:
542
- rlt = np.dot(img, [65.481, 128.553, 24.966]) / 255.0 + 16.0
543
- else:
544
- rlt = np.matmul(img, [[65.481, -37.797, 112.0], [128.553, -74.203, -93.786],
545
- [24.966, 112.0, -18.214]]) / 255.0 + [16, 128, 128]
546
- if in_img_type == np.uint8:
547
- rlt = rlt.round()
548
- else:
549
- rlt /= 255.
550
- return rlt.astype(in_img_type)
551
-
552
-
553
- def ycbcr2rgb(img):
554
- '''same as matlab ycbcr2rgb
555
- Input:
556
- uint8, [0, 255]
557
- float, [0, 1]
558
- '''
559
- in_img_type = img.dtype
560
- img.astype(np.float32)
561
- if in_img_type != np.uint8:
562
- img *= 255.
563
- # convert
564
- rlt = np.matmul(img, [[0.00456621, 0.00456621, 0.00456621], [0, -0.00153632, 0.00791071],
565
- [0.00625893, -0.00318811, 0]]) * 255.0 + [-222.921, 135.576, -276.836]
566
- if in_img_type == np.uint8:
567
- rlt = rlt.round()
568
- else:
569
- rlt /= 255.
570
- return rlt.astype(in_img_type)
571
-
572
-
573
- def bgr2ycbcr(img, only_y=True):
574
- '''bgr version of rgb2ycbcr
575
- only_y: only return Y channel
576
- Input:
577
- uint8, [0, 255]
578
- float, [0, 1]
579
- '''
580
- in_img_type = img.dtype
581
- img.astype(np.float32)
582
- if in_img_type != np.uint8:
583
- img *= 255.
584
- # convert
585
- if only_y:
586
- rlt = np.dot(img, [24.966, 128.553, 65.481]) / 255.0 + 16.0
587
- else:
588
- rlt = np.matmul(img, [[24.966, 112.0, -18.214], [128.553, -74.203, -93.786],
589
- [65.481, -37.797, 112.0]]) / 255.0 + [16, 128, 128]
590
- if in_img_type == np.uint8:
591
- rlt = rlt.round()
592
- else:
593
- rlt /= 255.
594
- return rlt.astype(in_img_type)
595
-
596
-
597
- def channel_convert(in_c, tar_type, img_list):
598
- # conversion among BGR, gray and y
599
- if in_c == 3 and tar_type == 'gray': # BGR to gray
600
- gray_list = [cv2.cvtColor(img, cv2.COLOR_BGR2GRAY) for img in img_list]
601
- return [np.expand_dims(img, axis=2) for img in gray_list]
602
- elif in_c == 3 and tar_type == 'y': # BGR to y
603
- y_list = [bgr2ycbcr(img, only_y=True) for img in img_list]
604
- return [np.expand_dims(img, axis=2) for img in y_list]
605
- elif in_c == 1 and tar_type == 'RGB': # gray/y to BGR
606
- return [cv2.cvtColor(img, cv2.COLOR_GRAY2BGR) for img in img_list]
607
- else:
608
- return img_list
609
-
610
-
611
- '''
612
- # --------------------------------------------
613
- # metric, PSNR and SSIM
614
- # --------------------------------------------
615
- '''
616
-
617
-
618
- # --------------------------------------------
619
- # PSNR
620
- # --------------------------------------------
621
- def calculate_psnr(img1, img2, border=0):
622
- # img1 and img2 have range [0, 255]
623
- #img1 = img1.squeeze()
624
- #img2 = img2.squeeze()
625
- if not img1.shape == img2.shape:
626
- raise ValueError('Input images must have the same dimensions.')
627
- h, w = img1.shape[:2]
628
- img1 = img1[border:h-border, border:w-border]
629
- img2 = img2[border:h-border, border:w-border]
630
-
631
- img1 = img1.astype(np.float64)
632
- img2 = img2.astype(np.float64)
633
- mse = np.mean((img1 - img2)**2)
634
- if mse == 0:
635
- return float('inf')
636
- return 20 * math.log10(255.0 / math.sqrt(mse))
637
-
638
-
639
- # --------------------------------------------
640
- # SSIM
641
- # --------------------------------------------
642
- def calculate_ssim(img1, img2, border=0):
643
- '''calculate SSIM
644
- the same outputs as MATLAB's
645
- img1, img2: [0, 255]
646
- '''
647
- #img1 = img1.squeeze()
648
- #img2 = img2.squeeze()
649
- if not img1.shape == img2.shape:
650
- raise ValueError('Input images must have the same dimensions.')
651
- h, w = img1.shape[:2]
652
- img1 = img1[border:h-border, border:w-border]
653
- img2 = img2[border:h-border, border:w-border]
654
-
655
- if img1.ndim == 2:
656
- return ssim(img1, img2)
657
- elif img1.ndim == 3:
658
- if img1.shape[2] == 3:
659
- ssims = []
660
- for i in range(3):
661
- ssims.append(ssim(img1[:,:,i], img2[:,:,i]))
662
- return np.array(ssims).mean()
663
- elif img1.shape[2] == 1:
664
- return ssim(np.squeeze(img1), np.squeeze(img2))
665
- else:
666
- raise ValueError('Wrong input image dimensions.')
667
-
668
-
669
- def ssim(img1, img2):
670
- C1 = (0.01 * 255)**2
671
- C2 = (0.03 * 255)**2
672
-
673
- img1 = img1.astype(np.float64)
674
- img2 = img2.astype(np.float64)
675
- kernel = cv2.getGaussianKernel(11, 1.5)
676
- window = np.outer(kernel, kernel.transpose())
677
-
678
- mu1 = cv2.filter2D(img1, -1, window)[5:-5, 5:-5] # valid
679
- mu2 = cv2.filter2D(img2, -1, window)[5:-5, 5:-5]
680
- mu1_sq = mu1**2
681
- mu2_sq = mu2**2
682
- mu1_mu2 = mu1 * mu2
683
- sigma1_sq = cv2.filter2D(img1**2, -1, window)[5:-5, 5:-5] - mu1_sq
684
- sigma2_sq = cv2.filter2D(img2**2, -1, window)[5:-5, 5:-5] - mu2_sq
685
- sigma12 = cv2.filter2D(img1 * img2, -1, window)[5:-5, 5:-5] - mu1_mu2
686
-
687
- ssim_map = ((2 * mu1_mu2 + C1) * (2 * sigma12 + C2)) / ((mu1_sq + mu2_sq + C1) *
688
- (sigma1_sq + sigma2_sq + C2))
689
- return ssim_map.mean()
690
-
691
-
692
- '''
693
- # --------------------------------------------
694
- # matlab's bicubic imresize (numpy and torch) [0, 1]
695
- # --------------------------------------------
696
- '''
697
-
698
-
699
- # matlab 'imresize' function, now only support 'bicubic'
700
- def cubic(x):
701
- absx = torch.abs(x)
702
- absx2 = absx**2
703
- absx3 = absx**3
704
- return (1.5*absx3 - 2.5*absx2 + 1) * ((absx <= 1).type_as(absx)) + \
705
- (-0.5*absx3 + 2.5*absx2 - 4*absx + 2) * (((absx > 1)*(absx <= 2)).type_as(absx))
706
-
707
-
708
- def calculate_weights_indices(in_length, out_length, scale, kernel, kernel_width, antialiasing):
709
- if (scale < 1) and (antialiasing):
710
- # Use a modified kernel to simultaneously interpolate and antialias- larger kernel width
711
- kernel_width = kernel_width / scale
712
-
713
- # Output-space coordinates
714
- x = torch.linspace(1, out_length, out_length)
715
-
716
- # Input-space coordinates. Calculate the inverse mapping such that 0.5
717
- # in output space maps to 0.5 in input space, and 0.5+scale in output
718
- # space maps to 1.5 in input space.
719
- u = x / scale + 0.5 * (1 - 1 / scale)
720
-
721
- # What is the left-most pixel that can be involved in the computation?
722
- left = torch.floor(u - kernel_width / 2)
723
-
724
- # What is the maximum number of pixels that can be involved in the
725
- # computation? Note: it's OK to use an extra pixel here; if the
726
- # corresponding weights are all zero, it will be eliminated at the end
727
- # of this function.
728
- P = math.ceil(kernel_width) + 2
729
-
730
- # The indices of the input pixels involved in computing the k-th output
731
- # pixel are in row k of the indices matrix.
732
- indices = left.view(out_length, 1).expand(out_length, P) + torch.linspace(0, P - 1, P).view(
733
- 1, P).expand(out_length, P)
734
-
735
- # The weights used to compute the k-th output pixel are in row k of the
736
- # weights matrix.
737
- distance_to_center = u.view(out_length, 1).expand(out_length, P) - indices
738
- # apply cubic kernel
739
- if (scale < 1) and (antialiasing):
740
- weights = scale * cubic(distance_to_center * scale)
741
- else:
742
- weights = cubic(distance_to_center)
743
- # Normalize the weights matrix so that each row sums to 1.
744
- weights_sum = torch.sum(weights, 1).view(out_length, 1)
745
- weights = weights / weights_sum.expand(out_length, P)
746
-
747
- # If a column in weights is all zero, get rid of it. only consider the first and last column.
748
- weights_zero_tmp = torch.sum((weights == 0), 0)
749
- if not math.isclose(weights_zero_tmp[0], 0, rel_tol=1e-6):
750
- indices = indices.narrow(1, 1, P - 2)
751
- weights = weights.narrow(1, 1, P - 2)
752
- if not math.isclose(weights_zero_tmp[-1], 0, rel_tol=1e-6):
753
- indices = indices.narrow(1, 0, P - 2)
754
- weights = weights.narrow(1, 0, P - 2)
755
- weights = weights.contiguous()
756
- indices = indices.contiguous()
757
- sym_len_s = -indices.min() + 1
758
- sym_len_e = indices.max() - in_length
759
- indices = indices + sym_len_s - 1
760
- return weights, indices, int(sym_len_s), int(sym_len_e)
761
-
762
-
763
- # --------------------------------------------
764
- # imresize for tensor image [0, 1]
765
- # --------------------------------------------
766
- def imresize(img, scale, antialiasing=True):
767
- # Now the scale should be the same for H and W
768
- # input: img: pytorch tensor, CHW or HW [0,1]
769
- # output: CHW or HW [0,1] w/o round
770
- need_squeeze = True if img.dim() == 2 else False
771
- if need_squeeze:
772
- img.unsqueeze_(0)
773
- in_C, in_H, in_W = img.size()
774
- out_C, out_H, out_W = in_C, math.ceil(in_H * scale), math.ceil(in_W * scale)
775
- kernel_width = 4
776
- kernel = 'cubic'
777
-
778
- # Return the desired dimension order for performing the resize. The
779
- # strategy is to perform the resize first along the dimension with the
780
- # smallest scale factor.
781
- # Now we do not support this.
782
-
783
- # get weights and indices
784
- weights_H, indices_H, sym_len_Hs, sym_len_He = calculate_weights_indices(
785
- in_H, out_H, scale, kernel, kernel_width, antialiasing)
786
- weights_W, indices_W, sym_len_Ws, sym_len_We = calculate_weights_indices(
787
- in_W, out_W, scale, kernel, kernel_width, antialiasing)
788
- # process H dimension
789
- # symmetric copying
790
- img_aug = torch.FloatTensor(in_C, in_H + sym_len_Hs + sym_len_He, in_W)
791
- img_aug.narrow(1, sym_len_Hs, in_H).copy_(img)
792
-
793
- sym_patch = img[:, :sym_len_Hs, :]
794
- inv_idx = torch.arange(sym_patch.size(1) - 1, -1, -1).long()
795
- sym_patch_inv = sym_patch.index_select(1, inv_idx)
796
- img_aug.narrow(1, 0, sym_len_Hs).copy_(sym_patch_inv)
797
-
798
- sym_patch = img[:, -sym_len_He:, :]
799
- inv_idx = torch.arange(sym_patch.size(1) - 1, -1, -1).long()
800
- sym_patch_inv = sym_patch.index_select(1, inv_idx)
801
- img_aug.narrow(1, sym_len_Hs + in_H, sym_len_He).copy_(sym_patch_inv)
802
-
803
- out_1 = torch.FloatTensor(in_C, out_H, in_W)
804
- kernel_width = weights_H.size(1)
805
- for i in range(out_H):
806
- idx = int(indices_H[i][0])
807
- for j in range(out_C):
808
- out_1[j, i, :] = img_aug[j, idx:idx + kernel_width, :].transpose(0, 1).mv(weights_H[i])
809
-
810
- # process W dimension
811
- # symmetric copying
812
- out_1_aug = torch.FloatTensor(in_C, out_H, in_W + sym_len_Ws + sym_len_We)
813
- out_1_aug.narrow(2, sym_len_Ws, in_W).copy_(out_1)
814
-
815
- sym_patch = out_1[:, :, :sym_len_Ws]
816
- inv_idx = torch.arange(sym_patch.size(2) - 1, -1, -1).long()
817
- sym_patch_inv = sym_patch.index_select(2, inv_idx)
818
- out_1_aug.narrow(2, 0, sym_len_Ws).copy_(sym_patch_inv)
819
-
820
- sym_patch = out_1[:, :, -sym_len_We:]
821
- inv_idx = torch.arange(sym_patch.size(2) - 1, -1, -1).long()
822
- sym_patch_inv = sym_patch.index_select(2, inv_idx)
823
- out_1_aug.narrow(2, sym_len_Ws + in_W, sym_len_We).copy_(sym_patch_inv)
824
-
825
- out_2 = torch.FloatTensor(in_C, out_H, out_W)
826
- kernel_width = weights_W.size(1)
827
- for i in range(out_W):
828
- idx = int(indices_W[i][0])
829
- for j in range(out_C):
830
- out_2[j, :, i] = out_1_aug[j, :, idx:idx + kernel_width].mv(weights_W[i])
831
- if need_squeeze:
832
- out_2.squeeze_()
833
- return out_2
834
-
835
-
836
- # --------------------------------------------
837
- # imresize for numpy image [0, 1]
838
- # --------------------------------------------
839
- def imresize_np(img, scale, antialiasing=True):
840
- # Now the scale should be the same for H and W
841
- # input: img: Numpy, HWC or HW [0,1]
842
- # output: HWC or HW [0,1] w/o round
843
- img = torch.from_numpy(img)
844
- need_squeeze = True if img.dim() == 2 else False
845
- if need_squeeze:
846
- img.unsqueeze_(2)
847
-
848
- in_H, in_W, in_C = img.size()
849
- out_C, out_H, out_W = in_C, math.ceil(in_H * scale), math.ceil(in_W * scale)
850
- kernel_width = 4
851
- kernel = 'cubic'
852
-
853
- # Return the desired dimension order for performing the resize. The
854
- # strategy is to perform the resize first along the dimension with the
855
- # smallest scale factor.
856
- # Now we do not support this.
857
-
858
- # get weights and indices
859
- weights_H, indices_H, sym_len_Hs, sym_len_He = calculate_weights_indices(
860
- in_H, out_H, scale, kernel, kernel_width, antialiasing)
861
- weights_W, indices_W, sym_len_Ws, sym_len_We = calculate_weights_indices(
862
- in_W, out_W, scale, kernel, kernel_width, antialiasing)
863
- # process H dimension
864
- # symmetric copying
865
- img_aug = torch.FloatTensor(in_H + sym_len_Hs + sym_len_He, in_W, in_C)
866
- img_aug.narrow(0, sym_len_Hs, in_H).copy_(img)
867
-
868
- sym_patch = img[:sym_len_Hs, :, :]
869
- inv_idx = torch.arange(sym_patch.size(0) - 1, -1, -1).long()
870
- sym_patch_inv = sym_patch.index_select(0, inv_idx)
871
- img_aug.narrow(0, 0, sym_len_Hs).copy_(sym_patch_inv)
872
-
873
- sym_patch = img[-sym_len_He:, :, :]
874
- inv_idx = torch.arange(sym_patch.size(0) - 1, -1, -1).long()
875
- sym_patch_inv = sym_patch.index_select(0, inv_idx)
876
- img_aug.narrow(0, sym_len_Hs + in_H, sym_len_He).copy_(sym_patch_inv)
877
-
878
- out_1 = torch.FloatTensor(out_H, in_W, in_C)
879
- kernel_width = weights_H.size(1)
880
- for i in range(out_H):
881
- idx = int(indices_H[i][0])
882
- for j in range(out_C):
883
- out_1[i, :, j] = img_aug[idx:idx + kernel_width, :, j].transpose(0, 1).mv(weights_H[i])
884
-
885
- # process W dimension
886
- # symmetric copying
887
- out_1_aug = torch.FloatTensor(out_H, in_W + sym_len_Ws + sym_len_We, in_C)
888
- out_1_aug.narrow(1, sym_len_Ws, in_W).copy_(out_1)
889
-
890
- sym_patch = out_1[:, :sym_len_Ws, :]
891
- inv_idx = torch.arange(sym_patch.size(1) - 1, -1, -1).long()
892
- sym_patch_inv = sym_patch.index_select(1, inv_idx)
893
- out_1_aug.narrow(1, 0, sym_len_Ws).copy_(sym_patch_inv)
894
-
895
- sym_patch = out_1[:, -sym_len_We:, :]
896
- inv_idx = torch.arange(sym_patch.size(1) - 1, -1, -1).long()
897
- sym_patch_inv = sym_patch.index_select(1, inv_idx)
898
- out_1_aug.narrow(1, sym_len_Ws + in_W, sym_len_We).copy_(sym_patch_inv)
899
-
900
- out_2 = torch.FloatTensor(out_H, out_W, in_C)
901
- kernel_width = weights_W.size(1)
902
- for i in range(out_W):
903
- idx = int(indices_W[i][0])
904
- for j in range(out_C):
905
- out_2[:, i, j] = out_1_aug[:, idx:idx + kernel_width, j].mv(weights_W[i])
906
- if need_squeeze:
907
- out_2.squeeze_()
908
-
909
- return out_2.numpy()
910
-
911
-
912
- if __name__ == '__main__':
913
- print('---')
914
- # img = imread_uint('test.bmp', 3)
915
- # img = uint2single(img)
916
- # img_bicubic = imresize_np(img, 1/4)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
spaces/AIWaves/Software_Company/gradio_backend.py DELETED
@@ -1,127 +0,0 @@
1
- import os
2
- import argparse
3
- import sys
4
- sys.path.append("src/agents")
5
- from utils import extract
6
- from SOP import SOP
7
- from Agent import Agent
8
- from Environment import Environment
9
- from Memory import Memory
10
- from gradio_base import Client, convert2list4agentname
11
-
12
- def process(action):
13
- response = action.response
14
- send_name = action.name
15
- send_role = action.role
16
- if not action.is_user:
17
- print(f"{send_name}({send_role}):{response}")
18
- memory = Memory(send_role, send_name, response)
19
- return memory
20
-
21
- def gradio_process(action,current_state):
22
- response = action.response
23
- all = ""
24
- for i,res in enumerate(response):
25
- all+=res
26
- state = 10
27
- if action.is_user:
28
- state = 30
29
- elif action.state_begin:
30
- state = 12
31
- action.state_begin = False
32
- elif i>0:
33
- state = 11
34
- send_name = f"{action.name}({action.role})"
35
- Client.send_server(str([state, send_name, res, current_state.name]))
36
- if state == 30:
37
- # print("client: waiting for user input")
38
- data: list = next(Client.receive_server)
39
- content = ""
40
- for item in data:
41
- if item.startswith("<USER>"):
42
- content = item.split("<USER>")[1]
43
- break
44
- # print(f"client: received `{content}` from server.")
45
- action.response = content
46
- break
47
- else:
48
- action.response = all
49
-
50
- def init(config):
51
- if not os.path.exists("logs"):
52
- os.mkdir("logs")
53
- sop = SOP.from_config(config)
54
- agents,roles_to_names,names_to_roles = Agent.from_config(config)
55
- environment = Environment.from_config(config)
56
- environment.agents = agents
57
- environment.roles_to_names,environment.names_to_roles = roles_to_names,names_to_roles
58
- sop.roles_to_names,sop.names_to_roles = roles_to_names,names_to_roles
59
- for name,agent in agents.items():
60
- agent.environment = environment
61
- return agents,sop,environment
62
-
63
- def block_when_next(current_agent, current_state):
64
- if Client.LAST_USER:
65
- assert not current_agent.is_user
66
- Client.LAST_USER = False
67
- return
68
- if current_agent.is_user:
69
- # if next turn is user, we don't handle it here
70
- Client.LAST_USER = True
71
- return
72
- if Client.FIRST_RUN:
73
- Client.FIRST_RUN = False
74
- else:
75
- # block current process
76
- if Client.mode == Client.SINGLE_MODE:
77
- Client.send_server(str([98, f"{current_agent.name}({current_agent.state_roles[current_state.name]})", " ", current_state.name]))
78
- data: list = next(Client.receive_server)
79
-
80
- def run(agents,sop,environment):
81
- while True:
82
- current_state,current_agent= sop.next(environment,agents)
83
- if sop.finished:
84
- print("finished!")
85
- Client.send_server(str([99, ' ', ' ', 'done']))
86
- os.environ.clear()
87
- break
88
- block_when_next(current_agent, current_state)
89
- action = current_agent.step(current_state) #component_dict = current_state[self.role[current_node.name]] current_agent.compile(component_dict)
90
- gradio_process(action,current_state)
91
- memory = process(action)
92
- environment.update_memory(memory,current_state)
93
-
94
- def prepare(agents, sop, environment):
95
- client = Client()
96
- Client.send_server = client.send_message
97
-
98
- requirement_game_name = extract(sop.states['design_state'].environment_prompt,"target")
99
- client.send_message(
100
- {
101
- "requirement": requirement_game_name,
102
- "agents_name": convert2list4agentname(sop)[0],
103
- # "only_name": DebateUI.convert2list4agentname(sop)[1],
104
- "only_name": convert2list4agentname(sop)[0],
105
- "default_cos_play_id": -1,
106
- "api_key": os.environ["API_KEY"]
107
- }
108
- )
109
- # print(f"client: send {requirement_game_name}")
110
- client.listening_for_start_()
111
- client.mode = Client.mode = client.cache["mode"]
112
- new_requirement = Client.cache['requirement']
113
- os.environ["API_KEY"] = client.cache["api_key"]
114
- for state in sop.states.values():
115
- state.environment_prompt = state.environment_prompt.replace("<target>a snake game with python</target>", f"<target>{new_requirement}</target>")
116
- # print(f"client: received {Client.cache['requirement']} from server.")
117
-
118
- if __name__ == '__main__':
119
- parser = argparse.ArgumentParser(description='A demo of chatbot')
120
- parser.add_argument('--agent', type=str, help='path to SOP json', default="config.json")
121
- args = parser.parse_args()
122
-
123
- agents,sop,environment = init(args.agent)
124
- # add================================
125
- prepare(agents, sop, environment)
126
- # ===================================
127
- run(agents,sop,environment)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
spaces/AIZeroToHero/3-NLP-MLM-MaskedLanguageModel/README.md DELETED
@@ -1,13 +0,0 @@
1
- ---
2
- title: 3 NLP MLM MaskedLanguageModel
3
- emoji: 🌖
4
- colorFrom: green
5
- colorTo: blue
6
- sdk: gradio
7
- sdk_version: 3.1.7
8
- app_file: app.py
9
- pinned: false
10
- license: mit
11
- ---
12
-
13
- Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
 
 
 
 
 
 
 
 
 
 
 
 
 
 
spaces/Adapter/T2I-Adapter/ldm/modules/diffusionmodules/util.py DELETED
@@ -1,270 +0,0 @@
1
- # adopted from
2
- # https://github.com/openai/improved-diffusion/blob/main/improved_diffusion/gaussian_diffusion.py
3
- # and
4
- # https://github.com/lucidrains/denoising-diffusion-pytorch/blob/7706bdfc6f527f58d33f84b7b522e61e6e3164b3/denoising_diffusion_pytorch/denoising_diffusion_pytorch.py
5
- # and
6
- # https://github.com/openai/guided-diffusion/blob/0ba878e517b276c45d1195eb29f6f5f72659a05b/guided_diffusion/nn.py
7
- #
8
- # thanks!
9
-
10
-
11
- import os
12
- import math
13
- import torch
14
- import torch.nn as nn
15
- import numpy as np
16
- from einops import repeat
17
-
18
- from ldm.util import instantiate_from_config
19
-
20
-
21
- def make_beta_schedule(schedule, n_timestep, linear_start=1e-4, linear_end=2e-2, cosine_s=8e-3):
22
- if schedule == "linear":
23
- betas = (
24
- torch.linspace(linear_start ** 0.5, linear_end ** 0.5, n_timestep, dtype=torch.float64) ** 2
25
- )
26
-
27
- elif schedule == "cosine":
28
- timesteps = (
29
- torch.arange(n_timestep + 1, dtype=torch.float64) / n_timestep + cosine_s
30
- )
31
- alphas = timesteps / (1 + cosine_s) * np.pi / 2
32
- alphas = torch.cos(alphas).pow(2)
33
- alphas = alphas / alphas[0]
34
- betas = 1 - alphas[1:] / alphas[:-1]
35
- betas = np.clip(betas, a_min=0, a_max=0.999)
36
-
37
- elif schedule == "sqrt_linear":
38
- betas = torch.linspace(linear_start, linear_end, n_timestep, dtype=torch.float64)
39
- elif schedule == "sqrt":
40
- betas = torch.linspace(linear_start, linear_end, n_timestep, dtype=torch.float64) ** 0.5
41
- else:
42
- raise ValueError(f"schedule '{schedule}' unknown.")
43
- return betas.numpy()
44
-
45
-
46
- def make_ddim_timesteps(ddim_discr_method, num_ddim_timesteps, num_ddpm_timesteps, verbose=True):
47
- if ddim_discr_method == 'uniform':
48
- c = num_ddpm_timesteps // num_ddim_timesteps
49
- ddim_timesteps = np.asarray(list(range(0, num_ddpm_timesteps, c)))
50
- elif ddim_discr_method == 'quad':
51
- ddim_timesteps = ((np.linspace(0, np.sqrt(num_ddpm_timesteps * .8), num_ddim_timesteps)) ** 2).astype(int)
52
- else:
53
- raise NotImplementedError(f'There is no ddim discretization method called "{ddim_discr_method}"')
54
-
55
- # assert ddim_timesteps.shape[0] == num_ddim_timesteps
56
- # add one to get the final alpha values right (the ones from first scale to data during sampling)
57
- steps_out = ddim_timesteps + 1
58
- if verbose:
59
- print(f'Selected timesteps for ddim sampler: {steps_out}')
60
- return steps_out
61
-
62
-
63
- def make_ddim_sampling_parameters(alphacums, ddim_timesteps, eta, verbose=True):
64
- # select alphas for computing the variance schedule
65
- alphas = alphacums[ddim_timesteps]
66
- alphas_prev = np.asarray([alphacums[0]] + alphacums[ddim_timesteps[:-1]].tolist())
67
-
68
- # according the the formula provided in https://arxiv.org/abs/2010.02502
69
- sigmas = eta * np.sqrt((1 - alphas_prev) / (1 - alphas) * (1 - alphas / alphas_prev))
70
- if verbose:
71
- print(f'Selected alphas for ddim sampler: a_t: {alphas}; a_(t-1): {alphas_prev}')
72
- print(f'For the chosen value of eta, which is {eta}, '
73
- f'this results in the following sigma_t schedule for ddim sampler {sigmas}')
74
- return sigmas, alphas, alphas_prev
75
-
76
-
77
- def betas_for_alpha_bar(num_diffusion_timesteps, alpha_bar, max_beta=0.999):
78
- """
79
- Create a beta schedule that discretizes the given alpha_t_bar function,
80
- which defines the cumulative product of (1-beta) over time from t = [0,1].
81
- :param num_diffusion_timesteps: the number of betas to produce.
82
- :param alpha_bar: a lambda that takes an argument t from 0 to 1 and
83
- produces the cumulative product of (1-beta) up to that
84
- part of the diffusion process.
85
- :param max_beta: the maximum beta to use; use values lower than 1 to
86
- prevent singularities.
87
- """
88
- betas = []
89
- for i in range(num_diffusion_timesteps):
90
- t1 = i / num_diffusion_timesteps
91
- t2 = (i + 1) / num_diffusion_timesteps
92
- betas.append(min(1 - alpha_bar(t2) / alpha_bar(t1), max_beta))
93
- return np.array(betas)
94
-
95
-
96
- def extract_into_tensor(a, t, x_shape):
97
- b, *_ = t.shape
98
- out = a.gather(-1, t)
99
- return out.reshape(b, *((1,) * (len(x_shape) - 1)))
100
-
101
-
102
- def checkpoint(func, inputs, params, flag):
103
- """
104
- Evaluate a function without caching intermediate activations, allowing for
105
- reduced memory at the expense of extra compute in the backward pass.
106
- :param func: the function to evaluate.
107
- :param inputs: the argument sequence to pass to `func`.
108
- :param params: a sequence of parameters `func` depends on but does not
109
- explicitly take as arguments.
110
- :param flag: if False, disable gradient checkpointing.
111
- """
112
- if flag:
113
- args = tuple(inputs) + tuple(params)
114
- return CheckpointFunction.apply(func, len(inputs), *args)
115
- else:
116
- return func(*inputs)
117
-
118
-
119
- class CheckpointFunction(torch.autograd.Function):
120
- @staticmethod
121
- def forward(ctx, run_function, length, *args):
122
- ctx.run_function = run_function
123
- ctx.input_tensors = list(args[:length])
124
- ctx.input_params = list(args[length:])
125
- ctx.gpu_autocast_kwargs = {"enabled": torch.is_autocast_enabled(),
126
- "dtype": torch.get_autocast_gpu_dtype(),
127
- "cache_enabled": torch.is_autocast_cache_enabled()}
128
- with torch.no_grad():
129
- output_tensors = ctx.run_function(*ctx.input_tensors)
130
- return output_tensors
131
-
132
- @staticmethod
133
- def backward(ctx, *output_grads):
134
- ctx.input_tensors = [x.detach().requires_grad_(True) for x in ctx.input_tensors]
135
- with torch.enable_grad(), \
136
- torch.cuda.amp.autocast(**ctx.gpu_autocast_kwargs):
137
- # Fixes a bug where the first op in run_function modifies the
138
- # Tensor storage in place, which is not allowed for detach()'d
139
- # Tensors.
140
- shallow_copies = [x.view_as(x) for x in ctx.input_tensors]
141
- output_tensors = ctx.run_function(*shallow_copies)
142
- input_grads = torch.autograd.grad(
143
- output_tensors,
144
- ctx.input_tensors + ctx.input_params,
145
- output_grads,
146
- allow_unused=True,
147
- )
148
- del ctx.input_tensors
149
- del ctx.input_params
150
- del output_tensors
151
- return (None, None) + input_grads
152
-
153
-
154
- def timestep_embedding(timesteps, dim, max_period=10000, repeat_only=False):
155
- """
156
- Create sinusoidal timestep embeddings.
157
- :param timesteps: a 1-D Tensor of N indices, one per batch element.
158
- These may be fractional.
159
- :param dim: the dimension of the output.
160
- :param max_period: controls the minimum frequency of the embeddings.
161
- :return: an [N x dim] Tensor of positional embeddings.
162
- """
163
- if not repeat_only:
164
- half = dim // 2
165
- freqs = torch.exp(
166
- -math.log(max_period) * torch.arange(start=0, end=half, dtype=torch.float32) / half
167
- ).to(device=timesteps.device)
168
- args = timesteps[:, None].float() * freqs[None]
169
- embedding = torch.cat([torch.cos(args), torch.sin(args)], dim=-1)
170
- if dim % 2:
171
- embedding = torch.cat([embedding, torch.zeros_like(embedding[:, :1])], dim=-1)
172
- else:
173
- embedding = repeat(timesteps, 'b -> b d', d=dim)
174
- return embedding
175
-
176
-
177
- def zero_module(module):
178
- """
179
- Zero out the parameters of a module and return it.
180
- """
181
- for p in module.parameters():
182
- p.detach().zero_()
183
- return module
184
-
185
-
186
- def scale_module(module, scale):
187
- """
188
- Scale the parameters of a module and return it.
189
- """
190
- for p in module.parameters():
191
- p.detach().mul_(scale)
192
- return module
193
-
194
-
195
- def mean_flat(tensor):
196
- """
197
- Take the mean over all non-batch dimensions.
198
- """
199
- return tensor.mean(dim=list(range(1, len(tensor.shape))))
200
-
201
-
202
- def normalization(channels):
203
- """
204
- Make a standard normalization layer.
205
- :param channels: number of input channels.
206
- :return: an nn.Module for normalization.
207
- """
208
- return GroupNorm32(32, channels)
209
-
210
-
211
- # PyTorch 1.7 has SiLU, but we support PyTorch 1.5.
212
- class SiLU(nn.Module):
213
- def forward(self, x):
214
- return x * torch.sigmoid(x)
215
-
216
-
217
- class GroupNorm32(nn.GroupNorm):
218
- def forward(self, x):
219
- return super().forward(x.float()).type(x.dtype)
220
-
221
- def conv_nd(dims, *args, **kwargs):
222
- """
223
- Create a 1D, 2D, or 3D convolution module.
224
- """
225
- if dims == 1:
226
- return nn.Conv1d(*args, **kwargs)
227
- elif dims == 2:
228
- return nn.Conv2d(*args, **kwargs)
229
- elif dims == 3:
230
- return nn.Conv3d(*args, **kwargs)
231
- raise ValueError(f"unsupported dimensions: {dims}")
232
-
233
-
234
- def linear(*args, **kwargs):
235
- """
236
- Create a linear module.
237
- """
238
- return nn.Linear(*args, **kwargs)
239
-
240
-
241
- def avg_pool_nd(dims, *args, **kwargs):
242
- """
243
- Create a 1D, 2D, or 3D average pooling module.
244
- """
245
- if dims == 1:
246
- return nn.AvgPool1d(*args, **kwargs)
247
- elif dims == 2:
248
- return nn.AvgPool2d(*args, **kwargs)
249
- elif dims == 3:
250
- return nn.AvgPool3d(*args, **kwargs)
251
- raise ValueError(f"unsupported dimensions: {dims}")
252
-
253
-
254
- class HybridConditioner(nn.Module):
255
-
256
- def __init__(self, c_concat_config, c_crossattn_config):
257
- super().__init__()
258
- self.concat_conditioner = instantiate_from_config(c_concat_config)
259
- self.crossattn_conditioner = instantiate_from_config(c_crossattn_config)
260
-
261
- def forward(self, c_concat, c_crossattn):
262
- c_concat = self.concat_conditioner(c_concat)
263
- c_crossattn = self.crossattn_conditioner(c_crossattn)
264
- return {'c_concat': [c_concat], 'c_crossattn': [c_crossattn]}
265
-
266
-
267
- def noise_like(shape, device, repeat=False):
268
- repeat_noise = lambda: torch.randn((1, *shape[1:]), device=device).repeat(shape[0], *((1,) * (len(shape) - 1)))
269
- noise = lambda: torch.randn(shape, device=device)
270
- return repeat_noise() if repeat else noise()
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
spaces/AgentVerse/agentVerse/ui/src/phaser3-rex-plugins/templates/bejeweled/board/Init.js DELETED
@@ -1,9 +0,0 @@
1
- /*
2
- 1. Fill background tiles
3
- */
4
- var Init = function () {
5
- // TODO: assign symobls of board via callback
6
- return this;
7
- }
8
-
9
- export default Init;
 
 
 
 
 
 
 
 
 
 
spaces/AgentVerse/agentVerse/ui/src/phaser3-rex-plugins/templates/ui/colorinput/colorcomponents/Factory.js DELETED
@@ -1,13 +0,0 @@
1
- import ColorComponents from './ColorComponents.js';
2
- import ObjectFactory from '../../ObjectFactory.js';
3
- import SetValue from '../../../../plugins/utils/object/SetValue.js';
4
-
5
- ObjectFactory.register('colorComponents', function (config) {
6
- var gameObject = new ColorComponents(this.scene, config);
7
- this.scene.add.existing(gameObject);
8
- return gameObject;
9
- });
10
-
11
- SetValue(window, 'RexPlugins.UI.ColorComponents', ColorComponents);
12
-
13
- export default ColorComponents;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
spaces/AhmedTambal/malaria/app.py DELETED
@@ -1,74 +0,0 @@
1
- from __future__ import division, print_function
2
- import numpy as np # linear algebra
3
- import pandas as pd
4
- import os
5
- import tensorflow as tf
6
-
7
- import numpy as np
8
- import matplotlib.image as mpimg
9
- import matplotlib.pyplot as plt
10
-
11
-
12
-
13
-
14
- #!pip install gradio
15
-
16
- #!git clone https://huggingface.co/spaces/AhmedTambal/malaria
17
-
18
-
19
-
20
-
21
- import gradio as gr
22
- import skimage
23
- import keras.preprocessing.image
24
- from tensorflow.keras.utils import load_img
25
- from tensorflow.keras.utils import img_to_array
26
-
27
- # coding=utf-8
28
- import sys
29
- import os
30
- import glob
31
- import re
32
- import numpy as np
33
-
34
- # Keras
35
- from tensorflow.keras.applications.imagenet_utils import preprocess_input, decode_predictions
36
- from tensorflow.keras.models import load_model
37
- from tensorflow.keras.preprocessing import image
38
-
39
- MODEL_PATH ='/content/drive/MyDrive/Fraud Detection/malaria5.h5'
40
-
41
- saved_model = tf.keras.models.load_model(MODEL_PATH)
42
-
43
- image = gr.inputs.Image(shape=(224,224))
44
-
45
- label = gr.outputs.Label(num_top_classes=2)
46
-
47
-
48
- def predict_input_image(img):
49
- img_4d=img.reshape(-1,224,224,3)
50
- prediction=saved_model.predict(img_4d)[0]
51
-
52
- p_pred1 = prediction.flatten()
53
- print(p_pred1.round(2))
54
- # [1. 0.01 0.91 0.87 0.06 0.95 0.24 0.58 0.78 ...
55
-
56
- # extract the predicted class labels
57
- y_pred1 = np.where(p_pred1 > 0.5, 1, 0)
58
-
59
-
60
- if y_pred1==1:
61
- y_pred1="The cells is not Infected With the parasitized"
62
- else:
63
- y_pred1="The cells is Infected With the parasitized"
64
-
65
- return y_pred1
66
-
67
- import gradio as gr
68
- gr.Interface(fn=predict_input_image,
69
- inputs=image,
70
- outputs=label).launch(share=True,debug=False)
71
-
72
- #$ git add app.py
73
- #$ git commit -m "Add application file"
74
- #$ git push
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
spaces/AlexZou/Deploy_Restoration/model/global_net.py DELETED
@@ -1,132 +0,0 @@
1
- import imp
2
- import torch
3
- import torch.nn as nn
4
- from timm.models.layers import trunc_normal_, DropPath, to_2tuple
5
- import os
6
- from model.blocks import Mlp
7
-
8
-
9
- class query_Attention(nn.Module):
10
- def __init__(self, dim, num_heads=2, qkv_bias=False, qk_scale=None, attn_drop=0., proj_drop=0.):
11
- super().__init__()
12
- self.num_heads = num_heads
13
- head_dim = dim // num_heads
14
- # NOTE scale factor was wrong in my original version, can set manually to be compat with prev weights
15
- self.scale = qk_scale or head_dim ** -0.5
16
-
17
- self.q = nn.Parameter(torch.ones((1, 10, dim)), requires_grad=True)
18
- self.k = nn.Linear(dim, dim, bias=qkv_bias)
19
- self.v = nn.Linear(dim, dim, bias=qkv_bias)
20
- self.attn_drop = nn.Dropout(attn_drop)
21
- self.proj = nn.Linear(dim, dim)
22
- self.proj_drop = nn.Dropout(proj_drop)
23
-
24
- def forward(self, x):
25
- B, N, C = x.shape
26
- k = self.k(x).reshape(B, N, self.num_heads, C // self.num_heads).permute(0, 2, 1, 3)
27
- v = self.v(x).reshape(B, N, self.num_heads, C // self.num_heads).permute(0, 2, 1, 3)
28
- q = self.q.expand(B, -1, -1).view(B, -1, self.num_heads, C // self.num_heads).permute(0, 2, 1, 3)
29
-
30
- # k = self.k(x).reshape(B, N, self.num_heads, torch.div(C,self.num_heads, rounding_mode='floor')).permute(0, 2, 1, 3)
31
- # v = self.v(x).reshape(B, N, self.num_heads, torch.div(C,self.num_heads, rounding_mode='floor')).permute(0, 2, 1, 3)
32
- # q = self.q.expand(B, -1, -1).view(B, -1, self.num_heads, torch.div(C,self.num_heads, rounding_mode='floor')).permute(0, 2, 1, 3)
33
- attn = (q @ k.transpose(-2, -1)) * self.scale
34
- attn = attn.softmax(dim=-1)
35
- attn = self.attn_drop(attn)
36
-
37
- x = (attn @ v).transpose(1, 2).reshape(B, 10, C)
38
- x = self.proj(x)
39
- x = self.proj_drop(x)
40
- return x
41
-
42
-
43
- class query_SABlock(nn.Module):
44
- def __init__(self, dim, num_heads, mlp_ratio=4., qkv_bias=False, qk_scale=None, drop=0., attn_drop=0.,
45
- drop_path=0., act_layer=nn.GELU, norm_layer=nn.LayerNorm):
46
- super().__init__()
47
- self.pos_embed = nn.Conv2d(dim, dim, 3, padding=1, groups=dim)
48
- self.norm1 = norm_layer(dim)
49
- self.attn = query_Attention(
50
- dim,
51
- num_heads=num_heads, qkv_bias=qkv_bias, qk_scale=qk_scale,
52
- attn_drop=attn_drop, proj_drop=drop)
53
- # NOTE: drop path for stochastic depth, we shall see if this is better than dropout here
54
- self.drop_path = DropPath(drop_path) if drop_path > 0. else nn.Identity()
55
- self.norm2 = norm_layer(dim)
56
- mlp_hidden_dim = int(dim * mlp_ratio)
57
- self.mlp = Mlp(in_features=dim, hidden_features=mlp_hidden_dim, act_layer=act_layer, drop=drop)
58
-
59
- def forward(self, x):
60
- x = x + self.pos_embed(x)
61
- x = x.flatten(2).transpose(1, 2)
62
- x = self.drop_path(self.attn(self.norm1(x)))
63
- x = x + self.drop_path(self.mlp(self.norm2(x)))
64
- return x
65
-
66
-
67
- class conv_embedding(nn.Module):
68
- def __init__(self, in_channels, out_channels):
69
- super(conv_embedding, self).__init__()
70
- self.proj = nn.Sequential(
71
- nn.Conv2d(in_channels, out_channels // 2, kernel_size=(3, 3), stride=(2, 2), padding=(1, 1)),
72
- nn.BatchNorm2d(out_channels // 2),
73
- nn.GELU(),
74
- # nn.Conv2d(out_channels // 2, out_channels // 2, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1)),
75
- # nn.BatchNorm2d(out_channels // 2),
76
- # nn.GELU(),
77
- nn.Conv2d(out_channels // 2, out_channels, kernel_size=(3, 3), stride=(2, 2), padding=(1, 1)),
78
- nn.BatchNorm2d(out_channels),
79
- )
80
-
81
- def forward(self, x):
82
- x = self.proj(x)
83
- return x
84
-
85
-
86
- class Global_pred(nn.Module):
87
- def __init__(self, in_channels=3, out_channels=64, num_heads=4, type='exp'):
88
- super(Global_pred, self).__init__()
89
- if type == 'exp':
90
- self.gamma_base = nn.Parameter(torch.ones((1)), requires_grad=False) # False in exposure correction
91
- else:
92
- self.gamma_base = nn.Parameter(torch.ones((1)), requires_grad=True)
93
- self.color_base = nn.Parameter(torch.eye((3)), requires_grad=True) # basic color matrix
94
- # main blocks
95
- self.conv_large = conv_embedding(in_channels, out_channels)
96
- self.generator = query_SABlock(dim=out_channels, num_heads=num_heads)
97
- self.gamma_linear = nn.Linear(out_channels, 1)
98
- self.color_linear = nn.Linear(out_channels, 1)
99
-
100
- self.apply(self._init_weights)
101
-
102
- for name, p in self.named_parameters():
103
- if name == 'generator.attn.v.weight':
104
- nn.init.constant_(p, 0)
105
-
106
- def _init_weights(self, m):
107
- if isinstance(m, nn.Linear):
108
- trunc_normal_(m.weight, std=.02)
109
- if isinstance(m, nn.Linear) and m.bias is not None:
110
- nn.init.constant_(m.bias, 0)
111
- elif isinstance(m, nn.LayerNorm):
112
- nn.init.constant_(m.bias, 0)
113
- nn.init.constant_(m.weight, 1.0)
114
-
115
-
116
- def forward(self, x):
117
- #print(self.gamma_base)
118
- x = self.conv_large(x)
119
- x = self.generator(x)
120
- gamma, color = x[:, 0].unsqueeze(1), x[:, 1:]
121
- gamma = self.gamma_linear(gamma).squeeze(-1) + self.gamma_base
122
- #print(self.gamma_base, self.gamma_linear(gamma))
123
- color = self.color_linear(color).squeeze(-1).view(-1, 3, 3) + self.color_base
124
- return gamma, color
125
-
126
- if __name__ == "__main__":
127
- os.environ['CUDA_VISIBLE_DEVICES']='3'
128
- #net = Local_pred_new().cuda()
129
- img = torch.Tensor(8, 3, 400, 600)
130
- global_net = Global_pred()
131
- gamma, color = global_net(img)
132
- print(gamma.shape, color.shape)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
spaces/Aloento/9Nine-PITS/utils.py DELETED
@@ -1,302 +0,0 @@
1
- # from https://github.com/jaywalnut310/vits
2
- import logging
3
- import os
4
- import subprocess
5
- import sys
6
- import glob
7
-
8
- import numpy as np
9
- import torch
10
- from omegaconf import OmegaConf
11
- from scipy.io.wavfile import read
12
-
13
- MATPLOTLIB_FLAG = False
14
-
15
- logging.basicConfig(
16
- stream=sys.stdout,
17
- level=logging.INFO,
18
- format='[%(levelname)s|%(filename)s:%(lineno)s][%(asctime)s] >>> %(message)s'
19
- )
20
- logger = logging
21
-
22
-
23
- def latest_checkpoint_path(dir_path, regex="*.pth"):
24
- f_list = glob.glob(os.path.join(dir_path, regex))
25
- f_list.sort(key=lambda f: int("".join(filter(str.isdigit, f))))
26
- x = f_list[-1]
27
- print(x)
28
- return x
29
-
30
-
31
- def load_checkpoint(checkpoint_path, rank=0, model_g=None, model_d=None, optim_g=None, optim_d=None):
32
- is_train = os.path.isdir(checkpoint_path)
33
-
34
- if is_train:
35
- train = latest_checkpoint_path(checkpoint_path, "*_Train_*.pth")
36
- val = latest_checkpoint_path(checkpoint_path, "*_Eval_*.pth")
37
-
38
- assert train is not None
39
- assert val is not None
40
-
41
- train_dict = torch.load(train, map_location='cpu')
42
- iteration = train_dict['iteration']
43
- else:
44
- assert os.path.isfile(checkpoint_path)
45
- val = checkpoint_path
46
- iteration = "Eval"
47
-
48
- val_dict = torch.load(val, map_location='cpu')
49
-
50
- assert model_g is not None
51
- model_g = load_model(
52
- model_g,
53
- val_dict['model_g']
54
- )
55
-
56
- if is_train:
57
- if optim_g is not None:
58
- optim_g.load_state_dict(train_dict['optimizer_g'])
59
-
60
- if model_d is not None:
61
- model_d = load_model(
62
- model_d,
63
- train_dict['model_d']
64
- )
65
-
66
- if optim_d is not None:
67
- optim_d.load_state_dict(train_dict['optimizer_d'])
68
-
69
- if rank == 0:
70
- logger.info(
71
- "Loaded checkpoint '{}' (iteration {})".format(
72
- checkpoint_path,
73
- iteration
74
- )
75
- )
76
-
77
- return model_g, model_d, optim_g, optim_d, iteration
78
-
79
-
80
- def load_model(model, model_state_dict):
81
- if hasattr(model, 'module'):
82
- state_dict = model.module.state_dict()
83
- else:
84
- state_dict = model.state_dict()
85
-
86
- for k, v in model_state_dict.items():
87
- if k in state_dict and state_dict[k].size() == v.size():
88
- state_dict[k] = v
89
-
90
- if hasattr(model, 'module'):
91
- model.module.load_state_dict(state_dict)
92
- else:
93
- model.load_state_dict(state_dict)
94
-
95
- return model
96
-
97
-
98
- def save_checkpoint(net_g, optim_g, net_d, optim_d, hps, epoch, global_step):
99
- def get_state_dict(model):
100
- if hasattr(model, 'module'):
101
- state_dict = model.module.state_dict()
102
- else:
103
- state_dict = model.state_dict()
104
- return state_dict
105
-
106
- torch.save(
107
- {
108
- 'model_d': get_state_dict(net_d),
109
- 'optimizer_g': optim_g.state_dict(),
110
- 'optimizer_d': optim_d.state_dict(),
111
- 'iteration': epoch,
112
- }, os.path.join(
113
- hps.model_dir, "{}_Train_{}.pth".format(hps.model_name, global_step)
114
- )
115
- )
116
-
117
- torch.save(
118
- {
119
- 'model_g': get_state_dict(net_g),
120
- }, os.path.join(
121
- hps.model_dir, "{}_Eval_{}.pth".format(hps.model_name, global_step)
122
- )
123
- )
124
-
125
-
126
- def summarize(writer, global_step, scalars={}, histograms={}, images={}, audios={}, audio_sampling_rate=22050):
127
- for k, v in scalars.items():
128
- writer.add_scalar(k, v, global_step)
129
- for k, v in histograms.items():
130
- writer.add_histogram(k, v, global_step)
131
- for k, v in images.items():
132
- writer.add_image(k, v, global_step, dataformats='HWC')
133
- for k, v in audios.items():
134
- writer.add_audio(k, v, global_step, audio_sampling_rate)
135
-
136
-
137
- def plot_spectrogram_to_numpy(spectrogram):
138
- global MATPLOTLIB_FLAG
139
- if not MATPLOTLIB_FLAG:
140
- import matplotlib
141
- matplotlib.use("Agg")
142
- MATPLOTLIB_FLAG = True
143
- mpl_logger = logging.getLogger('matplotlib')
144
- mpl_logger.setLevel(logging.WARNING)
145
- import matplotlib.pylab as plt
146
- import numpy as np
147
-
148
- fig, ax = plt.subplots(figsize=(10, 2))
149
- im = ax.imshow(spectrogram, aspect="auto", origin="lower",
150
- interpolation='none')
151
- plt.colorbar(im, ax=ax)
152
- plt.xlabel("Frames")
153
- plt.ylabel("Channels")
154
- plt.tight_layout()
155
-
156
- fig.canvas.draw()
157
- data = np.fromstring(fig.canvas.tostring_rgb(), dtype=np.uint8, sep='')
158
- data = data.reshape(fig.canvas.get_width_height()[::-1] + (3,))
159
- plt.close()
160
- return data
161
-
162
-
163
- def plot_alignment_to_numpy(alignment, info=None):
164
- global MATPLOTLIB_FLAG
165
- if not MATPLOTLIB_FLAG:
166
- import matplotlib
167
- matplotlib.use("Agg")
168
- MATPLOTLIB_FLAG = True
169
- mpl_logger = logging.getLogger('matplotlib')
170
- mpl_logger.setLevel(logging.WARNING)
171
- import matplotlib.pylab as plt
172
- import numpy as np
173
-
174
- fig, ax = plt.subplots(figsize=(6, 4))
175
- im = ax.imshow(alignment.transpose(), aspect='auto', origin='lower',
176
- interpolation='none')
177
- fig.colorbar(im, ax=ax)
178
- xlabel = 'Decoder timestep'
179
- if info is not None:
180
- xlabel += '\n\n' + info
181
- plt.xlabel(xlabel)
182
- plt.ylabel('Encoder timestep')
183
- plt.tight_layout()
184
-
185
- fig.canvas.draw()
186
- data = np.fromstring(fig.canvas.tostring_rgb(), dtype=np.uint8, sep='')
187
- data = data.reshape(fig.canvas.get_width_height()[::-1] + (3,))
188
- plt.close()
189
- return data
190
-
191
-
192
- def load_wav_to_torch(full_path):
193
- sampling_rate, wav = read(full_path)
194
-
195
- if len(wav.shape) == 2:
196
- wav = wav[:, 0]
197
-
198
- if wav.dtype == np.int16:
199
- wav = wav / 32768.0
200
- elif wav.dtype == np.int32:
201
- wav = wav / 2147483648.0
202
- elif wav.dtype == np.uint8:
203
- wav = (wav - 128) / 128.0
204
- wav = wav.astype(np.float32)
205
- return torch.FloatTensor(wav), sampling_rate
206
-
207
-
208
- def load_filepaths_and_text(filename, split="|"):
209
- with open(filename, encoding='utf-8') as f:
210
- filepaths_and_text = [line.strip().split(split) for line in f]
211
- return filepaths_and_text
212
-
213
-
214
- def get_hparams(args, init=True):
215
- config = OmegaConf.load(args.config)
216
- hparams = HParams(**config)
217
- model_dir = os.path.join(hparams.train.log_path, args.model)
218
-
219
- if not os.path.exists(model_dir):
220
- os.makedirs(model_dir)
221
- hparams.model_name = args.model
222
- hparams.model_dir = model_dir
223
- config_save_path = os.path.join(model_dir, "config.yaml")
224
-
225
- if init:
226
- OmegaConf.save(config, config_save_path)
227
-
228
- return hparams
229
-
230
-
231
- def get_hparams_from_file(config_path):
232
- config = OmegaConf.load(config_path)
233
- hparams = HParams(**config)
234
- return hparams
235
-
236
-
237
- def check_git_hash(model_dir):
238
- source_dir = os.path.dirname(os.path.realpath(__file__))
239
- if not os.path.exists(os.path.join(source_dir, ".git")):
240
- logger.warn("{} is not a git repository, therefore hash value comparison will be ignored.".format(
241
- source_dir
242
- ))
243
- return
244
-
245
- cur_hash = subprocess.getoutput("git rev-parse HEAD")
246
-
247
- path = os.path.join(model_dir, "githash")
248
- if os.path.exists(path):
249
- saved_hash = open(path).read()
250
- if saved_hash != cur_hash:
251
- logger.warn("git hash values are different. {}(saved) != {}(current)".format(
252
- saved_hash[:8], cur_hash[:8]))
253
- else:
254
- open(path, "w").write(cur_hash)
255
-
256
-
257
- def get_logger(model_dir, filename="train.log"):
258
- global logger
259
- logger = logging.getLogger(os.path.basename(model_dir))
260
- logger.setLevel(logging.DEBUG)
261
-
262
- formatter = logging.Formatter(
263
- "%(asctime)s\t%(name)s\t%(levelname)s\t%(message)s")
264
- if not os.path.exists(model_dir):
265
- os.makedirs(model_dir)
266
- h = logging.FileHandler(os.path.join(model_dir, filename))
267
- h.setLevel(logging.DEBUG)
268
- h.setFormatter(formatter)
269
- logger.addHandler(h)
270
- return logger
271
-
272
-
273
- class HParams():
274
- def __init__(self, **kwargs):
275
- for k, v in kwargs.items():
276
- if type(v) == dict:
277
- v = HParams(**v)
278
- self[k] = v
279
-
280
- def keys(self):
281
- return self.__dict__.keys()
282
-
283
- def items(self):
284
- return self.__dict__.items()
285
-
286
- def values(self):
287
- return self.__dict__.values()
288
-
289
- def __len__(self):
290
- return len(self.__dict__)
291
-
292
- def __getitem__(self, key):
293
- return getattr(self, key)
294
-
295
- def __setitem__(self, key, value):
296
- return setattr(self, key, value)
297
-
298
- def __contains__(self, key):
299
- return key in self.__dict__
300
-
301
- def __repr__(self):
302
- return self.__dict__.__repr__()
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
spaces/Alpaca233/SadTalker/src/face3d/util/my_awing_arch.py DELETED
@@ -1,378 +0,0 @@
1
- import cv2
2
- import numpy as np
3
- import torch
4
- import torch.nn as nn
5
- import torch.nn.functional as F
6
-
7
-
8
- def calculate_points(heatmaps):
9
- # change heatmaps to landmarks
10
- B, N, H, W = heatmaps.shape
11
- HW = H * W
12
- BN_range = np.arange(B * N)
13
-
14
- heatline = heatmaps.reshape(B, N, HW)
15
- indexes = np.argmax(heatline, axis=2)
16
-
17
- preds = np.stack((indexes % W, indexes // W), axis=2)
18
- preds = preds.astype(np.float, copy=False)
19
-
20
- inr = indexes.ravel()
21
-
22
- heatline = heatline.reshape(B * N, HW)
23
- x_up = heatline[BN_range, inr + 1]
24
- x_down = heatline[BN_range, inr - 1]
25
- # y_up = heatline[BN_range, inr + W]
26
-
27
- if any((inr + W) >= 4096):
28
- y_up = heatline[BN_range, 4095]
29
- else:
30
- y_up = heatline[BN_range, inr + W]
31
- if any((inr - W) <= 0):
32
- y_down = heatline[BN_range, 0]
33
- else:
34
- y_down = heatline[BN_range, inr - W]
35
-
36
- think_diff = np.sign(np.stack((x_up - x_down, y_up - y_down), axis=1))
37
- think_diff *= .25
38
-
39
- preds += think_diff.reshape(B, N, 2)
40
- preds += .5
41
- return preds
42
-
43
-
44
- class AddCoordsTh(nn.Module):
45
-
46
- def __init__(self, x_dim=64, y_dim=64, with_r=False, with_boundary=False):
47
- super(AddCoordsTh, self).__init__()
48
- self.x_dim = x_dim
49
- self.y_dim = y_dim
50
- self.with_r = with_r
51
- self.with_boundary = with_boundary
52
-
53
- def forward(self, input_tensor, heatmap=None):
54
- """
55
- input_tensor: (batch, c, x_dim, y_dim)
56
- """
57
- batch_size_tensor = input_tensor.shape[0]
58
-
59
- xx_ones = torch.ones([1, self.y_dim], dtype=torch.int32, device=input_tensor.device)
60
- xx_ones = xx_ones.unsqueeze(-1)
61
-
62
- xx_range = torch.arange(self.x_dim, dtype=torch.int32, device=input_tensor.device).unsqueeze(0)
63
- xx_range = xx_range.unsqueeze(1)
64
-
65
- xx_channel = torch.matmul(xx_ones.float(), xx_range.float())
66
- xx_channel = xx_channel.unsqueeze(-1)
67
-
68
- yy_ones = torch.ones([1, self.x_dim], dtype=torch.int32, device=input_tensor.device)
69
- yy_ones = yy_ones.unsqueeze(1)
70
-
71
- yy_range = torch.arange(self.y_dim, dtype=torch.int32, device=input_tensor.device).unsqueeze(0)
72
- yy_range = yy_range.unsqueeze(-1)
73
-
74
- yy_channel = torch.matmul(yy_range.float(), yy_ones.float())
75
- yy_channel = yy_channel.unsqueeze(-1)
76
-
77
- xx_channel = xx_channel.permute(0, 3, 2, 1)
78
- yy_channel = yy_channel.permute(0, 3, 2, 1)
79
-
80
- xx_channel = xx_channel / (self.x_dim - 1)
81
- yy_channel = yy_channel / (self.y_dim - 1)
82
-
83
- xx_channel = xx_channel * 2 - 1
84
- yy_channel = yy_channel * 2 - 1
85
-
86
- xx_channel = xx_channel.repeat(batch_size_tensor, 1, 1, 1)
87
- yy_channel = yy_channel.repeat(batch_size_tensor, 1, 1, 1)
88
-
89
- if self.with_boundary and heatmap is not None:
90
- boundary_channel = torch.clamp(heatmap[:, -1:, :, :], 0.0, 1.0)
91
-
92
- zero_tensor = torch.zeros_like(xx_channel)
93
- xx_boundary_channel = torch.where(boundary_channel > 0.05, xx_channel, zero_tensor)
94
- yy_boundary_channel = torch.where(boundary_channel > 0.05, yy_channel, zero_tensor)
95
- if self.with_boundary and heatmap is not None:
96
- xx_boundary_channel = xx_boundary_channel.to(input_tensor.device)
97
- yy_boundary_channel = yy_boundary_channel.to(input_tensor.device)
98
- ret = torch.cat([input_tensor, xx_channel, yy_channel], dim=1)
99
-
100
- if self.with_r:
101
- rr = torch.sqrt(torch.pow(xx_channel, 2) + torch.pow(yy_channel, 2))
102
- rr = rr / torch.max(rr)
103
- ret = torch.cat([ret, rr], dim=1)
104
-
105
- if self.with_boundary and heatmap is not None:
106
- ret = torch.cat([ret, xx_boundary_channel, yy_boundary_channel], dim=1)
107
- return ret
108
-
109
-
110
- class CoordConvTh(nn.Module):
111
- """CoordConv layer as in the paper."""
112
-
113
- def __init__(self, x_dim, y_dim, with_r, with_boundary, in_channels, first_one=False, *args, **kwargs):
114
- super(CoordConvTh, self).__init__()
115
- self.addcoords = AddCoordsTh(x_dim=x_dim, y_dim=y_dim, with_r=with_r, with_boundary=with_boundary)
116
- in_channels += 2
117
- if with_r:
118
- in_channels += 1
119
- if with_boundary and not first_one:
120
- in_channels += 2
121
- self.conv = nn.Conv2d(in_channels=in_channels, *args, **kwargs)
122
-
123
- def forward(self, input_tensor, heatmap=None):
124
- ret = self.addcoords(input_tensor, heatmap)
125
- last_channel = ret[:, -2:, :, :]
126
- ret = self.conv(ret)
127
- return ret, last_channel
128
-
129
-
130
- def conv3x3(in_planes, out_planes, strd=1, padding=1, bias=False, dilation=1):
131
- '3x3 convolution with padding'
132
- return nn.Conv2d(in_planes, out_planes, kernel_size=3, stride=strd, padding=padding, bias=bias, dilation=dilation)
133
-
134
-
135
- class BasicBlock(nn.Module):
136
- expansion = 1
137
-
138
- def __init__(self, inplanes, planes, stride=1, downsample=None):
139
- super(BasicBlock, self).__init__()
140
- self.conv1 = conv3x3(inplanes, planes, stride)
141
- # self.bn1 = nn.BatchNorm2d(planes)
142
- self.relu = nn.ReLU(inplace=True)
143
- self.conv2 = conv3x3(planes, planes)
144
- # self.bn2 = nn.BatchNorm2d(planes)
145
- self.downsample = downsample
146
- self.stride = stride
147
-
148
- def forward(self, x):
149
- residual = x
150
-
151
- out = self.conv1(x)
152
- out = self.relu(out)
153
-
154
- out = self.conv2(out)
155
-
156
- if self.downsample is not None:
157
- residual = self.downsample(x)
158
-
159
- out += residual
160
- out = self.relu(out)
161
-
162
- return out
163
-
164
-
165
- class ConvBlock(nn.Module):
166
-
167
- def __init__(self, in_planes, out_planes):
168
- super(ConvBlock, self).__init__()
169
- self.bn1 = nn.BatchNorm2d(in_planes)
170
- self.conv1 = conv3x3(in_planes, int(out_planes / 2))
171
- self.bn2 = nn.BatchNorm2d(int(out_planes / 2))
172
- self.conv2 = conv3x3(int(out_planes / 2), int(out_planes / 4), padding=1, dilation=1)
173
- self.bn3 = nn.BatchNorm2d(int(out_planes / 4))
174
- self.conv3 = conv3x3(int(out_planes / 4), int(out_planes / 4), padding=1, dilation=1)
175
-
176
- if in_planes != out_planes:
177
- self.downsample = nn.Sequential(
178
- nn.BatchNorm2d(in_planes),
179
- nn.ReLU(True),
180
- nn.Conv2d(in_planes, out_planes, kernel_size=1, stride=1, bias=False),
181
- )
182
- else:
183
- self.downsample = None
184
-
185
- def forward(self, x):
186
- residual = x
187
-
188
- out1 = self.bn1(x)
189
- out1 = F.relu(out1, True)
190
- out1 = self.conv1(out1)
191
-
192
- out2 = self.bn2(out1)
193
- out2 = F.relu(out2, True)
194
- out2 = self.conv2(out2)
195
-
196
- out3 = self.bn3(out2)
197
- out3 = F.relu(out3, True)
198
- out3 = self.conv3(out3)
199
-
200
- out3 = torch.cat((out1, out2, out3), 1)
201
-
202
- if self.downsample is not None:
203
- residual = self.downsample(residual)
204
-
205
- out3 += residual
206
-
207
- return out3
208
-
209
-
210
- class HourGlass(nn.Module):
211
-
212
- def __init__(self, num_modules, depth, num_features, first_one=False):
213
- super(HourGlass, self).__init__()
214
- self.num_modules = num_modules
215
- self.depth = depth
216
- self.features = num_features
217
- self.coordconv = CoordConvTh(
218
- x_dim=64,
219
- y_dim=64,
220
- with_r=True,
221
- with_boundary=True,
222
- in_channels=256,
223
- first_one=first_one,
224
- out_channels=256,
225
- kernel_size=1,
226
- stride=1,
227
- padding=0)
228
- self._generate_network(self.depth)
229
-
230
- def _generate_network(self, level):
231
- self.add_module('b1_' + str(level), ConvBlock(256, 256))
232
-
233
- self.add_module('b2_' + str(level), ConvBlock(256, 256))
234
-
235
- if level > 1:
236
- self._generate_network(level - 1)
237
- else:
238
- self.add_module('b2_plus_' + str(level), ConvBlock(256, 256))
239
-
240
- self.add_module('b3_' + str(level), ConvBlock(256, 256))
241
-
242
- def _forward(self, level, inp):
243
- # Upper branch
244
- up1 = inp
245
- up1 = self._modules['b1_' + str(level)](up1)
246
-
247
- # Lower branch
248
- low1 = F.avg_pool2d(inp, 2, stride=2)
249
- low1 = self._modules['b2_' + str(level)](low1)
250
-
251
- if level > 1:
252
- low2 = self._forward(level - 1, low1)
253
- else:
254
- low2 = low1
255
- low2 = self._modules['b2_plus_' + str(level)](low2)
256
-
257
- low3 = low2
258
- low3 = self._modules['b3_' + str(level)](low3)
259
-
260
- up2 = F.interpolate(low3, scale_factor=2, mode='nearest')
261
-
262
- return up1 + up2
263
-
264
- def forward(self, x, heatmap):
265
- x, last_channel = self.coordconv(x, heatmap)
266
- return self._forward(self.depth, x), last_channel
267
-
268
-
269
- class FAN(nn.Module):
270
-
271
- def __init__(self, num_modules=1, end_relu=False, gray_scale=False, num_landmarks=68, device='cuda'):
272
- super(FAN, self).__init__()
273
- self.device = device
274
- self.num_modules = num_modules
275
- self.gray_scale = gray_scale
276
- self.end_relu = end_relu
277
- self.num_landmarks = num_landmarks
278
-
279
- # Base part
280
- if self.gray_scale:
281
- self.conv1 = CoordConvTh(
282
- x_dim=256,
283
- y_dim=256,
284
- with_r=True,
285
- with_boundary=False,
286
- in_channels=3,
287
- out_channels=64,
288
- kernel_size=7,
289
- stride=2,
290
- padding=3)
291
- else:
292
- self.conv1 = CoordConvTh(
293
- x_dim=256,
294
- y_dim=256,
295
- with_r=True,
296
- with_boundary=False,
297
- in_channels=3,
298
- out_channels=64,
299
- kernel_size=7,
300
- stride=2,
301
- padding=3)
302
- self.bn1 = nn.BatchNorm2d(64)
303
- self.conv2 = ConvBlock(64, 128)
304
- self.conv3 = ConvBlock(128, 128)
305
- self.conv4 = ConvBlock(128, 256)
306
-
307
- # Stacking part
308
- for hg_module in range(self.num_modules):
309
- if hg_module == 0:
310
- first_one = True
311
- else:
312
- first_one = False
313
- self.add_module('m' + str(hg_module), HourGlass(1, 4, 256, first_one))
314
- self.add_module('top_m_' + str(hg_module), ConvBlock(256, 256))
315
- self.add_module('conv_last' + str(hg_module), nn.Conv2d(256, 256, kernel_size=1, stride=1, padding=0))
316
- self.add_module('bn_end' + str(hg_module), nn.BatchNorm2d(256))
317
- self.add_module('l' + str(hg_module), nn.Conv2d(256, num_landmarks + 1, kernel_size=1, stride=1, padding=0))
318
-
319
- if hg_module < self.num_modules - 1:
320
- self.add_module('bl' + str(hg_module), nn.Conv2d(256, 256, kernel_size=1, stride=1, padding=0))
321
- self.add_module('al' + str(hg_module),
322
- nn.Conv2d(num_landmarks + 1, 256, kernel_size=1, stride=1, padding=0))
323
-
324
- def forward(self, x):
325
- x, _ = self.conv1(x)
326
- x = F.relu(self.bn1(x), True)
327
- # x = F.relu(self.bn1(self.conv1(x)), True)
328
- x = F.avg_pool2d(self.conv2(x), 2, stride=2)
329
- x = self.conv3(x)
330
- x = self.conv4(x)
331
-
332
- previous = x
333
-
334
- outputs = []
335
- boundary_channels = []
336
- tmp_out = None
337
- for i in range(self.num_modules):
338
- hg, boundary_channel = self._modules['m' + str(i)](previous, tmp_out)
339
-
340
- ll = hg
341
- ll = self._modules['top_m_' + str(i)](ll)
342
-
343
- ll = F.relu(self._modules['bn_end' + str(i)](self._modules['conv_last' + str(i)](ll)), True)
344
-
345
- # Predict heatmaps
346
- tmp_out = self._modules['l' + str(i)](ll)
347
- if self.end_relu:
348
- tmp_out = F.relu(tmp_out) # HACK: Added relu
349
- outputs.append(tmp_out)
350
- boundary_channels.append(boundary_channel)
351
-
352
- if i < self.num_modules - 1:
353
- ll = self._modules['bl' + str(i)](ll)
354
- tmp_out_ = self._modules['al' + str(i)](tmp_out)
355
- previous = previous + ll + tmp_out_
356
-
357
- return outputs, boundary_channels
358
-
359
- def get_landmarks(self, img):
360
- H, W, _ = img.shape
361
- offset = W / 64, H / 64, 0, 0
362
-
363
- img = cv2.resize(img, (256, 256))
364
- inp = img[..., ::-1]
365
- inp = torch.from_numpy(np.ascontiguousarray(inp.transpose((2, 0, 1)))).float()
366
- inp = inp.to(self.device)
367
- inp.div_(255.0).unsqueeze_(0)
368
-
369
- outputs, _ = self.forward(inp)
370
- out = outputs[-1][:, :-1, :, :]
371
- heatmaps = out.detach().cpu().numpy()
372
-
373
- pred = calculate_points(heatmaps).reshape(-1, 2)
374
-
375
- pred *= offset[:2]
376
- pred += offset[-2:]
377
-
378
- return pred
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
spaces/Androidonnxfork/CivitAi-to-Diffusers/diffusers/examples/reinforcement_learning/README.md DELETED
@@ -1,22 +0,0 @@
1
- # Overview
2
-
3
- These examples show how to run [Diffuser](https://arxiv.org/abs/2205.09991) in Diffusers.
4
- There are two ways to use the script, `run_diffuser_locomotion.py`.
5
-
6
- The key option is a change of the variable `n_guide_steps`.
7
- When `n_guide_steps=0`, the trajectories are sampled from the diffusion model, but not fine-tuned to maximize reward in the environment.
8
- By default, `n_guide_steps=2` to match the original implementation.
9
-
10
-
11
- You will need some RL specific requirements to run the examples:
12
-
13
- ```
14
- pip install -f https://download.pytorch.org/whl/torch_stable.html \
15
- free-mujoco-py \
16
- einops \
17
- gym==0.24.1 \
18
- protobuf==3.20.1 \
19
- git+https://github.com/rail-berkeley/d4rl.git \
20
- mediapy \
21
- Pillow==9.0.0
22
- ```
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
spaces/Andy1621/uniformer_image_detection/configs/legacy_1.x/ssd300_coco_v1.py DELETED
@@ -1,79 +0,0 @@
1
- _base_ = [
2
- '../_base_/models/ssd300.py', '../_base_/datasets/coco_detection.py',
3
- '../_base_/schedules/schedule_2x.py', '../_base_/default_runtime.py'
4
- ]
5
- # model settings
6
- input_size = 300
7
- model = dict(
8
- bbox_head=dict(
9
- type='SSDHead',
10
- anchor_generator=dict(
11
- type='LegacySSDAnchorGenerator',
12
- scale_major=False,
13
- input_size=input_size,
14
- basesize_ratio_range=(0.15, 0.9),
15
- strides=[8, 16, 32, 64, 100, 300],
16
- ratios=[[2], [2, 3], [2, 3], [2, 3], [2], [2]]),
17
- bbox_coder=dict(
18
- type='LegacyDeltaXYWHBBoxCoder',
19
- target_means=[.0, .0, .0, .0],
20
- target_stds=[0.1, 0.1, 0.2, 0.2])))
21
- # dataset settings
22
- dataset_type = 'CocoDataset'
23
- data_root = 'data/coco/'
24
- img_norm_cfg = dict(mean=[123.675, 116.28, 103.53], std=[1, 1, 1], to_rgb=True)
25
- train_pipeline = [
26
- dict(type='LoadImageFromFile', to_float32=True),
27
- dict(type='LoadAnnotations', with_bbox=True),
28
- dict(
29
- type='PhotoMetricDistortion',
30
- brightness_delta=32,
31
- contrast_range=(0.5, 1.5),
32
- saturation_range=(0.5, 1.5),
33
- hue_delta=18),
34
- dict(
35
- type='Expand',
36
- mean=img_norm_cfg['mean'],
37
- to_rgb=img_norm_cfg['to_rgb'],
38
- ratio_range=(1, 4)),
39
- dict(
40
- type='MinIoURandomCrop',
41
- min_ious=(0.1, 0.3, 0.5, 0.7, 0.9),
42
- min_crop_size=0.3),
43
- dict(type='Resize', img_scale=(300, 300), keep_ratio=False),
44
- dict(type='Normalize', **img_norm_cfg),
45
- dict(type='RandomFlip', flip_ratio=0.5),
46
- dict(type='DefaultFormatBundle'),
47
- dict(type='Collect', keys=['img', 'gt_bboxes', 'gt_labels']),
48
- ]
49
- test_pipeline = [
50
- dict(type='LoadImageFromFile'),
51
- dict(
52
- type='MultiScaleFlipAug',
53
- img_scale=(300, 300),
54
- flip=False,
55
- transforms=[
56
- dict(type='Resize', keep_ratio=False),
57
- dict(type='Normalize', **img_norm_cfg),
58
- dict(type='ImageToTensor', keys=['img']),
59
- dict(type='Collect', keys=['img']),
60
- ])
61
- ]
62
- data = dict(
63
- samples_per_gpu=8,
64
- workers_per_gpu=3,
65
- train=dict(
66
- _delete_=True,
67
- type='RepeatDataset',
68
- times=5,
69
- dataset=dict(
70
- type=dataset_type,
71
- ann_file=data_root + 'annotations/instances_train2017.json',
72
- img_prefix=data_root + 'train2017/',
73
- pipeline=train_pipeline)),
74
- val=dict(pipeline=test_pipeline),
75
- test=dict(pipeline=test_pipeline))
76
- # optimizer
77
- optimizer = dict(type='SGD', lr=2e-3, momentum=0.9, weight_decay=5e-4)
78
- optimizer_config = dict(_delete_=True)
79
- dist_params = dict(backend='nccl', port=29555)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
spaces/Andy1621/uniformer_image_segmentation/configs/deeplabv3/deeplabv3_r101-d8_769x769_80k_cityscapes.py DELETED
@@ -1,2 +0,0 @@
1
- _base_ = './deeplabv3_r50-d8_769x769_80k_cityscapes.py'
2
- model = dict(pretrained='open-mmlab://resnet101_v1c', backbone=dict(depth=101))
 
 
 
spaces/Andy1621/uniformer_image_segmentation/configs/deeplabv3plus/deeplabv3plus_r101-d8_512x1024_40k_cityscapes.py DELETED
@@ -1,2 +0,0 @@
1
- _base_ = './deeplabv3plus_r50-d8_512x1024_40k_cityscapes.py'
2
- model = dict(pretrained='open-mmlab://resnet101_v1c', backbone=dict(depth=101))
 
 
 
spaces/Apex-X/GODROOP/README.md DELETED
@@ -1,13 +0,0 @@
1
- ---
2
- title: GODROOP
3
- emoji: 🐢
4
- colorFrom: blue
5
- colorTo: purple
6
- sdk: gradio
7
- sdk_version: 3.42.0
8
- app_file: app.py
9
- pinned: false
10
- license: openrail
11
- ---
12
-
13
- Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
 
 
 
 
 
 
 
 
 
 
 
 
 
 
spaces/Ataturk-Chatbot/HuggingFaceChat/venv/lib/python3.11/site-packages/pip/_internal/network/xmlrpc.py DELETED
@@ -1,60 +0,0 @@
1
- """xmlrpclib.Transport implementation
2
- """
3
-
4
- import logging
5
- import urllib.parse
6
- import xmlrpc.client
7
- from typing import TYPE_CHECKING, Tuple
8
-
9
- from pip._internal.exceptions import NetworkConnectionError
10
- from pip._internal.network.session import PipSession
11
- from pip._internal.network.utils import raise_for_status
12
-
13
- if TYPE_CHECKING:
14
- from xmlrpc.client import _HostType, _Marshallable
15
-
16
- logger = logging.getLogger(__name__)
17
-
18
-
19
- class PipXmlrpcTransport(xmlrpc.client.Transport):
20
- """Provide a `xmlrpclib.Transport` implementation via a `PipSession`
21
- object.
22
- """
23
-
24
- def __init__(
25
- self, index_url: str, session: PipSession, use_datetime: bool = False
26
- ) -> None:
27
- super().__init__(use_datetime)
28
- index_parts = urllib.parse.urlparse(index_url)
29
- self._scheme = index_parts.scheme
30
- self._session = session
31
-
32
- def request(
33
- self,
34
- host: "_HostType",
35
- handler: str,
36
- request_body: bytes,
37
- verbose: bool = False,
38
- ) -> Tuple["_Marshallable", ...]:
39
- assert isinstance(host, str)
40
- parts = (self._scheme, host, handler, None, None, None)
41
- url = urllib.parse.urlunparse(parts)
42
- try:
43
- headers = {"Content-Type": "text/xml"}
44
- response = self._session.post(
45
- url,
46
- data=request_body,
47
- headers=headers,
48
- stream=True,
49
- )
50
- raise_for_status(response)
51
- self.verbose = verbose
52
- return self.parse_response(response.raw)
53
- except NetworkConnectionError as exc:
54
- assert exc.response
55
- logger.critical(
56
- "HTTP error %s while getting %s",
57
- exc.response.status_code,
58
- url,
59
- )
60
- raise
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
spaces/Ataturk-Chatbot/HuggingFaceChat/venv/lib/python3.11/site-packages/pip/_vendor/rich/live_render.py DELETED
@@ -1,113 +0,0 @@
1
- import sys
2
- from typing import Optional, Tuple
3
-
4
- if sys.version_info >= (3, 8):
5
- from typing import Literal
6
- else:
7
- from pip._vendor.typing_extensions import Literal # pragma: no cover
8
-
9
-
10
- from ._loop import loop_last
11
- from .console import Console, ConsoleOptions, RenderableType, RenderResult
12
- from .control import Control
13
- from .segment import ControlType, Segment
14
- from .style import StyleType
15
- from .text import Text
16
-
17
- VerticalOverflowMethod = Literal["crop", "ellipsis", "visible"]
18
-
19
-
20
- class LiveRender:
21
- """Creates a renderable that may be updated.
22
-
23
- Args:
24
- renderable (RenderableType): Any renderable object.
25
- style (StyleType, optional): An optional style to apply to the renderable. Defaults to "".
26
- """
27
-
28
- def __init__(
29
- self,
30
- renderable: RenderableType,
31
- style: StyleType = "",
32
- vertical_overflow: VerticalOverflowMethod = "ellipsis",
33
- ) -> None:
34
- self.renderable = renderable
35
- self.style = style
36
- self.vertical_overflow = vertical_overflow
37
- self._shape: Optional[Tuple[int, int]] = None
38
-
39
- def set_renderable(self, renderable: RenderableType) -> None:
40
- """Set a new renderable.
41
-
42
- Args:
43
- renderable (RenderableType): Any renderable object, including str.
44
- """
45
- self.renderable = renderable
46
-
47
- def position_cursor(self) -> Control:
48
- """Get control codes to move cursor to beginning of live render.
49
-
50
- Returns:
51
- Control: A control instance that may be printed.
52
- """
53
- if self._shape is not None:
54
- _, height = self._shape
55
- return Control(
56
- ControlType.CARRIAGE_RETURN,
57
- (ControlType.ERASE_IN_LINE, 2),
58
- *(
59
- (
60
- (ControlType.CURSOR_UP, 1),
61
- (ControlType.ERASE_IN_LINE, 2),
62
- )
63
- * (height - 1)
64
- )
65
- )
66
- return Control()
67
-
68
- def restore_cursor(self) -> Control:
69
- """Get control codes to clear the render and restore the cursor to its previous position.
70
-
71
- Returns:
72
- Control: A Control instance that may be printed.
73
- """
74
- if self._shape is not None:
75
- _, height = self._shape
76
- return Control(
77
- ControlType.CARRIAGE_RETURN,
78
- *((ControlType.CURSOR_UP, 1), (ControlType.ERASE_IN_LINE, 2)) * height
79
- )
80
- return Control()
81
-
82
- def __rich_console__(
83
- self, console: Console, options: ConsoleOptions
84
- ) -> RenderResult:
85
-
86
- renderable = self.renderable
87
- style = console.get_style(self.style)
88
- lines = console.render_lines(renderable, options, style=style, pad=False)
89
- shape = Segment.get_shape(lines)
90
-
91
- _, height = shape
92
- if height > options.size.height:
93
- if self.vertical_overflow == "crop":
94
- lines = lines[: options.size.height]
95
- shape = Segment.get_shape(lines)
96
- elif self.vertical_overflow == "ellipsis":
97
- lines = lines[: (options.size.height - 1)]
98
- overflow_text = Text(
99
- "...",
100
- overflow="crop",
101
- justify="center",
102
- end="",
103
- style="live.ellipsis",
104
- )
105
- lines.append(list(console.render(overflow_text)))
106
- shape = Segment.get_shape(lines)
107
- self._shape = shape
108
-
109
- new_line = Segment.line()
110
- for last, line in loop_last(lines):
111
- yield from line
112
- if not last:
113
- yield new_line
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
spaces/Ataturk-Chatbot/HuggingFaceChat/venv/lib/python3.11/site-packages/setuptools/_vendor/packaging/_manylinux.py DELETED
@@ -1,301 +0,0 @@
1
- import collections
2
- import functools
3
- import os
4
- import re
5
- import struct
6
- import sys
7
- import warnings
8
- from typing import IO, Dict, Iterator, NamedTuple, Optional, Tuple
9
-
10
-
11
- # Python does not provide platform information at sufficient granularity to
12
- # identify the architecture of the running executable in some cases, so we
13
- # determine it dynamically by reading the information from the running
14
- # process. This only applies on Linux, which uses the ELF format.
15
- class _ELFFileHeader:
16
- # https://en.wikipedia.org/wiki/Executable_and_Linkable_Format#File_header
17
- class _InvalidELFFileHeader(ValueError):
18
- """
19
- An invalid ELF file header was found.
20
- """
21
-
22
- ELF_MAGIC_NUMBER = 0x7F454C46
23
- ELFCLASS32 = 1
24
- ELFCLASS64 = 2
25
- ELFDATA2LSB = 1
26
- ELFDATA2MSB = 2
27
- EM_386 = 3
28
- EM_S390 = 22
29
- EM_ARM = 40
30
- EM_X86_64 = 62
31
- EF_ARM_ABIMASK = 0xFF000000
32
- EF_ARM_ABI_VER5 = 0x05000000
33
- EF_ARM_ABI_FLOAT_HARD = 0x00000400
34
-
35
- def __init__(self, file: IO[bytes]) -> None:
36
- def unpack(fmt: str) -> int:
37
- try:
38
- data = file.read(struct.calcsize(fmt))
39
- result: Tuple[int, ...] = struct.unpack(fmt, data)
40
- except struct.error:
41
- raise _ELFFileHeader._InvalidELFFileHeader()
42
- return result[0]
43
-
44
- self.e_ident_magic = unpack(">I")
45
- if self.e_ident_magic != self.ELF_MAGIC_NUMBER:
46
- raise _ELFFileHeader._InvalidELFFileHeader()
47
- self.e_ident_class = unpack("B")
48
- if self.e_ident_class not in {self.ELFCLASS32, self.ELFCLASS64}:
49
- raise _ELFFileHeader._InvalidELFFileHeader()
50
- self.e_ident_data = unpack("B")
51
- if self.e_ident_data not in {self.ELFDATA2LSB, self.ELFDATA2MSB}:
52
- raise _ELFFileHeader._InvalidELFFileHeader()
53
- self.e_ident_version = unpack("B")
54
- self.e_ident_osabi = unpack("B")
55
- self.e_ident_abiversion = unpack("B")
56
- self.e_ident_pad = file.read(7)
57
- format_h = "<H" if self.e_ident_data == self.ELFDATA2LSB else ">H"
58
- format_i = "<I" if self.e_ident_data == self.ELFDATA2LSB else ">I"
59
- format_q = "<Q" if self.e_ident_data == self.ELFDATA2LSB else ">Q"
60
- format_p = format_i if self.e_ident_class == self.ELFCLASS32 else format_q
61
- self.e_type = unpack(format_h)
62
- self.e_machine = unpack(format_h)
63
- self.e_version = unpack(format_i)
64
- self.e_entry = unpack(format_p)
65
- self.e_phoff = unpack(format_p)
66
- self.e_shoff = unpack(format_p)
67
- self.e_flags = unpack(format_i)
68
- self.e_ehsize = unpack(format_h)
69
- self.e_phentsize = unpack(format_h)
70
- self.e_phnum = unpack(format_h)
71
- self.e_shentsize = unpack(format_h)
72
- self.e_shnum = unpack(format_h)
73
- self.e_shstrndx = unpack(format_h)
74
-
75
-
76
- def _get_elf_header() -> Optional[_ELFFileHeader]:
77
- try:
78
- with open(sys.executable, "rb") as f:
79
- elf_header = _ELFFileHeader(f)
80
- except (OSError, TypeError, _ELFFileHeader._InvalidELFFileHeader):
81
- return None
82
- return elf_header
83
-
84
-
85
- def _is_linux_armhf() -> bool:
86
- # hard-float ABI can be detected from the ELF header of the running
87
- # process
88
- # https://static.docs.arm.com/ihi0044/g/aaelf32.pdf
89
- elf_header = _get_elf_header()
90
- if elf_header is None:
91
- return False
92
- result = elf_header.e_ident_class == elf_header.ELFCLASS32
93
- result &= elf_header.e_ident_data == elf_header.ELFDATA2LSB
94
- result &= elf_header.e_machine == elf_header.EM_ARM
95
- result &= (
96
- elf_header.e_flags & elf_header.EF_ARM_ABIMASK
97
- ) == elf_header.EF_ARM_ABI_VER5
98
- result &= (
99
- elf_header.e_flags & elf_header.EF_ARM_ABI_FLOAT_HARD
100
- ) == elf_header.EF_ARM_ABI_FLOAT_HARD
101
- return result
102
-
103
-
104
- def _is_linux_i686() -> bool:
105
- elf_header = _get_elf_header()
106
- if elf_header is None:
107
- return False
108
- result = elf_header.e_ident_class == elf_header.ELFCLASS32
109
- result &= elf_header.e_ident_data == elf_header.ELFDATA2LSB
110
- result &= elf_header.e_machine == elf_header.EM_386
111
- return result
112
-
113
-
114
- def _have_compatible_abi(arch: str) -> bool:
115
- if arch == "armv7l":
116
- return _is_linux_armhf()
117
- if arch == "i686":
118
- return _is_linux_i686()
119
- return arch in {"x86_64", "aarch64", "ppc64", "ppc64le", "s390x"}
120
-
121
-
122
- # If glibc ever changes its major version, we need to know what the last
123
- # minor version was, so we can build the complete list of all versions.
124
- # For now, guess what the highest minor version might be, assume it will
125
- # be 50 for testing. Once this actually happens, update the dictionary
126
- # with the actual value.
127
- _LAST_GLIBC_MINOR: Dict[int, int] = collections.defaultdict(lambda: 50)
128
-
129
-
130
- class _GLibCVersion(NamedTuple):
131
- major: int
132
- minor: int
133
-
134
-
135
- def _glibc_version_string_confstr() -> Optional[str]:
136
- """
137
- Primary implementation of glibc_version_string using os.confstr.
138
- """
139
- # os.confstr is quite a bit faster than ctypes.DLL. It's also less likely
140
- # to be broken or missing. This strategy is used in the standard library
141
- # platform module.
142
- # https://github.com/python/cpython/blob/fcf1d003bf4f0100c/Lib/platform.py#L175-L183
143
- try:
144
- # os.confstr("CS_GNU_LIBC_VERSION") returns a string like "glibc 2.17".
145
- version_string = os.confstr("CS_GNU_LIBC_VERSION")
146
- assert version_string is not None
147
- _, version = version_string.split()
148
- except (AssertionError, AttributeError, OSError, ValueError):
149
- # os.confstr() or CS_GNU_LIBC_VERSION not available (or a bad value)...
150
- return None
151
- return version
152
-
153
-
154
- def _glibc_version_string_ctypes() -> Optional[str]:
155
- """
156
- Fallback implementation of glibc_version_string using ctypes.
157
- """
158
- try:
159
- import ctypes
160
- except ImportError:
161
- return None
162
-
163
- # ctypes.CDLL(None) internally calls dlopen(NULL), and as the dlopen
164
- # manpage says, "If filename is NULL, then the returned handle is for the
165
- # main program". This way we can let the linker do the work to figure out
166
- # which libc our process is actually using.
167
- #
168
- # We must also handle the special case where the executable is not a
169
- # dynamically linked executable. This can occur when using musl libc,
170
- # for example. In this situation, dlopen() will error, leading to an
171
- # OSError. Interestingly, at least in the case of musl, there is no
172
- # errno set on the OSError. The single string argument used to construct
173
- # OSError comes from libc itself and is therefore not portable to
174
- # hard code here. In any case, failure to call dlopen() means we
175
- # can proceed, so we bail on our attempt.
176
- try:
177
- process_namespace = ctypes.CDLL(None)
178
- except OSError:
179
- return None
180
-
181
- try:
182
- gnu_get_libc_version = process_namespace.gnu_get_libc_version
183
- except AttributeError:
184
- # Symbol doesn't exist -> therefore, we are not linked to
185
- # glibc.
186
- return None
187
-
188
- # Call gnu_get_libc_version, which returns a string like "2.5"
189
- gnu_get_libc_version.restype = ctypes.c_char_p
190
- version_str: str = gnu_get_libc_version()
191
- # py2 / py3 compatibility:
192
- if not isinstance(version_str, str):
193
- version_str = version_str.decode("ascii")
194
-
195
- return version_str
196
-
197
-
198
- def _glibc_version_string() -> Optional[str]:
199
- """Returns glibc version string, or None if not using glibc."""
200
- return _glibc_version_string_confstr() or _glibc_version_string_ctypes()
201
-
202
-
203
- def _parse_glibc_version(version_str: str) -> Tuple[int, int]:
204
- """Parse glibc version.
205
-
206
- We use a regexp instead of str.split because we want to discard any
207
- random junk that might come after the minor version -- this might happen
208
- in patched/forked versions of glibc (e.g. Linaro's version of glibc
209
- uses version strings like "2.20-2014.11"). See gh-3588.
210
- """
211
- m = re.match(r"(?P<major>[0-9]+)\.(?P<minor>[0-9]+)", version_str)
212
- if not m:
213
- warnings.warn(
214
- "Expected glibc version with 2 components major.minor,"
215
- " got: %s" % version_str,
216
- RuntimeWarning,
217
- )
218
- return -1, -1
219
- return int(m.group("major")), int(m.group("minor"))
220
-
221
-
222
- @functools.lru_cache()
223
- def _get_glibc_version() -> Tuple[int, int]:
224
- version_str = _glibc_version_string()
225
- if version_str is None:
226
- return (-1, -1)
227
- return _parse_glibc_version(version_str)
228
-
229
-
230
- # From PEP 513, PEP 600
231
- def _is_compatible(name: str, arch: str, version: _GLibCVersion) -> bool:
232
- sys_glibc = _get_glibc_version()
233
- if sys_glibc < version:
234
- return False
235
- # Check for presence of _manylinux module.
236
- try:
237
- import _manylinux # noqa
238
- except ImportError:
239
- return True
240
- if hasattr(_manylinux, "manylinux_compatible"):
241
- result = _manylinux.manylinux_compatible(version[0], version[1], arch)
242
- if result is not None:
243
- return bool(result)
244
- return True
245
- if version == _GLibCVersion(2, 5):
246
- if hasattr(_manylinux, "manylinux1_compatible"):
247
- return bool(_manylinux.manylinux1_compatible)
248
- if version == _GLibCVersion(2, 12):
249
- if hasattr(_manylinux, "manylinux2010_compatible"):
250
- return bool(_manylinux.manylinux2010_compatible)
251
- if version == _GLibCVersion(2, 17):
252
- if hasattr(_manylinux, "manylinux2014_compatible"):
253
- return bool(_manylinux.manylinux2014_compatible)
254
- return True
255
-
256
-
257
- _LEGACY_MANYLINUX_MAP = {
258
- # CentOS 7 w/ glibc 2.17 (PEP 599)
259
- (2, 17): "manylinux2014",
260
- # CentOS 6 w/ glibc 2.12 (PEP 571)
261
- (2, 12): "manylinux2010",
262
- # CentOS 5 w/ glibc 2.5 (PEP 513)
263
- (2, 5): "manylinux1",
264
- }
265
-
266
-
267
- def platform_tags(linux: str, arch: str) -> Iterator[str]:
268
- if not _have_compatible_abi(arch):
269
- return
270
- # Oldest glibc to be supported regardless of architecture is (2, 17).
271
- too_old_glibc2 = _GLibCVersion(2, 16)
272
- if arch in {"x86_64", "i686"}:
273
- # On x86/i686 also oldest glibc to be supported is (2, 5).
274
- too_old_glibc2 = _GLibCVersion(2, 4)
275
- current_glibc = _GLibCVersion(*_get_glibc_version())
276
- glibc_max_list = [current_glibc]
277
- # We can assume compatibility across glibc major versions.
278
- # https://sourceware.org/bugzilla/show_bug.cgi?id=24636
279
- #
280
- # Build a list of maximum glibc versions so that we can
281
- # output the canonical list of all glibc from current_glibc
282
- # down to too_old_glibc2, including all intermediary versions.
283
- for glibc_major in range(current_glibc.major - 1, 1, -1):
284
- glibc_minor = _LAST_GLIBC_MINOR[glibc_major]
285
- glibc_max_list.append(_GLibCVersion(glibc_major, glibc_minor))
286
- for glibc_max in glibc_max_list:
287
- if glibc_max.major == too_old_glibc2.major:
288
- min_minor = too_old_glibc2.minor
289
- else:
290
- # For other glibc major versions oldest supported is (x, 0).
291
- min_minor = -1
292
- for glibc_minor in range(glibc_max.minor, min_minor, -1):
293
- glibc_version = _GLibCVersion(glibc_max.major, glibc_minor)
294
- tag = "manylinux_{}_{}".format(*glibc_version)
295
- if _is_compatible(tag, arch, glibc_version):
296
- yield linux.replace("linux", tag)
297
- # Handle the legacy manylinux1, manylinux2010, manylinux2014 tags.
298
- if glibc_version in _LEGACY_MANYLINUX_MAP:
299
- legacy_tag = _LEGACY_MANYLINUX_MAP[glibc_version]
300
- if _is_compatible(legacy_tag, arch, glibc_version):
301
- yield linux.replace("linux", legacy_tag)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
spaces/Banbri/zcvzcv/src/app/main.tsx DELETED
@@ -1,155 +0,0 @@
1
- "use client"
2
-
3
- import { useEffect, useState, useTransition } from "react"
4
-
5
- import { cn } from "@/lib/utils"
6
- import { TopMenu } from "./interface/top-menu"
7
- import { fonts } from "@/lib/fonts"
8
- import { useStore } from "./store"
9
- import { Zoom } from "./interface/zoom"
10
- import { getStory } from "./queries/getStory"
11
- import { BottomBar } from "./interface/bottom-bar"
12
- import { Page } from "./interface/page"
13
- import { LLMResponse } from "@/types"
14
-
15
- export default function Main() {
16
- const [_isPending, startTransition] = useTransition()
17
-
18
- const isGeneratingStory = useStore(state => state.isGeneratingStory)
19
- const setGeneratingStory = useStore(state => state.setGeneratingStory)
20
-
21
- const font = useStore(state => state.font)
22
- const preset = useStore(state => state.preset)
23
- const prompt = useStore(state => state.prompt)
24
-
25
- const setLayouts = useStore(state => state.setLayouts)
26
-
27
- const setPanels = useStore(state => state.setPanels)
28
- const setCaptions = useStore(state => state.setCaptions)
29
-
30
- const zoomLevel = useStore(state => state.zoomLevel)
31
-
32
- const [waitABitMore, setWaitABitMore] = useState(false)
33
-
34
- // react to prompt changes
35
- useEffect(() => {
36
- if (!prompt) { return }
37
-
38
- startTransition(async () => {
39
- setWaitABitMore(false)
40
- setGeneratingStory(true)
41
-
42
- // I don't think we are going to need a rate limiter on the LLM part anymore
43
- const enableRateLimiter = false // `${process.env.NEXT_PUBLIC_ENABLE_RATE_LIMITER}` === "true"
44
-
45
- const nbPanels = 4
46
-
47
- let llmResponse: LLMResponse = []
48
-
49
- try {
50
- llmResponse = await getStory({ preset, prompt })
51
- console.log("LLM responded:", llmResponse)
52
-
53
- } catch (err) {
54
- console.log("LLM step failed due to:", err)
55
- console.log("we are now switching to a degraded mode, using 4 similar panels")
56
-
57
- llmResponse = []
58
- for (let p = 0; p < nbPanels; p++) {
59
- llmResponse.push({
60
- panel: p,
61
- instructions: `${prompt} ${".".repeat(p)}`,
62
- caption: "(Sorry, LLM generation failed: using degraded mode)"
63
- })
64
- }
65
- console.error(err)
66
- }
67
-
68
- // we have to limit the size of the prompt, otherwise the rest of the style won't be followed
69
-
70
- let limitedPrompt = prompt.slice(0, 77)
71
- if (limitedPrompt.length !== prompt.length) {
72
- console.log("Sorry folks, the prompt was cut to:", limitedPrompt)
73
- }
74
-
75
- const panelPromptPrefix = preset.imagePrompt(limitedPrompt).join(", ")
76
-
77
- const newPanels: string[] = []
78
- const newCaptions: string[] = []
79
- setWaitABitMore(true)
80
- console.log("Panel prompts for SDXL:")
81
- for (let p = 0; p < nbPanels; p++) {
82
- newCaptions.push(llmResponse[p]?.caption || "...")
83
- const newPanel = [panelPromptPrefix, llmResponse[p]?.instructions || ""].map(chunk => chunk).join(", ")
84
- newPanels.push(newPanel)
85
- console.log(newPanel)
86
- }
87
-
88
- setCaptions(newCaptions)
89
- setPanels(newPanels)
90
-
91
- setTimeout(() => {
92
- setGeneratingStory(false)
93
- setWaitABitMore(false)
94
- }, enableRateLimiter ? 12000 : 0)
95
-
96
- })
97
- }, [prompt, preset?.label]) // important: we need to react to preset changes too
98
-
99
- return (
100
- <div>
101
- <TopMenu />
102
- <div className={cn(
103
- `flex items-start w-screen h-screen pt-24 md:pt-[72px] overflow-y-scroll`,
104
- `transition-all duration-200 ease-in-out`,
105
- zoomLevel > 105 ? `px-0` : `pl-1 pr-8 md:pl-16 md:pr-16`,
106
- `print:pt-0 print:px-0 print:pl-0 print:pr-0`,
107
- fonts.actionman.className
108
- )}>
109
- <div
110
- className={cn(
111
- `flex flex-col w-full`,
112
- zoomLevel > 105 ? `items-start` : `items-center`
113
- )}>
114
- <div
115
- className={cn(
116
- `comic-page`,
117
- `flex flex-col md:flex-row md:space-x-16 md:items-center md:justify-start`,
118
- )}
119
- style={{
120
- width: `${zoomLevel}%`
121
- }}>
122
- <Page page={0} />
123
-
124
- {/*
125
- // we could support multiple pages here,
126
- // but let's disable it for now
127
- <Page page={1} />
128
- */}
129
- </div>
130
- </div>
131
- </div>
132
- <Zoom />
133
- <BottomBar />
134
- <div className={cn(
135
- `print:hidden`,
136
- `z-20 fixed inset-0`,
137
- `flex flex-row items-center justify-center`,
138
- `transition-all duration-300 ease-in-out`,
139
- isGeneratingStory
140
- ? `bg-zinc-100/10 backdrop-blur-md`
141
- : `bg-zinc-100/0 backdrop-blur-none pointer-events-none`,
142
- fonts.actionman.className
143
- )}>
144
- <div className={cn(
145
- `text-center text-xl text-stone-700 w-[70%]`,
146
- isGeneratingStory ? ``: `scale-0 opacity-0`,
147
- `transition-all duration-300 ease-in-out`,
148
- )}>
149
- {waitABitMore ? `Story is ready, but server is a bit busy!`: 'Generating a new story..'}<br/>
150
- {waitABitMore ? `Please hold tight..` : ''}
151
- </div>
152
- </div>
153
- </div>
154
- )
155
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
spaces/Bart92/RVC_HF/infer/lib/infer_pack/modules.py DELETED
@@ -1,521 +0,0 @@
1
- import copy
2
- import math
3
-
4
- import numpy as np
5
- import scipy
6
- import torch
7
- from torch import nn
8
- from torch.nn import AvgPool1d, Conv1d, Conv2d, ConvTranspose1d
9
- from torch.nn import functional as F
10
- from torch.nn.utils import remove_weight_norm, weight_norm
11
-
12
- from infer.lib.infer_pack import commons
13
- from infer.lib.infer_pack.commons import get_padding, init_weights
14
- from infer.lib.infer_pack.transforms import piecewise_rational_quadratic_transform
15
-
16
- LRELU_SLOPE = 0.1
17
-
18
-
19
- class LayerNorm(nn.Module):
20
- def __init__(self, channels, eps=1e-5):
21
- super().__init__()
22
- self.channels = channels
23
- self.eps = eps
24
-
25
- self.gamma = nn.Parameter(torch.ones(channels))
26
- self.beta = nn.Parameter(torch.zeros(channels))
27
-
28
- def forward(self, x):
29
- x = x.transpose(1, -1)
30
- x = F.layer_norm(x, (self.channels,), self.gamma, self.beta, self.eps)
31
- return x.transpose(1, -1)
32
-
33
-
34
- class ConvReluNorm(nn.Module):
35
- def __init__(
36
- self,
37
- in_channels,
38
- hidden_channels,
39
- out_channels,
40
- kernel_size,
41
- n_layers,
42
- p_dropout,
43
- ):
44
- super().__init__()
45
- self.in_channels = in_channels
46
- self.hidden_channels = hidden_channels
47
- self.out_channels = out_channels
48
- self.kernel_size = kernel_size
49
- self.n_layers = n_layers
50
- self.p_dropout = p_dropout
51
- assert n_layers > 1, "Number of layers should be larger than 0."
52
-
53
- self.conv_layers = nn.ModuleList()
54
- self.norm_layers = nn.ModuleList()
55
- self.conv_layers.append(
56
- nn.Conv1d(
57
- in_channels, hidden_channels, kernel_size, padding=kernel_size // 2
58
- )
59
- )
60
- self.norm_layers.append(LayerNorm(hidden_channels))
61
- self.relu_drop = nn.Sequential(nn.ReLU(), nn.Dropout(p_dropout))
62
- for _ in range(n_layers - 1):
63
- self.conv_layers.append(
64
- nn.Conv1d(
65
- hidden_channels,
66
- hidden_channels,
67
- kernel_size,
68
- padding=kernel_size // 2,
69
- )
70
- )
71
- self.norm_layers.append(LayerNorm(hidden_channels))
72
- self.proj = nn.Conv1d(hidden_channels, out_channels, 1)
73
- self.proj.weight.data.zero_()
74
- self.proj.bias.data.zero_()
75
-
76
- def forward(self, x, x_mask):
77
- x_org = x
78
- for i in range(self.n_layers):
79
- x = self.conv_layers[i](x * x_mask)
80
- x = self.norm_layers[i](x)
81
- x = self.relu_drop(x)
82
- x = x_org + self.proj(x)
83
- return x * x_mask
84
-
85
-
86
- class DDSConv(nn.Module):
87
- """
88
- Dialted and Depth-Separable Convolution
89
- """
90
-
91
- def __init__(self, channels, kernel_size, n_layers, p_dropout=0.0):
92
- super().__init__()
93
- self.channels = channels
94
- self.kernel_size = kernel_size
95
- self.n_layers = n_layers
96
- self.p_dropout = p_dropout
97
-
98
- self.drop = nn.Dropout(p_dropout)
99
- self.convs_sep = nn.ModuleList()
100
- self.convs_1x1 = nn.ModuleList()
101
- self.norms_1 = nn.ModuleList()
102
- self.norms_2 = nn.ModuleList()
103
- for i in range(n_layers):
104
- dilation = kernel_size**i
105
- padding = (kernel_size * dilation - dilation) // 2
106
- self.convs_sep.append(
107
- nn.Conv1d(
108
- channels,
109
- channels,
110
- kernel_size,
111
- groups=channels,
112
- dilation=dilation,
113
- padding=padding,
114
- )
115
- )
116
- self.convs_1x1.append(nn.Conv1d(channels, channels, 1))
117
- self.norms_1.append(LayerNorm(channels))
118
- self.norms_2.append(LayerNorm(channels))
119
-
120
- def forward(self, x, x_mask, g=None):
121
- if g is not None:
122
- x = x + g
123
- for i in range(self.n_layers):
124
- y = self.convs_sep[i](x * x_mask)
125
- y = self.norms_1[i](y)
126
- y = F.gelu(y)
127
- y = self.convs_1x1[i](y)
128
- y = self.norms_2[i](y)
129
- y = F.gelu(y)
130
- y = self.drop(y)
131
- x = x + y
132
- return x * x_mask
133
-
134
-
135
- class WN(torch.nn.Module):
136
- def __init__(
137
- self,
138
- hidden_channels,
139
- kernel_size,
140
- dilation_rate,
141
- n_layers,
142
- gin_channels=0,
143
- p_dropout=0,
144
- ):
145
- super(WN, self).__init__()
146
- assert kernel_size % 2 == 1
147
- self.hidden_channels = hidden_channels
148
- self.kernel_size = (kernel_size,)
149
- self.dilation_rate = dilation_rate
150
- self.n_layers = n_layers
151
- self.gin_channels = gin_channels
152
- self.p_dropout = p_dropout
153
-
154
- self.in_layers = torch.nn.ModuleList()
155
- self.res_skip_layers = torch.nn.ModuleList()
156
- self.drop = nn.Dropout(p_dropout)
157
-
158
- if gin_channels != 0:
159
- cond_layer = torch.nn.Conv1d(
160
- gin_channels, 2 * hidden_channels * n_layers, 1
161
- )
162
- self.cond_layer = torch.nn.utils.weight_norm(cond_layer, name="weight")
163
-
164
- for i in range(n_layers):
165
- dilation = dilation_rate**i
166
- padding = int((kernel_size * dilation - dilation) / 2)
167
- in_layer = torch.nn.Conv1d(
168
- hidden_channels,
169
- 2 * hidden_channels,
170
- kernel_size,
171
- dilation=dilation,
172
- padding=padding,
173
- )
174
- in_layer = torch.nn.utils.weight_norm(in_layer, name="weight")
175
- self.in_layers.append(in_layer)
176
-
177
- # last one is not necessary
178
- if i < n_layers - 1:
179
- res_skip_channels = 2 * hidden_channels
180
- else:
181
- res_skip_channels = hidden_channels
182
-
183
- res_skip_layer = torch.nn.Conv1d(hidden_channels, res_skip_channels, 1)
184
- res_skip_layer = torch.nn.utils.weight_norm(res_skip_layer, name="weight")
185
- self.res_skip_layers.append(res_skip_layer)
186
-
187
- def forward(self, x, x_mask, g=None, **kwargs):
188
- output = torch.zeros_like(x)
189
- n_channels_tensor = torch.IntTensor([self.hidden_channels])
190
-
191
- if g is not None:
192
- g = self.cond_layer(g)
193
-
194
- for i in range(self.n_layers):
195
- x_in = self.in_layers[i](x)
196
- if g is not None:
197
- cond_offset = i * 2 * self.hidden_channels
198
- g_l = g[:, cond_offset : cond_offset + 2 * self.hidden_channels, :]
199
- else:
200
- g_l = torch.zeros_like(x_in)
201
-
202
- acts = commons.fused_add_tanh_sigmoid_multiply(x_in, g_l, n_channels_tensor)
203
- acts = self.drop(acts)
204
-
205
- res_skip_acts = self.res_skip_layers[i](acts)
206
- if i < self.n_layers - 1:
207
- res_acts = res_skip_acts[:, : self.hidden_channels, :]
208
- x = (x + res_acts) * x_mask
209
- output = output + res_skip_acts[:, self.hidden_channels :, :]
210
- else:
211
- output = output + res_skip_acts
212
- return output * x_mask
213
-
214
- def remove_weight_norm(self):
215
- if self.gin_channels != 0:
216
- torch.nn.utils.remove_weight_norm(self.cond_layer)
217
- for l in self.in_layers:
218
- torch.nn.utils.remove_weight_norm(l)
219
- for l in self.res_skip_layers:
220
- torch.nn.utils.remove_weight_norm(l)
221
-
222
-
223
- class ResBlock1(torch.nn.Module):
224
- def __init__(self, channels, kernel_size=3, dilation=(1, 3, 5)):
225
- super(ResBlock1, self).__init__()
226
- self.convs1 = nn.ModuleList(
227
- [
228
- weight_norm(
229
- Conv1d(
230
- channels,
231
- channels,
232
- kernel_size,
233
- 1,
234
- dilation=dilation[0],
235
- padding=get_padding(kernel_size, dilation[0]),
236
- )
237
- ),
238
- weight_norm(
239
- Conv1d(
240
- channels,
241
- channels,
242
- kernel_size,
243
- 1,
244
- dilation=dilation[1],
245
- padding=get_padding(kernel_size, dilation[1]),
246
- )
247
- ),
248
- weight_norm(
249
- Conv1d(
250
- channels,
251
- channels,
252
- kernel_size,
253
- 1,
254
- dilation=dilation[2],
255
- padding=get_padding(kernel_size, dilation[2]),
256
- )
257
- ),
258
- ]
259
- )
260
- self.convs1.apply(init_weights)
261
-
262
- self.convs2 = nn.ModuleList(
263
- [
264
- weight_norm(
265
- Conv1d(
266
- channels,
267
- channels,
268
- kernel_size,
269
- 1,
270
- dilation=1,
271
- padding=get_padding(kernel_size, 1),
272
- )
273
- ),
274
- weight_norm(
275
- Conv1d(
276
- channels,
277
- channels,
278
- kernel_size,
279
- 1,
280
- dilation=1,
281
- padding=get_padding(kernel_size, 1),
282
- )
283
- ),
284
- weight_norm(
285
- Conv1d(
286
- channels,
287
- channels,
288
- kernel_size,
289
- 1,
290
- dilation=1,
291
- padding=get_padding(kernel_size, 1),
292
- )
293
- ),
294
- ]
295
- )
296
- self.convs2.apply(init_weights)
297
-
298
- def forward(self, x, x_mask=None):
299
- for c1, c2 in zip(self.convs1, self.convs2):
300
- xt = F.leaky_relu(x, LRELU_SLOPE)
301
- if x_mask is not None:
302
- xt = xt * x_mask
303
- xt = c1(xt)
304
- xt = F.leaky_relu(xt, LRELU_SLOPE)
305
- if x_mask is not None:
306
- xt = xt * x_mask
307
- xt = c2(xt)
308
- x = xt + x
309
- if x_mask is not None:
310
- x = x * x_mask
311
- return x
312
-
313
- def remove_weight_norm(self):
314
- for l in self.convs1:
315
- remove_weight_norm(l)
316
- for l in self.convs2:
317
- remove_weight_norm(l)
318
-
319
-
320
- class ResBlock2(torch.nn.Module):
321
- def __init__(self, channels, kernel_size=3, dilation=(1, 3)):
322
- super(ResBlock2, self).__init__()
323
- self.convs = nn.ModuleList(
324
- [
325
- weight_norm(
326
- Conv1d(
327
- channels,
328
- channels,
329
- kernel_size,
330
- 1,
331
- dilation=dilation[0],
332
- padding=get_padding(kernel_size, dilation[0]),
333
- )
334
- ),
335
- weight_norm(
336
- Conv1d(
337
- channels,
338
- channels,
339
- kernel_size,
340
- 1,
341
- dilation=dilation[1],
342
- padding=get_padding(kernel_size, dilation[1]),
343
- )
344
- ),
345
- ]
346
- )
347
- self.convs.apply(init_weights)
348
-
349
- def forward(self, x, x_mask=None):
350
- for c in self.convs:
351
- xt = F.leaky_relu(x, LRELU_SLOPE)
352
- if x_mask is not None:
353
- xt = xt * x_mask
354
- xt = c(xt)
355
- x = xt + x
356
- if x_mask is not None:
357
- x = x * x_mask
358
- return x
359
-
360
- def remove_weight_norm(self):
361
- for l in self.convs:
362
- remove_weight_norm(l)
363
-
364
-
365
- class Log(nn.Module):
366
- def forward(self, x, x_mask, reverse=False, **kwargs):
367
- if not reverse:
368
- y = torch.log(torch.clamp_min(x, 1e-5)) * x_mask
369
- logdet = torch.sum(-y, [1, 2])
370
- return y, logdet
371
- else:
372
- x = torch.exp(x) * x_mask
373
- return x
374
-
375
-
376
- class Flip(nn.Module):
377
- def forward(self, x, *args, reverse=False, **kwargs):
378
- x = torch.flip(x, [1])
379
- if not reverse:
380
- logdet = torch.zeros(x.size(0)).to(dtype=x.dtype, device=x.device)
381
- return x, logdet
382
- else:
383
- return x
384
-
385
-
386
- class ElementwiseAffine(nn.Module):
387
- def __init__(self, channels):
388
- super().__init__()
389
- self.channels = channels
390
- self.m = nn.Parameter(torch.zeros(channels, 1))
391
- self.logs = nn.Parameter(torch.zeros(channels, 1))
392
-
393
- def forward(self, x, x_mask, reverse=False, **kwargs):
394
- if not reverse:
395
- y = self.m + torch.exp(self.logs) * x
396
- y = y * x_mask
397
- logdet = torch.sum(self.logs * x_mask, [1, 2])
398
- return y, logdet
399
- else:
400
- x = (x - self.m) * torch.exp(-self.logs) * x_mask
401
- return x
402
-
403
-
404
- class ResidualCouplingLayer(nn.Module):
405
- def __init__(
406
- self,
407
- channels,
408
- hidden_channels,
409
- kernel_size,
410
- dilation_rate,
411
- n_layers,
412
- p_dropout=0,
413
- gin_channels=0,
414
- mean_only=False,
415
- ):
416
- assert channels % 2 == 0, "channels should be divisible by 2"
417
- super().__init__()
418
- self.channels = channels
419
- self.hidden_channels = hidden_channels
420
- self.kernel_size = kernel_size
421
- self.dilation_rate = dilation_rate
422
- self.n_layers = n_layers
423
- self.half_channels = channels // 2
424
- self.mean_only = mean_only
425
-
426
- self.pre = nn.Conv1d(self.half_channels, hidden_channels, 1)
427
- self.enc = WN(
428
- hidden_channels,
429
- kernel_size,
430
- dilation_rate,
431
- n_layers,
432
- p_dropout=p_dropout,
433
- gin_channels=gin_channels,
434
- )
435
- self.post = nn.Conv1d(hidden_channels, self.half_channels * (2 - mean_only), 1)
436
- self.post.weight.data.zero_()
437
- self.post.bias.data.zero_()
438
-
439
- def forward(self, x, x_mask, g=None, reverse=False):
440
- x0, x1 = torch.split(x, [self.half_channels] * 2, 1)
441
- h = self.pre(x0) * x_mask
442
- h = self.enc(h, x_mask, g=g)
443
- stats = self.post(h) * x_mask
444
- if not self.mean_only:
445
- m, logs = torch.split(stats, [self.half_channels] * 2, 1)
446
- else:
447
- m = stats
448
- logs = torch.zeros_like(m)
449
-
450
- if not reverse:
451
- x1 = m + x1 * torch.exp(logs) * x_mask
452
- x = torch.cat([x0, x1], 1)
453
- logdet = torch.sum(logs, [1, 2])
454
- return x, logdet
455
- else:
456
- x1 = (x1 - m) * torch.exp(-logs) * x_mask
457
- x = torch.cat([x0, x1], 1)
458
- return x
459
-
460
- def remove_weight_norm(self):
461
- self.enc.remove_weight_norm()
462
-
463
-
464
- class ConvFlow(nn.Module):
465
- def __init__(
466
- self,
467
- in_channels,
468
- filter_channels,
469
- kernel_size,
470
- n_layers,
471
- num_bins=10,
472
- tail_bound=5.0,
473
- ):
474
- super().__init__()
475
- self.in_channels = in_channels
476
- self.filter_channels = filter_channels
477
- self.kernel_size = kernel_size
478
- self.n_layers = n_layers
479
- self.num_bins = num_bins
480
- self.tail_bound = tail_bound
481
- self.half_channels = in_channels // 2
482
-
483
- self.pre = nn.Conv1d(self.half_channels, filter_channels, 1)
484
- self.convs = DDSConv(filter_channels, kernel_size, n_layers, p_dropout=0.0)
485
- self.proj = nn.Conv1d(
486
- filter_channels, self.half_channels * (num_bins * 3 - 1), 1
487
- )
488
- self.proj.weight.data.zero_()
489
- self.proj.bias.data.zero_()
490
-
491
- def forward(self, x, x_mask, g=None, reverse=False):
492
- x0, x1 = torch.split(x, [self.half_channels] * 2, 1)
493
- h = self.pre(x0)
494
- h = self.convs(h, x_mask, g=g)
495
- h = self.proj(h) * x_mask
496
-
497
- b, c, t = x0.shape
498
- h = h.reshape(b, c, -1, t).permute(0, 1, 3, 2) # [b, cx?, t] -> [b, c, t, ?]
499
-
500
- unnormalized_widths = h[..., : self.num_bins] / math.sqrt(self.filter_channels)
501
- unnormalized_heights = h[..., self.num_bins : 2 * self.num_bins] / math.sqrt(
502
- self.filter_channels
503
- )
504
- unnormalized_derivatives = h[..., 2 * self.num_bins :]
505
-
506
- x1, logabsdet = piecewise_rational_quadratic_transform(
507
- x1,
508
- unnormalized_widths,
509
- unnormalized_heights,
510
- unnormalized_derivatives,
511
- inverse=reverse,
512
- tails="linear",
513
- tail_bound=self.tail_bound,
514
- )
515
-
516
- x = torch.cat([x0, x1], 1) * x_mask
517
- logdet = torch.sum(logabsdet * x_mask, [1, 2])
518
- if not reverse:
519
- return x, logdet
520
- else:
521
- return x
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
spaces/Benson/text-generation/Examples/Descargar Clicker Hroes Mod Apk.md DELETED
@@ -1,70 +0,0 @@
1
- <br />
2
- <h1>Descargar Clicker Heroes Mod APK: Una guía para principiantes</h1>
3
- <p>Si usted está buscando un divertido y adictivo juego de ocio que le mantendrá entretenido durante horas, es posible que desee probar Clicker Heroes. Este juego es uno de los juegos de clickers más populares del mercado, con millones de descargas y críticas positivas. Pero lo que si quieres disfrutar del juego sin limitaciones o restricciones? Ahí es donde Clicker Heroes mod apk entra en juego. En este artículo, le diremos todo lo que necesita saber sobre Clicker Heroes, por qué debe descargar su apk mod, y cómo hacerlo de forma segura y fácil. </p>
4
- <h2>descargar clicker héroes mod apk</h2><br /><p><b><b>Download File</b> >>> <a href="https://bltlly.com/2v6JzL">https://bltlly.com/2v6JzL</a></b></p><br /><br />
5
- <h2>¿Qué es Clicker Heroes? </h2>
6
- <p>Clicker Heroes es un juego desarrollado por Playsaurus, un estudio especializado en juegos casuales y ociosos. El juego fue lanzado en 2014 para navegadores, y posteriormente portado a dispositivos móviles y consolas. El juego ha recibido varias actualizaciones y expansiones a lo largo de los años, añadiendo nuevas características y contenido. </p>
7
- <h3>El juego de Clicker Heroes</h3>
8
- <p>La jugabilidad de Clicker Heroes es simple y directa. Empiezas tocando la pantalla para matar monstruos y ganar oro. Puedes usar el oro para contratar y actualizar héroes, que te ayudarán a luchar contra más monstruos y jefes. También puedes desbloquear habilidades y habilidades que aumentarán tu daño y velocidad. El juego no tiene fin, ya que siempre puedes avanzar a niveles y mundos más altos, donde te enfrentarás a enemigos y desafíos más fuertes. </p>
9
- <h3>Las características de Clicker Heroes</h3>
10
- <p>Algunas de las características que hacen que Clicker Heroes se destaque de otros juegos de clicker son:</p>
11
- <p></p>
12
- <ul>
13
- <li>Más de 1000 héroes para recoger y actualizar, cada uno con sus propias habilidades y habilidades únicas. </li>
14
- <li>Más de 10.000 niveles para explorar, cada uno con diferentes temas y entornos. </li>
15
- <li>Una variedad de modos de juego, como incursiones, clanes, torneos, eventos, misiones, logros y más. </li>
16
- <li>Un estilo gráfico vibrante y colorido, con animaciones y efectos suaves. </li>
17
-
18
- <li>Una comunidad amigable y activa, con foros, wikis, guías, consejos, trucos y más. </li>
19
- </ul>
20
- <h2>¿Por qué descargar Clicker Heroes mod apk? </h2>
21
- <p>Aunque Clicker Heroes es un juego gratuito, también tiene algunas compras en la aplicación que pueden mejorar tu experiencia de juego. Por ejemplo, puedes comprar rubíes, que son la moneda premium del juego. Puedes usar rubíes para comprar pieles, cofres, dorados, auto-clickers, timelapses y más. Sin embargo, estas compras pueden ser bastante caras, especialmente si desea obtener los mejores artículos y mejoras. Es por eso que algunos jugadores prefieren descargar Clicker Heroes mod apk en su lugar. </p>
22
- <h3>Los beneficios de Clicker Heroes mod apk</h3>
23
- <p>Clicker Heroes mod apk es una versión modificada del juego original que le da acceso a recursos y características ilimitadas. Algunos de los beneficios de descargar Clicker Heroes mod apk son:</p>
24
- <ul>
25
- <li>Puedes obtener rubíes ilimitados gratis, sin gastar dinero real. </li>
26
- <li> Puedes desbloquear todos los héroes y sus mejoras al instante, sin moler o esperar. </li>
27
- <li>Puedes saltarte cualquier nivel o jefe que encuentres demasiado duro o aburrido. </li>
28
- <li>Puedes personalizar la configuración del juego según tus preferencias. </li>
29
- <li>Puedes disfrutar del juego sin anuncios ni interrupciones. </li>
30
- </ul>
31
- <h3>Los inconvenientes de Clicker Heroes mod apk</h3>
32
- <p>Sin embargo, descargar Clicker Heroes mod apk también tiene algunos inconvenientes que usted debe tener en cuenta. Algunos de los inconvenientes de descargar Clicker Heroes mod apk son:</p>
33
- <ul>
34
- <li> Es posible que se enfrentan a algunos problemas de compatibilidad o rendimiento, como el apk mod no puede ser actualizado o optimizado para su dispositivo. </li>
35
- <li> Usted puede encontrar algunos errores o fallos, como el apk mod no puede ser probado o verificado por la calidad. </li>
36
- <li>Usted puede arriesgarse a perder su progreso o datos, como el apk mod no puede ser sincronizado o respaldado con su cuenta. </li>
37
- <li>Usted puede violar los términos y condiciones del juego, como el apk mod puede ser considerado como trampa o piratería. </li>
38
-
39
- </ul>
40
- <h2>Cómo descargar e instalar Clicker Heroes mod apk? </h2>
41
- <p>Si usted ha decidido descargar Clicker Heroes mod apk, usted debe seguir estos pasos cuidadosamente para asegurar una instalación segura y exitosa. Antes de proceder, asegúrese de que tiene suficiente espacio de almacenamiento en su dispositivo y que tiene una conexión a Internet estable. </p>
42
- <h3>Paso 1: Encuentra una fuente confiable</h3>
43
- <p>El primer paso es encontrar una fuente confiable que ofrece Clicker Heroes mod apk para descargar. Usted puede buscar en línea para varios sitios web o plataformas que proporcionan este servicio, pero tenga cuidado de los sitios falsos o estafa que pueden engañar a descargar algo más. También puedes consultar las reseñas y valoraciones de otros usuarios para ver si han tenido una buena experiencia con la fuente. Alternativamente, puede utilizar el siguiente enlace para descargar Clicker Heroes mod apk de una fuente de confianza:</p>
44
- <p><a href=">Haga clic aquí para descargar Clicker Heroes mod apk</a></p>
45
- <h3>Paso 2: Descargar el archivo apk</h3>
46
- <p>El siguiente paso es descargar el archivo apk de Clicker Heroes mod apk de la fuente. Puede hacer esto haciendo clic en el botón de descarga o enlace, y luego esperar a que el archivo se descargue en su dispositivo. El tamaño del archivo puede variar dependiendo de la versión y características de la apk mod, pero no debe tardar mucho en completarse. </p>
47
- <h3>Paso 3: Habilitar fuentes desconocidas</h3>
48
- <p>El tercer paso es habilitar fuentes desconocidas en su dispositivo. Esta es una configuración de seguridad que le impide instalar aplicaciones desde fuentes distintas de la tienda de aplicaciones oficial. Sin embargo, ya que está instalando un apk mod, es necesario habilitar esta opción temporalmente. Puede hacer esto yendo a la configuración del dispositivo, luego a la seguridad, luego a fuentes desconocidas y luego activarlo. También puede ver un mensaje emergente pidiendo su permiso para instalar aplicaciones de fuentes desconocidas. Simplemente toque en permitir o aceptar para proceder. </p>
49
- <h3>Paso 4: Instalar el archivo apk</h3>
50
-
51
- <h3>Paso 5: Disfruta del juego</h3>
52
- <p>El paso final es disfrutar del juego. Puede hacerlo abriendo el icono de la aplicación en la pantalla de inicio o en el cajón de la aplicación, y luego lanzando el juego. Deberías ver una versión modificada de Clicker Heroes, con recursos y funciones ilimitadas. Ahora puedes jugar el juego tanto como quieras, sin limitaciones ni restricciones. </p>
53
- <h2>Conclusión</h2>
54
- <p>En conclusión, Clicker Heroes es un divertido y adictivo juego de ocio que te mantendrá entretenido durante horas. Sin embargo, si desea disfrutar del juego sin limitaciones o restricciones, puede descargar Clicker Heroes mod apk lugar. Esto le dará acceso a recursos y características ilimitadas, pero también algunos inconvenientes que debe tener en cuenta. Para descargar e instalar Clicker Heroes mod apk de forma segura y fácil, puede seguir los pasos que hemos descrito en este artículo. Esperamos que esta guía haya sido útil e informativa para usted. ¡Feliz clic! </p>
55
- <h2>Preguntas frecuentes</h2>
56
- <p>Aquí hay algunas preguntas frecuentes sobre Clicker Heroes mod apk:</p>
57
- <ul>
58
- <li><b>Q: ¿Es seguro Clicker Heroes mod apk? </b></li>
59
- <li>A: Clicker Heroes mod apk es generalmente seguro, siempre y cuando se descarga desde una fuente confiable y siga los pasos de instalación correctamente. Sin embargo, siempre hay un riesgo de malware o virus al descargar cualquier apk mod, por lo que siempre debe escanear su dispositivo con una aplicación antivirus antes y después de instalarlo. </li>
60
- <li><b>Q: ¿Es Clicker Heroes mod apk legal? </b></li>
61
- <li>A: Clicker Heroes mod apk no es legal, ya que viola los términos y condiciones del juego. Al usarlo, estás haciendo trampa o hackeando el juego, lo que puede resultar en una prohibición o suspensión de tu cuenta. Por lo tanto, no recomendamos ni apoyamos el uso de Clicker Heroes mod apk, y le recomendamos que juegue el juego de forma justa y responsable. </li>
62
- <li><b>Q: Es Clicker Heroes mod apk compatible con mi dispositivo? </b></li>
63
-
64
- <li><b>Q: Es Clicker Heroes mod apk actualizado? </b></li>
65
- <li>A: Clicker Heroes mod apk se actualiza regularmente, como los desarrolladores tratan de mantenerse al día con la última versión y características del juego original. Sin embargo, puede haber algunos retrasos o discrepancias entre las actualizaciones, como el mod apk requiere más tiempo y esfuerzo para modificar y probar. Por lo tanto, siempre debe comprobar la fuente y la versión del apk mod antes de descargarlo, y asegúrese de que coincide con la versión actual del juego. </li>
66
- <li><b>Q: ¿Puedo jugar Clicker Heroes mod apk online? </b></li>
67
- <li>A: Clicker Heroes mod apk se puede jugar en línea, ya que se conecta a los mismos servidores y bases de datos que el juego original. Sin embargo, esto también significa que puede ser detectado por el sistema de seguridad del juego, que puede marcar su cuenta como sospechosa o fraudulenta. Esto puede resultar en una prohibición o suspensión de su cuenta, o una pérdida de su progreso o datos. Por lo tanto, le sugerimos que juegue Clicker Heroes mod apk offline, o use una VPN para ocultar su dirección IP y ubicación. </li>
68
- </ul></p> 64aa2da5cf<br />
69
- <br />
70
- <br />
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
spaces/Big-Web/MMSD/env/Lib/site-packages/botocore/discovery.py DELETED
@@ -1,282 +0,0 @@
1
- # Copyright 2018 Amazon.com, Inc. or its affiliates. All Rights Reserved.
2
- #
3
- # Licensed under the Apache License, Version 2.0 (the "License"). You
4
- # may not use this file except in compliance with the License. A copy of
5
- # the License is located at
6
- #
7
- # http://aws.amazon.com/apache2.0/
8
- #
9
- # or in the "license" file accompanying this file. This file is
10
- # distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
11
- # ANY KIND, either express or implied. See the License for the specific
12
- # language governing permissions and limitations under the License.
13
- import logging
14
- import time
15
- import weakref
16
-
17
- from botocore import xform_name
18
- from botocore.exceptions import BotoCoreError, ConnectionError, HTTPClientError
19
- from botocore.model import OperationNotFoundError
20
- from botocore.utils import CachedProperty
21
-
22
- logger = logging.getLogger(__name__)
23
-
24
-
25
- class EndpointDiscoveryException(BotoCoreError):
26
- pass
27
-
28
-
29
- class EndpointDiscoveryRequired(EndpointDiscoveryException):
30
- """Endpoint Discovery is disabled but is required for this operation."""
31
-
32
- fmt = 'Endpoint Discovery is not enabled but this operation requires it.'
33
-
34
-
35
- class EndpointDiscoveryRefreshFailed(EndpointDiscoveryException):
36
- """Endpoint Discovery failed to the refresh the known endpoints."""
37
-
38
- fmt = 'Endpoint Discovery failed to refresh the required endpoints.'
39
-
40
-
41
- def block_endpoint_discovery_required_operations(model, **kwargs):
42
- endpoint_discovery = model.endpoint_discovery
43
- if endpoint_discovery and endpoint_discovery.get('required'):
44
- raise EndpointDiscoveryRequired()
45
-
46
-
47
- class EndpointDiscoveryModel:
48
- def __init__(self, service_model):
49
- self._service_model = service_model
50
-
51
- @CachedProperty
52
- def discovery_operation_name(self):
53
- discovery_operation = self._service_model.endpoint_discovery_operation
54
- return xform_name(discovery_operation.name)
55
-
56
- @CachedProperty
57
- def discovery_operation_keys(self):
58
- discovery_operation = self._service_model.endpoint_discovery_operation
59
- keys = []
60
- if discovery_operation.input_shape:
61
- keys = list(discovery_operation.input_shape.members.keys())
62
- return keys
63
-
64
- def discovery_required_for(self, operation_name):
65
- try:
66
- operation_model = self._service_model.operation_model(
67
- operation_name
68
- )
69
- return operation_model.endpoint_discovery.get('required', False)
70
- except OperationNotFoundError:
71
- return False
72
-
73
- def discovery_operation_kwargs(self, **kwargs):
74
- input_keys = self.discovery_operation_keys
75
- # Operation and Identifiers are only sent if there are Identifiers
76
- if not kwargs.get('Identifiers'):
77
- kwargs.pop('Operation', None)
78
- kwargs.pop('Identifiers', None)
79
- return {k: v for k, v in kwargs.items() if k in input_keys}
80
-
81
- def gather_identifiers(self, operation, params):
82
- return self._gather_ids(operation.input_shape, params)
83
-
84
- def _gather_ids(self, shape, params, ids=None):
85
- # Traverse the input shape and corresponding parameters, gathering
86
- # any input fields labeled as an endpoint discovery id
87
- if ids is None:
88
- ids = {}
89
- for member_name, member_shape in shape.members.items():
90
- if member_shape.metadata.get('endpointdiscoveryid'):
91
- ids[member_name] = params[member_name]
92
- elif (
93
- member_shape.type_name == 'structure' and member_name in params
94
- ):
95
- self._gather_ids(member_shape, params[member_name], ids)
96
- return ids
97
-
98
-
99
- class EndpointDiscoveryManager:
100
- def __init__(
101
- self, client, cache=None, current_time=None, always_discover=True
102
- ):
103
- if cache is None:
104
- cache = {}
105
- self._cache = cache
106
- self._failed_attempts = {}
107
- if current_time is None:
108
- current_time = time.time
109
- self._time = current_time
110
- self._always_discover = always_discover
111
-
112
- # This needs to be a weak ref in order to prevent memory leaks on
113
- # python 2.6
114
- self._client = weakref.proxy(client)
115
- self._model = EndpointDiscoveryModel(client.meta.service_model)
116
-
117
- def _parse_endpoints(self, response):
118
- endpoints = response['Endpoints']
119
- current_time = self._time()
120
- for endpoint in endpoints:
121
- cache_time = endpoint.get('CachePeriodInMinutes')
122
- endpoint['Expiration'] = current_time + cache_time * 60
123
- return endpoints
124
-
125
- def _cache_item(self, value):
126
- if isinstance(value, dict):
127
- return tuple(sorted(value.items()))
128
- else:
129
- return value
130
-
131
- def _create_cache_key(self, **kwargs):
132
- kwargs = self._model.discovery_operation_kwargs(**kwargs)
133
- return tuple(self._cache_item(v) for k, v in sorted(kwargs.items()))
134
-
135
- def gather_identifiers(self, operation, params):
136
- return self._model.gather_identifiers(operation, params)
137
-
138
- def delete_endpoints(self, **kwargs):
139
- cache_key = self._create_cache_key(**kwargs)
140
- if cache_key in self._cache:
141
- del self._cache[cache_key]
142
-
143
- def _describe_endpoints(self, **kwargs):
144
- # This is effectively a proxy to whatever name/kwargs the service
145
- # supports for endpoint discovery.
146
- kwargs = self._model.discovery_operation_kwargs(**kwargs)
147
- operation_name = self._model.discovery_operation_name
148
- discovery_operation = getattr(self._client, operation_name)
149
- logger.debug('Discovering endpoints with kwargs: %s', kwargs)
150
- return discovery_operation(**kwargs)
151
-
152
- def _get_current_endpoints(self, key):
153
- if key not in self._cache:
154
- return None
155
- now = self._time()
156
- return [e for e in self._cache[key] if now < e['Expiration']]
157
-
158
- def _refresh_current_endpoints(self, **kwargs):
159
- cache_key = self._create_cache_key(**kwargs)
160
- try:
161
- response = self._describe_endpoints(**kwargs)
162
- endpoints = self._parse_endpoints(response)
163
- self._cache[cache_key] = endpoints
164
- self._failed_attempts.pop(cache_key, None)
165
- return endpoints
166
- except (ConnectionError, HTTPClientError):
167
- self._failed_attempts[cache_key] = self._time() + 60
168
- return None
169
-
170
- def _recently_failed(self, cache_key):
171
- if cache_key in self._failed_attempts:
172
- now = self._time()
173
- if now < self._failed_attempts[cache_key]:
174
- return True
175
- del self._failed_attempts[cache_key]
176
- return False
177
-
178
- def _select_endpoint(self, endpoints):
179
- return endpoints[0]['Address']
180
-
181
- def describe_endpoint(self, **kwargs):
182
- operation = kwargs['Operation']
183
- discovery_required = self._model.discovery_required_for(operation)
184
-
185
- if not self._always_discover and not discovery_required:
186
- # Discovery set to only run on required operations
187
- logger.debug(
188
- 'Optional discovery disabled. Skipping discovery for Operation: %s'
189
- % operation
190
- )
191
- return None
192
-
193
- # Get the endpoint for the provided operation and identifiers
194
- cache_key = self._create_cache_key(**kwargs)
195
- endpoints = self._get_current_endpoints(cache_key)
196
- if endpoints:
197
- return self._select_endpoint(endpoints)
198
- # All known endpoints are stale
199
- recently_failed = self._recently_failed(cache_key)
200
- if not recently_failed:
201
- # We haven't failed to discover recently, go ahead and refresh
202
- endpoints = self._refresh_current_endpoints(**kwargs)
203
- if endpoints:
204
- return self._select_endpoint(endpoints)
205
- # Discovery has failed recently, do our best to get an endpoint
206
- logger.debug('Endpoint Discovery has failed for: %s', kwargs)
207
- stale_entries = self._cache.get(cache_key, None)
208
- if stale_entries:
209
- # We have stale entries, use those while discovery is failing
210
- return self._select_endpoint(stale_entries)
211
- if discovery_required:
212
- # It looks strange to be checking recently_failed again but,
213
- # this informs us as to whether or not we tried to refresh earlier
214
- if recently_failed:
215
- # Discovery is required and we haven't already refreshed
216
- endpoints = self._refresh_current_endpoints(**kwargs)
217
- if endpoints:
218
- return self._select_endpoint(endpoints)
219
- # No endpoints even refresh, raise hard error
220
- raise EndpointDiscoveryRefreshFailed()
221
- # Discovery is optional, just use the default endpoint for now
222
- return None
223
-
224
-
225
- class EndpointDiscoveryHandler:
226
- def __init__(self, manager):
227
- self._manager = manager
228
-
229
- def register(self, events, service_id):
230
- events.register(
231
- 'before-parameter-build.%s' % service_id, self.gather_identifiers
232
- )
233
- events.register_first(
234
- 'request-created.%s' % service_id, self.discover_endpoint
235
- )
236
- events.register('needs-retry.%s' % service_id, self.handle_retries)
237
-
238
- def gather_identifiers(self, params, model, context, **kwargs):
239
- endpoint_discovery = model.endpoint_discovery
240
- # Only continue if the operation supports endpoint discovery
241
- if endpoint_discovery is None:
242
- return
243
- ids = self._manager.gather_identifiers(model, params)
244
- context['discovery'] = {'identifiers': ids}
245
-
246
- def discover_endpoint(self, request, operation_name, **kwargs):
247
- ids = request.context.get('discovery', {}).get('identifiers')
248
- if ids is None:
249
- return
250
- endpoint = self._manager.describe_endpoint(
251
- Operation=operation_name, Identifiers=ids
252
- )
253
- if endpoint is None:
254
- logger.debug('Failed to discover and inject endpoint')
255
- return
256
- if not endpoint.startswith('http'):
257
- endpoint = 'https://' + endpoint
258
- logger.debug('Injecting discovered endpoint: %s', endpoint)
259
- request.url = endpoint
260
-
261
- def handle_retries(self, request_dict, response, operation, **kwargs):
262
- if response is None:
263
- return None
264
-
265
- _, response = response
266
- status = response.get('ResponseMetadata', {}).get('HTTPStatusCode')
267
- error_code = response.get('Error', {}).get('Code')
268
- if status != 421 and error_code != 'InvalidEndpointException':
269
- return None
270
-
271
- context = request_dict.get('context', {})
272
- ids = context.get('discovery', {}).get('identifiers')
273
- if ids is None:
274
- return None
275
-
276
- # Delete the cached endpoints, forcing a refresh on retry
277
- # TODO: Improve eviction behavior to only evict the bad endpoint if
278
- # there are multiple. This will almost certainly require a lock.
279
- self._manager.delete_endpoints(
280
- Operation=operation.name, Identifiers=ids
281
- )
282
- return 0
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
spaces/Big-Web/MMSD/env/Lib/site-packages/pip/_vendor/pygments/modeline.py DELETED
@@ -1,43 +0,0 @@
1
- """
2
- pygments.modeline
3
- ~~~~~~~~~~~~~~~~~
4
-
5
- A simple modeline parser (based on pymodeline).
6
-
7
- :copyright: Copyright 2006-2022 by the Pygments team, see AUTHORS.
8
- :license: BSD, see LICENSE for details.
9
- """
10
-
11
- import re
12
-
13
- __all__ = ['get_filetype_from_buffer']
14
-
15
-
16
- modeline_re = re.compile(r'''
17
- (?: vi | vim | ex ) (?: [<=>]? \d* )? :
18
- .* (?: ft | filetype | syn | syntax ) = ( [^:\s]+ )
19
- ''', re.VERBOSE)
20
-
21
-
22
- def get_filetype_from_line(l):
23
- m = modeline_re.search(l)
24
- if m:
25
- return m.group(1)
26
-
27
-
28
- def get_filetype_from_buffer(buf, max_lines=5):
29
- """
30
- Scan the buffer for modelines and return filetype if one is found.
31
- """
32
- lines = buf.splitlines()
33
- for l in lines[-1:-max_lines-1:-1]:
34
- ret = get_filetype_from_line(l)
35
- if ret:
36
- return ret
37
- for i in range(max_lines, -1, -1):
38
- if i < len(lines):
39
- ret = get_filetype_from_line(lines[i])
40
- if ret:
41
- return ret
42
-
43
- return None
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
spaces/Big-Web/MMSD/env/Lib/site-packages/s3transfer/utils.py DELETED
@@ -1,802 +0,0 @@
1
- # Copyright 2016 Amazon.com, Inc. or its affiliates. All Rights Reserved.
2
- #
3
- # Licensed under the Apache License, Version 2.0 (the "License"). You
4
- # may not use this file except in compliance with the License. A copy of
5
- # the License is located at
6
- #
7
- # http://aws.amazon.com/apache2.0/
8
- #
9
- # or in the "license" file accompanying this file. This file is
10
- # distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
11
- # ANY KIND, either express or implied. See the License for the specific
12
- # language governing permissions and limitations under the License.
13
- import functools
14
- import logging
15
- import math
16
- import os
17
- import random
18
- import socket
19
- import stat
20
- import string
21
- import threading
22
- from collections import defaultdict
23
-
24
- from botocore.exceptions import IncompleteReadError, ReadTimeoutError
25
-
26
- from s3transfer.compat import SOCKET_ERROR, fallocate, rename_file
27
-
28
- MAX_PARTS = 10000
29
- # The maximum file size you can upload via S3 per request.
30
- # See: http://docs.aws.amazon.com/AmazonS3/latest/dev/UploadingObjects.html
31
- # and: http://docs.aws.amazon.com/AmazonS3/latest/dev/qfacts.html
32
- MAX_SINGLE_UPLOAD_SIZE = 5 * (1024**3)
33
- MIN_UPLOAD_CHUNKSIZE = 5 * (1024**2)
34
- logger = logging.getLogger(__name__)
35
-
36
-
37
- S3_RETRYABLE_DOWNLOAD_ERRORS = (
38
- socket.timeout,
39
- SOCKET_ERROR,
40
- ReadTimeoutError,
41
- IncompleteReadError,
42
- )
43
-
44
-
45
- def random_file_extension(num_digits=8):
46
- return ''.join(random.choice(string.hexdigits) for _ in range(num_digits))
47
-
48
-
49
- def signal_not_transferring(request, operation_name, **kwargs):
50
- if operation_name in ['PutObject', 'UploadPart'] and hasattr(
51
- request.body, 'signal_not_transferring'
52
- ):
53
- request.body.signal_not_transferring()
54
-
55
-
56
- def signal_transferring(request, operation_name, **kwargs):
57
- if operation_name in ['PutObject', 'UploadPart'] and hasattr(
58
- request.body, 'signal_transferring'
59
- ):
60
- request.body.signal_transferring()
61
-
62
-
63
- def calculate_num_parts(size, part_size):
64
- return int(math.ceil(size / float(part_size)))
65
-
66
-
67
- def calculate_range_parameter(
68
- part_size, part_index, num_parts, total_size=None
69
- ):
70
- """Calculate the range parameter for multipart downloads/copies
71
-
72
- :type part_size: int
73
- :param part_size: The size of the part
74
-
75
- :type part_index: int
76
- :param part_index: The index for which this parts starts. This index starts
77
- at zero
78
-
79
- :type num_parts: int
80
- :param num_parts: The total number of parts in the transfer
81
-
82
- :returns: The value to use for Range parameter on downloads or
83
- the CopySourceRange parameter for copies
84
- """
85
- # Used to calculate the Range parameter
86
- start_range = part_index * part_size
87
- if part_index == num_parts - 1:
88
- end_range = ''
89
- if total_size is not None:
90
- end_range = str(total_size - 1)
91
- else:
92
- end_range = start_range + part_size - 1
93
- range_param = f'bytes={start_range}-{end_range}'
94
- return range_param
95
-
96
-
97
- def get_callbacks(transfer_future, callback_type):
98
- """Retrieves callbacks from a subscriber
99
-
100
- :type transfer_future: s3transfer.futures.TransferFuture
101
- :param transfer_future: The transfer future the subscriber is associated
102
- to.
103
-
104
- :type callback_type: str
105
- :param callback_type: The type of callback to retrieve from the subscriber.
106
- Valid types include:
107
- * 'queued'
108
- * 'progress'
109
- * 'done'
110
-
111
- :returns: A list of callbacks for the type specified. All callbacks are
112
- preinjected with the transfer future.
113
- """
114
- callbacks = []
115
- for subscriber in transfer_future.meta.call_args.subscribers:
116
- callback_name = 'on_' + callback_type
117
- if hasattr(subscriber, callback_name):
118
- callbacks.append(
119
- functools.partial(
120
- getattr(subscriber, callback_name), future=transfer_future
121
- )
122
- )
123
- return callbacks
124
-
125
-
126
- def invoke_progress_callbacks(callbacks, bytes_transferred):
127
- """Calls all progress callbacks
128
-
129
- :param callbacks: A list of progress callbacks to invoke
130
- :param bytes_transferred: The number of bytes transferred. This is passed
131
- to the callbacks. If no bytes were transferred the callbacks will not
132
- be invoked because no progress was achieved. It is also possible
133
- to receive a negative amount which comes from retrying a transfer
134
- request.
135
- """
136
- # Only invoke the callbacks if bytes were actually transferred.
137
- if bytes_transferred:
138
- for callback in callbacks:
139
- callback(bytes_transferred=bytes_transferred)
140
-
141
-
142
- def get_filtered_dict(original_dict, whitelisted_keys):
143
- """Gets a dictionary filtered by whitelisted keys
144
-
145
- :param original_dict: The original dictionary of arguments to source keys
146
- and values.
147
- :param whitelisted_key: A list of keys to include in the filtered
148
- dictionary.
149
-
150
- :returns: A dictionary containing key/values from the original dictionary
151
- whose key was included in the whitelist
152
- """
153
- filtered_dict = {}
154
- for key, value in original_dict.items():
155
- if key in whitelisted_keys:
156
- filtered_dict[key] = value
157
- return filtered_dict
158
-
159
-
160
- class CallArgs:
161
- def __init__(self, **kwargs):
162
- """A class that records call arguments
163
-
164
- The call arguments must be passed as keyword arguments. It will set
165
- each keyword argument as an attribute of the object along with its
166
- associated value.
167
- """
168
- for arg, value in kwargs.items():
169
- setattr(self, arg, value)
170
-
171
-
172
- class FunctionContainer:
173
- """An object that contains a function and any args or kwargs to call it
174
-
175
- When called the provided function will be called with provided args
176
- and kwargs.
177
- """
178
-
179
- def __init__(self, func, *args, **kwargs):
180
- self._func = func
181
- self._args = args
182
- self._kwargs = kwargs
183
-
184
- def __repr__(self):
185
- return 'Function: {} with args {} and kwargs {}'.format(
186
- self._func, self._args, self._kwargs
187
- )
188
-
189
- def __call__(self):
190
- return self._func(*self._args, **self._kwargs)
191
-
192
-
193
- class CountCallbackInvoker:
194
- """An abstraction to invoke a callback when a shared count reaches zero
195
-
196
- :param callback: Callback invoke when finalized count reaches zero
197
- """
198
-
199
- def __init__(self, callback):
200
- self._lock = threading.Lock()
201
- self._callback = callback
202
- self._count = 0
203
- self._is_finalized = False
204
-
205
- @property
206
- def current_count(self):
207
- with self._lock:
208
- return self._count
209
-
210
- def increment(self):
211
- """Increment the count by one"""
212
- with self._lock:
213
- if self._is_finalized:
214
- raise RuntimeError(
215
- 'Counter has been finalized it can no longer be '
216
- 'incremented.'
217
- )
218
- self._count += 1
219
-
220
- def decrement(self):
221
- """Decrement the count by one"""
222
- with self._lock:
223
- if self._count == 0:
224
- raise RuntimeError(
225
- 'Counter is at zero. It cannot dip below zero'
226
- )
227
- self._count -= 1
228
- if self._is_finalized and self._count == 0:
229
- self._callback()
230
-
231
- def finalize(self):
232
- """Finalize the counter
233
-
234
- Once finalized, the counter never be incremented and the callback
235
- can be invoked once the count reaches zero
236
- """
237
- with self._lock:
238
- self._is_finalized = True
239
- if self._count == 0:
240
- self._callback()
241
-
242
-
243
- class OSUtils:
244
- _MAX_FILENAME_LEN = 255
245
-
246
- def get_file_size(self, filename):
247
- return os.path.getsize(filename)
248
-
249
- def open_file_chunk_reader(self, filename, start_byte, size, callbacks):
250
- return ReadFileChunk.from_filename(
251
- filename, start_byte, size, callbacks, enable_callbacks=False
252
- )
253
-
254
- def open_file_chunk_reader_from_fileobj(
255
- self,
256
- fileobj,
257
- chunk_size,
258
- full_file_size,
259
- callbacks,
260
- close_callbacks=None,
261
- ):
262
- return ReadFileChunk(
263
- fileobj,
264
- chunk_size,
265
- full_file_size,
266
- callbacks=callbacks,
267
- enable_callbacks=False,
268
- close_callbacks=close_callbacks,
269
- )
270
-
271
- def open(self, filename, mode):
272
- return open(filename, mode)
273
-
274
- def remove_file(self, filename):
275
- """Remove a file, noop if file does not exist."""
276
- # Unlike os.remove, if the file does not exist,
277
- # then this method does nothing.
278
- try:
279
- os.remove(filename)
280
- except OSError:
281
- pass
282
-
283
- def rename_file(self, current_filename, new_filename):
284
- rename_file(current_filename, new_filename)
285
-
286
- def is_special_file(cls, filename):
287
- """Checks to see if a file is a special UNIX file.
288
-
289
- It checks if the file is a character special device, block special
290
- device, FIFO, or socket.
291
-
292
- :param filename: Name of the file
293
-
294
- :returns: True if the file is a special file. False, if is not.
295
- """
296
- # If it does not exist, it must be a new file so it cannot be
297
- # a special file.
298
- if not os.path.exists(filename):
299
- return False
300
- mode = os.stat(filename).st_mode
301
- # Character special device.
302
- if stat.S_ISCHR(mode):
303
- return True
304
- # Block special device
305
- if stat.S_ISBLK(mode):
306
- return True
307
- # Named pipe / FIFO
308
- if stat.S_ISFIFO(mode):
309
- return True
310
- # Socket.
311
- if stat.S_ISSOCK(mode):
312
- return True
313
- return False
314
-
315
- def get_temp_filename(self, filename):
316
- suffix = os.extsep + random_file_extension()
317
- path = os.path.dirname(filename)
318
- name = os.path.basename(filename)
319
- temp_filename = name[: self._MAX_FILENAME_LEN - len(suffix)] + suffix
320
- return os.path.join(path, temp_filename)
321
-
322
- def allocate(self, filename, size):
323
- try:
324
- with self.open(filename, 'wb') as f:
325
- fallocate(f, size)
326
- except OSError:
327
- self.remove_file(filename)
328
- raise
329
-
330
-
331
- class DeferredOpenFile:
332
- def __init__(self, filename, start_byte=0, mode='rb', open_function=open):
333
- """A class that defers the opening of a file till needed
334
-
335
- This is useful for deferring opening of a file till it is needed
336
- in a separate thread, as there is a limit of how many open files
337
- there can be in a single thread for most operating systems. The
338
- file gets opened in the following methods: ``read()``, ``seek()``,
339
- and ``__enter__()``
340
-
341
- :type filename: str
342
- :param filename: The name of the file to open
343
-
344
- :type start_byte: int
345
- :param start_byte: The byte to seek to when the file is opened.
346
-
347
- :type mode: str
348
- :param mode: The mode to use to open the file
349
-
350
- :type open_function: function
351
- :param open_function: The function to use to open the file
352
- """
353
- self._filename = filename
354
- self._fileobj = None
355
- self._start_byte = start_byte
356
- self._mode = mode
357
- self._open_function = open_function
358
-
359
- def _open_if_needed(self):
360
- if self._fileobj is None:
361
- self._fileobj = self._open_function(self._filename, self._mode)
362
- if self._start_byte != 0:
363
- self._fileobj.seek(self._start_byte)
364
-
365
- @property
366
- def name(self):
367
- return self._filename
368
-
369
- def read(self, amount=None):
370
- self._open_if_needed()
371
- return self._fileobj.read(amount)
372
-
373
- def write(self, data):
374
- self._open_if_needed()
375
- self._fileobj.write(data)
376
-
377
- def seek(self, where, whence=0):
378
- self._open_if_needed()
379
- self._fileobj.seek(where, whence)
380
-
381
- def tell(self):
382
- if self._fileobj is None:
383
- return self._start_byte
384
- return self._fileobj.tell()
385
-
386
- def close(self):
387
- if self._fileobj:
388
- self._fileobj.close()
389
-
390
- def __enter__(self):
391
- self._open_if_needed()
392
- return self
393
-
394
- def __exit__(self, *args, **kwargs):
395
- self.close()
396
-
397
-
398
- class ReadFileChunk:
399
- def __init__(
400
- self,
401
- fileobj,
402
- chunk_size,
403
- full_file_size,
404
- callbacks=None,
405
- enable_callbacks=True,
406
- close_callbacks=None,
407
- ):
408
- """
409
-
410
- Given a file object shown below::
411
-
412
- |___________________________________________________|
413
- 0 | | full_file_size
414
- |----chunk_size---|
415
- f.tell()
416
-
417
- :type fileobj: file
418
- :param fileobj: File like object
419
-
420
- :type chunk_size: int
421
- :param chunk_size: The max chunk size to read. Trying to read
422
- pass the end of the chunk size will behave like you've
423
- reached the end of the file.
424
-
425
- :type full_file_size: int
426
- :param full_file_size: The entire content length associated
427
- with ``fileobj``.
428
-
429
- :type callbacks: A list of function(amount_read)
430
- :param callbacks: Called whenever data is read from this object in the
431
- order provided.
432
-
433
- :type enable_callbacks: boolean
434
- :param enable_callbacks: True if to run callbacks. Otherwise, do not
435
- run callbacks
436
-
437
- :type close_callbacks: A list of function()
438
- :param close_callbacks: Called when close is called. The function
439
- should take no arguments.
440
- """
441
- self._fileobj = fileobj
442
- self._start_byte = self._fileobj.tell()
443
- self._size = self._calculate_file_size(
444
- self._fileobj,
445
- requested_size=chunk_size,
446
- start_byte=self._start_byte,
447
- actual_file_size=full_file_size,
448
- )
449
- # _amount_read represents the position in the chunk and may exceed
450
- # the chunk size, but won't allow reads out of bounds.
451
- self._amount_read = 0
452
- self._callbacks = callbacks
453
- if callbacks is None:
454
- self._callbacks = []
455
- self._callbacks_enabled = enable_callbacks
456
- self._close_callbacks = close_callbacks
457
- if close_callbacks is None:
458
- self._close_callbacks = close_callbacks
459
-
460
- @classmethod
461
- def from_filename(
462
- cls,
463
- filename,
464
- start_byte,
465
- chunk_size,
466
- callbacks=None,
467
- enable_callbacks=True,
468
- ):
469
- """Convenience factory function to create from a filename.
470
-
471
- :type start_byte: int
472
- :param start_byte: The first byte from which to start reading.
473
-
474
- :type chunk_size: int
475
- :param chunk_size: The max chunk size to read. Trying to read
476
- pass the end of the chunk size will behave like you've
477
- reached the end of the file.
478
-
479
- :type full_file_size: int
480
- :param full_file_size: The entire content length associated
481
- with ``fileobj``.
482
-
483
- :type callbacks: function(amount_read)
484
- :param callbacks: Called whenever data is read from this object.
485
-
486
- :type enable_callbacks: bool
487
- :param enable_callbacks: Indicate whether to invoke callback
488
- during read() calls.
489
-
490
- :rtype: ``ReadFileChunk``
491
- :return: A new instance of ``ReadFileChunk``
492
-
493
- """
494
- f = open(filename, 'rb')
495
- f.seek(start_byte)
496
- file_size = os.fstat(f.fileno()).st_size
497
- return cls(f, chunk_size, file_size, callbacks, enable_callbacks)
498
-
499
- def _calculate_file_size(
500
- self, fileobj, requested_size, start_byte, actual_file_size
501
- ):
502
- max_chunk_size = actual_file_size - start_byte
503
- return min(max_chunk_size, requested_size)
504
-
505
- def read(self, amount=None):
506
- amount_left = max(self._size - self._amount_read, 0)
507
- if amount is None:
508
- amount_to_read = amount_left
509
- else:
510
- amount_to_read = min(amount_left, amount)
511
- data = self._fileobj.read(amount_to_read)
512
- self._amount_read += len(data)
513
- if self._callbacks is not None and self._callbacks_enabled:
514
- invoke_progress_callbacks(self._callbacks, len(data))
515
- return data
516
-
517
- def signal_transferring(self):
518
- self.enable_callback()
519
- if hasattr(self._fileobj, 'signal_transferring'):
520
- self._fileobj.signal_transferring()
521
-
522
- def signal_not_transferring(self):
523
- self.disable_callback()
524
- if hasattr(self._fileobj, 'signal_not_transferring'):
525
- self._fileobj.signal_not_transferring()
526
-
527
- def enable_callback(self):
528
- self._callbacks_enabled = True
529
-
530
- def disable_callback(self):
531
- self._callbacks_enabled = False
532
-
533
- def seek(self, where, whence=0):
534
- if whence not in (0, 1, 2):
535
- # Mimic io's error for invalid whence values
536
- raise ValueError(f"invalid whence ({whence}, should be 0, 1 or 2)")
537
-
538
- # Recalculate where based on chunk attributes so seek from file
539
- # start (whence=0) is always used
540
- where += self._start_byte
541
- if whence == 1:
542
- where += self._amount_read
543
- elif whence == 2:
544
- where += self._size
545
-
546
- self._fileobj.seek(max(where, self._start_byte))
547
- if self._callbacks is not None and self._callbacks_enabled:
548
- # To also rewind the callback() for an accurate progress report
549
- bounded_where = max(min(where - self._start_byte, self._size), 0)
550
- bounded_amount_read = min(self._amount_read, self._size)
551
- amount = bounded_where - bounded_amount_read
552
- invoke_progress_callbacks(
553
- self._callbacks, bytes_transferred=amount
554
- )
555
- self._amount_read = max(where - self._start_byte, 0)
556
-
557
- def close(self):
558
- if self._close_callbacks is not None and self._callbacks_enabled:
559
- for callback in self._close_callbacks:
560
- callback()
561
- self._fileobj.close()
562
-
563
- def tell(self):
564
- return self._amount_read
565
-
566
- def __len__(self):
567
- # __len__ is defined because requests will try to determine the length
568
- # of the stream to set a content length. In the normal case
569
- # of the file it will just stat the file, but we need to change that
570
- # behavior. By providing a __len__, requests will use that instead
571
- # of stat'ing the file.
572
- return self._size
573
-
574
- def __enter__(self):
575
- return self
576
-
577
- def __exit__(self, *args, **kwargs):
578
- self.close()
579
-
580
- def __iter__(self):
581
- # This is a workaround for http://bugs.python.org/issue17575
582
- # Basically httplib will try to iterate over the contents, even
583
- # if its a file like object. This wasn't noticed because we've
584
- # already exhausted the stream so iterating over the file immediately
585
- # stops, which is what we're simulating here.
586
- return iter([])
587
-
588
-
589
- class StreamReaderProgress:
590
- """Wrapper for a read only stream that adds progress callbacks."""
591
-
592
- def __init__(self, stream, callbacks=None):
593
- self._stream = stream
594
- self._callbacks = callbacks
595
- if callbacks is None:
596
- self._callbacks = []
597
-
598
- def read(self, *args, **kwargs):
599
- value = self._stream.read(*args, **kwargs)
600
- invoke_progress_callbacks(self._callbacks, len(value))
601
- return value
602
-
603
-
604
- class NoResourcesAvailable(Exception):
605
- pass
606
-
607
-
608
- class TaskSemaphore:
609
- def __init__(self, count):
610
- """A semaphore for the purpose of limiting the number of tasks
611
-
612
- :param count: The size of semaphore
613
- """
614
- self._semaphore = threading.Semaphore(count)
615
-
616
- def acquire(self, tag, blocking=True):
617
- """Acquire the semaphore
618
-
619
- :param tag: A tag identifying what is acquiring the semaphore. Note
620
- that this is not really needed to directly use this class but is
621
- needed for API compatibility with the SlidingWindowSemaphore
622
- implementation.
623
- :param block: If True, block until it can be acquired. If False,
624
- do not block and raise an exception if cannot be acquired.
625
-
626
- :returns: A token (can be None) to use when releasing the semaphore
627
- """
628
- logger.debug("Acquiring %s", tag)
629
- if not self._semaphore.acquire(blocking):
630
- raise NoResourcesAvailable("Cannot acquire tag '%s'" % tag)
631
-
632
- def release(self, tag, acquire_token):
633
- """Release the semaphore
634
-
635
- :param tag: A tag identifying what is releasing the semaphore
636
- :param acquire_token: The token returned from when the semaphore was
637
- acquired. Note that this is not really needed to directly use this
638
- class but is needed for API compatibility with the
639
- SlidingWindowSemaphore implementation.
640
- """
641
- logger.debug(f"Releasing acquire {tag}/{acquire_token}")
642
- self._semaphore.release()
643
-
644
-
645
- class SlidingWindowSemaphore(TaskSemaphore):
646
- """A semaphore used to coordinate sequential resource access.
647
-
648
- This class is similar to the stdlib BoundedSemaphore:
649
-
650
- * It's initialized with a count.
651
- * Each call to ``acquire()`` decrements the counter.
652
- * If the count is at zero, then ``acquire()`` will either block until the
653
- count increases, or if ``blocking=False``, then it will raise
654
- a NoResourcesAvailable exception indicating that it failed to acquire the
655
- semaphore.
656
-
657
- The main difference is that this semaphore is used to limit
658
- access to a resource that requires sequential access. For example,
659
- if I want to access resource R that has 20 subresources R_0 - R_19,
660
- this semaphore can also enforce that you only have a max range of
661
- 10 at any given point in time. You must also specify a tag name
662
- when you acquire the semaphore. The sliding window semantics apply
663
- on a per tag basis. The internal count will only be incremented
664
- when the minimum sequence number for a tag is released.
665
-
666
- """
667
-
668
- def __init__(self, count):
669
- self._count = count
670
- # Dict[tag, next_sequence_number].
671
- self._tag_sequences = defaultdict(int)
672
- self._lowest_sequence = {}
673
- self._lock = threading.Lock()
674
- self._condition = threading.Condition(self._lock)
675
- # Dict[tag, List[sequence_number]]
676
- self._pending_release = {}
677
-
678
- def current_count(self):
679
- with self._lock:
680
- return self._count
681
-
682
- def acquire(self, tag, blocking=True):
683
- logger.debug("Acquiring %s", tag)
684
- self._condition.acquire()
685
- try:
686
- if self._count == 0:
687
- if not blocking:
688
- raise NoResourcesAvailable("Cannot acquire tag '%s'" % tag)
689
- else:
690
- while self._count == 0:
691
- self._condition.wait()
692
- # self._count is no longer zero.
693
- # First, check if this is the first time we're seeing this tag.
694
- sequence_number = self._tag_sequences[tag]
695
- if sequence_number == 0:
696
- # First time seeing the tag, so record we're at 0.
697
- self._lowest_sequence[tag] = sequence_number
698
- self._tag_sequences[tag] += 1
699
- self._count -= 1
700
- return sequence_number
701
- finally:
702
- self._condition.release()
703
-
704
- def release(self, tag, acquire_token):
705
- sequence_number = acquire_token
706
- logger.debug("Releasing acquire %s/%s", tag, sequence_number)
707
- self._condition.acquire()
708
- try:
709
- if tag not in self._tag_sequences:
710
- raise ValueError("Attempted to release unknown tag: %s" % tag)
711
- max_sequence = self._tag_sequences[tag]
712
- if self._lowest_sequence[tag] == sequence_number:
713
- # We can immediately process this request and free up
714
- # resources.
715
- self._lowest_sequence[tag] += 1
716
- self._count += 1
717
- self._condition.notify()
718
- queued = self._pending_release.get(tag, [])
719
- while queued:
720
- if self._lowest_sequence[tag] == queued[-1]:
721
- queued.pop()
722
- self._lowest_sequence[tag] += 1
723
- self._count += 1
724
- else:
725
- break
726
- elif self._lowest_sequence[tag] < sequence_number < max_sequence:
727
- # We can't do anything right now because we're still waiting
728
- # for the min sequence for the tag to be released. We have
729
- # to queue this for pending release.
730
- self._pending_release.setdefault(tag, []).append(
731
- sequence_number
732
- )
733
- self._pending_release[tag].sort(reverse=True)
734
- else:
735
- raise ValueError(
736
- "Attempted to release unknown sequence number "
737
- "%s for tag: %s" % (sequence_number, tag)
738
- )
739
- finally:
740
- self._condition.release()
741
-
742
-
743
- class ChunksizeAdjuster:
744
- def __init__(
745
- self,
746
- max_size=MAX_SINGLE_UPLOAD_SIZE,
747
- min_size=MIN_UPLOAD_CHUNKSIZE,
748
- max_parts=MAX_PARTS,
749
- ):
750
- self.max_size = max_size
751
- self.min_size = min_size
752
- self.max_parts = max_parts
753
-
754
- def adjust_chunksize(self, current_chunksize, file_size=None):
755
- """Get a chunksize close to current that fits within all S3 limits.
756
-
757
- :type current_chunksize: int
758
- :param current_chunksize: The currently configured chunksize.
759
-
760
- :type file_size: int or None
761
- :param file_size: The size of the file to upload. This might be None
762
- if the object being transferred has an unknown size.
763
-
764
- :returns: A valid chunksize that fits within configured limits.
765
- """
766
- chunksize = current_chunksize
767
- if file_size is not None:
768
- chunksize = self._adjust_for_max_parts(chunksize, file_size)
769
- return self._adjust_for_chunksize_limits(chunksize)
770
-
771
- def _adjust_for_chunksize_limits(self, current_chunksize):
772
- if current_chunksize > self.max_size:
773
- logger.debug(
774
- "Chunksize greater than maximum chunksize. "
775
- "Setting to %s from %s." % (self.max_size, current_chunksize)
776
- )
777
- return self.max_size
778
- elif current_chunksize < self.min_size:
779
- logger.debug(
780
- "Chunksize less than minimum chunksize. "
781
- "Setting to %s from %s." % (self.min_size, current_chunksize)
782
- )
783
- return self.min_size
784
- else:
785
- return current_chunksize
786
-
787
- def _adjust_for_max_parts(self, current_chunksize, file_size):
788
- chunksize = current_chunksize
789
- num_parts = int(math.ceil(file_size / float(chunksize)))
790
-
791
- while num_parts > self.max_parts:
792
- chunksize *= 2
793
- num_parts = int(math.ceil(file_size / float(chunksize)))
794
-
795
- if chunksize != current_chunksize:
796
- logger.debug(
797
- "Chunksize would result in the number of parts exceeding the "
798
- "maximum. Setting to %s from %s."
799
- % (chunksize, current_chunksize)
800
- )
801
-
802
- return chunksize
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
spaces/CVPR/Dual-Key_Backdoor_Attacks/datagen/detectron2/detectron2/data/samplers/grouped_batch_sampler.py DELETED
@@ -1,47 +0,0 @@
1
- # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved
2
- import numpy as np
3
- from torch.utils.data.sampler import BatchSampler, Sampler
4
-
5
-
6
- class GroupedBatchSampler(BatchSampler):
7
- """
8
- Wraps another sampler to yield a mini-batch of indices.
9
- It enforces that the batch only contain elements from the same group.
10
- It also tries to provide mini-batches which follows an ordering which is
11
- as close as possible to the ordering from the original sampler.
12
- """
13
-
14
- def __init__(self, sampler, group_ids, batch_size):
15
- """
16
- Args:
17
- sampler (Sampler): Base sampler.
18
- group_ids (list[int]): If the sampler produces indices in range [0, N),
19
- `group_ids` must be a list of `N` ints which contains the group id of each sample.
20
- The group ids must be a set of integers in the range [0, num_groups).
21
- batch_size (int): Size of mini-batch.
22
- """
23
- if not isinstance(sampler, Sampler):
24
- raise ValueError(
25
- "sampler should be an instance of "
26
- "torch.utils.data.Sampler, but got sampler={}".format(sampler)
27
- )
28
- self.sampler = sampler
29
- self.group_ids = np.asarray(group_ids)
30
- assert self.group_ids.ndim == 1
31
- self.batch_size = batch_size
32
- groups = np.unique(self.group_ids).tolist()
33
-
34
- # buffer the indices of each group until batch size is reached
35
- self.buffer_per_group = {k: [] for k in groups}
36
-
37
- def __iter__(self):
38
- for idx in self.sampler:
39
- group_id = self.group_ids[idx]
40
- group_buffer = self.buffer_per_group[group_id]
41
- group_buffer.append(idx)
42
- if len(group_buffer) == self.batch_size:
43
- yield group_buffer[:] # yield a copy of the list
44
- del group_buffer[:]
45
-
46
- def __len__(self):
47
- raise NotImplementedError("len() of GroupedBatchSampler is not well-defined.")
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
spaces/CVPR/Dual-Key_Backdoor_Attacks/datagen/detectron2/detectron2/modeling/proposal_generator/proposal_utils.py DELETED
@@ -1,57 +0,0 @@
1
- # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved
2
- import math
3
- import torch
4
-
5
- from detectron2.structures import Instances
6
-
7
-
8
- def add_ground_truth_to_proposals(gt_boxes, proposals):
9
- """
10
- Call `add_ground_truth_to_proposals_single_image` for all images.
11
-
12
- Args:
13
- gt_boxes(list[Boxes]): list of N elements. Element i is a Boxes
14
- representing the gound-truth for image i.
15
- proposals (list[Instances]): list of N elements. Element i is a Instances
16
- representing the proposals for image i.
17
-
18
- Returns:
19
- list[Instances]: list of N Instances. Each is the proposals for the image,
20
- with field "proposal_boxes" and "objectness_logits".
21
- """
22
- assert gt_boxes is not None
23
-
24
- assert len(proposals) == len(gt_boxes)
25
- if len(proposals) == 0:
26
- return proposals
27
-
28
- return [
29
- add_ground_truth_to_proposals_single_image(gt_boxes_i, proposals_i)
30
- for gt_boxes_i, proposals_i in zip(gt_boxes, proposals)
31
- ]
32
-
33
-
34
- def add_ground_truth_to_proposals_single_image(gt_boxes, proposals):
35
- """
36
- Augment `proposals` with ground-truth boxes from `gt_boxes`.
37
-
38
- Args:
39
- Same as `add_ground_truth_to_proposals`, but with gt_boxes and proposals
40
- per image.
41
-
42
- Returns:
43
- Same as `add_ground_truth_to_proposals`, but for only one image.
44
- """
45
- device = proposals.objectness_logits.device
46
- # Concatenating gt_boxes with proposals requires them to have the same fields
47
- # Assign all ground-truth boxes an objectness logit corresponding to P(object) \approx 1.
48
- gt_logit_value = math.log((1.0 - 1e-10) / (1 - (1.0 - 1e-10)))
49
-
50
- gt_logits = gt_logit_value * torch.ones(len(gt_boxes), device=device)
51
- gt_proposal = Instances(proposals.image_size)
52
-
53
- gt_proposal.proposal_boxes = gt_boxes
54
- gt_proposal.objectness_logits = gt_logits
55
- new_proposals = Instances.cat([proposals, gt_proposal])
56
-
57
- return new_proposals
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
spaces/CVPR/GFPGAN-example/gfpgan/train.py DELETED
@@ -1,11 +0,0 @@
1
- # flake8: noqa
2
- import os.path as osp
3
- from basicsr.train import train_pipeline
4
-
5
- import gfpgan.archs
6
- import gfpgan.data
7
- import gfpgan.models
8
-
9
- if __name__ == '__main__':
10
- root_path = osp.abspath(osp.join(__file__, osp.pardir, osp.pardir))
11
- train_pipeline(root_path)
 
 
 
 
 
 
 
 
 
 
 
 
spaces/CVPR/LIVE/pybind11/tests/test_union.py DELETED
@@ -1,9 +0,0 @@
1
- # -*- coding: utf-8 -*-
2
- from pybind11_tests import union_ as m
3
-
4
-
5
- def test_union():
6
- instance = m.TestUnion()
7
-
8
- instance.as_uint = 10
9
- assert instance.as_int == 10
 
 
 
 
 
 
 
 
 
 
spaces/CVPR/LIVE/thrust/thrust/system/detail/generic/swap_ranges.h DELETED
@@ -1,47 +0,0 @@
1
- /*
2
- * Copyright 2008-2013 NVIDIA Corporation
3
- *
4
- * Licensed under the Apache License, Version 2.0 (the "License");
5
- * you may not use this file except in compliance with the License.
6
- * You may obtain a copy of the License at
7
- *
8
- * http://www.apache.org/licenses/LICENSE-2.0
9
- *
10
- * Unless required by applicable law or agreed to in writing, software
11
- * distributed under the License is distributed on an "AS IS" BASIS,
12
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
- * See the License for the specific language governing permissions and
14
- * limitations under the License.
15
- */
16
-
17
-
18
- #pragma once
19
-
20
- #include <thrust/detail/config.h>
21
- #include <thrust/system/detail/generic/tag.h>
22
-
23
- namespace thrust
24
- {
25
- namespace system
26
- {
27
- namespace detail
28
- {
29
- namespace generic
30
- {
31
-
32
- template<typename DerivedPolicy,
33
- typename ForwardIterator1,
34
- typename ForwardIterator2>
35
- __host__ __device__
36
- ForwardIterator2 swap_ranges(thrust::execution_policy<DerivedPolicy> &exec,
37
- ForwardIterator1 first1,
38
- ForwardIterator1 last1,
39
- ForwardIterator2 first2);
40
-
41
- } // end namespace generic
42
- } // end namespace detail
43
- } // end namespace system
44
- } // end namespace thrust
45
-
46
- #include <thrust/system/detail/generic/swap_ranges.inl>
47
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
spaces/CofAI/chat.b4/client/css/label.css DELETED
@@ -1,16 +0,0 @@
1
- label {
2
- cursor: pointer;
3
- text-indent: -9999px;
4
- width: 50px;
5
- height: 30px;
6
- backdrop-filter: blur(20px);
7
- -webkit-backdrop-filter: blur(20px);
8
- background-color: var(--blur-bg);
9
- border-radius: var(--border-radius-1);
10
- border: 1px solid var(--blur-border);
11
- display: block;
12
- border-radius: 100px;
13
- position: relative;
14
- overflow: hidden;
15
- transition: 0.33s;
16
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
spaces/CofAI/chat.b4/server/bp.py DELETED
@@ -1,6 +0,0 @@
1
- from flask import Blueprint
2
-
3
- bp = Blueprint('bp', __name__,
4
- template_folder='./../client/html',
5
- static_folder='./../client',
6
- static_url_path='assets')
 
 
 
 
 
 
 
spaces/Curranj/Regex_Generator/app.py DELETED
@@ -1,35 +0,0 @@
1
- import openai
2
- import gradio as gr
3
- import os
4
-
5
-
6
- #OpenAi call
7
-
8
-
9
- def gpt3(texts):
10
- openai.api_key = os.environ["Secret"]
11
- response = openai.Completion.create(
12
- engine="code-davinci-002",
13
- prompt= texts,
14
- temperature=0,
15
- max_tokens=750,
16
- top_p=1,
17
- frequency_penalty=0.0,
18
- presence_penalty=0.0,
19
- stop = ("'","#", "</code>")
20
- )
21
- x = response.choices[0].text
22
-
23
- return x
24
-
25
- # Function to elicit regex response from model
26
- def greet(prompt):
27
- txt= (f"""#---Regex Generator--- \n #Prompt: {prompt}\n#Regex String :\n#'""")
28
- regex = gpt3(txt)
29
- return regex
30
-
31
-
32
- #Code to set up Gradio UI
33
- iface = gr.Interface(greet, inputs = ["text"], outputs = "text",title="Natural Language to Regex ", description="Enter any prompt and get a regex statement back!")
34
- iface.launch()
35
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
spaces/DQChoi/gpt-demo/venv/lib/python3.11/site-packages/PIL/PaletteFile.py DELETED
@@ -1,51 +0,0 @@
1
- #
2
- # Python Imaging Library
3
- # $Id$
4
- #
5
- # stuff to read simple, teragon-style palette files
6
- #
7
- # History:
8
- # 97-08-23 fl Created
9
- #
10
- # Copyright (c) Secret Labs AB 1997.
11
- # Copyright (c) Fredrik Lundh 1997.
12
- #
13
- # See the README file for information on usage and redistribution.
14
- #
15
-
16
- from ._binary import o8
17
-
18
-
19
- class PaletteFile:
20
- """File handler for Teragon-style palette files."""
21
-
22
- rawmode = "RGB"
23
-
24
- def __init__(self, fp):
25
- self.palette = [(i, i, i) for i in range(256)]
26
-
27
- while True:
28
- s = fp.readline()
29
-
30
- if not s:
31
- break
32
- if s[:1] == b"#":
33
- continue
34
- if len(s) > 100:
35
- msg = "bad palette file"
36
- raise SyntaxError(msg)
37
-
38
- v = [int(x) for x in s.split()]
39
- try:
40
- [i, r, g, b] = v
41
- except ValueError:
42
- [i, r] = v
43
- g = b = r
44
-
45
- if 0 <= i <= 255:
46
- self.palette[i] = o8(r) + o8(g) + o8(b)
47
-
48
- self.palette = b"".join(self.palette)
49
-
50
- def getpalette(self):
51
- return self.palette, self.rawmode
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
spaces/DQChoi/gpt-demo/venv/lib/python3.11/site-packages/fontTools/pens/qu2cuPen.py DELETED
@@ -1,105 +0,0 @@
1
- # Copyright 2016 Google Inc. All Rights Reserved.
2
- # Copyright 2023 Behdad Esfahbod. All Rights Reserved.
3
- #
4
- # Licensed under the Apache License, Version 2.0 (the "License");
5
- # you may not use this file except in compliance with the License.
6
- # You may obtain a copy of the License at
7
- #
8
- # http://www.apache.org/licenses/LICENSE-2.0
9
- #
10
- # Unless required by applicable law or agreed to in writing, software
11
- # distributed under the License is distributed on an "AS IS" BASIS,
12
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
- # See the License for the specific language governing permissions and
14
- # limitations under the License.
15
-
16
- from fontTools.qu2cu import quadratic_to_curves
17
- from fontTools.pens.filterPen import ContourFilterPen
18
- from fontTools.pens.reverseContourPen import ReverseContourPen
19
- import math
20
-
21
-
22
- class Qu2CuPen(ContourFilterPen):
23
- """A filter pen to convert quadratic bezier splines to cubic curves
24
- using the FontTools SegmentPen protocol.
25
-
26
- Args:
27
-
28
- other_pen: another SegmentPen used to draw the transformed outline.
29
- max_err: maximum approximation error in font units. For optimal results,
30
- if you know the UPEM of the font, we recommend setting this to a
31
- value equal, or close to UPEM / 1000.
32
- reverse_direction: flip the contours' direction but keep starting point.
33
- stats: a dictionary counting the point numbers of cubic segments.
34
- """
35
-
36
- def __init__(
37
- self,
38
- other_pen,
39
- max_err,
40
- all_cubic=False,
41
- reverse_direction=False,
42
- stats=None,
43
- ):
44
- if reverse_direction:
45
- other_pen = ReverseContourPen(other_pen)
46
- super().__init__(other_pen)
47
- self.all_cubic = all_cubic
48
- self.max_err = max_err
49
- self.stats = stats
50
-
51
- def _quadratics_to_curve(self, q):
52
- curves = quadratic_to_curves(q, self.max_err, all_cubic=self.all_cubic)
53
- if self.stats is not None:
54
- for curve in curves:
55
- n = str(len(curve) - 2)
56
- self.stats[n] = self.stats.get(n, 0) + 1
57
- for curve in curves:
58
- if len(curve) == 4:
59
- yield ("curveTo", curve[1:])
60
- else:
61
- yield ("qCurveTo", curve[1:])
62
-
63
- def filterContour(self, contour):
64
- quadratics = []
65
- currentPt = None
66
- newContour = []
67
- for op, args in contour:
68
- if op == "qCurveTo" and (
69
- self.all_cubic or (len(args) > 2 and args[-1] is not None)
70
- ):
71
- if args[-1] is None:
72
- raise NotImplementedError(
73
- "oncurve-less contours with all_cubic not implemented"
74
- )
75
- quadratics.append((currentPt,) + args)
76
- else:
77
- if quadratics:
78
- newContour.extend(self._quadratics_to_curve(quadratics))
79
- quadratics = []
80
- newContour.append((op, args))
81
- currentPt = args[-1] if args else None
82
- if quadratics:
83
- newContour.extend(self._quadratics_to_curve(quadratics))
84
-
85
- if not self.all_cubic:
86
- # Add back implicit oncurve points
87
- contour = newContour
88
- newContour = []
89
- for op, args in contour:
90
- if op == "qCurveTo" and newContour and newContour[-1][0] == "qCurveTo":
91
- pt0 = newContour[-1][1][-2]
92
- pt1 = newContour[-1][1][-1]
93
- pt2 = args[0]
94
- if (
95
- pt1 is not None
96
- and math.isclose(pt2[0] - pt1[0], pt1[0] - pt0[0])
97
- and math.isclose(pt2[1] - pt1[1], pt1[1] - pt0[1])
98
- ):
99
- newArgs = newContour[-1][1][:-1] + args
100
- newContour[-1] = (op, newArgs)
101
- continue
102
-
103
- newContour.append((op, args))
104
-
105
- return newContour
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
spaces/DQChoi/gpt-demo/venv/lib/python3.11/site-packages/gradio/templates/cdn/assets/index-9a8f514c.js DELETED
@@ -1,2 +0,0 @@
1
- import{S as G,e as I,s as J,G as Z,N as O,K as F,p as U,M as z,n as q,A as j,V as be,B as K,P as D,O as S,U as $,Q as ge,R as x,k as p,m as L,o as v,u as Q,v as d,y as V,z as h,x as y,F as C,a7 as de,h as he,j as we,t as ke,a9 as Ae,ab as pe,ac as ve,ad as ye,ak as k,at as Fe,au as Be,E as ze,ae as Ue,q as je,r as Ee}from"./index-1d65707a.js";import{B as Ne}from"./Button-f155035a.js";import{B as ae}from"./BlockLabel-66866176.js";import{E as Oe}from"./Empty-eec13822.js";import{F as W}from"./File-b8a2be67.js";import{U as Se}from"./Upload-9bb55fba.js";import{M as Te}from"./ModifyUpload-c89cfce3.js";import{n as ee,b as Me}from"./ModifyUpload.svelte_svelte_type_style_lang-d2acacf0.js";import{U as Pe}from"./UploadText-f599be03.js";import"./Blocks-c9e1499d.js";import"./IconButton-d42f3661.js";const Ce=t=>{let e=["B","KB","MB","GB","PB"],n=0;for(;t>1024;)t/=1024,n++;let l=e[n];return t.toFixed(1)+" "+l},le=t=>{var e;return e=t.orig_name||t.name,e.length>30?`${e.substr(0,30)}...`:e},te=t=>{var e=0;if(Array.isArray(t))for(var n of t)n.size!==void 0&&(e+=n.size);else e=t.size||0;return Ce(e)};function ne(t,e,n){const l=t.slice();return l[4]=e[n],l[6]=n,l}function Re(t){let e;return{c(){e=D("Uploading...")},m(n,l){U(n,e,l)},p:q,d(n){n&&j(e)}}}function qe(t){let e,n,l,s;return{c(){e=O("a"),n=D("Download"),F(e,"href",l=t[4].data),F(e,"target","_blank"),F(e,"download",s=window.__is_colab__?null:t[4].orig_name||t[4].name),F(e,"class","svelte-xrr240")},m(a,i){U(a,e,i),z(e,n)},p(a,i){i&1&&l!==(l=a[4].data)&&F(e,"href",l),i&1&&s!==(s=window.__is_colab__?null:a[4].orig_name||a[4].name)&&F(e,"download",s)},d(a){a&&j(e)}}}function se(t){let e,n,l=le(t[4])+"",s,a,i,f=te(t[4])+"",r,g,o,m,_,b;function B(c,E){return c[4].data?qe:Re}let w=B(t),A=w(t);function T(){return t[3](t[4],t[6])}return{c(){e=O("tr"),n=O("td"),s=D(l),a=S(),i=O("td"),r=D(f),g=S(),o=O("td"),A.c(),m=S(),F(n,"class","svelte-xrr240"),F(i,"class","svelte-xrr240"),F(o,"class","download svelte-xrr240"),F(e,"class","file svelte-xrr240"),$(e,"selectable",t[1])},m(c,E){U(c,e,E),z(e,n),z(n,s),z(e,a),z(e,i),z(i,r),z(e,g),z(e,o),A.m(o,null),z(e,m),_||(b=ge(e,"click",T),_=!0)},p(c,E){t=c,E&1&&l!==(l=le(t[4])+"")&&x(s,l),E&1&&f!==(f=te(t[4])+"")&&x(r,f),w===(w=B(t))&&A?A.p(t,E):(A.d(1),A=w(t),A&&(A.c(),A.m(o,null))),E&2&&$(e,"selectable",t[1])},d(c){c&&j(e),A.d(),_=!1,b()}}}function De(t){let e,n,l,s=Z(Array.isArray(t[0])?t[0]:[t[0]]),a=[];for(let i=0;i<s.length;i+=1)a[i]=se(ne(t,s,i));return{c(){e=O("div"),n=O("table"),l=O("tbody");for(let i=0;i<a.length;i+=1)a[i].c();F(n,"class","file-preview svelte-xrr240"),F(e,"class","file-preview-holder svelte-xrr240")},m(i,f){U(i,e,f),z(e,n),z(n,l);for(let r=0;r<a.length;r+=1)a[r]&&a[r].m(l,null)},p(i,[f]){if(f&7){s=Z(Array.isArray(i[0])?i[0]:[i[0]]);let r;for(r=0;r<s.length;r+=1){const g=ne(i,s,r);a[r]?a[r].p(g,f):(a[r]=se(g),a[r].c(),a[r].m(l,null))}for(;r<a.length;r+=1)a[r].d(1);a.length=s.length}},i:q,o:q,d(i){i&&j(e),be(a,i)}}}function Ge(t,e,n){const l=K();let{value:s}=e,{selectable:a=!1}=e;const i=(f,r)=>l("select",{value:f.orig_name||f.name,index:r});return t.$$set=f=>{"value"in f&&n(0,s=f.value),"selectable"in f&&n(1,a=f.selectable)},[s,a,l,i]}class ie extends G{constructor(e){super(),I(this,e,Ge,De,J,{value:0,selectable:1})}}function Ie(t){let e,n;return e=new Oe({props:{unpadded_box:!0,size:"large",$$slots:{default:[Ke]},$$scope:{ctx:t}}}),{c(){p(e.$$.fragment)},m(l,s){v(e,l,s),n=!0},p(l,s){const a={};s&32&&(a.$$scope={dirty:s,ctx:l}),e.$set(a)},i(l){n||(h(e.$$.fragment,l),n=!0)},o(l){d(e.$$.fragment,l),n=!1},d(l){y(e,l)}}}function Je(t){let e,n;return e=new ie({props:{selectable:t[3],value:t[0]}}),e.$on("select",t[4]),{c(){p(e.$$.fragment)},m(l,s){v(e,l,s),n=!0},p(l,s){const a={};s&8&&(a.selectable=l[3]),s&1&&(a.value=l[0]),e.$set(a)},i(l){n||(h(e.$$.fragment,l),n=!0)},o(l){d(e.$$.fragment,l),n=!1},d(l){y(e,l)}}}function Ke(t){let e,n;return e=new W({}),{c(){p(e.$$.fragment)},m(l,s){v(e,l,s),n=!0},i(l){n||(h(e.$$.fragment,l),n=!0)},o(l){d(e.$$.fragment,l),n=!1},d(l){y(e,l)}}}function Le(t){let e,n,l,s,a,i;e=new ae({props:{show_label:t[2],float:t[0]===null,Icon:W,label:t[1]||"File"}});const f=[Je,Ie],r=[];function g(o,m){return o[0]?0:1}return l=g(t),s=r[l]=f[l](t),{c(){p(e.$$.fragment),n=S(),s.c(),a=L()},m(o,m){v(e,o,m),U(o,n,m),r[l].m(o,m),U(o,a,m),i=!0},p(o,[m]){const _={};m&4&&(_.show_label=o[2]),m&1&&(_.float=o[0]===null),m&2&&(_.label=o[1]||"File"),e.$set(_);let b=l;l=g(o),l===b?r[l].p(o,m):(Q(),d(r[b],1,1,()=>{r[b]=null}),V(),s=r[l],s?s.p(o,m):(s=r[l]=f[l](o),s.c()),h(s,1),s.m(a.parentNode,a))},i(o){i||(h(e.$$.fragment,o),h(s),i=!0)},o(o){d(e.$$.fragment,o),d(s),i=!1},d(o){o&&(j(n),j(a)),y(e,o),r[l].d(o)}}}function Qe(t,e,n){let{value:l=null}=e,{label:s}=e,{show_label:a=!0}=e,{selectable:i=!1}=e;function f(r){C.call(this,t,r)}return t.$$set=r=>{"value"in r&&n(0,l=r.value),"label"in r&&n(1,s=r.label),"show_label"in r&&n(2,a=r.show_label),"selectable"in r&&n(3,i=r.selectable)},[l,s,a,i,f]}class Ve extends G{constructor(e){super(),I(this,e,Qe,Le,J,{value:0,label:1,show_label:2,selectable:3})}}function We(t){let e,n,l;function s(i){t[12](i)}let a={filetype:t[6],parse_to_data_url:!1,file_count:t[3],$$slots:{default:[Xe]},$$scope:{ctx:t}};return t[5]!==void 0&&(a.dragging=t[5]),e=new Se({props:a}),he.push(()=>we(e,"dragging",s)),e.$on("load",t[7]),{c(){p(e.$$.fragment)},m(i,f){v(e,i,f),l=!0},p(i,f){const r={};f&64&&(r.filetype=i[6]),f&8&&(r.file_count=i[3]),f&8192&&(r.$$scope={dirty:f,ctx:i}),!n&&f&32&&(n=!0,r.dragging=i[5],ke(()=>n=!1)),e.$set(r)},i(i){l||(h(e.$$.fragment,i),l=!0)},o(i){d(e.$$.fragment,i),l=!1},d(i){y(e,i)}}}function He(t){let e,n,l,s;return e=new Te({props:{absolute:!0}}),e.$on("clear",t[8]),l=new ie({props:{selectable:t[4],value:t[0]}}),l.$on("select",t[11]),{c(){p(e.$$.fragment),n=S(),p(l.$$.fragment)},m(a,i){v(e,a,i),U(a,n,i),v(l,a,i),s=!0},p(a,i){const f={};i&16&&(f.selectable=a[4]),i&1&&(f.value=a[0]),l.$set(f)},i(a){s||(h(e.$$.fragment,a),h(l.$$.fragment,a),s=!0)},o(a){d(e.$$.fragment,a),d(l.$$.fragment,a),s=!1},d(a){a&&j(n),y(e,a),y(l,a)}}}function Xe(t){let e;const n=t[10].default,l=Ae(n,t,t[13],null);return{c(){l&&l.c()},m(s,a){l&&l.m(s,a),e=!0},p(s,a){l&&l.p&&(!e||a&8192)&&pe(l,n,s,s[13],e?ye(n,s[13],a,null):ve(s[13]),null)},i(s){e||(h(l,s),e=!0)},o(s){d(l,s),e=!1},d(s){l&&l.d(s)}}}function Ye(t){let e,n,l,s,a,i;e=new ae({props:{show_label:t[2],Icon:W,float:t[0]===null,label:t[1]||"File"}});const f=[He,We],r=[];function g(o,m){return o[0]?0:1}return l=g(t),s=r[l]=f[l](t),{c(){p(e.$$.fragment),n=S(),s.c(),a=L()},m(o,m){v(e,o,m),U(o,n,m),r[l].m(o,m),U(o,a,m),i=!0},p(o,[m]){const _={};m&4&&(_.show_label=o[2]),m&1&&(_.float=o[0]===null),m&2&&(_.label=o[1]||"File"),e.$set(_);let b=l;l=g(o),l===b?r[l].p(o,m):(Q(),d(r[b],1,1,()=>{r[b]=null}),V(),s=r[l],s?s.p(o,m):(s=r[l]=f[l](o),s.c()),h(s,1),s.m(a.parentNode,a))},i(o){i||(h(e.$$.fragment,o),h(s),i=!0)},o(o){d(e.$$.fragment,o),d(s),i=!1},d(o){o&&(j(n),j(a)),y(e,o),r[l].d(o)}}}function Ze(t,e,n){let{$$slots:l={},$$scope:s}=e,{value:a}=e,{label:i}=e,{show_label:f=!0}=e,{file_count:r="single"}=e,{file_types:g=null}=e,{selectable:o=!1}=e;async function m({detail:c}){n(0,a=c),await de(),b("change",a),b("upload",c)}function _({detail:c}){n(0,a=null),b("change",a),b("clear")}const b=K();let B;g==null?B=null:(g=g.map(c=>c.startsWith(".")?c:c+"/*"),B=g.join(", "));let w=!1;function A(c){C.call(this,t,c)}function T(c){w=c,n(5,w)}return t.$$set=c=>{"value"in c&&n(0,a=c.value),"label"in c&&n(1,i=c.label),"show_label"in c&&n(2,f=c.show_label),"file_count"in c&&n(3,r=c.file_count),"file_types"in c&&n(9,g=c.file_types),"selectable"in c&&n(4,o=c.selectable),"$$scope"in c&&n(13,s=c.$$scope)},t.$$.update=()=>{t.$$.dirty&32&&b("drag",w)},[a,i,f,r,o,w,B,m,_,g,l,A,T,s]}class $e extends G{constructor(e){super(),I(this,e,Ze,Ye,J,{value:0,label:1,show_label:2,file_count:3,file_types:9,selectable:4})}}function xe(t){let e,n;return e=new Ve({props:{selectable:t[9],value:t[14],label:t[5],show_label:t[6]}}),e.$on("select",t[24]),{c(){p(e.$$.fragment)},m(l,s){v(e,l,s),n=!0},p(l,s){const a={};s&512&&(a.selectable=l[9]),s&16384&&(a.value=l[14]),s&32&&(a.label=l[5]),s&64&&(a.show_label=l[6]),e.$set(a)},i(l){n||(h(e.$$.fragment,l),n=!0)},o(l){d(e.$$.fragment,l),n=!1},d(l){y(e,l)}}}function el(t){let e,n;return e=new $e({props:{label:t[5],show_label:t[6],value:t[14],file_count:t[7],file_types:t[8],selectable:t[9],$$slots:{default:[ll]},$$scope:{ctx:t}}}),e.$on("change",t[20]),e.$on("drag",t[21]),e.$on("clear",t[22]),e.$on("select",t[23]),{c(){p(e.$$.fragment)},m(l,s){v(e,l,s),n=!0},p(l,s){const a={};s&32&&(a.label=l[5]),s&64&&(a.show_label=l[6]),s&16384&&(a.value=l[14]),s&128&&(a.file_count=l[7]),s&256&&(a.file_types=l[8]),s&512&&(a.selectable=l[9]),s&134217728&&(a.$$scope={dirty:s,ctx:l}),e.$set(a)},i(l){n||(h(e.$$.fragment,l),n=!0)},o(l){d(e.$$.fragment,l),n=!1},d(l){y(e,l)}}}function ll(t){let e,n;return e=new Pe({props:{type:"file"}}),{c(){p(e.$$.fragment)},m(l,s){v(e,l,s),n=!0},p:q,i(l){n||(h(e.$$.fragment,l),n=!0)},o(l){d(e.$$.fragment,l),n=!1},d(l){y(e,l)}}}function tl(t){let e,n,l,s,a,i;const f=[t[10],{status:t[16]?"generating":t[10]?.status||"complete"}];let r={};for(let _=0;_<f.length;_+=1)r=ze(r,f[_]);e=new Ue({props:r});const g=[el,xe],o=[];function m(_,b){return _[4]==="dynamic"?0:1}return l=m(t),s=o[l]=g[l](t),{c(){p(e.$$.fragment),n=S(),s.c(),a=L()},m(_,b){v(e,_,b),U(_,n,b),o[l].m(_,b),U(_,a,b),i=!0},p(_,b){const B=b&66560?je(f,[b&1024&&Ee(_[10]),{status:_[16]?"generating":_[10]?.status||"complete"}]):{};e.$set(B);let w=l;l=m(_),l===w?o[l].p(_,b):(Q(),d(o[w],1,1,()=>{o[w]=null}),V(),s=o[l],s?s.p(_,b):(s=o[l]=g[l](_),s.c()),h(s,1),s.m(a.parentNode,a))},i(_){i||(h(e.$$.fragment,_),h(s),i=!0)},o(_){d(e.$$.fragment,_),d(s),i=!1},d(_){_&&(j(n),j(a)),y(e,_),o[l].d(_)}}}function nl(t){let e,n;return e=new Ne({props:{visible:t[3],variant:t[4]==="dynamic"&&t[0]===null?"dashed":"solid",border_mode:t[15]?"focus":"base",padding:!1,elem_id:t[1],elem_classes:t[2],container:t[11],scale:t[12],min_width:t[13],$$slots:{default:[tl]},$$scope:{ctx:t}}}),{c(){p(e.$$.fragment)},m(l,s){v(e,l,s),n=!0},p(l,[s]){const a={};s&8&&(a.visible=l[3]),s&17&&(a.variant=l[4]==="dynamic"&&l[0]===null?"dashed":"solid"),s&32768&&(a.border_mode=l[15]?"focus":"base"),s&2&&(a.elem_id=l[1]),s&4&&(a.elem_classes=l[2]),s&2048&&(a.container=l[11]),s&4096&&(a.scale=l[12]),s&8192&&(a.min_width=l[13]),s&134334449&&(a.$$scope={dirty:s,ctx:l}),e.$set(a)},i(l){n||(h(e.$$.fragment,l),n=!0)},o(l){d(e.$$.fragment,l),n=!1},d(l){y(e,l)}}}function sl(t,e,n){let l,{elem_id:s=""}=e,{elem_classes:a=[]}=e,{visible:i=!0}=e,{value:f}=e,r,{mode:g}=e,{root:o}=e,{label:m}=e,{show_label:_}=e,{file_count:b}=e,{file_types:B=["file"]}=e,{root_url:w}=e,{selectable:A=!1}=e,{loading_status:T}=e,{container:c=!0}=e,{scale:E=null}=e,{min_width:H=void 0}=e;const re=Fe("upload_files")??Be;let X=!1,M=!1;const R=K(),oe=({detail:u})=>n(0,f=u),fe=({detail:u})=>n(15,X=u);function ue(u){C.call(this,t,u)}function _e(u){C.call(this,t,u)}function ce(u){C.call(this,t,u)}return t.$$set=u=>{"elem_id"in u&&n(1,s=u.elem_id),"elem_classes"in u&&n(2,a=u.elem_classes),"visible"in u&&n(3,i=u.visible),"value"in u&&n(0,f=u.value),"mode"in u&&n(4,g=u.mode),"root"in u&&n(17,o=u.root),"label"in u&&n(5,m=u.label),"show_label"in u&&n(6,_=u.show_label),"file_count"in u&&n(7,b=u.file_count),"file_types"in u&&n(8,B=u.file_types),"root_url"in u&&n(18,w=u.root_url),"selectable"in u&&n(9,A=u.selectable),"loading_status"in u&&n(10,T=u.loading_status),"container"in u&&n(11,c=u.container),"scale"in u&&n(12,E=u.scale),"min_width"in u&&n(13,H=u.min_width)},t.$$.update=()=>{if(t.$$.dirty&393217&&n(14,l=ee(f,o,w)),t.$$.dirty&933905&&JSON.stringify(l)!==JSON.stringify(r)){if(n(19,r=l),l===null)R("change"),n(16,M=!1);else if(!(Array.isArray(l)?l:[l]).every(u=>u.blob))n(16,M=!1),R("change");else if(g==="dynamic"){let u=(Array.isArray(l)?l:[l]).map(P=>P.blob),me=l;n(16,M=!0),re(o,u).then(P=>{me===l&&(n(16,M=!1),P.error?(Array.isArray(l)?l:[l]).forEach(async(N,Y)=>{N.data=await Me(N.blob),N.blob=void 0}):((Array.isArray(l)?l:[l]).forEach((N,Y)=>{P.files&&(N.orig_name=N.name,N.name=P.files[Y],N.is_file=!0,N.blob=void 0)}),n(19,r=n(14,l=ee(f,o,w)))),R("change"),R("upload"))})}}},[f,s,a,i,g,m,_,b,B,A,T,c,E,H,l,X,M,o,w,r,oe,fe,ue,_e,ce]}class al extends G{constructor(e){super(),I(this,e,sl,nl,J,{elem_id:1,elem_classes:2,visible:3,value:0,mode:4,root:17,label:5,show_label:6,file_count:7,file_types:8,root_url:18,selectable:9,loading_status:10,container:11,scale:12,min_width:13})}get elem_id(){return this.$$.ctx[1]}set elem_id(e){this.$$set({elem_id:e}),k()}get elem_classes(){return this.$$.ctx[2]}set elem_classes(e){this.$$set({elem_classes:e}),k()}get visible(){return this.$$.ctx[3]}set visible(e){this.$$set({visible:e}),k()}get value(){return this.$$.ctx[0]}set value(e){this.$$set({value:e}),k()}get mode(){return this.$$.ctx[4]}set mode(e){this.$$set({mode:e}),k()}get root(){return this.$$.ctx[17]}set root(e){this.$$set({root:e}),k()}get label(){return this.$$.ctx[5]}set label(e){this.$$set({label:e}),k()}get show_label(){return this.$$.ctx[6]}set show_label(e){this.$$set({show_label:e}),k()}get file_count(){return this.$$.ctx[7]}set file_count(e){this.$$set({file_count:e}),k()}get file_types(){return this.$$.ctx[8]}set file_types(e){this.$$set({file_types:e}),k()}get root_url(){return this.$$.ctx[18]}set root_url(e){this.$$set({root_url:e}),k()}get selectable(){return this.$$.ctx[9]}set selectable(e){this.$$set({selectable:e}),k()}get loading_status(){return this.$$.ctx[10]}set loading_status(e){this.$$set({loading_status:e}),k()}get container(){return this.$$.ctx[11]}set container(e){this.$$set({container:e}),k()}get scale(){return this.$$.ctx[12]}set scale(e){this.$$set({scale:e}),k()}get min_width(){return this.$$.ctx[13]}set min_width(e){this.$$set({min_width:e}),k()}}const hl=al,wl=["static","dynamic"],kl=t=>({type:{input_payload:"{ name: string; data: string }",response_object:"{ orig_name: string; name: string, size: number, data: string, is_file: boolean}"},description:{input_payload:"object with file name and base64 data",response_object:"object that includes path to file. The URL: {ROOT}file={name} contains the data"},example_data:{name:"zip.zip",data:"data:@file/octet-stream;base64,UEsFBgAAAAAAAAAAAAAAAAAAAAAAAA=="}});export{hl as Component,kl as document,wl as modes};
2
- //# sourceMappingURL=index-9a8f514c.js.map