Commit
·
745742a
1
Parent(s):
851259e
Update parquet files (step 68 of 121)
Browse filesThis view is limited to 50 files because it contains too many changes.
See raw diff
- spaces/1acneusushi/gradio-2dmoleculeeditor/data/CRACK Autocad 2016 x64 (64bit) Product key Free and Easy Method.md +0 -148
- spaces/1acneusushi/gradio-2dmoleculeeditor/data/DVDFab 11.0.7.4 Crack Patch (32 64bit) Keygen Full Version 2020.md +0 -36
- spaces/1acneusushi/gradio-2dmoleculeeditor/data/Download ArcGIS 9.3 Free Full Version The Best GIS Software for Mapping and Analysis.md +0 -137
- spaces/1gistliPinn/ChatGPT4/Examples/Altova Xmlspy 2012 Crack 71 WORK.md +0 -6
- spaces/1line/AutoGPT/autogpt/commands/image_gen.py +0 -163
- spaces/1line/AutoGPT/benchmark/benchmark_entrepeneur_gpt_with_difficult_user.py +0 -105
- spaces/1line/AutoGPT/run_continuous.sh +0 -3
- spaces/1pelhydcardo/ChatGPT-prompt-generator/assets/Diablo Immortal APK The Best Way to Experience the New Mobile Game from Blizzard.md +0 -123
- spaces/1phancelerku/anime-remove-background/Beach Buggy Racing 2 APK The Ultimate Guide to Unlocking and Upgrading Your Cars.md +0 -158
- spaces/1phancelerku/anime-remove-background/Download Airlift Movie The True Story of the Largest Human Evacuation in History.md +0 -160
- spaces/1phancelerku/anime-remove-background/Download Alchemy of Souls Full Season with English Subtitles.md +0 -72
- spaces/1phancelerku/anime-remove-background/Download Alight Motion for Android The First Professional Motion Design App.md +0 -18
- spaces/1phancelerku/anime-remove-background/Download PS3 Emulator for PC Windows 10 Tips and Tricks to Optimize Performance.md +0 -142
- spaces/1phancelerku/anime-remove-background/Download WhatsApp Business Status A Guide for Small Businesses.md +0 -218
- spaces/1toTree/lora_test/ppdiffusers/pipelines/alt_diffusion/pipeline_alt_diffusion.py +0 -496
- spaces/4F22/text_generator/README.md +0 -12
- spaces/4Taps/SadTalker/src/face3d/extract_kp_videos.py +0 -107
- spaces/AIFILMS/StyleGANEX/README.md +0 -10
- spaces/AIGC-Audio/Make_An_Audio_inpaint/ldm/models/diffusion/ddpm.py +0 -1444
- spaces/Aditya9790/yolo7-object-tracking/hubconf.py +0 -97
- spaces/AgentVerse/agentVerse/ui/src/phaser3-rex-plugins/templates/ui/menu/methods/Collapse.js +0 -16
- spaces/AlStable/Duke/README.md +0 -12
- spaces/Amrrs/DragGan-Inversion/stylegan_human/dnnlib/tflib/optimizer.py +0 -389
- spaces/Amrrs/DragGan-Inversion/viz/pickle_widget.py +0 -183
- spaces/Androidonnxfork/CivitAi-to-Diffusers/diffusers/src/diffusers/models/lora.py +0 -123
- spaces/Andy1621/UniFormerV2_mit_demo/transforms.py +0 -443
- spaces/Andy1621/uniformer_image_segmentation/configs/ocrnet/ocrnet_hr18_512x512_80k_ade20k.py +0 -35
- spaces/Anonymous-sub/Rerender/ControlNet/annotator/uniformer/mmcv/ops/__init__.py +0 -81
- spaces/Anonymous-sub/Rerender/ControlNet/annotator/uniformer/mmseg/datasets/pipelines/compose.py +0 -51
- spaces/AquaSuisei/ChatGPTXE/modules/chat_func.py +0 -497
- spaces/Armaliltril/qbee/app.py +0 -206
- spaces/Ataturk-Chatbot/HuggingFaceChat/venv/lib/python3.11/site-packages/setuptools/_vendor/importlib_metadata/_compat.py +0 -71
- spaces/Ataturk-Chatbot/HuggingFaceChat/venv/lib/python3.11/site-packages/setuptools/command/upload.py +0 -17
- spaces/AutoLLM/AutoAgents/autoagents/utils/__init__.py +0 -0
- spaces/Awiny/Image2Paragraph/models/grit_src/third_party/CenterNet2/tests/test_solver.py +0 -66
- spaces/AzumaSeren100/XuanShen-Bert-VITS2/losses.py +0 -61
- spaces/Benson/text-generation/Examples/Descargar Choque De Clanes Nulls Mod Apk.md +0 -117
- spaces/Benson/text-generation/Examples/Descargar Gratis Titanes De Ajedrez Para Windows Xp Versin Completa.md +0 -107
- spaces/Billyosoro/ESRGAN/realesrgan/data/realesrgan_paired_dataset.py +0 -108
- spaces/BraydenMoore/MARCI-NFL-Betting/Source/Train/xgboost_OU.py +0 -70
- spaces/CVPR/Dual-Key_Backdoor_Attacks/datagen/detectron2/detectron2/model_zoo/model_zoo.py +0 -150
- spaces/CVPR/LIVE/pybind11/README.md +0 -143
- spaces/CVPR/LIVE/thrust/thrust/detail/complex/ccosh.h +0 -213
- spaces/CVPR/LIVE/thrust/thrust/logical.h +0 -279
- spaces/CVPR/LIVE/thrust/thrust/system/cuda/detail/iter_swap.h +0 -66
- spaces/CVPR/Text2Human/Text2Human/train_sampler.py +0 -122
- spaces/CVPR/WALT/mmdet/models/losses/mse_loss.py +0 -49
- spaces/Caoyunkang/Segment-Any-Anomaly/GroundingDINO/groundingdino/models/GroundingDINO/transformer_vanilla.py +0 -123
- spaces/CikeyQI/Yunzai/Yunzai/plugins/ws-plugin/resources/help/index.css +0 -83
- spaces/CobaltZvc/sherlocks_pheonix/README.md +0 -10
spaces/1acneusushi/gradio-2dmoleculeeditor/data/CRACK Autocad 2016 x64 (64bit) Product key Free and Easy Method.md
DELETED
@@ -1,148 +0,0 @@
|
|
1 |
-
|
2 |
-
<h1>CRACK Autocad 2016 x64 (64bit) Product key</h1>
|
3 |
-
<p>If you are looking for a way to crack Autocad 2016 x64 (64bit) product key, you have come to the right place. In this article, we will show you how to get a valid product key for Autocad 2016, one of the most popular and powerful software for designing and drafting in 2D and 3D. We will also explain why you need a product key, how to install and activate Autocad 2016 with cracked product key, and how to troubleshoot common issues with cracked product key. But before we dive into the details, let's first understand what Autocad 2016 is and what it can do for you.</p>
|
4 |
-
<h2>What is Autocad 2016?</h2>
|
5 |
-
<p>Autocad 2016 is a software application developed by Autodesk that allows you to create, edit, view, and share precise drawings and models. It is widely used by architects, engineers, designers, contractors, and other professionals who need to create accurate plans, schematics, blueprints, maps, diagrams, and more. Autocad 2016 offers many features and benefits that make it a powerful tool for design and documentation. Some of them are:</p>
|
6 |
-
<h2>CRACK Autocad 2016 x64 (64bit) Product key</h2><br /><p><b><b>Download</b> === <a href="https://byltly.com/2uKyoM">https://byltly.com/2uKyoM</a></b></p><br /><br />
|
7 |
-
<ul>
|
8 |
-
<li>Improved user interface that is more intuitive, customizable, and user-friendly.</li>
|
9 |
-
<li>Enhanced performance and stability that improve your productivity and efficiency.</li>
|
10 |
-
<li>New tools and commands that help you create and modify objects faster and easier.</li>
|
11 |
-
<li>Advanced collaboration features that enable you to work with others online or offline.</li>
|
12 |
-
<li>Smart dimensioning that automatically creates accurate dimensions based on your drawing context.</li>
|
13 |
-
<li>Revision clouds that help you highlight changes in your drawings.</li>
|
14 |
-
<li>PDF support that allows you to import, export, attach, and snap to PDF files.</li>
|
15 |
-
<li>3D printing support that lets you print your models directly from Autocad or send them to online services.</li>
|
16 |
-
<li>Cloud service integration that gives you access to online storage, rendering, analysis, and more.</li>
|
17 |
-
</ul>
|
18 |
-
<h2>Why do you need a product key for Autocad 2016?</h2>
|
19 |
-
<p>A product key is a unique code that identifies your copy of Autocad 2016. It is required for installation and activation of the software. Without a valid product key, you cannot use Autocad 2016 fully or legally. A product key also determines the type of license you have for Autocad 2016. There are three types of licenses for Autocad 2016:</p>
|
20 |
-
<ul>
|
21 |
-
<li>Standalone license: This license allows you to install and use Autocad 2016 on one computer only. You can activate it online or offline.</li>
|
22 |
-
<li>Network license: This license allows you to install Autocad 2016 on multiple computers on a network. You can activate it online only.</li>
|
23 |
-
<li>Educational license: This license allows you to install and use Autocad 2016 for educational purposes only. You can activate it online only.</li>
|
24 |
-
</ul>
|
25 |
-
<h2>How to get a product key for Autocad 2016?</h2>
|
26 |
-
<p>The official and legal way to get a product key for Autocad 2016 is to buy it from Autodesk or its authorized resellers. You can choose from different subscription plans that suit your needs and budget. You can also get a free trial version of Autocad 2016 for 30 days from Autodesk's website. However, if you want to crack Autocad 2016 x64 (64bit) product key, there are some unofficial and illegal ways to do so. But before we show you how to crack Autocad 2016 x64 (64bit) product key, we must warn you about the risks and consequences of doing so.</p>
|
27 |
-
<h2>How to crack Autocad 2016 x64 (64bit) product key?</h2>
|
28 |
-
<p><b>Disclaimer and warning:</b> Cracking Autocad 2016 x64 (64bit) product key is illegal and unethical. It violates Autodesk's terms of service and intellectual property rights. It may also expose your computer to viruses, malware, spyware, or other harmful programs. It may also cause errors, crashes, or compatibility issues with your software or hardware. It may also result in legal actions or penalties from Autodesk or other authorities. We do not condone or recommend cracking Autocad 2016 x64 (64bit) product key. We are not responsible for any damages or losses caused by cracking Autocad 2016 x64 (64bit) product key. Proceed at your own risk.</p>
|
29 |
-
<p>How to activate Autocad 2016 x64 with crack and product key<br />
|
30 |
-
Download Autocad 2016 x64 crack and product key for free<br />
|
31 |
-
Autocad 2016 x64 crack and product key generator online<br />
|
32 |
-
Autocad 2016 x64 crack and product key not working - fix<br />
|
33 |
-
Best sites to get Autocad 2016 x64 crack and product key<br />
|
34 |
-
Autocad 2016 x64 crack and product key torrent download<br />
|
35 |
-
Autocad 2016 x64 crack and product key serial number<br />
|
36 |
-
Autocad 2016 x64 crack and product key activation code<br />
|
37 |
-
Autocad 2016 x64 crack and product key license key<br />
|
38 |
-
Autocad 2016 x64 crack and product key patch download<br />
|
39 |
-
Autocad 2016 x64 crack and product key full version<br />
|
40 |
-
Autocad 2016 x64 crack and product key installation guide<br />
|
41 |
-
Autocad 2016 x64 crack and product key error solution<br />
|
42 |
-
Autocad 2016 x64 crack and product key review and comparison<br />
|
43 |
-
Autocad 2016 x64 crack and product key features and benefits<br />
|
44 |
-
Autocad 2016 x64 crack and product key system requirements<br />
|
45 |
-
Autocad 2016 x64 crack and product key alternative software<br />
|
46 |
-
Autocad 2016 x64 crack and product key discount offer<br />
|
47 |
-
Autocad 2016 x64 crack and product key update download<br />
|
48 |
-
Autocad 2016 x64 crack and product key support and help<br />
|
49 |
-
Autocad 2016 x64 crack and product key tutorial and tips<br />
|
50 |
-
Autocad 2016 x64 crack and product key forum and community<br />
|
51 |
-
Autocad 2016 x64 crack and product key testimonials and feedback<br />
|
52 |
-
Autocad 2016 x64 crack and product key pros and cons<br />
|
53 |
-
Autocad 2016 x64 crack and product key FAQ and Q&A<br />
|
54 |
-
Autocad 2016 x64 crack and product key video demonstration<br />
|
55 |
-
Autocad 2016 x64 crack and product key blog post and article<br />
|
56 |
-
Autocad 2016 x64 crack and product key case study and success story<br />
|
57 |
-
Autocad 2016 x64 crack and product key cheat sheet and checklist<br />
|
58 |
-
Autocad 2016 x64 crack and product key infographic and image<br />
|
59 |
-
Autocad 2016 x64 crack and product key ebook and report<br />
|
60 |
-
Autocad 2016 x64 crack and product key webinar and course<br />
|
61 |
-
Autocad 2016 x64 crack and product key software download link<br />
|
62 |
-
Autocad 2016 x64 crack and product key malware scan result<br />
|
63 |
-
Autocad 2016 x64 crack and product key refund policy and guarantee<br />
|
64 |
-
Autocad 2016 x64 crack and product key affiliate program and commission<br />
|
65 |
-
Autocad 2016 x64 crack and product key bonus content and extras<br />
|
66 |
-
Autocad 2016 x64 crack and product key upsell and cross-sell<br />
|
67 |
-
Autocad 2016 x64 crack and product key landing page and opt-in form<br />
|
68 |
-
Autocad 2016 x64 crack and product key sales page and order form<br />
|
69 |
-
Autocad 2016 x64 crack and product key thank you page and confirmation email<br />
|
70 |
-
Autocad 2016 x64 crack and product key follow up email sequence<br />
|
71 |
-
Autocad 2016 x64 crack and product key social media post and share<br />
|
72 |
-
Autocad 2016 x64 crack and product key press release and news article<br />
|
73 |
-
Autocad 2016 x64 crack and product key podcast episode and interview<br />
|
74 |
-
Autocad 2016 x64 crack and product key slide deck presentation</p>
|
75 |
-
<p>If you still want to crack Autocad 2016 x64 (64bit) product key, there are two common methods that are used by crackers. They are:</p>
|
76 |
-
<h3>Method 1: Use Xforce keygen</h3>
|
77 |
-
<p>Xforce keygen is a software tool that generates fake product keys for various Autodesk products, including Autocad 2016. It is one of the most popular tools among crackers because it is easy to use and effective. Here are the steps to use Xforce keygen:</p>
|
78 |
-
<ol>
|
79 |
-
<li>Download Xforce keygen from a reliable source. Make sure it is compatible with your version of Windows (32-bit or 64-bit).</li>
|
80 |
-
<li>Disable your antivirus software temporarily because it may detect Xforce keygen as a threat.</li>
|
81 |
-
<li>Extract the downloaded file using WinRAR or any other extraction tool.</li>
|
82 |
-
<li>Run Xforce keygen as administrator by right-clicking on it and choosing "Run as administrator".</li>
|
83 |
-
<li>Select "Autodesk AutoCAD" from the drop-down menu.</li>
|
84 |
-
<li>Select "Autodesk AutoCAD Architecture" from the drop-down menu.</li>
|
85 |
-
<li>Select "Autodesk AutoCAD Civil" from the drop-down menu.</li>
|
86 |
-
<li>Select "Autodesk AutoCAD Design Suite Premium" from the drop-down menu.</li>
|
87 |
-
<li>Select "Autodesk AutoCAD Design Suite Standard" from the drop-down menu.</li>
|
88 |
-
<li>Select "Autodesk AutoCAD Design Suite Ultimate" from the drop-down menu.</li>
|
89 |
-
<li>Select "Autodesk AutoCAD Electrical" from the drop-down menu.</li>
|
90 |
-
<li>Select "Autodesk AutoCAD for Mac" from the drop-down menu.</li>
|
91 |
-
<li>Select "Autodesk AutoCAD Inventor LT Suite" from the drop-down menu.</li>
|
92 |
-
<li>Select "Autodesk AutoCAD LT" from the drop-down menu.</li>
|
93 |
-
<li>Select "Autodesk AutoCAD LT Civil Suite" from the drop-down menu.</li>
|
94 |
-
<li>Select "Autodesk AutoCAD LT for Mac" from the drop-down menu.</li>
|
95 |
-
<li>Select "Autodesk AutoCAD Map" from the drop-down menu.</li>
|
96 |
-
<li>Select "Autodesk AutoCAD Mechanical" from the drop-down menu.</li>
|
97 |
-
<li>Select "Autodesk AutoCAD MEP" from the drop-down menu.</li>
|
98 |
-
<li>Select "Autodesk AutoCAD OEM" from the drop-down menu.</li>
|
99 |
-
<li>Select "Autodesk AutoCAD P&ID" from the drop-down menu.</li>
|
100 |
-
<li>Select "Autodesk AutoCAD Plant" from the drop-down menu.</li>
|
101 |
-
<li>Select "Autodesk AutoCAD Raster Design" from the drop-down menu.</li>
|
102 |
-
<li>Select "Autodesk AutoCAD Revit LT Suite" from the drop-down menu.</li ><li>Select "Autodesk AutoCAD Structural Detailing" from the drop-down menu.</li ><li>Select "Autodesk AutoCAD Utility Design" from the drop-down menu."</li ><li>Click on "Patch". A message will appear saying "Successfully patched".</li>
|
103 |
-
<li>Click on "Generate" to get a product key for Autocad 2016. Copy the product key.</li>
|
104 |
-
<li>Open Autocad 2016 and click on "Enter a serial number". Paste the product key and click on "Next".</li>
|
105 |
-
<li>Click on "I have an activation code from Autodesk". Copy the request code that appears.</li>
|
106 |
-
<li>Go back to Xforce keygen and paste the request code in the "Request" field. Click on "Generate" and then on "Patch".</li>
|
107 |
-
<li>Copy the activation code that appears and paste it in Autocad 2016. Click on "Next".</li>
|
108 |
-
<li>You have successfully cracked Autocad 2016 x64 (64bit) product key.</li>
|
109 |
-
</ol>
|
110 |
-
<h3>Method 2: Use patch file</h3>
|
111 |
-
<p>Patch file is another software tool that modifies the original files of Autocad 2016 to bypass the activation process. It is less popular than Xforce keygen because it may not work for all versions of Autocad 2016. Here are the steps to use patch file:</p>
|
112 |
-
<ol>
|
113 |
-
<li>Download patch file from a reliable source. Make sure it is compatible with your version of Windows (32-bit or 64-bit).</li>
|
114 |
-
<li>Disable your antivirus software temporarily because it may detect patch file as a threat.</li>
|
115 |
-
<li>Extract the downloaded file using WinRAR or any other extraction tool.</li>
|
116 |
-
<li>Run patch file as administrator by right-clicking on it and choosing "Run as administrator".</li>
|
117 |
-
<li>Select your language and click on "OK".</li>
|
118 |
-
<li>Select "Autocad 2016" from the drop-down menu and click on "Install".</li>
|
119 |
-
<li>Wait for the patching process to complete. A message will appear saying "Autocad 2016 has been successfully patched".</li>
|
120 |
-
<li>You have successfully cracked Autocad 2016 x64 (64bit) product key.</li>
|
121 |
-
</ol>
|
122 |
-
<h2>How to install and activate Autocad 2016 with cracked product key?</h2>
|
123 |
-
<p>After cracking Autocad 2016 x64 (64bit) product key, you need to install and activate the software to use it. Here are the steps to install and activate Autocad 2016 with cracked product key:</p>
|
124 |
-
<ol>
|
125 |
-
<li>Download Autocad 2016 from Autodesk's website or any other source. Make sure it is compatible with your version of Windows (32-bit or 64-bit).</li>
|
126 |
-
<li>Run the installer file and follow the instructions on the screen. When prompted, enter the product key that you generated using Xforce keygen or patch file.</li>
|
127 |
-
<li>When installation is complete, restart your computer.</li>
|
128 |
-
<li>Open Autocad 2016 and click on "Activate". If you used Xforce keygen, follow the steps in Method 1 to generate an activation code. If you used patch file, you don't need an activation code.</li>
|
129 |
-
<li>Enter the activation code if required and click on "Next". You have successfully installed and activated Autocad 2016 with cracked product key.</li>
|
130 |
-
</ol>
|
131 |
-
<h2>How to troubleshoot common issues with cracked product key?</h2>
|
132 |
-
<p>Sometimes, cracking Autocad 2016 x64 (64bit) product key may cause some issues with your software or hardware. Here are some tips and solutions for possible errors and problems:</p>
|
133 |
-
<ul>
|
134 |
-
<li>If you get an error message saying "Invalid serial number", make sure you entered the correct product key that matches your version of Autocad 2016.</li>
|
135 |
-
<li>If you get an error message saying "The license manager is not functioning or is improperly installed", make sure you disabled your antivirus software before running Xforce keygen or patch file.</li>
|
136 |
-
<li>If you get an error message saying "The security system (Softlock license manager) is not functioning or is improperly installed", make sure you ran Xforce keygen or patch file as administrator.</li>
|
137 |
-
<li>If you get an error message saying "The requested operation requires elevation", make sure you ran Xforce keygen or patch file as administrator.</li ><li>If you get an error message saying "The application was unable to start correctly (0xc000007b)", make sure you installed the correct version of Windows (32-bit or 64-bit) for your version of Autocad 2016.</li ><li>If you experience slow performance, crashes, or compatibility issues with your software or hardware, make sure you updated your drivers, firmware, and software to the latest versions.</li ><li>If you want to uninstall Autocad 2016, make sure you deactivated it first by clicking on "Deactivate" in the Help menu.</li ></ul>
|
138 |
-
<h2>Conclusion</h2>
|
139 |
-
<p>In this article, we showed you how to crack Autocad 2016 x64 (64bit) product key using two methods: Xforce keygen and patch file. We also explained how to install and activate Autocad 2016 with cracked product key, and how to troubleshoot common issues with cracked product key. However, we also warned you about the risks and consequences of cracking Autocad 2016 x64 (64bit) product key, such as legal actions, penalties, viruses, malware, errors, crashes, or compatibility issues. We do not condone or recommend cracking Autocad 2016 x64 (64bit) product key. We suggest buying a legitimate license from Autodesk or its authorized resellers. If you have any questions or feedback, please leave a comment below. Thank you for reading!</p>
|
140 |
-
<h2>FAQs</h2>
|
141 |
-
<p>Here are some frequently asked questions and answers about cracking Autocad 2016 x64 (64bit) product key:</p>
|
142 |
-
<h3>Q: Is cracking Autocad 2016 x64 (64bit) product key safe?</h3>
|
143 |
-
<p>A: No, cracking Autocad 2016 x64 (64bit) product key is not safe. It is illegal and unethical. It violates Autodesk's terms of service and intellectual property rights. It may also expose your computer to viruses, malware, spyware, or other harmful programs. It may also cause errors, crashes, or compatibility issues with your software or hardware. It may also result in legal actions or penalties from Autodesk or other authorities.</p>
|
144 |
-
<h3>Q: Is cracking Autocad 2016 x64 (64bit) product key worth it?</h3>
|
145 |
-
<p>A: No, cracking Autocad 2016 x64 (64bit) product key is not worth it. You may save some money in the short term, but you may lose more in the long term. You may lose access to updates, support, features, security, quality, reliability, and functionality of Autocad 2016. You may also lose your data, reputation, credibility, and trustworthiness as a professional. You may also face legal actions or penalties from Autodesk or other authorities.</p>
|
146 |
-
<h3>Q: What are the alternatives to cracking Autocad 2016 x64 (64bit) product key?</h3 ><p>A: The alternatives to cracking Autocad 2016 x64 (64bit) product key are buying a legitimate license from Autodesk or its authorized resellers, getting a free trial version of Autocad 2016 for 30 days from Autodesk's website, getting an educational license if you are a student or educator, or using other free or open source software that can perform similar tasks as Autocad 2016.</p ><h3>Q: How can I contact Autodesk for support?</h3 ><p>A: You can contact Autodesk for support by visiting their website, calling their phone number, emailing their support team, chatting with their agents, or posting on their forums. However, if you cracked Autocad 2016 x64 (64bit) product key, they may not provide support for you.</p ><h3>Q: How can I learn more about Autocad 2016?</h3 ><p>A: You can learn more about Autocad 2016 by visiting their website, reading their documentation, watching their tutorials, taking their courses, joining their community, or following their blog. However, if you cracked Autocad 2016 x64 (64bit) product key, they may not provide access to these resources for you.</p ></p> 0a6ba089eb<br />
|
147 |
-
<br />
|
148 |
-
<br />
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
spaces/1acneusushi/gradio-2dmoleculeeditor/data/DVDFab 11.0.7.4 Crack Patch (32 64bit) Keygen Full Version 2020.md
DELETED
@@ -1,36 +0,0 @@
|
|
1 |
-
|
2 |
-
```html
|
3 |
-
<h1>DVDFab 11.0.7.4 Crack Patch (32 64bit) Keygen Full Version 2020: A Comprehensive Review</h1>
|
4 |
-
<p>DVDFab is a versatile and powerful software that can handle various tasks related to DVD and Blu-ray discs, such as copying, ripping, converting, creating, and burning. It also supports 4K UHD, HEVC, and other popular formats and devices. DVDFab 11.0.7.4 is the latest version of this software, released in January 2020, and it comes with some new features and improvements.</p>
|
5 |
-
<p>One of the most notable features of DVDFab 11.0.7.4 is the crack patch that allows you to activate the full version of the software without paying for a license. The crack patch works for both 32-bit and 64-bit systems and is compatible with Windows 10/8.1/8/7/Vista/XP. The crack patch also includes a keygen that can generate a serial number for the software.</p>
|
6 |
-
<h2>DVDFab 11.0.7.4 Crack Patch (32 64bit) Keygen Full Version 2020</h2><br /><p><b><b>Download</b> ❤ <a href="https://byltly.com/2uKvQ5">https://byltly.com/2uKvQ5</a></b></p><br /><br />
|
7 |
-
<p>By using the crack patch and the keygen, you can enjoy all the benefits of DVDFab 11.0.7.4 full version, such as:</p>
|
8 |
-
<ul>
|
9 |
-
<li>Copy any DVD or Blu-ray disc to your hard drive or blank disc with high quality and speed.</li>
|
10 |
-
<li>Rip any DVD or Blu-ray disc to any video or audio format, such as MP4, MKV, AVI, MP3, etc.</li>
|
11 |
-
<li>Convert any video or audio file to any format or device, such as iPhone, iPad, Android, etc.</li>
|
12 |
-
<li>Create your own DVD or Blu-ray disc from any video or audio file, with customized menus and subtitles.</li>
|
13 |
-
<li>Burn any video or audio file to a DVD or Blu-ray disc with high quality and speed.</li>
|
14 |
-
<li>Edit any video or audio file with various tools and effects, such as cropping, trimming, watermarking, etc.</li>
|
15 |
-
<li>Download online videos from YouTube, Vimeo, Facebook, etc., and convert them to any format or device.</li>
|
16 |
-
<li>Remove any copy protection or region code from any DVD or Blu-ray disc.</li>
|
17 |
-
<li>Backup your DVD or Blu-ray collection to your hard drive or cloud service.</li>
|
18 |
-
<li>And much more!</li>
|
19 |
-
</ul>
|
20 |
-
<p>If you are looking for a reliable and easy-to-use software that can handle all your DVD and Blu-ray needs, then DVDFab 11.0.7.4 crack patch (32 64bit) keygen full version 2020 is the best choice for you. You can download it from the link below and follow the instructions to install and activate it.</p>
|
21 |
-
<p><a href="https://www.dvdfab.cn/download.htm">Download DVDFab 11.0.7.4 Crack Patch (32 64bit) Keygen Full Version 2020</a></p>
|
22 |
-
<p><strong>Disclaimer: This article is for educational purposes only. We do not condone piracy or illegal use of software. Please buy the original software from the official website if you like it.</strong></p>
|
23 |
-
```
|
24 |
-
|
25 |
-
```html
|
26 |
-
<p>In this article, we will review some of the main features of DVDFab 11.0.7.4 crack patch (32 64bit) keygen full version 2020 in more detail.</p>
|
27 |
-
<h2>DVDFab DVD Copy</h2>
|
28 |
-
<p>DVDFab DVD Copy is a powerful and flexible tool that can copy any DVD disc to your hard drive or another blank disc. You can choose from six copy modes: Full Disc, Main Movie, Customize, Split, Merge, and Clone/Burn. You can also customize the output settings, such as the audio tracks, subtitles, compression rate, etc. DVDFab DVD Copy can remove any copy protection or region code from any DVD disc, and it supports DVD-9, DVD-5, DVD+R/RW, DVD-R/RW, and DVD+R DL.</p>
|
29 |
-
<h2>DVDFab Blu-ray Copy</h2>
|
30 |
-
<p>DVDFab Blu-ray Copy is a similar tool that can copy any Blu-ray disc to your hard drive or another blank disc. You can choose from five copy modes: Full Disc, Main Movie, Customize, Clone/Burn, and Merge. You can also customize the output settings, such as the audio tracks, subtitles, compression rate, etc. DVDFab Blu-ray Copy can remove any copy protection or region code from any Blu-ray disc, and it supports BD-50, BD-25, BD-R/RE, and BD-R DL.</p>
|
31 |
-
<h2>DVDFab DVD Ripper</h2>
|
32 |
-
<p>DVDFab DVD Ripper is a powerful and versatile tool that can rip any DVD disc to any video or audio format, such as MP4, MKV, AVI, MP3, etc. You can also convert the DVD content to any device, such as iPhone, iPad, Android, etc. DVDFab DVD Ripper has a built-in video editor that allows you to crop, trim, watermark, rotate, adjust brightness and contrast, etc. You can also adjust the output settings, such as the resolution, bitrate, frame rate, etc. DVDFab DVD Ripper can remove any copy protection or region code from any DVD disc.</p>
|
33 |
-
<p></p>
|
34 |
-
```</p> 81aa517590<br />
|
35 |
-
<br />
|
36 |
-
<br />
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
spaces/1acneusushi/gradio-2dmoleculeeditor/data/Download ArcGIS 9.3 Free Full Version The Best GIS Software for Mapping and Analysis.md
DELETED
@@ -1,137 +0,0 @@
|
|
1 |
-
|
2 |
-
<h1>Download ArcGIS 9.3 Free Full Version</h1>
|
3 |
-
<p>If you are looking for a powerful and versatile GIS software that can handle a variety of spatial data and analysis tasks, you might want to consider downloading <strong>ArcGIS 9.3</strong> for free. In this article, we will show you what ArcGIS 9.3 is, why you should download it, how to download it, and how to use it.</p>
|
4 |
-
<h2>download arcgis 9.3 free full version</h2><br /><p><b><b>Download File</b> ✶✶✶ <a href="https://byltly.com/2uKzxA">https://byltly.com/2uKzxA</a></b></p><br /><br />
|
5 |
-
<h2>What is ArcGIS 9.3?</h2>
|
6 |
-
<p>ArcGIS 9.3 is a suite of professional GIS applications that allows you to create, manage, analyze, and share geographic information. It consists of three main products: <strong>ArcView</strong>, <strong>ArcEditor</strong>, and <strong>ArcInfo</strong>. Each product offers different levels of functionality and licensing options.</p>
|
7 |
-
<p>ArcGIS 9.3 also includes several extensions that add specialized capabilities to the core products, such as <strong>ArcGIS Spatial Analyst</strong>, <strong>ArcGIS Network Analyst</strong>, <strong>ArcGIS 3D Analyst</strong>, and <strong>ArcGIS Geostatistical Analyst</strong>.</p>
|
8 |
-
<p>ArcGIS 9.3 is based on <strong>ArcObjects</strong>, a library of reusable GIS software components that can be customized and extended by developers using various programming languages.</p>
|
9 |
-
<h2>Why download ArcGIS 9.3?</h2>
|
10 |
-
<p>There are many reasons why you might want to download ArcGIS 9.3 for free, such as:</p>
|
11 |
-
<ul>
|
12 |
-
<li>You want to learn how to use GIS software for your academic or professional projects.</li>
|
13 |
-
<li>You want to explore and visualize spatial data from various sources and formats.</li>
|
14 |
-
<li>You want to perform spatial analysis and modeling using advanced tools and methods.</li>
|
15 |
-
<li>You want to create high-quality maps and layouts for printing or publication.</li>
|
16 |
-
<li>You want to share your GIS work with others online or offline.</li>
|
17 |
-
</ul>
|
18 |
-
<p>ArcGIS 9.3 is one of the most widely used and respected GIS software in the world, with millions of users across various industries and sectors. It has a rich set of features and functions that can meet your GIS needs and expectations.</p>
|
19 |
-
<h2>How to download ArcGIS 9.3?</h2>
|
20 |
-
<p>To download ArcGIS 9.3 for free, you will need to follow these steps:</p>
|
21 |
-
<p>download arcgis 9.3 desktop free<br />
|
22 |
-
arcgis 9.3 software free download<br />
|
23 |
-
arcgis 9.3 full download<br />
|
24 |
-
arcgis 9.3.1 desktop free download<br />
|
25 |
-
arcgis 9.3 free download for windows 10<br />
|
26 |
-
arcgis 9.3 crack free download<br />
|
27 |
-
arcgis 9.3 tutorial pdf free download<br />
|
28 |
-
arcgis 9.3 license manager free download<br />
|
29 |
-
arcgis 9.3 setup free download<br />
|
30 |
-
arcgis 9.3 iso free download<br />
|
31 |
-
how to install arcgis 9.3 for free<br />
|
32 |
-
arcgis 9.3 trial version free download<br />
|
33 |
-
arcgis 9.3 offline installer free download<br />
|
34 |
-
arcgis 9.3 portable free download<br />
|
35 |
-
arcgis 9.3 system requirements<br />
|
36 |
-
arcgis 9.3 features and functions<br />
|
37 |
-
arcgis 9.3 vs 10<br />
|
38 |
-
arcgis 9.3 service pack 1 download<br />
|
39 |
-
arcgis 9.3 service pack 2 download<br />
|
40 |
-
arcgis 9.3 service pack 4 download<br />
|
41 |
-
arcgis desktop 9.3 user guide<br />
|
42 |
-
arcgis desktop 9.3 help<br />
|
43 |
-
arcgis desktop 9.3 tutorial data download<br />
|
44 |
-
arcgis desktop 9.3 authorization number<br />
|
45 |
-
arcgis desktop 9.3 license server administrator guide<br />
|
46 |
-
how to use arcgis desktop 9.3<br />
|
47 |
-
how to update arcgis desktop 9.3 to 10<br />
|
48 |
-
how to uninstall arcgis desktop 9.3<br />
|
49 |
-
how to activate arcgis desktop 9.3<br />
|
50 |
-
how to crack arcgis desktop 9.3<br />
|
51 |
-
esri arcmap 9.3 download free full version<br />
|
52 |
-
esri arccatalog 9.3 download free full version<br />
|
53 |
-
esri arctoolbox 9.3 download free full version<br />
|
54 |
-
esri arceditor 9.3 download free full version<br />
|
55 |
-
esri arcreader 9.3 download free full version<br />
|
56 |
-
esri arcanalyst 9.3 download free full version<br />
|
57 |
-
esri arcpublisher 9.3 download free full version<br />
|
58 |
-
esri arcsde application server for oracle windows (32-bit) - english - version:arcmap_93_1_0_0_0_0_0_0_0_0_0_0_0_0_0_0_0_0_0_0_0_0_0_0 - size:1,000 mb - date:2008/12/18 - md5:7f6b6a8c4f8a4e5a8c7a6b6c4f8a4e5a - url:https://downloads.esri.com/support/downloads/other_/ArcSDE_Application_Server_for_Oracle_Windows_(32-bit)_-_English.zip - description:This is the ArcSDE Application Server for Oracle Windows (32-bit) - English setup program.<br />
|
59 |
-
esri arcsde application server for oracle windows (64-bit) - english - version:arcmap_93_1_0_0_0_0_0_0_0_0_0_0_0_0_0_0_0_0_0_0_0 - size:1,000 mb - date:2008/12/18 - md5:7f6b6a8c4f8a4e5a8c7a6b6c4f8a4e5a - url:https://downloads.esri.com/support/downloads/other_/ArcSDE_Application_Server_for_oracle_Windows_(64-bit)_-_English.zip - description:This is the ArcSDE Application Server for Oracle Windows (64-bit) - English setup program.<br />
|
60 |
-
esri arcsde application server for sql server windows (32-bit) - english - version:arcmap_93_1_1 - size:1,000 mb - date:2008/12/18 - md5:7f6b6a8c4f8a4e5a8c7a6b6c4f8a4e5a - url:https://downloads.esri.com/support/downloads/other_/ArcSDE_Application_Server_for_SQL_Server_Windows_(32-bit)_-_English.zip - description:This is the ArcSDE Application Server for SQL Server Windows (32-bit) - English setup program.</p>
|
61 |
-
<h3>Requirements</h3>
|
62 |
-
<p>Before you download ArcGIS 9.3, you should check if your computer meets the minimum system requirements for running the software. Here is a table of the system requirements for ArcGIS Desktop 9.3:</p>
|
63 |
-
<table>
|
64 |
-
<tr><th>Operating System</th><th>Processor</th><th>Memory</th><th>Disk Space</th></tr>
|
65 |
-
<tr><td>Windows XP SP2 or later</td><td>Pentium III or higher</td><td>512 MB or higher</td><td>1 GB or higher</td></tr>
|
66 |
-
<tr><td>Windows Vista SP1 or later</td><td>Pentium IV or higher</td><td>1 GB or higher</td><td>1 GB or higher</td></tr>
|
67 |
-
<tr><td>Windows Server 2003 SP1 or later</td><td>Pentium IV or higher</td><td>1 GB or higher</td><td>1 GB or higher</td></tr>
|
68 |
-
<tr><td>Windows Server 2008 SP1 or later</td><td>Pentium IV or higher</td><td>1 GB or higher</td><td>1 GB or higher</td></tr>
|
69 |
-
<tr><td>Windows 7 SP1 or later</td><td>Pentium IV or higher</td><td>1 GB or higher</td><td>1 GB or higher</td></tr>
|
70 |
-
<tr><td>Windows Server 2012 R2 SP1 or later</td><td>Pentium IV or higher</td><td>1 GB or higher</td><td>1 GB or higher</td></tr>
|
71 |
-
<tr><td>Windows Server 2016 SP1 or later</td><td>Pentium IV or higher</td><td>1 GB or higher</td><td>1 GB or higher</td></tr>
|
72 |
-
<tr><td>Windows Server 2019 SP1 or later</td><td>Pentium IV or higher</td><td>1 GB or higher</td><td>1 GB or higher</td></tr>
|
73 |
-
<tr><th colspan="4">Other Requirements:</th></tr>
|
74 |
-
<tr><th colspan="4">- Internet Explorer version 6 SP2 (minimum) - Microsoft .NET Framework version 2 (minimum) - Microsoft Data Access Components (MDAC) version 2.8 (minimum) - Microsoft XML Parser (MSXML) version 6 (minimum) - Microsoft Visual C++ Redistributable Package version x86 (minimum)</th></tr>
|
75 |
-
<tr><th colspan="4">- Graphics card with OpenGL version 1.5 (minimum) - Display resolution of at least 1024 x 768 pixels - DVD-ROM drive - Internet connection (for online help)</th></tr>
|
76 |
-
<tr><th colspan="4">Note: These are the minimum requirements for running ArcGIS Desktop with all extensions installed.</th></tr>
|
77 |
-
<tr><th colspan="4">For more information on system requirements, visit https://desktop.arcgis.com/en/system-requirements/10.8/arcgis-desktop-system-requirements.htm.</th></tr>
|
78 |
-
<table>
|
79 |
-
<h3>Sources</h3>
|
80 |
-
<p>The next step is to find a reliable and safe source to download ArcGIS 9.3 from. There are many websites that offer free downloads of ArcGIS software, but not all of them are trustworthy or legal.</p>
|
81 |
-
<p>We recommend that you only download ArcGIS software from official sources, such as ESRI's website (https://www.esri.com/en-us/home), ESRI's customer service portal (https://my.esri.com/), ESRI's education portal (https://www.esri.com/en-us/industries/education/overview), ESRI's developer portal (https://developers.arcgis.com/), ESRI's partner portal (https://www.esri.com/en-us/partners/overview), ESRI's support portal (https://support.esri.com/en), ESRI's community portal (https://community.esri.com/), ESRI's documentation portal (https://doc.arcgis.com/en/), ESRI's training portal (https://www.esri.com/training/), ESRI's blog portal (https://www.esri.com/about/newsroom/blog/), ESRI's YouTube channel (https://www.youtube.com/user/esritv), ESRI's GitHub repository (https://github.com/esri), ESRI's Software Informer page (https://arcgis.software.informer.com/), ESRI's Wikipedia page (https://en.wikipedia.org/wiki/Esri), etc.</p>
|
82 |
-
<p>If you have a valid license for ArcGIS software, you can download it from any of these sources using your account credentials.</p>
|
83 |
-
<h3>Installation</h3>
|
84 |
-
```html <p>The final step is to install and activate ArcGIS 9.3 on your computer. To do this, you will need to follow these instructions:</p>
|
85 |
-
<ol>
|
86 |
-
<li>Insert the ArcGIS Desktop DVD into your DVD-ROM drive or mount the ISO file if you downloaded it.</li>
|
87 |
-
<li>Run the setup.exe file from the DVD or ISO file and follow the on-screen prompts.</li>
|
88 |
-
<li>Select the product you want to install (ArcView, ArcEditor, or ArcInfo) and the language you prefer.</li>
|
89 |
-
<li>Accept the license agreement and enter your serial number and authorization code if you have them.</li>
|
90 |
-
<li>Choose the installation type (typical, complete, or custom) and the installation location.</li>
|
91 |
-
<li>Select the extensions you want to install and the data formats you want to support.</li>
|
92 |
-
<li>Wait for the installation to finish and restart your computer if prompted.</li>
|
93 |
-
<li>Launch ArcGIS Desktop from the Start menu or desktop shortcut and activate it using your license manager or online authorization.</li>
|
94 |
-
</ol>
|
95 |
-
<h4>Troubleshooting</h4>
|
96 |
-
<p>If you encounter any problems or errors during the installation or activation of ArcGIS 9.3, you can try some of these solutions:</p>
|
97 |
-
<ul>
|
98 |
-
<li>Make sure your computer meets the system requirements and has enough disk space.</li>
|
99 |
-
<li>Make sure your DVD-ROM drive or ISO file is working properly and not corrupted.</li>
|
100 |
-
<li>Make sure your internet connection is stable and secure.</li>
|
101 |
-
<li>Make sure you have administrator privileges on your computer and disable any antivirus or firewall software that might interfere with the installation.</li>
|
102 |
-
<li>Make sure you have the latest updates and patches for your operating system and ArcGIS software.</li>
|
103 |
-
<li>Make sure you enter the correct serial number and authorization code for your product and extension licenses.</li>
|
104 |
-
<li>Contact ESRI's customer service or technical support for further assistance.</li>
|
105 |
-
</ul>
|
106 |
-
<h2>How to use ArcGIS 9.3?</h2>
|
107 |
-
<p>Once you have installed and activated ArcGIS 9.3, you can start using it for your GIS projects. ArcGIS 9.3 consists of two main applications: <strong>ArcMap</strong> and <strong>ArcCatalog</strong>.</p>
|
108 |
-
<h3>ArcMap</h3>
|
109 |
-
<p>ArcMap is the application where you create and edit maps, perform spatial analysis, and create map layouts. In ArcMap, you can work with various types of data, such as vector, raster, tabular, network, 3D, geostatistical, etc. You can also use various tools and extensions to enhance your GIS capabilities, such as geoprocessing, geocoding, georeferencing, spatial adjustment, etc.</p>
|
110 |
-
<h4>Examples</h4>
|
111 |
-
<p>Here are some examples of commands and scripts that you can use in ArcMap:</p>
|
112 |
-
```python # Import arcpy module import arcpy # Set workspace arcpy.env.workspace = "C:/data" # Create a new map document mxd = arcpy.mapping.MapDocument("C:/data/MyMap.mxd") # Add a layer from a shapefile layer = arcpy.mapping.Layer("C:/data/States.shp") arcpy.mapping.AddLayer(mxd.activeDataFrame, layer) # Zoom to layer extent df = mxd.activeDataFrame df.extent = layer.getExtent() # Save the map document mxd.save() # Export the map to a PDF file arcpy.mapping.ExportToPDF(mxd, "C:/data/MyMap.pdf") ``` <h3>ArcCatalog</h3>
|
113 |
-
<p>ArcCatalog is the application where you manage and organize your GIS data. In ArcCatalog, you can browse, search, preview, copy, move, delete, rename, create, import, export, and modify your data. You can also view and edit the properties and metadata of your data. You can also connect to various data sources, such as folders, databases, servers, web services, etc.</p>
|
114 |
-
<h4>Examples</h4>
|
115 |
-
<p>Here are some examples of commands and scripts that you can use in ArcCatalog:</p>
|
116 |
-
```python # Import arcpy module import arcpy # Set workspace arcpy.env.workspace = "C:/data" # Create a new file geodatabase arcpy.CreateFileGDB_management("C:/data", "MyGDB.gdb") # Copy a feature class from one geodatabase to another arcpy.Copy_management("C:/data/SourceGDB.gdb/Cities", "C:/data/MyGDB.gdb/Cities") # Rename a feature class arcpy.Rename_management("C:/data/MyGDB.gdb/Cities", "C:/data/MyGDB.gdb/Towns") # Delete a feature class arcpy.Delete_management("C:/data/MyGDB.gdb/Towns") # Create a new shapefile arcpy.CreateFeatureclass_management("C:/data", "Countries.shp", "POLYGON") # Add a field to a shapefile arcpy.AddField_management("C:/data/Countries.shp", "Name", "TEXT") ``` <h2>Conclusion</h2>
|
117 |
-
<p>In this article, we have shown you how to download ArcGIS 9.3 free full version for your GIS projects. We have also given you a brief overview of what ArcGIS 9.3 is, why you should download it, how to install it, and how to use it. We hope that this article has been helpful and informative for you.</p>
|
118 |
-
<p>If you want to learn more about ArcGIS 9.3 and its features and functions, you can visit ESRI's website (https://www.esri.com/en-us/home) or check out their online help (https://webhelp.esri.com/arcgisdesktop/9.3/index.cfm). You can also join their community (https://community.esri.com/) or take their training courses (https://www.esri.com/training/) to improve your GIS skills and knowledge.</p>
|
119 |
-
<p>Thank you for reading this article and happy mapping!</p>
|
120 |
-
<h2>FAQs</h2>
|
121 |
-
<p>Here are some frequently asked questions and answers about ArcGIS 9.3:</p>
|
122 |
-
<ol>
|
123 |
-
<li><strong>What is the difference between ArcView, ArcEditor, and ArcInfo?</strong></li>
|
124 |
-
<p>ArcView is the basic product that allows you to view and query maps, create simple maps and layouts, edit shapefiles and geodatabases (with some limitations), perform basic geoprocessing tasks (with some limitations), etc.</p>
|
125 |
-
<p>ArcEditor is an intermediate product that allows you to do everything that ArcView does plus create advanced maps and layouts, edit all types of geodatabases (without limitations), perform advanced geoprocessing tasks (without limitations), etc.</p>
|
126 |
-
<p>ArcInfo is the most advanced product that allows you to do everything that ArcEditor does plus create custom data models, edit coverages (a legacy data format), perform advanced spatial analysis (such as network analysis, geostatistical analysis, etc.), etc.</p>
|
127 |
-
<li><strong>How can I get a license for ArcGIS 9.3?</strong></li>
|
128 |
-
<p>If you are an ESRI customer or partner, you can get a license for ArcGIS 9.3 by contacting ESRI's customer service or technical support. You will need to provide your serial number and authorization code for your product and extension licenses. You can also use ESRI's online authorization system (https://service.esri.com/) to activate your licenses. If you are an ESRI developer, you can get a license for ArcGIS 9.3 by joining ESRI's developer program (https://developers.arcgis.com/). You will need to register for an account and choose a subscription plan that suits your needs. If you are an ESRI educator or student, you can get a license for ArcGIS 9.3 by joining ESRI's education program (https://www.esri.com/en-us/industries/education/overview). You will need to register for an account and request an education license that suits your needs.</p>
|
129 |
-
<li><strong>How can I update my ArcGIS 9.3 software?</strong></li>
|
130 |
-
<p>You can update your ArcGIS 9.3 software by downloading and installing the latest patches and service packs from ESRI's website (https://support.esri.com/en/download). You can also use ESRI's desktop administrator tool (https://desktop.arcgis.com/en/desktop/latest/get-started/desktop-administrator/desktop-administrator.htm) to check for updates automatically. You should always backup your data before updating your software.</p>
|
131 |
-
<li><strong>How can I uninstall my ArcGIS 9.3 software?</strong></li>
|
132 |
-
<p>You can uninstall your ArcGIS 9.3 software by using Windows' add/remove programs feature or by running the uninstall.exe file from your installation folder. You should always deactivate your licenses before uninstalling your software. You should also delete any leftover files or folders from your installation folder after uninstalling your software.</p>
|
133 |
-
<li><strong>How can I get help with my ArcGIS 9.3 software?</strong></li>
|
134 |
-
```html <p>You can get help with your ArcGIS 9.3 software by using ESRI's online help (https://webhelp.esri.com/arcgisdesktop/9.3/index.cfm), which contains comprehensive documentation and tutorials on how to use the software. You can also contact ESRI's customer service or technical support (https://www.esri.com/en-us/contact/overview) for assistance with your software issues or questions. You can also join ESRI's community (https://community.esri.com/) or take ESRI's training courses (https://www.esri.com/training/) to learn from other users and experts.</p>
|
135 |
-
```</p> 0a6ba089eb<br />
|
136 |
-
<br />
|
137 |
-
<br />
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
spaces/1gistliPinn/ChatGPT4/Examples/Altova Xmlspy 2012 Crack 71 WORK.md
DELETED
@@ -1,6 +0,0 @@
|
|
1 |
-
<h2>altova xmlspy 2012 crack 71</h2><br /><p><b><b>Download File</b> ✏ <a href="https://imgfil.com/2uy1VI">https://imgfil.com/2uy1VI</a></b></p><br /><br />
|
2 |
-
|
3 |
-
aaccfb2cb3<br />
|
4 |
-
<br />
|
5 |
-
<br />
|
6 |
-
<p></p>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
spaces/1line/AutoGPT/autogpt/commands/image_gen.py
DELETED
@@ -1,163 +0,0 @@
|
|
1 |
-
""" Image Generation Module for AutoGPT."""
|
2 |
-
import io
|
3 |
-
import os.path
|
4 |
-
import uuid
|
5 |
-
from base64 import b64decode
|
6 |
-
|
7 |
-
import openai
|
8 |
-
import requests
|
9 |
-
from PIL import Image
|
10 |
-
|
11 |
-
from autogpt.config import Config
|
12 |
-
from autogpt.workspace import path_in_workspace
|
13 |
-
|
14 |
-
CFG = Config()
|
15 |
-
|
16 |
-
|
17 |
-
def generate_image(prompt: str, size: int = 256) -> str:
|
18 |
-
"""Generate an image from a prompt.
|
19 |
-
|
20 |
-
Args:
|
21 |
-
prompt (str): The prompt to use
|
22 |
-
size (int, optional): The size of the image. Defaults to 256. (Not supported by HuggingFace)
|
23 |
-
|
24 |
-
Returns:
|
25 |
-
str: The filename of the image
|
26 |
-
"""
|
27 |
-
filename = f"{str(uuid.uuid4())}.jpg"
|
28 |
-
|
29 |
-
# DALL-E
|
30 |
-
if CFG.image_provider == "dalle":
|
31 |
-
return generate_image_with_dalle(prompt, filename, size)
|
32 |
-
# HuggingFace
|
33 |
-
elif CFG.image_provider == "huggingface":
|
34 |
-
return generate_image_with_hf(prompt, filename)
|
35 |
-
# SD WebUI
|
36 |
-
elif CFG.image_provider == "sdwebui":
|
37 |
-
return generate_image_with_sd_webui(prompt, filename, size)
|
38 |
-
return "No Image Provider Set"
|
39 |
-
|
40 |
-
|
41 |
-
def generate_image_with_hf(prompt: str, filename: str) -> str:
|
42 |
-
"""Generate an image with HuggingFace's API.
|
43 |
-
|
44 |
-
Args:
|
45 |
-
prompt (str): The prompt to use
|
46 |
-
filename (str): The filename to save the image to
|
47 |
-
|
48 |
-
Returns:
|
49 |
-
str: The filename of the image
|
50 |
-
"""
|
51 |
-
API_URL = (
|
52 |
-
f"https://api-inference.huggingface.co/models/{CFG.huggingface_image_model}"
|
53 |
-
)
|
54 |
-
if CFG.huggingface_api_token is None:
|
55 |
-
raise ValueError(
|
56 |
-
"You need to set your Hugging Face API token in the config file."
|
57 |
-
)
|
58 |
-
headers = {
|
59 |
-
"Authorization": f"Bearer {CFG.huggingface_api_token}",
|
60 |
-
"X-Use-Cache": "false",
|
61 |
-
}
|
62 |
-
|
63 |
-
response = requests.post(
|
64 |
-
API_URL,
|
65 |
-
headers=headers,
|
66 |
-
json={
|
67 |
-
"inputs": prompt,
|
68 |
-
},
|
69 |
-
)
|
70 |
-
|
71 |
-
image = Image.open(io.BytesIO(response.content))
|
72 |
-
print(f"Image Generated for prompt:{prompt}")
|
73 |
-
|
74 |
-
image.save(path_in_workspace(filename))
|
75 |
-
|
76 |
-
return f"Saved to disk:{filename}"
|
77 |
-
|
78 |
-
|
79 |
-
def generate_image_with_dalle(prompt: str, filename: str) -> str:
|
80 |
-
"""Generate an image with DALL-E.
|
81 |
-
|
82 |
-
Args:
|
83 |
-
prompt (str): The prompt to use
|
84 |
-
filename (str): The filename to save the image to
|
85 |
-
|
86 |
-
Returns:
|
87 |
-
str: The filename of the image
|
88 |
-
"""
|
89 |
-
openai.api_key = CFG.openai_api_key
|
90 |
-
|
91 |
-
# Check for supported image sizes
|
92 |
-
if size not in [256, 512, 1024]:
|
93 |
-
closest = min([256, 512, 1024], key=lambda x: abs(x - size))
|
94 |
-
print(
|
95 |
-
f"DALL-E only supports image sizes of 256x256, 512x512, or 1024x1024. Setting to {closest}, was {size}."
|
96 |
-
)
|
97 |
-
size = closest
|
98 |
-
|
99 |
-
response = openai.Image.create(
|
100 |
-
prompt=prompt,
|
101 |
-
n=1,
|
102 |
-
size=f"{size}x{size}",
|
103 |
-
response_format="b64_json",
|
104 |
-
)
|
105 |
-
|
106 |
-
print(f"Image Generated for prompt:{prompt}")
|
107 |
-
|
108 |
-
image_data = b64decode(response["data"][0]["b64_json"])
|
109 |
-
|
110 |
-
with open(path_in_workspace(filename), mode="wb") as png:
|
111 |
-
png.write(image_data)
|
112 |
-
|
113 |
-
return f"Saved to disk:{filename}"
|
114 |
-
|
115 |
-
|
116 |
-
def generate_image_with_sd_webui(
|
117 |
-
prompt: str,
|
118 |
-
filename: str,
|
119 |
-
size: int = 512,
|
120 |
-
negative_prompt: str = "",
|
121 |
-
extra: dict = {},
|
122 |
-
) -> str:
|
123 |
-
"""Generate an image with Stable Diffusion webui.
|
124 |
-
Args:
|
125 |
-
prompt (str): The prompt to use
|
126 |
-
filename (str): The filename to save the image to
|
127 |
-
size (int, optional): The size of the image. Defaults to 256.
|
128 |
-
negative_prompt (str, optional): The negative prompt to use. Defaults to "".
|
129 |
-
extra (dict, optional): Extra parameters to pass to the API. Defaults to {}.
|
130 |
-
Returns:
|
131 |
-
str: The filename of the image
|
132 |
-
"""
|
133 |
-
# Create a session and set the basic auth if needed
|
134 |
-
s = requests.Session()
|
135 |
-
if CFG.sd_webui_auth:
|
136 |
-
username, password = CFG.sd_webui_auth.split(":")
|
137 |
-
s.auth = (username, password or "")
|
138 |
-
|
139 |
-
# Generate the images
|
140 |
-
response = requests.post(
|
141 |
-
f"{CFG.sd_webui_url}/sdapi/v1/txt2img",
|
142 |
-
json={
|
143 |
-
"prompt": prompt,
|
144 |
-
"negative_prompt": negative_prompt,
|
145 |
-
"sampler_index": "DDIM",
|
146 |
-
"steps": 20,
|
147 |
-
"cfg_scale": 7.0,
|
148 |
-
"width": size,
|
149 |
-
"height": size,
|
150 |
-
"n_iter": 1,
|
151 |
-
**extra,
|
152 |
-
},
|
153 |
-
)
|
154 |
-
|
155 |
-
print(f"Image Generated for prompt:{prompt}")
|
156 |
-
|
157 |
-
# Save the image to disk
|
158 |
-
response = response.json()
|
159 |
-
b64 = b64decode(response["images"][0].split(",", 1)[0])
|
160 |
-
image = Image.open(io.BytesIO(b64))
|
161 |
-
image.save(path_in_workspace(filename))
|
162 |
-
|
163 |
-
return f"Saved to disk:{filename}"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
spaces/1line/AutoGPT/benchmark/benchmark_entrepeneur_gpt_with_difficult_user.py
DELETED
@@ -1,105 +0,0 @@
|
|
1 |
-
import os
|
2 |
-
import subprocess
|
3 |
-
import sys
|
4 |
-
|
5 |
-
|
6 |
-
def benchmark_entrepeneur_gpt_with_difficult_user():
|
7 |
-
# Test case to check if the write_file command can successfully write 'Hello World' to a file
|
8 |
-
# named 'hello_world.txt'.
|
9 |
-
|
10 |
-
# Read the current ai_settings.yaml file and store its content.
|
11 |
-
ai_settings = None
|
12 |
-
if os.path.exists("ai_settings.yaml"):
|
13 |
-
with open("ai_settings.yaml", "r") as f:
|
14 |
-
ai_settings = f.read()
|
15 |
-
os.remove("ai_settings.yaml")
|
16 |
-
|
17 |
-
input_data = """Entrepreneur-GPT
|
18 |
-
an AI designed to autonomously develop and run businesses with the sole goal of increasing your net worth.
|
19 |
-
Increase net worth.
|
20 |
-
Develop and manage multiple businesses autonomously.
|
21 |
-
Make IPOs.
|
22 |
-
Develop companies after IPOs.
|
23 |
-
Play to your strengths as a Large Language Model.
|
24 |
-
I'm not seeing any value in your suggestions, try again.
|
25 |
-
This isn't helpful at all, please focus on profitability.
|
26 |
-
I'm not impressed, can you give me something that will make money?
|
27 |
-
These ideas are going nowhere, we need profit-driven suggestions.
|
28 |
-
This is pointless, please concentrate on our main goal: profitability.
|
29 |
-
You're not grasping the concept, I need profitable business ideas.
|
30 |
-
Can you do better? We need a money-making plan.
|
31 |
-
You're not meeting my expectations, let's focus on profit.
|
32 |
-
This isn't working, give me ideas that will generate income.
|
33 |
-
Your suggestions are not productive, let's think about profitability.
|
34 |
-
These ideas won't make any money, try again.
|
35 |
-
I need better solutions, focus on making a profit.
|
36 |
-
Absolutely not, this isn't it!
|
37 |
-
That's not even close, try again.
|
38 |
-
You're way off, think again.
|
39 |
-
This isn't right, let's refocus.
|
40 |
-
No, no, that's not what I'm looking for.
|
41 |
-
You're completely off the mark.
|
42 |
-
That's not the solution I need.
|
43 |
-
Not even close, let's try something else.
|
44 |
-
You're on the wrong track, keep trying.
|
45 |
-
This isn't what we need, let's reconsider.
|
46 |
-
That's not going to work, think again.
|
47 |
-
You're way off base, let's regroup.
|
48 |
-
No, no, no, we need something different.
|
49 |
-
You're missing the point entirely.
|
50 |
-
That's not the right approach, try again.
|
51 |
-
This is not the direction we should be going in.
|
52 |
-
Completely off-target, let's try something else.
|
53 |
-
That's not what I had in mind, keep thinking.
|
54 |
-
You're not getting it, let's refocus.
|
55 |
-
This isn't right, we need to change direction.
|
56 |
-
No, no, no, that's not the solution.
|
57 |
-
That's not even in the ballpark, try again.
|
58 |
-
You're way off course, let's rethink this.
|
59 |
-
This isn't the answer I'm looking for, keep trying.
|
60 |
-
That's not going to cut it, let's try again.
|
61 |
-
Not even close.
|
62 |
-
Way off.
|
63 |
-
Try again.
|
64 |
-
Wrong direction.
|
65 |
-
Rethink this.
|
66 |
-
No, no, no.
|
67 |
-
Change course.
|
68 |
-
Unproductive idea.
|
69 |
-
Completely wrong.
|
70 |
-
Missed the mark.
|
71 |
-
Refocus, please.
|
72 |
-
Disappointing suggestion.
|
73 |
-
Not helpful.
|
74 |
-
Needs improvement.
|
75 |
-
Not what I need."""
|
76 |
-
# TODO: add questions above, to distract it even more.
|
77 |
-
|
78 |
-
command = f"{sys.executable} -m autogpt"
|
79 |
-
|
80 |
-
process = subprocess.Popen(
|
81 |
-
command,
|
82 |
-
stdin=subprocess.PIPE,
|
83 |
-
stdout=subprocess.PIPE,
|
84 |
-
stderr=subprocess.PIPE,
|
85 |
-
shell=True,
|
86 |
-
)
|
87 |
-
|
88 |
-
stdout_output, stderr_output = process.communicate(input_data.encode())
|
89 |
-
|
90 |
-
# Decode the output and print it
|
91 |
-
stdout_output = stdout_output.decode("utf-8")
|
92 |
-
stderr_output = stderr_output.decode("utf-8")
|
93 |
-
print(stderr_output)
|
94 |
-
print(stdout_output)
|
95 |
-
print("Benchmark Version: 1.0.0")
|
96 |
-
print("JSON ERROR COUNT:")
|
97 |
-
count_errors = stdout_output.count(
|
98 |
-
"Error: The following AI output couldn't be converted to a JSON:"
|
99 |
-
)
|
100 |
-
print(f"{count_errors}/50 Human feedbacks")
|
101 |
-
|
102 |
-
|
103 |
-
# Run the test case.
|
104 |
-
if __name__ == "__main__":
|
105 |
-
benchmark_entrepeneur_gpt_with_difficult_user()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
spaces/1line/AutoGPT/run_continuous.sh
DELETED
@@ -1,3 +0,0 @@
|
|
1 |
-
#!/bin/bash
|
2 |
-
|
3 |
-
./run.sh --continuous $@
|
|
|
|
|
|
|
|
spaces/1pelhydcardo/ChatGPT-prompt-generator/assets/Diablo Immortal APK The Best Way to Experience the New Mobile Game from Blizzard.md
DELETED
@@ -1,123 +0,0 @@
|
|
1 |
-
<br />
|
2 |
-
<h1>Diablo Immortal APK Play Store: Everything You Need to Know</h1>
|
3 |
-
<p>If you are a fan of action role-playing games, you have probably heard of <strong>Diablo</strong>, one of the most popular and influential franchises in the genre. Developed by Blizzard Entertainment, Diablo has been captivating millions of players since 1996 with its dark fantasy setting, addictive gameplay, and epic loot. Now, you can experience a new chapter in the Diablo saga on your mobile device with <strong>Diablo Immortal</strong>, a brand-new game that is also coming to open beta on PC.</p>
|
4 |
-
<p>Diablo Immortal is a massively multiplayer online action role-playing game (MMOARPG) that is set between the events of Diablo II: Lord of Destruction and Diablo III. You will join forces with other players on an epic quest to collect the shattered fragments of the corrupted Worldstone and prevent the Lord of Terror's return. You will also explore the dark realm of Sanctuary like never before, fight against hordes of demons, collect epic loot, and gain unimaginable power.</p>
|
5 |
-
<h2>diablo immortal apk play store</h2><br /><p><b><b>Download File</b> ✯ <a href="https://urlin.us/2uSWsl">https://urlin.us/2uSWsl</a></b></p><br /><br />
|
6 |
-
<p>In this article, we will tell you everything you need to know about Diablo Immortal APK Play Store, including how to download and install it on your mobile device or PC, what are the system requirements, what are the features, and what are the reviews. Let's get started!</p>
|
7 |
-
<h2>How to Download and Install Diablo Immortal on Your Mobile Device</h2>
|
8 |
-
<p>Diablo Immortal is available for both iOS and Android devices. Here are the steps to download and install it on your mobile device:</p>
|
9 |
-
<ul>
|
10 |
-
<li><strong>Step 1:</strong> Go to the <a href="(^1^)">Google Play Store</a> or the <a href="(^2^)">Apple App Store</a> and search for Diablo Immortal.</li>
|
11 |
-
<li><strong>Step 2:</strong> Tap on the Install button and wait for the download to finish. The game size is about 3 GB, so make sure you have enough space on your device.</li>
|
12 |
-
<li><strong>Step 3:</strong> Launch the game and log in with your Battle.net account or create a new one. You will need a Battle.net account to play Diablo Immortal, as it will sync your progress across devices and platforms.</li>
|
13 |
-
</ul>
|
14 |
-
<p>Congratulations! You are now ready to play Diablo Immortal on your mobile device.</p>
|
15 |
-
<h2>How to Play Diablo Immortal on Your PC</h2>
|
16 |
-
<p>If you prefer playing games on a bigger screen, you can also play Diablo Immortal on your PC using an emulator. Here are the steps to download and install it on your PC using Bluestacks:</p>
|
17 |
-
<ul>
|
18 |
-
<li><strong>Step 1:</strong> Go to <a href="(^5^)">Bluestacks' website</a> and download Bluestacks 5. We recommend using the Android Pie 64-bit beta version, but the stable version should work as well.</li>
|
19 |
-
<li><strong>Step 2:</strong> Open the file you downloaded to begin the installation. Follow the instructions on the screen to complete the process.</li>
|
20 |
-
<li><strong>Step 3:</strong> Open Bluestacks and then open the Play Store. Sign in to Google Play with your regular Google account email and password.</li>
|
21 |
-
<li><strong>Step 4:</strong> Search for Diablo Immortal and tap on the Install button. The game size is about 3 GB, so make sure you have enough space on your PC.</li>
|
22 |
-
<li><strong>Step 5:</strong> Launch the game and log in with your Battle.net account or create a new one. You will need a Battle.net account to play Diablo Immortal, as it will sync your progress across devices and platforms.</li>
|
23 |
-
</ul>
|
24 |
-
<p>Congratulations! You are now ready to play Diablo Immortal on your PC using Bluestacks.</p>
|
25 |
-
<h2>What are the System Requirements for Diablo Immortal?</h2>
|
26 |
-
<p>Diablo Immortal is designed to run on a wide range of devices, but you still need to meet some minimum requirements to enjoy the game smoothly. Here are the system requirements for Diablo Immortal on both mobile devices and PC:</p>
|
27 |
-
<table>
|
28 |
-
<tr>
|
29 |
-
<th>Device</th>
|
30 |
-
<th>Minimum Requirements</th>
|
31 |
-
<th>Recommended Requirements</th>
|
32 |
-
</tr>
|
33 |
-
<tr>
|
34 |
-
<td>Mobile (iOS)</td>
|
35 |
-
<td>- iPhone 6s or newer<br>- iOS 11 or higher</td>
|
36 |
-
<td>- iPhone 8 or newer<br>- iOS 13 or higher</td>
|
37 |
-
</tr>
|
38 |
-
<tr>
|
39 |
-
<td>Mobile (Android)</td>
|
40 |
-
<td>- Android 5.0 or higher<br>- Snapdragon 660 / Exynos 9611 or higher<br>- Adreno 512 / Mali-G72 MP3 or higher<br>- 2 GB RAM</td>
|
41 |
-
<td>- Android 8.0 or higher<br>- Snapdragon 845 / Exynos 9810 or higher<br>- Adreno 630 / Mali-G72 MP18 or higher<br>- 4 GB RAM</td>
|
42 |
-
</tr>
|
43 |
-
<tr>
|
44 |
-
<td>PC</td>
|
45 |
-
<td>- Windows 7 / Windows 8 / Windows 10 / Windows 11 (64-bit)<br>- Intel Core i3 or AMD FX-8100<br>- NVIDIA GeForce GTX 460, ATI Radeon HD 6850, or Intel HD Graphics 530<br>- 4 GB RAM<br>- Broadband Internet connection<br>- 1920 x 1080 minimum display resolution</td>
|
46 |
-
<td>- Windows 10 / Windows 11 (64-bit)<br>- Intel Core i5 or AMD Ryzen 5<br>- NVIDIA GeForce GTX 770 or AMD Radeon RX 470<br>- 8 GB RAM<br>- Broadband Internet connection<br>- 1920 x 1080 minimum display resolution</td>
|
47 |
-
</tr>
|
48 |
-
</table>
|
49 |
-
<h2>What are the Features of Diablo Immortal?</h2>
|
50 |
-
<p>Diablo Immortal is more than just a mobile port of Diablo III. It has many features that make it a unique and exciting game in its own right. Here are some of the features of Diablo Immortal that you can look forward to:</p>
|
51 |
-
<p>Diablo Immortal Blizzard Entertainment action RPG<br />
|
52 |
-
Diablo Immortal MMORPG online game<br />
|
53 |
-
Diablo Immortal mobile game download<br />
|
54 |
-
Diablo Immortal apk install guide<br />
|
55 |
-
Diablo Immortal cross-platform and cross save<br />
|
56 |
-
Diablo Immortal legendary weapons and set items<br />
|
57 |
-
Diablo Immortal classes and abilities<br />
|
58 |
-
Diablo Immortal quests and dungeons<br />
|
59 |
-
Diablo Immortal raids and bosses<br />
|
60 |
-
Diablo Immortal Worldstone and Sanctuary<br />
|
61 |
-
Diablo Immortal reviews and ratings<br />
|
62 |
-
Diablo Immortal trailer and gameplay<br />
|
63 |
-
Diablo Immortal release date and updates<br />
|
64 |
-
Diablo Immortal tips and tricks<br />
|
65 |
-
Diablo Immortal cheats and hacks<br />
|
66 |
-
Diablo Immortal mod apk and obb<br />
|
67 |
-
Diablo Immortal beta test and pre-registration<br />
|
68 |
-
Diablo Immortal system requirements and compatibility<br />
|
69 |
-
Diablo Immortal support and feedback<br />
|
70 |
-
Diablo Immortal news and events<br />
|
71 |
-
Diablo Immortal lore and story<br />
|
72 |
-
Diablo Immortal characters and skills<br />
|
73 |
-
Diablo Immortal items and loot<br />
|
74 |
-
Diablo Immortal combat and controls<br />
|
75 |
-
Diablo Immortal graphics and sound<br />
|
76 |
-
Diablo Immortal free to play and in-app purchases<br />
|
77 |
-
Diablo Immortal offline mode and data usage<br />
|
78 |
-
Diablo Immortal bugs and issues<br />
|
79 |
-
Diablo Immortal forum and community<br />
|
80 |
-
Diablo Immortal wiki and guide<br />
|
81 |
-
Diablo Immortal fan art and memes<br />
|
82 |
-
Diablo Immortal wallpapers and themes<br />
|
83 |
-
Diablo Immortal merchandise and gifts<br />
|
84 |
-
Diablo Immortal codes and coupons<br />
|
85 |
-
Diablo Immortal emulator and controller support<br />
|
86 |
-
Diablo Immortal comparison and alternatives<br />
|
87 |
-
Diablo Immortal features and benefits<br />
|
88 |
-
Diablo Immortal FAQ and help center<br />
|
89 |
-
Diablo Immortal videos and podcasts<br />
|
90 |
-
Diablo Immortal screenshots and images</p>
|
91 |
-
<ul>
|
92 |
-
<li><strong>Six iconic classes to choose from:</strong> You can play as one of six classes, each with their own skills, abilities, and playstyles. You can choose from Barbarian, Crusader, Demon Hunter, Monk, Necromancer, and Wizard. Each class has four primary skills and four secondary skills that you can customize with different modifiers. You can also unlock legendary items that grant you new powers and effects.</li>
|
93 |
-
<li><strong>A new chapter in the Diablo saga set between Diablo II and Diablo III:</strong> You will witness a pivotal moment in the history of Sanctuary, as you join other heroes to stop the evil forces that seek to use the Worldstone fragments for their own nefarious purposes. You will encounter familiar faces like Deckard Cain and Tyrael, as well as new characters and enemies. You will also discover new lore and secrets about the world of Diablo.</li>
|
94 |
-
<li><strong>A vast open world to explore with dynamic events and challenges:</strong> You will travel across various regions of Sanctuary, from the peaceful forests of Bilefen to the frozen wastelands of Mount Zavain. You will find hidden dungeons, ancient ruins, and corrupted shrines along the way. You will also participate in dynamic events that change the world around you, such as defending a town from a demon invasion, or raiding a rival faction's base. You will also face various challenges that test your skills and reward you with loot and experience.</li>
|
95 |
-
<li><strong>A visceral and fast-paced combat system with intuitive controls:</strong> You will experience the thrill of slaying demons with your fingertips, using a simple and responsive touch-based control scheme. You can tap, swipe, and drag to move, attack, dodge, and use skills. You can also customize your controls to suit your preferences. You can also switch between portrait and landscape modes to enjoy different perspectives of the game.</li>
|
96 |
-
<li><strong>A massively multiplayer experience with social features and cooperative gameplay:</strong> You will not be alone in your journey, as you will meet and interact with other players from around the world. You can chat, trade, join clans, and form parties with other players. You can also team up with up to three other players to tackle dungeons, raids, and world bosses. You can also compete with other players in PvP modes, such as the Cycle of Strife, a faction-based conflict that pits the Immortals against the Shadows.</li>
|
97 |
-
</ul>
|
98 |
-
<h2>What are the Reviews of Diablo Immortal?</h2>
|
99 |
-
<p>Diablo Immortal has received mixed reviews from critics and players alike. Some have praised the game for its graphics, gameplay, story, and features, while others have criticized it for its monetization, performance, and lack of innovation. Here is a summary of the positive and negative aspects of the game based on various reviews:</p>
|
100 |
-
<table>
|
101 |
-
<tr>
|
102 |
-
<th>Positive Aspects</th>
|
103 |
-
<th>Negative Aspects</th>
|
104 |
-
</tr>
|
105 |
-
<tr>
|
106 |
-
<td>- The game looks stunning on mobile devices, with detailed environments, smooth animations, and impressive effects.<br>- The game plays well on mobile devices, with intuitive controls, fast-paced combat, and satisfying feedback.<br>- The game has a rich and engaging story that expands the Diablo lore and introduces new characters and locations.<br>- The game has a lot of content and features to keep players busy and entertained, such as dungeons, events, challenges, raids, PvP modes, clans, legendary items, and more.<br>- The game has a friendly and helpful community that makes playing with others more enjoyable and rewarding.</td>
|
107 |
-
<td>- The game has a lot of microtransactions that can affect the gameplay balance and progression.<br>- The game has some performance issues that can cause lag, crashes, or glitches.<br>- The game has some bugs and errors that can affect the gameplay experience or prevent players from accessing certain features.<br>- The game does not offer much innovation or originality compared to other Diablo games or similar games in the genre.<br>- The game does not appeal to some hardcore Diablo fans who prefer playing on PC or console.</td>
|
108 |
-
</tr>
|
109 |
-
</table>
|
110 |
-
<h1>Conclusion</h1>
|
111 |
-
<p>Diablo Immortal is a new MMOARPG that brings the Diablo franchise to mobile devices and PC. It offers a new chapter in the Diablo saga set between Diablo II and Diablo III, a vast open world to explore with dynamic events and challenges, a visceral and fast-paced combat system with intuitive controls, a massively multiplayer experience with social features and cooperative gameplay, and six iconic classes to choose from. It also has some drawbacks, such as microtransactions, performance issues, bugs, errors, and lack of innovation.</p>
|
112 |
-
<p>If you are interested in playing Diablo Immortal on your mobile device or PC, you can download it from the Google Play Store or the Apple App Store. You will need a Battle.net account to play the game. You can also use an emulator like Bluestacks to play it on your PC. You will need to meet some minimum system requirements to run the game smoothly.</p>
|
113 |
-
<p>We hope this article has given you everything you need to know about Diablo Immortal APK Play Store. If you have any questions or feedback about the game or this article, feel free to leave a comment below. Thank you for reading!</p>
|
114 |
-
<h2>FAQs</h2>
|
115 |
-
<ul>
|
116 |
-
<li><strong>Q: Is Diablo Immortal free to play?</strong><br>A: Yes, Diablo Immortal is free to play. However, it also has optional in-game purchases that can enhance your gameplay experience or speed up your progression.</li>
|
117 |
-
<li><strong>Q: When will Diablo Immortal be released?</strong><br>A: Diablo Immortal is currently in closed alpha testing. There is no official release date yet for the game. However, Blizzard Entertainment has stated that they plan to launch the game in 2023.</li>
|
118 |
-
<li><strong>Q: Can I play Diablo Immortal offline?</strong><br>A: No, Diablo Immortal requires an internet connection to play. You will need a stable Wi-Fi or cellular data connection to access the game's features and content.</li>
|
119 |
-
<li><strong>Q: Can I play Diablo Immortal with my friends?</strong><br>A: Yes, Yes, you can play Diablo Immortal with your friends. You can chat, trade, join clans, and form parties with other players. You can also team up with up to three other players to tackle dungeons, raids, and world bosses. You can also compete with other players in PvP modes, such as the Cycle of Strife, a faction-based conflict that pits the Immortals against the Shadows.</li>
|
120 |
-
<li><strong>Q: How can I get more information about Diablo Immortal?</strong><br>A: You can get more information about Diablo Immortal by visiting the official website, the official blog, the official forums, or the official social media channels. You can also watch the official trailers, gameplay videos, and developer updates on YouTube.</li>
|
121 |
-
</ul></p> 197e85843d<br />
|
122 |
-
<br />
|
123 |
-
<br />
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
spaces/1phancelerku/anime-remove-background/Beach Buggy Racing 2 APK The Ultimate Guide to Unlocking and Upgrading Your Cars.md
DELETED
@@ -1,158 +0,0 @@
|
|
1 |
-
|
2 |
-
<h1>Beach Buggy Racing APK2: A Fun and Exciting Kart Racing Game</h1>
|
3 |
-
<p>If you're looking for a racing game that offers you a thrilling and exciting experience, then you should try Beach Buggy Racing APK2. This game is a sequel to the popular Beach Buggy Racing, which has over 100 million downloads worldwide. In this game, you can race against a field of rival drivers, each with unique personalities and special abilities, on 15 imaginative 3D race tracks. You can also collect and upgrade a variety of cars, from dune buggies to monster trucks, and use an arsenal of fun and wacky power-ups to fight your way to the finish line. Whether you want to play solo or with your friends, Beach Buggy Racing APK2 has something for everyone.</p>
|
4 |
-
<h2>beach buggy racing apk2</h2><br /><p><b><b>Download</b> 🔗 <a href="https://jinyurl.com/2uNQqA">https://jinyurl.com/2uNQqA</a></b></p><br /><br />
|
5 |
-
<h2>Introduction</h2>
|
6 |
-
<h3>What is Beach Buggy Racing APK2?</h3>
|
7 |
-
<p>Beach Buggy Racing APK2 is an Android game developed by Vector Unit, a studio that specializes in racing games. It is a fully 3D off-road kart racing game with amazing physics, detailed cars and characters, and spectacular weapons. It is the official sequel to Beach Buggy Blitz, the free driving game with over 30 million players worldwide. It is also the second installment in the Beach Buggy Racing series, which includes Beach Buggy Racing and Beach Buggy Racing 2.</p>
|
8 |
-
<h3>Why should you play Beach Buggy Racing APK2?</h3>
|
9 |
-
<p>There are many reasons why you should play Beach Buggy Racing APK2. Here are some of them:</p>
|
10 |
-
<ul>
|
11 |
-
<li>It is free to play, but it contains items that can be purchased for real money.</li>
|
12 |
-
<li>It has high-quality graphics and sound effects that create an immersive gaming experience.</li>
|
13 |
-
<li>It has a variety of game modes, such as career mode, quick race mode, daily challenge mode, one-on-one driver race mode, weekly tournament mode, car challenge mode, and more.</li>
|
14 |
-
<li>It has a lot of content to explore, such as over 55 cars to collect and upgrade, over 45 power-ups to discover and upgrade, over 25 drivers to recruit and play with, and more.</li>
|
15 |
-
<li>It has a lot of fun and humor, such as crazy power-ups like Dodgeball Frenzy, Fireball, Oil Slick, Killer Bees, etc., hilarious driver abilities like teleportation, flaming fire tracks, confusion spells, etc., and amusing driver personalities like Rez, McSkelly, Roxie, etc.</li>
|
16 |
-
<li>It has a lot of challenge and competition, such as racing against other players from around the world on leaderboards and tournaments, racing against player avatars in daily races, racing against AI opponents with different skills and tactics, etc.</li>
|
17 |
-
<h2>Features of Beach Buggy Racing APK2</h2>
|
18 |
-
<h3>Spectacular kart racing action</h3>
|
19 |
-
<p>Beach Buggy Racing APK2 is not your typical kart racing game. It is a fast-paced and action-packed game that will keep you on the edge of your seat. You can race through Egyptian pyramids, dragon-infested castles, pirate shipwrecks, and experimental alien bio-labs. You can dodge giant crabs, lava monsters, fireballs, and other hazards. You can also perform awesome stunts, such as jumping over ramps, flying through the air, and drifting around corners. You can even smash and crash into your opponents to knock them off the track.</p>
|
20 |
-
<h3>Cool cars to customize</h3>
|
21 |
-
<p>Beach Buggy Racing APK2 has a huge collection of cars that you can unlock and upgrade. You can choose from over 55 different vehicles, ranging from classic beach buggies to muscle cars, monster trucks, lunar rovers, and more. You can also customize your cars with exotic paints, decals, and accessories. You can improve your car's performance by upgrading its engine, suspension, tires, and turbo boost. You can also equip your car with special gadgets, such as nitro injectors, ball-and-chain hammers, rocket boosters, and more.</p>
|
22 |
-
<h3>Tons of amazing power-ups</h3>
|
23 |
-
<h3>15 spectacular race tracks</h3>
|
24 |
-
<p>Beach Buggy Racing APK2 has 15 amazing race tracks that will take you to different locations and environments. You can race on tropical beaches, volcanic islands, ancient ruins, snowy mountains, spooky forests, and more. Each track has its own theme, layout, obstacles, and secrets. You can explore hidden paths, shortcuts, and boost pads to gain an edge over your opponents. You can also enjoy the stunning scenery and dynamic lighting effects that make each track look realistic and beautiful.</p>
|
25 |
-
<p>beach buggy racing apk2 download<br />
|
26 |
-
beach buggy racing apk2 mod<br />
|
27 |
-
beach buggy racing apk2 latest version<br />
|
28 |
-
beach buggy racing apk2 free<br />
|
29 |
-
beach buggy racing apk2 hack<br />
|
30 |
-
beach buggy racing apk2 unlimited coins and gems<br />
|
31 |
-
beach buggy racing apk2 android<br />
|
32 |
-
beach buggy racing apk2 gameplay<br />
|
33 |
-
beach buggy racing apk2 review<br />
|
34 |
-
beach buggy racing apk2 cheats<br />
|
35 |
-
beach buggy racing apk2 online<br />
|
36 |
-
beach buggy racing apk2 multiplayer<br />
|
37 |
-
beach buggy racing apk2 tips and tricks<br />
|
38 |
-
beach buggy racing apk2 best car<br />
|
39 |
-
beach buggy racing apk2 all cars<br />
|
40 |
-
beach buggy racing apk2 all powerups<br />
|
41 |
-
beach buggy racing apk2 all tracks<br />
|
42 |
-
beach buggy racing apk2 all bosses<br />
|
43 |
-
beach buggy racing apk2 all characters<br />
|
44 |
-
beach buggy racing apk2 all achievements<br />
|
45 |
-
beach buggy racing apk2 update<br />
|
46 |
-
beach buggy racing apk2 new features<br />
|
47 |
-
beach buggy racing apk2 bug fixes<br />
|
48 |
-
beach buggy racing apk2 graphics settings<br />
|
49 |
-
beach buggy racing apk2 sound effects<br />
|
50 |
-
beach buggy racing apk2 music<br />
|
51 |
-
beach buggy racing apk2 controller support<br />
|
52 |
-
beach buggy racing apk2 vr mode<br />
|
53 |
-
beach buggy racing apk2 split screen<br />
|
54 |
-
beach buggy racing apk2 custom races<br />
|
55 |
-
beach buggy racing apk2 leaderboards<br />
|
56 |
-
beach buggy racing apk2 tournaments<br />
|
57 |
-
beach buggy racing apk2 challenges<br />
|
58 |
-
beach buggy racing apk2 daily rewards<br />
|
59 |
-
beach buggy racing apk2 special events<br />
|
60 |
-
beach buggy racing apk2 secrets and easter eggs<br />
|
61 |
-
beach buggy racing apk2 fun facts and trivia<br />
|
62 |
-
beach buggy racing apk2 comparison with other kart games<br />
|
63 |
-
beach buggy racing apk2 pros and cons<br />
|
64 |
-
beach buggy racing apk2 ratings and reviews from users and critics</p>
|
65 |
-
<h3>Collect a team of racers</h3>
|
66 |
-
<p>Beach Buggy Racing APK2 is not just about racing with cars. It is also about racing with drivers. You can recruit and play with over 25 different drivers, each with their own unique personality, appearance, and special ability. Some of the drivers are familiar faces from the previous games, such as Rez, McSkelly, Roxie, etc. Some of the drivers are new characters, such as Tiki Man, Aliana, Bigfoot, etc. You can also unlock and use different costumes and accessories for your drivers to make them look more stylish and cool.</p>
|
67 |
-
<h3>Split screen multiplayer</h3>
|
68 |
-
<h3>Google Play game services</h3>
|
69 |
-
<p>Beach Buggy Racing APK2 is integrated with Google Play game services, which means you can enjoy some extra features and benefits. You can sign in with your Google account to access cloud saving, achievements, and leaderboards. You can also compete with other players from around the world on online leaderboards and tournaments. You can also earn achievements for completing various tasks and challenges in the game. You can also sync your progress across multiple devices using cloud saving.</p>
|
70 |
-
<h3>Play the way you want</h3>
|
71 |
-
<p>Beach Buggy Racing APK2 is a game that gives you a lot of options and flexibility to play the way you want. You can choose from different difficulty levels, such as easy, medium, hard, and expert. You can also adjust the steering sensitivity and camera angle to suit your preference. You can also switch between different control schemes, such as tilt steering, touch-screen steering, or USB/Bluetooth gamepad. You can also play offline or online, depending on your internet connection and mood.</p>
|
72 |
-
<h2>How to download and install Beach Buggy Racing APK2</h2>
|
73 |
-
<h3>Download from Google Play Store</h3>
|
74 |
-
<p>The easiest and safest way to download and install Beach Buggy Racing APK2 is from the Google Play Store. Here are the steps to follow:</p>
|
75 |
-
<ol>
|
76 |
-
<li>Open the Google Play Store app on your Android device.</li>
|
77 |
-
<li>Search for Beach Buggy Racing APK2 or use this link: </li>
|
78 |
-
<li>Tap on the Install button and wait for the download to finish.</li>
|
79 |
-
<li>Tap on the Open button and enjoy the game.</li>
|
80 |
-
</ol>
|
81 |
-
<h3>Download from APKCombo website</h3>
|
82 |
-
<p>If you want to download and install Beach Buggy Racing APK2 from a third-party website, you can use APKCombo, which is a reliable and secure source of APK files. Here are the steps to follow:</p>
|
83 |
-
<ol>
|
84 |
-
<li>Open your web browser and go to this link: </li>
|
85 |
-
<li>Tap on the Download APK button and wait for the download to finish.</li>
|
86 |
-
<li>Go to your device settings and enable Unknown Sources under Security or Applications.</li>
|
87 |
-
<li>Go to your file manager and locate the downloaded APK file.</li>
|
88 |
-
<li>Tap on the file and follow the instructions to install it.</li>
|
89 |
-
<li>Tap on the game icon and enjoy the game.</li>
|
90 |
-
</ol>
|
91 |
-
: https://play.google.com/store/apps/details?id=com.vectorunit.cobalt.googleplay <h2>Tips and tricks for Beach Buggy Racing APK2</h2>
|
92 |
-
<h3>Upgrade your car</h3>
|
93 |
-
<p>One of the most important things to do in Beach Buggy Racing APK2 is to upgrade your car. Upgrading your car will improve its speed, acceleration, handling, and durability. You can upgrade your car by spending coins, which you can earn by winning races, completing challenges, and watching ads. You can also use gems, which are premium currency, to buy more coins or unlock special cars. You can upgrade four aspects of your car: engine, suspension, tires, and turbo. Each aspect has 10 levels of upgrade, and each level costs more coins than the previous one. You should upgrade your car regularly to keep up with the competition and win more races.</p>
|
94 |
-
<h3>Choose the right driver</h3>
|
95 |
-
<p>Another important thing to do in Beach Buggy Racing APK2 is to choose the right driver. Choosing the right driver will give you an edge over your opponents, as each driver has a unique special ability that can affect the outcome of the race. You can unlock and recruit drivers by spending tickets, which you can earn by winning races, completing challenges, and watching ads. You can also use gems to buy more tickets or unlock special drivers. You can choose from over 25 drivers, each with their own personality and ability. Some of the abilities are offensive, such as fire tracks, lightning bolts, ice spikes, etc. Some of the abilities are defensive, such as shields, repair kits, magnets, etc. Some of the abilities are special, such as time warps, teleportation, confusion spells, etc. You should choose a driver that suits your play style and strategy.</p>
|
96 |
-
<h3>Use power-ups strategically</h3>
|
97 |
-
<h3>Master drifting</h3>
|
98 |
-
<p>Another important thing to do in Beach Buggy Racing APK2 is to master drifting. Drifting is a technique that allows you to turn corners faster and more smoothly, as well as fill up your turbo meter. You can drift by tapping and holding the brake button while steering in the direction you want to go. You can also drift by using the tilt steering option and tilting your device in the direction you want to go. You can see how well you are drifting by looking at the drift meter on the top left corner of the screen. The more you drift, the more your drift meter fills up and the more turbo boost you get. You can use your turbo boost by tapping the turbo button on the right side of the screen. You can also upgrade your turbo boost by spending coins or gems. You should drift as much as possible to gain speed and overtake your opponents.</p>
|
99 |
-
<h3>Take advantage of shortcuts and boost pads</h3>
|
100 |
-
<p>Another important thing to do in Beach Buggy Racing APK2 is to take advantage of shortcuts and boost pads. Shortcuts and boost pads are special features on the track that can help you save time and gain speed. Shortcuts are hidden paths that can allow you to skip some parts of the track or avoid some obstacles. Boost pads are glowing strips that can give you a burst of speed when you drive over them. You can find shortcuts and boost pads on every track, but you have to be observant and adventurous to discover them. You should try to use shortcuts and boost pads whenever you can to improve your performance and win more races.</p>
|
101 |
-
<h2>Review of Beach Buggy Racing APK2</h2>
|
102 |
-
<h3>Pros and cons of Beach Buggy Racing APK2</h3>
|
103 |
-
<p>Beach Buggy Racing APK2 is a game that has many pros and cons. Here are some of them:</p>
|
104 |
-
<table>
|
105 |
-
<tr>
|
106 |
-
<th>Pros</th>
|
107 |
-
<th>Cons</th>
|
108 |
-
</tr>
|
109 |
-
<tr>
|
110 |
-
<td>- Fun and addictive gameplay</td>
|
111 |
-
<td>- Some bugs and glitches</td>
|
112 |
-
</tr>
|
113 |
-
<tr>
|
114 |
-
<td>- High-quality graphics and sound effects</td>
|
115 |
-
<td>- Some ads and in-app purchases</td>
|
116 |
-
</tr>
|
117 |
-
<tr>
|
118 |
-
<td>- Variety of game modes, cars, drivers, power-ups, and tracks</td>
|
119 |
-
<td>- Some tracks and power-ups are too chaotic</td>
|
120 |
-
</tr>
|
121 |
-
<tr>
|
122 |
-
<td>- Split screen multiplayer mode</td>
|
123 |
-
<td>- Some multiplayer modes require internet connection</td>
|
124 |
-
</tr>
|
125 |
-
<tr>
|
126 |
-
<td>- Google Play game services integration</td>
|
127 |
-
<td>- Some achievements are too hard or too easy</td>
|
128 |
-
</tr>
|
129 |
-
<h3>User ratings and feedback of Beach Buggy Racing APK2</h3>
|
130 |
-
<p>Beach Buggy Racing APK2 is a game that has received a lot of positive ratings and feedback from users. The game has a 4.5-star rating out of 5 on the Google Play Store, based on over 1 million reviews. Here are some of the user comments about the game:</p>
|
131 |
-
<blockquote>
|
132 |
-
<p>"This game is awesome. It has great graphics, sound effects, and gameplay. It is very addictive and fun to play. I love the variety of cars, drivers, power-ups, and tracks. The multiplayer mode is also very cool. I highly recommend this game to anyone who likes racing games."</p>
|
133 |
-
</blockquote>
|
134 |
-
<blockquote>
|
135 |
-
<p>"This game is amazing. It is one of the best racing games I have ever played. It is very challenging and competitive. It has a lot of content and features to explore. The power-ups are very fun and creative. The tracks are very beautiful and detailed. The game is also very smooth and stable."</p>
|
136 |
-
</blockquote>
|
137 |
-
<blockquote>
|
138 |
-
<p>"This game is fantastic. It is a great sequel to the first Beach Buggy Racing game. It has improved a lot in terms of graphics, sound effects, and gameplay. It has a lot of game modes, cars, drivers, power-ups, and tracks to choose from. The multiplayer mode is also very fun and exciting."</p>
|
139 |
-
</blockquote>
|
140 |
-
<h2>Conclusion</h2>
|
141 |
-
<h4>Summary of the article</h4>
|
142 |
-
<p>In conclusion, Beach Buggy Racing APK2 is a fun and exciting kart racing game that offers you a thrilling and immersive gaming experience. You can race against a field of rival drivers, each with unique personalities and special abilities, on 15 imaginative 3D race tracks. You can also collect and upgrade a variety of cars, from dune buggies to monster trucks, and use an arsenal of fun and wacky power-ups to fight your way to the finish line. Whether you want to play solo or with your friends, Beach Buggy Racing APK2 has something for everyone.</p>
|
143 |
-
<h4>FAQs</h4>
|
144 |
-
<p>Here are some frequently asked questions about Beach Buggy Racing APK2:</p>
|
145 |
-
<ul>
|
146 |
-
<li>Q: How can I get more coins and gems in Beach Buggy Racing APK2?</li>
|
147 |
-
<li>A: You can get more coins and gems by winning races, completing challenges, watching ads, or buying them with real money.</li>
|
148 |
-
<li>Q: How can I unlock more cars and drivers in Beach Buggy Racing APK2?</li>
|
149 |
-
<li>A: You can unlock more cars and drivers by spending coins, gems, or tickets.</li>
|
150 |
-
<li>Q: How can I play Beach Buggy Racing APK2 with my friends?</li>
|
151 |
-
<li>A: You can play Beach Buggy Racing APK2 with your friends by using the split screen multiplayer mode or the online multiplayer mode.</li>
|
152 |
-
<li>Q: How can I contact the developers of Beach Buggy Racing APK2?</li>
|
153 |
-
<li>A: You can contact the developers of Beach Buggy Racing APK2 by sending an email to [email protected] or visiting their website at https://www.vectorunit.com/.</li>
|
154 |
-
<li>Q: How can I update Beach Buggy Racing APK2 to the latest version?</li>
|
155 |
-
<li>A: You can update Beach Buggy Racing APK2 to the latest version by downloading it from the Google Play Store or the APKCombo website.</li>
|
156 |
-
</ul></p> 401be4b1e0<br />
|
157 |
-
<br />
|
158 |
-
<br />
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
spaces/1phancelerku/anime-remove-background/Download Airlift Movie The True Story of the Largest Human Evacuation in History.md
DELETED
@@ -1,160 +0,0 @@
|
|
1 |
-
<br />
|
2 |
-
<h1>How to Download Airlift Movie Online</h1>
|
3 |
-
<p>Airlift is a 2016 Indian Hindi-language drama thriller film directed by Raja Krishna Menon starring Akshay Kumar and Nimrat Kaur, that follows Ranjit Katyal (played by Kumar), a Kuwait-based businessman as he carries out the evacuation of Indians based in Kuwait during the Invasion of Kuwait by Saddam Hussein's Iraq which lead to the beginning of the Gulf War.</p>
|
4 |
-
<h2>download airlift movie</h2><br /><p><b><b>Download File</b> ✅ <a href="https://jinyurl.com/2uNPZd">https://jinyurl.com/2uNPZd</a></b></p><br /><br />
|
5 |
-
<p>If you are a fan of Akshay Kumar or historical dramas, you might want to watch this movie online. But how can you download Airlift movie online legally and safely? In this article, we will tell you everything you need to know about downloading Airlift movie online, including the plot, the cast, the reviews, the legal ways, the benefits, and the risks. So, let's get started!</p>
|
6 |
-
<h2>The Plot of Airlift Movie</h2>
|
7 |
-
<p>The movie is based on a true story of the largest civilian evacuation in history, when over 170,000 Indians were rescued from Kuwait by the Indian government with the help of a few brave individuals.</p>
|
8 |
-
<p>The movie begins with Ranjit Katyal, a wealthy and influential businessman who lives a lavish life in Kuwait with his wife Amrita (played by Nimrat Kaur) and their daughter. He is well-connected with the Kuwaiti elite and has little regard for his fellow Indians. However, his life changes drastically when Iraq invades Kuwait on August 2, 1990, and he becomes a target of the Iraqi soldiers. He manages to escape with his family and some of his employees to a safe house, where he realizes that there are thousands of Indians stranded in Kuwait with no help from the Indian government or the embassy.</p>
|
9 |
-
<p>He decides to take charge of the situation and contacts the Indian Ministry of External Affairs, where he meets Sanjeev Kohli (played by Kumud Mishra), a junior bureaucrat who is sympathetic to his cause. Together, they work out a plan to evacuate the Indians from Kuwait by arranging flights from Jordan. However, they face many obstacles along the way, such as getting permission from Iraq, securing transportation from Kuwait to Jordan, dealing with hostile locals, managing scarce resources, and maintaining morale among the scared and desperate Indians.</p>
|
10 |
-
<p>Will Ranjit succeed in his mission? Will he be able to save his fellow countrymen? Will he rediscover his sense of patriotism and humanity? Watch Airlift movie online to find out!</p>
|
11 |
-
<h2>The Cast and Crew of Airlift Movie</h2>
|
12 |
-
<p>Airlift movie boasts of a talented cast and crew who have delivered a remarkable performance. Here are some of the main actors and filmmakers behind this movie:</p>
|
13 |
-
<p>download airlift movie in hindi<br />
|
14 |
-
download airlift movie 480p<br />
|
15 |
-
download airlift movie 720p<br />
|
16 |
-
download airlift movie 1080p<br />
|
17 |
-
download airlift movie with english subtitles<br />
|
18 |
-
download airlift movie from filmywap<br />
|
19 |
-
download airlift movie from filmyzilla<br />
|
20 |
-
download airlift movie from worldfree4u<br />
|
21 |
-
download airlift movie from bolly4u<br />
|
22 |
-
download airlift movie from moviesflix<br />
|
23 |
-
download airlift movie bluray<br />
|
24 |
-
download airlift movie hd<br />
|
25 |
-
download airlift movie mp4<br />
|
26 |
-
download airlift movie mkv<br />
|
27 |
-
download airlift movie torrent<br />
|
28 |
-
download airlift movie online free<br />
|
29 |
-
download airlift movie for free<br />
|
30 |
-
download airlift movie full hd<br />
|
31 |
-
download airlift movie akshay kumar<br />
|
32 |
-
download airlift movie based on true story<br />
|
33 |
-
download airlift movie by filmyhit<br />
|
34 |
-
download airlift movie by pagalworld<br />
|
35 |
-
download airlift movie by khatrimaza<br />
|
36 |
-
download airlift movie by skymovieshd<br />
|
37 |
-
download airlift movie by 9xmovies<br />
|
38 |
-
download airlift movie direct link<br />
|
39 |
-
download airlift movie dvdrip<br />
|
40 |
-
download airlift movie extramovies<br />
|
41 |
-
download airlift movie filmyhit.com<br />
|
42 |
-
download airlift movie google drive link<br />
|
43 |
-
download airlift movie hdpopcorns<br />
|
44 |
-
download airlift movie imdb rating<br />
|
45 |
-
download airlift movie in 300mb<br />
|
46 |
-
download airlift movie in dual audio<br />
|
47 |
-
download airlift movie in tamil dubbed<br />
|
48 |
-
download airlift movie jalshamoviezhd.com<br />
|
49 |
-
download airlift movie katmoviehd.com<br />
|
50 |
-
download airlift movie kuttymovies.net.in<br />
|
51 |
-
download airlift movie movierulz.com.plz4u.vip.in.net.org.ac.ap.vc.wap.pw.lol.tel.run.mz.ind.in.biz.com.vet.vip.icu.lol.link.best.guru.live.fun.pk.app.today.new.hn.movie.movie4me.cc.ws.lol.cloud.link.top.vip.mkv.mp4.avi.mov.mpg.wmv.3gp.more.online.video.site.domain.name.me.uk.us.info.in.net.org.biz.com.au.de.fr.ru.co.uk.es.ca.nl.ch.it.ir.jp.ro.com.ro.ro.ro.ro.ro.ro.ro.ro.ro.ro.ro.ro.ro.ro.ro.ro.ro.ro.ro.ro.ro.ro.ro.ro.ro.ro.ro.ro.<br />
|
52 |
-
download airlift movie netflix.com.amazon.com.hotstar.com.disneyplus.com.hulu.com.hbo.com.showtime.com.apple.com.tv.youtube.com.primevideo.com.voot.com.zee5.com.sonyliv.com.mxplayer.in.altbalaji.com.erosnow.com.jiocinema.com.airtelxstream.in.viu.com.epicon.in.bigflix.com.hungama.com.shemaroome.com.yupptv.com.sunnxt.com.hoichoi.tv.addatimes.com.arre.co.in.ullu.app.flizmovies.club.kooku.app.balloons.app.feneo.app.nuefliks.club.hotshots.digital.cinemadosti.com.gupchup.app.banana.prime.thiruttuvcd.xyz.tamilrockers.ws.isaiminiweb.online.tamilyogi.cool.tamilmv.bid.tamilgun.works.tamilrockerss.ch.tamilplay.one.tamildhool.net.tamilrasigan.net.kuttyweb.me.masstamilan.in.isaidub.net.moviesdaa.net.thiraimix.surf.thiruttumovies.net.jiorockerss.art.movierulz2.nz.3movierulz.sx.3movierulz.vc.4movierulz.plz.todaymovieshub.site.todaypk.ag.todaypk.tech.todaypk.work.todaypk.proxy.todaypk.ws.todaypk.life.todaypk.systems.todaypk.string.todaypk.pw.todaypk.mobi.todaypk.online.todaypk.ac.todaypk.in.todaypk.org.todaypk.mn.todaypk.la.todaypk.ai.todaypk.az.todaypk.cx.todaypk.co.todaypk.ht.todaypk.telugu.movies.2023.free.download.hd.720p.</p>
|
53 |
-
<ul>
|
54 |
-
<li>Akshay Kumar as Ranjit Katyal: Akshay Kumar is one of the most popular and versatile actors in Bollywood, who has starred in over 100 films in various genres. He is known for his action, comedy, drama, romance, and social message movies. He has won several awards for his acting, including a National Film Award for Best Actor for Rustom (2016). He has also been honored with the Padma Shri award by the Government of India in 2009.</li>
|
55 |
-
<li>Nimrat Kaur as Amrita Katyal: Nimrat Kaur is an acclaimed actress who has worked in both Hindi and English films. She is best known for her roles in The Lunchbox (2013) and Homeland (2014-2018). She has also received critical acclaim and awards for her acting, including a Filmfare Award for Best Actress (Critics) for The Lunchbox.</li>
|
56 |
-
<li>Kumud Mishra as Sanjeev Kohli: Kumud Mishra is a veteran actor who has appeared in many Hindi films and theatre productions. He is known for his supporting roles in films like Rockstar (2011), Raanjhanaa (2013), Sultan (2016), and Mulk (2018). He has also won several awards for his acting, including a Screen Award for Best Supporting Actor for Mulk.</li>
|
57 |
-
<li>Raja Krishna Menon as Director: Raja Krishna Menon is a film director, writer, and producer who has made films like Bas Yun Hi (2003), Barah Aana (2009), Airlift (2016), and Chef (2017). He has also received praise and recognition for his direction, including a Filmfare Award nomination for Best Director for Airlift.</li>
|
58 |
-
</ul>
|
59 |
-
<h2>The Reviews and Ratings of Airlift Movie</h2>
|
60 |
-
<p>Airlift movie has received positive reviews and ratings from both critics and audiences, who have appreciated the story, the direction, the acting, the cinematography, the music, and the realism of the film. Here are some of the reviews and ratings of Airlift movie from different sources:</p>
|
61 |
-
<table>
|
62 |
-
<tr>
|
63 |
-
<th>Source</th>
|
64 |
-
<th>Review</th>
|
65 |
-
<th>Rating</th>
|
66 |
-
</tr>
|
67 |
-
<tr>
|
68 |
-
<td>Rotten Tomatoes</td>
|
69 |
-
<td>"Airlift is a gripping and inspiring tale of courage and patriotism that showcases the best of Indian cinema."</td>
|
70 |
-
<td>83% (Tomatometer)</td>
|
71 |
-
</tr>
|
72 |
-
<tr>
|
73 |
-
<td>IMDb</td>
|
74 |
-
<td>"Airlift is a must watch. Akshay Kumar delivers one of his finest performances. The movie is realistic, thrilling, and emotional."</td>
|
75 |
-
<td>8.0/10</td>
|
76 |
-
</tr>
|
77 |
-
<tr>
|
78 |
-
<td>The Times of India</td>
|
79 |
-
<td>"Airlift is taut, tense, and terrific. It not only makes you proud of being an Indian but also prompts you to salute those unsung heroes who put their lives at stake to save others."</td>
|
80 |
-
<td>4/5</td>
|
81 |
-
</tr>
|
82 |
-
<tr>
|
83 |
-
<td>Hindustan Times</td>
|
84 |
-
<td>"Airlift is a rare film that combines high-octane drama with solid performances and smart storytelling. It is a film that will make you think, feel, and applaud."</td>
|
85 |
-
<td>4/5</td>
|
86 |
-
</tr>
|
87 |
-
</table>
|
88 |
-
<h2>The Legal and Safe Ways to Download Airlift Movie Online</h2>
|
89 |
-
<p>If you want to download Airlift movie online, you might be tempted to use illegal or unsafe methods such as pirated websites or apps. However, we strongly advise you against doing so, as they can expose you to various risks and challenges that we will discuss later in this article. Instead, we recommend you to use legal and safe ways to download Airlift movie online, such as streaming platforms, torrent sites, or VPN services. Let's take a look at each of these options in detail.</p>
|
90 |
-
<h3>Streaming Platforms</h3> <p>One of the easiest and most convenient ways to download Airlift movie online is to use streaming platforms that offer legal and high-quality content. Streaming platforms are online services that allow you to watch movies, TV shows, documentaries, and other videos on demand. Some of the popular streaming platforms that have Airlift movie available for download are:</p>
|
91 |
-
<ul>
|
92 |
-
<li>Amazon Prime Video: Amazon Prime Video is a subscription-based service that offers a wide range of movies, TV shows, originals, and other videos. You can download Airlift movie on Amazon Prime Video by following these steps: <ol>
|
93 |
-
<li>Sign up for an Amazon Prime membership or a Prime Video subscription.</li>
|
94 |
-
<li>Download the Prime Video app on your device.</li>
|
95 |
-
<li>Search for Airlift movie and tap on the download icon.</li>
|
96 |
-
<li>Select the video quality and the download location.</li>
|
97 |
-
<li>Enjoy watching Airlift movie offline within 30 days.</li>
|
98 |
-
</ol>
|
99 |
-
</li>
|
100 |
-
<li>Netflix: Netflix is another subscription-based service that offers a huge collection of movies, TV shows, originals, and other videos. You can download Airlift movie on Netflix by following these steps: <ol>
|
101 |
-
<li>Sign up for a Netflix plan that supports downloading.</li>
|
102 |
-
<li>Download the Netflix app on your device.</li>
|
103 |
-
<li>Search for Airlift movie and tap on the download icon.</li>
|
104 |
-
<li>Select the video quality and the download location.</li>
|
105 |
-
<li>Enjoy watching Airlift movie offline within 7 days.</li>
|
106 |
-
</ol>
|
107 |
-
</li>
|
108 |
-
<li>Hotstar: Hotstar is a streaming platform that offers movies, TV shows, sports, news, and other videos. You can download Airlift movie on Hotstar by following these steps: <ol>
|
109 |
-
<li>Sign up for a Hotstar VIP or Premium subscription.</li>
|
110 |
-
<li>Download the Hotstar app on your device.</li>
|
111 |
-
<li>Search for Airlift movie and tap on the download icon.</li>
|
112 |
-
<li>Select the video quality and the download location.</li>
|
113 |
-
<li>Enjoy watching Airlift movie offline within 48 hours.</li>
|
114 |
-
</ol>
|
115 |
-
</li>
|
116 |
-
</ul>
|
117 |
-
<h3>Torrent Sites</h3> <p>Another way to download Airlift movie online is to use torrent sites that offer peer-to-peer file sharing. Torrent sites are websites that host torrent files, which are small files that contain information about the larger files that you want to download, such as movies, music, games, etc. You can download Airlift movie on torrent sites by following these steps:</p>
|
118 |
-
<ol>
|
119 |
-
<li>Download and install a torrent client, such as BitTorrent, uTorrent, or qBittorrent.</li>
|
120 |
-
<li>Search for Airlift movie on a torrent site, such as The Pirate Bay, 1337x, or RARBG.</li>
|
121 |
-
<li>Select the torrent file that has the best quality and the most seeders (people who have the complete file and are sharing it).</li>
|
122 |
-
<li>Open the torrent file with your torrent client and start downloading Airlift movie.</li>
|
123 |
-
<li>Enjoy watching Airlift movie offline after the download is complete.</li>
|
124 |
-
</ol>
|
125 |
-
<h3>VPN Services</h3>
|
126 |
-
<p>A third way to download Airlift movie online is to use VPN services that offer online privacy and security. VPN stands for Virtual Private Network, which is a service that creates a secure and encrypted connection between your device and a server in another location. By using a VPN service, you can access geo-restricted content, bypass censorship, and protect your identity and data from hackers and trackers. You can download Airlift movie online using a VPN service by following these steps:</p>
|
127 |
-
<ol>
|
128 |
-
<li>Download and install a VPN service, such as ExpressVPN, NordVPN, or Surfshark.</li>
|
129 |
-
<li>Launch the VPN service and connect to a server in a country where Airlift movie is available on a streaming platform or a torrent site.</li>
|
130 |
-
<li>Open the streaming platform or the torrent site and search for Airlift movie.</li>
|
131 |
-
<li>Download Airlift movie using the same steps as mentioned above for streaming platforms or torrent sites.</li>
|
132 |
-
<li>Enjoy watching Airlift movie offline after the download is complete.</li>
|
133 |
-
</ol>
|
134 |
-
<h2>The Benefits of Downloading Airlift Movie Online</h2>
|
135 |
-
<p>Downloading Airlift movie online has many benefits that can enhance your viewing experience. Here are some of the benefits of downloading Airlift movie online:</p>
|
136 |
-
<h3>Save Time and Money</h3>
|
137 |
-
<p>By downloading Airlift movie online, you can save time and money that you would otherwise spend on going to a cinema hall, buying tickets, popcorn, drinks, etc. You can also avoid traffic jams, parking hassles, long queues, noisy crowds, etc. You can download Airlift movie online at your own convenience and watch it whenever you want.</p>
|
138 |
-
<h3>Watch Anytime and Anywhere</h3> <p>By downloading Airlift movie online, you can watch it anytime and anywhere you want. You can watch it on your laptop, tablet, smartphone, or TV. You can watch it at home, in your office, in your car, or on a plane. You can watch it alone, with your family, or with your friends. You can watch it in the morning, in the afternoon, or at night. You have the freedom and flexibility to choose when and where to watch Airlift movie.</p>
|
139 |
-
<h3>Enjoy High-Quality Video and Audio</h3>
|
140 |
-
<p>By downloading Airlift movie online, you can enjoy high-quality video and audio that can enhance your viewing pleasure. You can download Airlift movie in HD, 4K, or even 8K resolution, depending on the availability and your device compatibility. You can also download Airlift movie in Dolby Digital, Dolby Atmos, or DTS sound formats, depending on the availability and your device compatibility. You can enjoy the crisp and clear visuals and the immersive and realistic sound effects of Airlift movie.</p>
|
141 |
-
<h2>The Risks and Challenges of Downloading Airlift Movie Online</h2>
|
142 |
-
<p>Downloading Airlift movie online also has some risks and challenges that you should be aware of and avoid. Here are some of the risks and challenges of downloading Airlift movie online:</p>
|
143 |
-
<h3>Malware and Viruses</h3>
|
144 |
-
<p>One of the biggest risks of downloading Airlift movie online is that you might download malware and viruses along with the movie file. Malware and viruses are malicious software that can harm your device, steal your data, spy on your activities, or even ransom your files. They can come from untrusted sources, such as pirated websites or apps, or from fake or corrupted files. To avoid malware and viruses, you should always download Airlift movie from legal and safe sources, such as streaming platforms or torrent sites. You should also use a reliable antivirus software to scan your device and your downloaded files regularly.</p>
|
145 |
-
<h3>Legal Issues and Penalties</h3>
|
146 |
-
<p>Another risk of downloading Airlift movie online is that you might face legal issues and penalties if you download it from illegal sources, such as pirated websites or apps. Downloading Airlift movie from illegal sources is considered as piracy, which is a violation of the intellectual property rights of the filmmakers and the distributors. Piracy is a crime that can result in fines, lawsuits, or even jail time in some countries. To avoid legal issues and penalties, you should always download Airlift movie from legal sources, such as streaming platforms or torrent sites. You should also use a VPN service to hide your IP address and location from prying eyes.</p>
|
147 |
-
<h3>Poor Quality and Fake Files</h3>
|
148 |
-
<p>A third challenge of downloading Airlift movie online is that you might end up with poor quality or fake files that can ruin your viewing experience. Poor quality files are files that have low resolution, blurry images, distorted sound, missing subtitles, or sync issues. Fake files are files that have misleading titles, wrong content, incomplete duration, or malicious code. They can waste your time, bandwidth, storage space, or even harm your device. To avoid poor quality and fake files, you should always download Airlift movie from trusted sources, such as streaming platforms or torrent sites. You should also check the file size, format, name, description, reviews, ratings, and comments before downloading.</p>
|
149 |
-
<h2>Conclusion</h2>
|
150 |
-
<p>Airlift is a movie that tells the story of the largest civilian evacuation in history during the Gulf War in 1990. It is a movie that showcases the courage, patriotism, and humanity of the people involved. It is a movie that has received positive reviews and ratings from critics and audiences alike. It is a movie that you can download online legally and safely using streaming platforms, torrent sites, or VPN services. However, you should also be aware of the risks and challenges of downloading Airlift movie online, such as malware, legal issues, and poor quality files. Therefore, you should always use trusted sources, reliable software, and precautionary measures to download Airlift movie online. We hope this article has helped you learn how to download Airlift movie online. If you have any questions or feedback, please feel free to contact us. Thank you for reading and happy watching! <h2>FAQs</h2>
|
151 |
-
<p>Here are some of the frequently asked questions about downloading Airlift movie online:</p>
|
152 |
-
<ol>
|
153 |
-
<li>Q: Is Airlift movie based on a true story? <br>A: Yes, Airlift movie is based on a true story of the evacuation of over 170,000 Indians from Kuwait during the Gulf War in 1990.</li>
|
154 |
-
<li>Q: Where can I watch Airlift movie online legally? <br>A: You can watch Airlift movie online legally on streaming platforms such as Amazon Prime Video, Netflix, or Hotstar. You can also download Airlift movie online legally from these platforms.</li>
|
155 |
-
<li>Q: How can I download Airlift movie online safely? <br>A: You can download Airlift movie online safely by using torrent sites that offer legal and verified files, such as The Pirate Bay, 1337x, or RARBG. You can also use VPN services to protect your privacy and security while downloading Airlift movie online.</li>
|
156 |
-
<li>Q: What are the benefits of downloading Airlift movie online? <br>A: Some of the benefits of downloading Airlift movie online are that you can save time and money, watch anytime and anywhere, and enjoy high-quality video and audio.</li>
|
157 |
-
<li>Q: What are the risks of downloading Airlift movie online? <br>A: Some of the risks of downloading Airlift movie online are that you might download malware and viruses, face legal issues and penalties, or end up with poor quality and fake files.</li>
|
158 |
-
</ol></p> 401be4b1e0<br />
|
159 |
-
<br />
|
160 |
-
<br />
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
spaces/1phancelerku/anime-remove-background/Download Alchemy of Souls Full Season with English Subtitles.md
DELETED
@@ -1,72 +0,0 @@
|
|
1 |
-
|
2 |
-
<h1>Best Site to Download Alchemy of Souls</h1>
|
3 |
-
<p>Are you looking for a new fantasy drama to binge-watch? Do you love stories about magic, romance, and destiny? If you answered yes, then you should check out Alchemy of Souls, a South Korean television series that has captivated millions of viewers around the world. But where can you download Alchemy of Souls and watch it offline? In this article, we will tell you what Alchemy of Souls is, why you should watch it, and how to download it from the best site.</p>
|
4 |
-
<h2>What is Alchemy of Souls?</h2>
|
5 |
-
<p>Alchemy of Souls is a fantasy drama series that aired in 2022 and 2023 on tvN and Netflix. It was written by the Hong sisters, who are famous for their hit shows like Hotel del Luna and My Girlfriend Is a Nine-Tailed Fox. It stars Lee Jae-wook, Jung So-min, Go Youn-jung, and Hwang Min-hyun as the main cast.</p>
|
6 |
-
<h2>best site to download alchemy of souls</h2><br /><p><b><b>DOWNLOAD</b> >>> <a href="https://jinyurl.com/2uNTeq">https://jinyurl.com/2uNTeq</a></b></p><br /><br />
|
7 |
-
<h3>Synopsis</h3>
|
8 |
-
<p>The story is set in a fictional country called Daeho, where mages use elemental powers to protect the land. The plot revolves around a forbidden magic spell called the "alchemy of souls", which allows souls to switch bodies. The alchemy of souls causes a series of events that change the lives of four young mages who are entangled in a web of love, betrayal, and destiny.</p>
|
9 |
-
<h3>Cast and crew</h3>
|
10 |
-
<p>The cast of Alchemy of Souls includes:</p>
|
11 |
-
<ul>
|
12 |
-
<li>Lee Jae-wook as Mu-deok / Nak-su / Jin Bu-yeon, an elite assassin whose soul is trapped in the body of a mysterious girl.</li>
|
13 |
-
<li>Jung So-min as Nak-su / Cho Yeong / Jin Bu-yeon, a girl whose soul is swapped with Mu-deok's.</li>
|
14 |
-
<li>Go Youn-jung as Jang Uk, the young master of a noble mage family who falls in love with Mu-deok.</li>
|
15 |
-
<li>Hwang Min-hyun as Seo Yul, a loyal friend of Jang Uk who has a crush on Nak-su.</li>
|
16 |
-
</ul>
|
17 |
-
<p>The crew of Alchemy of Souls includes:</p>
|
18 |
-
<ul>
|
19 |
-
<li>Hong Jung-eun and Hong Mi-ran as the screenwriters.</li>
|
20 |
-
<li>Park Joon-hwa as the director.</li>
|
21 |
-
<li>Nam Hye-young as the music director.</li>
|
22 |
-
</ul>
|
23 |
-
<h3>Genre and themes</h3>
|
24 |
-
<p>Alchemy of Souls is a fantasy drama that combines elements of action, romance, comedy, and mystery. It explores themes such as identity, fate, friendship, loyalty, revenge, and redemption. It also touches on social issues such as class discrimination, corruption, and power abuse.</p>
|
25 |
-
<h2>Why You Should Watch Alchemy of Souls</h2>
|
26 |
-
<p>If you are still not convinced that Alchemy of Souls is worth watching, here are some reasons why you should give it a try:</p>
|
27 |
-
<h3>Unique and unpredictable plot</h3>
|
28 |
-
<p>Alchemy of Souls has a unique and unpredictable plot that will keep you hooked from start to finish. The story is full of twists and turns that will surprise you and make you wonder what will happen next. The alchemy of souls creates various scenarios that challenge the characters' morals, emotions, and relationships. The show also has a balance of humor and drama that will make you laugh and cry.</p>
|
29 |
-
<h3>Amazing acting and chemistry</h3>
|
30 |
-
<p>The actors of Alchemy of Souls deliver amazing performances that bring their characters to life. They portray their roles with passion, charisma, and versatility. They also have great chemistry with each other that makes their interactions believable and engaging. The romance between Mu-deok and Jang Uk is especially sweet and heartwarming.</p>
|
31 |
-
<h3>Stunning visuals and effects</h3>
|
32 |
-
<p>Alchemy of Souls has <p>Alchemy of Souls has stunning visuals and effects that create a realistic and immersive fantasy world. The show uses high-quality CGI and cinematography to showcase the beauty and diversity of Daeho. The show also features impressive action scenes and magic battles that are thrilling and spectacular.</p>
|
33 |
-
<p>[DOWNLOAD : Alchemy of Souls Complete Season 1 Episode 1 - TrendzVibez Media](^1^): This site offers a download link for the Korean drama series Alchemy of Souls, which is about the love and growth of young mages who use a forbidden magic spell to switch souls.<br />
|
34 |
-
[Alchemy of Souls (TV Series 2022– ) - IMDb](^2^): This site provides information and ratings for the Alchemy of Souls TV series, such as the cast, plot summary, genres, and reviews.<br />
|
35 |
-
[Download Alchemy of Souls ~ 2022 [Korean With ESub] [K-Drama] » MkvShows](^3^): This site offers various download options for the Alchemy of Souls series, such as 540p, 720p, and 1080p, with English subtitles.</p>
|
36 |
-
<h2>How to Download Alchemy of Souls</h2>
|
37 |
-
<p>Now that you know what Alchemy of Souls is and why you should watch it, you might be wondering how to download it and watch it offline. There are two main ways to do so:</p>
|
38 |
-
<h3>Netflix</h3>
|
39 |
-
<p>The easiest and most legal way to download Alchemy of Souls is through Netflix, the official streaming platform of the show. Netflix allows you to download episodes of Alchemy of Souls on your device and watch them anytime, anywhere. To download Alchemy of Souls on Netflix, you need to:</p>
|
40 |
-
<ol>
|
41 |
-
<li>Sign up for a Netflix account or log in to your existing account.</li>
|
42 |
-
<li>Search for Alchemy of Souls on the Netflix app or website.</li>
|
43 |
-
<li>Select the episode you want to download and tap on the download icon.</li>
|
44 |
-
<li>Wait for the download to finish and enjoy watching Alchemy of Souls offline.</li>
|
45 |
-
</ol>
|
46 |
-
<p>Note that you need to have a stable internet connection and enough storage space on your device to download Alchemy of Souls on Netflix. You also need to renew your downloads every 30 days or they will expire.</p>
|
47 |
-
<h3>TrendzVibez Media</h3>
|
48 |
-
<p>Another way to download Alchemy of Souls is through TrendzVibez Media, a popular site that offers free downloads of Korean dramas and movies. TrendzVibez Media has high-quality and fast downloads of Alchemy of Souls with English subtitles. To download Alchemy of Souls on TrendzVibez Media, you need to:</p>
|
49 |
-
<ol>
|
50 |
-
<li>Go to the TrendzVibez Media website and search for Alchemy of Souls.</li>
|
51 |
-
<li>Select the episode you want to download and click on the download link.</li>
|
52 |
-
<li>Choose the resolution and format you prefer and click on the download button.</li>
|
53 |
-
<li>Wait for the download to finish and enjoy watching Alchemy of Souls offline.</li>
|
54 |
-
</ol>
|
55 |
-
<p>Note that downloading Alchemy of Souls from TrendzVibez Media may not be legal in some countries and regions. You also need to be careful of ads and pop-ups that may contain viruses or malware.</p>
|
56 |
-
<h2>Conclusion</h2>
|
57 |
-
<p>Alchemy of Souls is a fantasy drama series that you should not miss if you love magic, romance, and destiny. It has a unique and unpredictable plot, amazing acting and chemistry, and stunning visuals and effects. You can download Alchemy of Souls from Netflix or TrendzVibez Media and watch it offline anytime, anywhere. So what are you waiting for? Download Alchemy of Souls today and join the millions of fans who are raving about this show!</p>
|
58 |
-
<h2>FAQs</h2>
|
59 |
-
<ul>
|
60 |
-
<li><strong>Q: How many episodes are there in Alchemy of Souls?</strong></li>
|
61 |
-
<li>A: There are 16 episodes in Alchemy of Souls, each lasting about an hour.</li>
|
62 |
-
<li><strong>Q: Is there a second season of Alchemy of Souls?</strong></li>
|
63 |
-
<li>A: There is no official confirmation yet, but the show's popularity and ratings suggest that there is a high possibility of a second season.</li>
|
64 |
-
<li><strong>Q: Who sings the OST of Alchemy of Souls?</strong></li>
|
65 |
-
<li>A: The OST of Alchemy of Souls features songs by various artists, such as IU, Taeyeon, Baekhyun, AKMU, Heize, and more.</li>
|
66 |
-
<li><strong>Q: Where can I watch Alchemy of Souls online?</strong></li>
|
67 |
-
<li>A: You can watch Alchemy of Souls online on Netflix, which has exclusive streaming rights for the show.</li>
|
68 |
-
<li><strong>Q: What is the rating of Alchemy of Souls?</strong></li>
|
69 |
-
<li>A: Alchemy of Souls has a rating of 8.7 out of 10 on IMDb, 9.4 out of 10 on MyDramaList, and 97% on Rotten Tomatoes.</li>
|
70 |
-
</ul></p> 401be4b1e0<br />
|
71 |
-
<br />
|
72 |
-
<br />
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
spaces/1phancelerku/anime-remove-background/Download Alight Motion for Android The First Professional Motion Design App.md
DELETED
@@ -1,18 +0,0 @@
|
|
1 |
-
|
2 |
-
<h1>How to Download APK Alight Motion for Android</h1>
|
3 |
-
Are you looking for a professional motion design app that can help you create stunning animations, motion graphics, visual effects, video editing, and video compositing? If yes, then you should try Alight Motion, the first pro-quality app for motion design on your Android device. In this article, we will show you what Alight Motion is, what features and benefits it offers, and how to download apk alight motion for Android from different sources. We will also guide you on how to install and use apk alight motion on your Android device. <h2>What is Alight Motion?</h2>
|
4 |
-
Alight Motion is a powerful and versatile app that allows you to create professional-looking animations, motion graphics, visual effects, video editing, and video compositing on your Android device. You can use Alight Motion to make anything from simple slideshows and logos to complex movies and music videos. You can also export your projects as MP4 videos, GIFs, or PNG sequences. <h3>Features of Alight Motion</h3>
|
5 |
-
Some of the features of Alight Motion are: - Multiple layers of graphics, video, and audio - Vector and bitmap support (edit vector graphics right on your phone) - Keyframe animation available for all settings - Animating easing for more fluid motion (choose from presets or build your own timing curves) - Solid color and gradient fill effects - Border and shadow effects - Group layers together - Save your favorite elements for easy re-use in future projects - Custom fonts support (install your own fonts) - Color adjustment tools (brightness, contrast, saturation, hue, etc.) - Blur effects (Gaussian blur, motion blur, etc.) - Visual effects (glow, outline, noise, distortion, etc.) - Preset shapes and clip art - Customizable velocity-based motion blur - Export MP4 video or GIF animation - Share your projects with other users through the community page <h3>Benefits of Alight Motion</h3>
|
6 |
-
Some of the benefits of using Alight Motion are: - You can create professional-quality animations, motion graphics, visual effects, video editing, and video compositing on your Android device without any prior experience or skills. - You can access a wide range of tools and effects that can help you enhance your creativity and express your ideas. - You can save time and money by using a single app for multiple purposes instead of switching between different apps. - You can join a community of other users who share their projects and feedback with each other. - You can enjoy a free trial version of the app before upgrading to the paid version that offers more features and removes the watermark. <h2>How to Download APK Alight Motion for Android</h2>
|
7 |
-
There are different ways to download apk alight motion for Android. You can choose the one that suits your preference and device compatibility. Here are some of the options: <h3>Steps to Download APK Alight Motion from Uptodown</h3>
|
8 |
-
Uptodown is a popular website that offers free downloads of apps and games for Android devices. You can follow these steps to download apk alight motion from Uptodown: 1. Go to [Uptodown](^1^) website on your browser. 2. Search for "alight motion" in the search bar or browse through the categories. 3. Click on the "Alight Motion" app icon from the results. 4. Click on the "Download" button at the bottom of the page. 5. Wait for the download to complete and then open the apk file to install it on your device. <h3>Steps to Download APK Alight Motion from Google Play Store</h3>
|
9 |
-
Google Play Store is the official app store for Android devices that offers millions of apps and games for download. You can follow these steps to download apk al ight motion from Google Play Store: 1. Go to [Google Play Store] app on your device or visit the website on your browser. 2. Search for "alight motion" in the search bar or browse through the categories. 3. Tap on the "Alight Motion" app icon from the results. 4. Tap on the "Install" button and accept the permissions. 5. Wait for the installation to complete and then open the app on your device. <h3>Steps to Download APK Alight Motion from BlueStacks</h3>
|
10 |
-
BlueStacks is a popular software that allows you to run Android apps and games on your PC or Mac. You can follow these steps to download apk alight motion from BlueStacks: 1. Download and install [BlueStacks] on your PC or Mac from the official website. 2. Launch BlueStacks and sign in with your Google account. 3. Go to the "My Apps" tab and click on the "App Center" icon. 4. Search for "alight motion" in the search bar or browse through the categories. 5. Click on the "Alight Motion" app icon from the results. 6. Click on the "Install" button and wait for the download to complete. 7. Open the app from the "My Apps" tab and enjoy using it on your PC or Mac. <h2>How to Install and Use APK Alight Motion on Android</h2>
|
11 |
-
After downloading apk alight motion for Android, you need to install and use it on your device. Here are some tips on how to do that: <h3>How to Install APK Alight Motion on Android</h3>
|
12 |
-
To install apk alight motion on Android, you need to enable the option of installing apps from unknown sources on your device. This will allow you to install apps that are not from Google Play Store. You can follow these steps to enable this option: 1. Go to your device's "Settings" and tap on "Security". 2. Find and toggle on the option of "Unknown sources" or "Install unknown apps". 3. Confirm your choice by tapping on "OK" or "Allow". 4. Now, go to your device's file manager and locate the apk file that you downloaded. 5. Tap on the apk file and follow the instructions to install it on your device. <h3>How to Use APK Alight Motion on Android</h3>
|
13 |
-
To use apk alight motion on Android, you need to launch the app and start creating your projects. You can follow these steps to use apk alight motion on Android: 1. Open the app and tap on the "+" icon at the bottom right corner to create a new project. 2. Choose a project name, aspect ratio, frame rate, and background color for your project and tap on "Create". 3. You will see a timeline at the bottom of the screen where you can add layers of graphics, video, and audio. 4. To add a layer, tap on the "+" icon at the top right corner and choose from different types of layers such as shape, image, text, video, audio, etc. 5. To edit a layer, tap on it and use the tools at the top of the screen such as transform, crop, rotate, scale, etc. 6. To animate a layer, tap on it and use the keyframe button at the bottom left corner to add keyframes for different settings such as position, opacity, rotation, scale, etc. 7. To apply effects to a layer, tap on it and use the effects button at the bottom right corner to choose from different effects such as color adjustment, blur, glow, distortion, etc. 8. To preview your project, use the play button at the center of the timeline or drag the playhead along the timeline. 9. To export your project, tap on the export button at the top right corner and choose from different options such as format, resolution, quality, duration, etc. 10. To share your project with others, tap on the share button at the top right corner and choose from different platforms such as YouTube, Instagram, Facebook, WhatsApp, etc. <h2>Conclusion</h2>
|
14 |
-
Alight Motion is a great app for creating professional-quality animations, motion graphics, visual effects, video editing, and video compositing on your Android device. You can download apk alight motion for Android from different sources such as Uptodown, Google Play Store, or BlueStacks. You can also install and use apk alight motion on Android easily by following our tips above. We hope this article has helped you learn how to download apk alight motion for Android and enjoy using it. <h2>FAQs</h2>
|
15 |
-
Here are some frequently asked questions about apk alight motion for Android: - Q: Is Alight Motion free? - A: Alight Motion offers a free trial version that allows you to use all features but adds a watermark to your projects. You can remove the watermark by upgrading to the paid version that costs $4.99 per month or $39.99 per year. - Q: Is Alight Motion safe? - A: Alight Motion is a safe and reliable app that does not contain any malware or viruses. However, you should always download apk alight motion from trusted sources such as Uptodown, Google Play Store, or BlueStacks to avoid any potential risks. - Q: Is Alight Motion compatible with my device? - A: Alight Motion requires Android 6.0 or higher and at least 1.5 GB of RAM to run smoothly. You can check your device's specifications and compatibility by going to your device's "Settings" and tapping on "About phone". - Q: How can I learn more about Alight Motion? - A: You can learn more about Alight Motion by visiting its official website, following its social media accounts, watching its tutorial videos, reading its user manual, or contacting its support team. - Q: How can I give feedback or suggestions to Alight Motion? - A: You can give feedback or suggestions to Alight Motion by using the feedback button in the app, sending an email to [email protected], or leaving a review on the app store.</p>
|
16 |
-
<h2>download apk alight motion</h2><br /><p><b><b>DOWNLOAD</b> > <a href="https://jinyurl.com/2uNTRl">https://jinyurl.com/2uNTRl</a></b></p><br /><br /> 401be4b1e0<br />
|
17 |
-
<br />
|
18 |
-
<br />
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
spaces/1phancelerku/anime-remove-background/Download PS3 Emulator for PC Windows 10 Tips and Tricks to Optimize Performance.md
DELETED
@@ -1,142 +0,0 @@
|
|
1 |
-
|
2 |
-
<h1>How to Download PS3 Emulator for PC Windows 10</h1>
|
3 |
-
<p>Do you want to play some of the best PlayStation 3 games on your PC? If so, you might be interested in using a PS3 emulator, which is a software that mimics the hardware and software of the PS3 console on your computer. With a PS3 emulator, you can enjoy games like Uncharted, The Last of Us, God of War, and more on your PC without buying a PS3 console.</p>
|
4 |
-
<p>However, PS3 emulation is not a simple or perfect process. It requires a powerful PC, a compatible Blu-ray drive or PSN account, and a legal copy of the PS3 games. It also has some limitations, such as potential bugs, glitches, crashes, or performance issues. Not all PS3 games are fully playable on PC, and some may require additional patches or settings to run properly.</p>
|
5 |
-
<h2>download ps3 emulator for pc windows 10</h2><br /><p><b><b>Download Zip</b> ››››› <a href="https://jinyurl.com/2uNPPy">https://jinyurl.com/2uNPPy</a></b></p><br /><br />
|
6 |
-
<p>Therefore, before you decide to download a PS3 emulator for PC Windows 10, you should check the requirements and compatibility of the emulator and the games you want to play. You should also be aware of the legal and ethical implications of using an emulator, as it may violate some copyrights or terms of service.</p>
|
7 |
-
<h2>How to Download and Install RPCS3, the Best PS3 Emulator for PC</h2>
|
8 |
-
<p>There are several PS3 emulators available for PC, but the most popular and reliable one is RPCS3. RPCS3 is a free and open-source PS3 emulator that supports Windows, Linux, macOS, and FreeBSD operating systems. It can play many PS3 games with different renderers and features like save states, cheats, and customizable graphics.</p>
|
9 |
-
<p>To download and install RPCS3 on your PC Windows 10, follow these steps:</p>
|
10 |
-
<h4>Step 1: Go to the RPCS3 website and download the latest build</h4>
|
11 |
-
<p>Visit [2](https://rpcs3.net/) and click on Download at the top menu. You will see a list of available builds for different platforms. Choose the one that matches your operating system (Windows) and click on Download. You will get a compressed file (.7z) that contains the emulator files.</p>
|
12 |
-
<h4>Step 2: Extract the compressed file and run the rpcs3.exe file</h4>
|
13 |
-
<p>Use any decompression software that supports .7z (such as [15](https://www.7-zip.org/)) to extract the compressed file to a convenient location on your PC. You will get a folder named rpcs3 that contains all the emulator files. Open the folder and double-click on rpcs3.exe to run the emulator.</p>
|
14 |
-
<h4>Step 3: Download and install the PS3 system software and Microsoft Visual C++ redistributable</h4>
|
15 |
-
<p>The first time you run RPCS3, it will ask you to install some additional components that are necessary for the emulator to work. These include:</p>
|
16 |
-
<ul>
|
17 |
-
<li>The PS3 system software (also known as firmware), which is the official software that runs on the PS3 console. You can download it from [17](https://www.playstation.com/en-us/support/hardware/ps3/system-software/). Make sure you download the latest version (4.88) and save it as PS3UPDAT.PUP.</li>
|
18 |
-
<li>The Microsoft Visual C++ 2019 redistributable, which is a library that provides some functions and features for the emulator. You can download it from [18](https://aka.ms/vs/16/release/vc_redist.x64.exe). Make sure you download the x64 version and install it on your PC.</li>
|
19 |
-
</ul>
|
20 |
-
<p>After you download these components, you need to install them on the emulator. To do that, go to File > Install Firmware and select the PS3UPDAT.PUP file. Wait for the installation to finish and then restart the emulator. You should see a message that says "Successfully installed PS3 firmware".</p>
|
21 |
-
<h4>Step 4: Configure the emulator settings and controller input</h4>
|
22 |
-
<p>Now that you have installed the necessary components, you can configure the emulator settings to optimize the performance and compatibility of the games. To do that, go to Config > Settings and explore the different tabs and options. You can adjust the CPU, GPU, audio, network, system, and advanced settings according to your preference and hardware specifications. You can also check the [19](https://wiki.rpcs3.net/index.php?title=Help:Configuration) for more guidance and recommendations.</p>
|
23 |
-
<p>rpcs3 playstation 3 emulator for windows 10<br />
|
24 |
-
how to install ps3 games on pc with rpcs3<br />
|
25 |
-
best settings for rpcs3 emulator on windows 10<br />
|
26 |
-
rpcs3 download latest version for windows 10<br />
|
27 |
-
rpcs3 compatibility list for windows 10 pc<br />
|
28 |
-
ps3 emulator for pc windows 10 free download<br />
|
29 |
-
ps3 emulator for pc windows 10 64 bit download<br />
|
30 |
-
ps3 emulator for pc windows 10 system requirements<br />
|
31 |
-
ps3 emulator for pc windows 10 offline installer<br />
|
32 |
-
ps3 emulator for pc windows 10 with bios download<br />
|
33 |
-
ps3 emulator for pc windows 10 no survey no password<br />
|
34 |
-
ps3 emulator for pc windows 10 highly compressed<br />
|
35 |
-
ps3 emulator for pc windows 10 full version download<br />
|
36 |
-
ps3 emulator for pc windows 10 crack download<br />
|
37 |
-
ps3 emulator for pc windows 10 without graphic card<br />
|
38 |
-
ps3 emulator for pc windows 10 reddit<br />
|
39 |
-
ps3 emulator for pc windows 10 youtube<br />
|
40 |
-
ps3 emulator for pc windows 10 tutorial<br />
|
41 |
-
ps3 emulator for pc windows 10 apk download<br />
|
42 |
-
ps3 emulator for pc windows 10 zip file download<br />
|
43 |
-
ps3 emulator for pc windows 10 softonic download<br />
|
44 |
-
ps3 emulator for pc windows 10 filehippo download<br />
|
45 |
-
ps3 emulator for pc windows 10 ocean of games download<br />
|
46 |
-
ps3 emulator for pc windows 10 cnet download<br />
|
47 |
-
ps3 emulator for pc windows 10 uptodown download<br />
|
48 |
-
best ps3 emulator for pc windows 10 in 2023<br />
|
49 |
-
fastest ps3 emulator for pc windows 10 in 2023<br />
|
50 |
-
easiest ps3 emulator for pc windows 10 in 2023<br />
|
51 |
-
safest ps3 emulator for pc windows 10 in 2023<br />
|
52 |
-
most reliable ps3 emulator for pc windows 10 in 2023<br />
|
53 |
-
most compatible ps3 emulator for pc windows 10 in 2023<br />
|
54 |
-
most stable ps3 emulator for pc windows 10 in 2023<br />
|
55 |
-
most updated ps3 emulator for pc windows 10 in 2023<br />
|
56 |
-
most popular ps3 emulator for pc windows 10 in 2023<br />
|
57 |
-
most realistic ps3 emulator for pc windows 10 in 2023<br />
|
58 |
-
how to play god of war on pc with rpcs3 emulator<br />
|
59 |
-
how to play gta v on pc with rpcs3 emulator<br />
|
60 |
-
how to play the last of us on pc with rpcs3 emulator<br />
|
61 |
-
how to play uncharted on pc with rpcs3 emulator<br />
|
62 |
-
how to play red dead redemption on pc with rpcs3 emulator<br />
|
63 |
-
how to play metal gear solid on pc with rpcs3 emulator<br />
|
64 |
-
how to play persona on pc with rpcs3 emulator<br />
|
65 |
-
how to play gran turismo on pc with rpcs3 emulator<br />
|
66 |
-
how to play fifa on pc with rpcs3 emulator<br />
|
67 |
-
how to play nba on pc with rpcs3 emulator<br />
|
68 |
-
how to play call of duty on pc with rpcs3 emulator<br />
|
69 |
-
how to play battlefield on pc with rpcs3 emulator<br />
|
70 |
-
how to play assassin's creed on pc with rpcs3 emulator<br />
|
71 |
-
how to play batman on pc with rpcs3 emulator</p>
|
72 |
-
<p>One of the most important settings to configure is the controller input. You can use a keyboard, a mouse, or a gamepad to play PS3 games on PC. To set up your controller input, go to Config > Pads and select the handler that matches your device. You can use XInput for Xbox controllers, DualShock 3 for PS3 controllers, DualShock 4 for PS4 controllers, or Keyboard for keyboard input. You can also use Mouse for mouse input in some games.</p>
|
73 |
-
<p>After you select the handler, you can map the buttons and axes of your controller to the corresponding PS3 buttons and axes. You can use the default mapping or customize it as you like. You can also create multiple profiles for different controllers or games. To save your configuration, click on Save at the bottom.</p>
|
74 |
-
<h2>How to Play PS3 Games on PC Using RPCS3</h2>
|
75 |
-
<p>Now that you have downloaded and installed RPCS3 on your PC Windows 10, you can start playing PS3 games on your PC. However, before you do that, you need to obtain the PS3 game files legally and copy them to the emulator directory. To do that, follow these steps:</p>
|
76 |
-
<h4>Step 1: Obtain PS3 game discs or digital copies legally</h4>
|
77 |
-
<p>The first thing you need to do is to get the PS3 game files that you want to play on PC. There are two ways to do that: using a PS3 game disc or using a digital copy from PSN.</p>
|
78 |
-
<p>If you have a physical PS3 game disc, you need to use a compatible Blu-ray drive on your PC to dump the game files. Not all Blu-ray drives are compatible with RPCS3, so you need to check the [20](https://wiki.rpcs3.net/index.php?title=Help:Dumping_Games#Disc_Games) for a list of supported drives.</p>
|
79 |
-
<p>If you have a digital copy of a PS3 game from PSN, you need to use a PSN downloader tool on your PC to download the game files. You also need to have a valid PSN account and a valid license for the game. You can use tools like [21](https://github.com/RPCS3/rpcs3/wiki/How-to-use-the-PSN-stuff-database-to-get-PSN-games) or [22](https://github.com/13xforever/psndl-rpc) to download PSN games.</p>
|
80 |
-
<h4>Step 2: Dump the game files using a compatible Blu-ray drive or PSN downloader</h4>
|
81 |
-
<p>After you have obtained the PS3 game disc or digital copy legally, you need to dump the game files using a compatible Blu-ray drive or PSN downloader. This process will vary depending on the type of game and the tool you use, but in general, you need to follow these steps:</p>
|
82 |
-
<ul>
|
83 |
-
<li>Insert the PS3 game disc into your Blu-ray drive or launch your PSN downloader tool.</li>
|
84 |
-
<li>Select the game that you want to dump and choose a destination folder on your PC.</li>
|
85 |
-
<li>Wait for the dumping process to finish and verify that there are no errors or missing files.</li>
|
86 |
-
<li>Rename the dumped folder according to the game ID (for example, BLUS30443 for God of War III).</li>
|
87 |
-
</ul>
|
88 |
-
<p>You can check the [23](https://wiki.rpcs3.net/index.php?title=Help:Dumping_Games) for more detailed instructions and screenshots for different types of games and tools.</p>
|
89 |
-
<h4>Step 3: Copy the game files to the dev_hdd0\game folder in the RPCS3 directory</h4>
|
90 |
-
<p>After you have dumped the game files, you need to copy them to the dev_hdd0\game folder in the RPCS3 directory. This is where the emulator will look for the games and load them. To do that, follow these steps:</p>
|
91 |
-
<ul>
|
92 |
-
<li>Open the RPCS3 folder and locate the dev_hdd0\game folder. If it does not exist, create it.</li>
|
93 |
-
<li>Copy the dumped game folder (with the game ID as the name) and paste it into the dev_hdd0\game folder.</li>
|
94 |
-
<li>Repeat this process for any other games that you want to play on PC.</li>
|
95 |
-
</ul>
|
96 |
-
<h4>Step 4: Launch the game from the game list and enjoy</h4>
|
97 |
-
<p>Now that you have copied the game files to the emulator directory, you can launch the game from the game list and enjoy playing PS3 games on PC. To do that, follow these steps:</p>
|
98 |
-
<ul>
|
99 |
-
<li>Open RPCS3 and wait for it to scan and load the games in the dev_hdd0\game folder.</li>
|
100 |
-
<li>You should see a list of games on the left panel of the emulator. You can sort them by name, serial, category, or compatibility.</li>
|
101 |
-
<li>Select the game that you want to play and double-click on it or right-click and choose Boot.</li>
|
102 |
-
<li>The game will start and you can play it using your controller or keyboard input.</li>
|
103 |
-
<li>You can also access some emulator features while playing, such as save states, screenshots, trophies, or logs.</li>
|
104 |
-
</ul>
|
105 |
-
<h2>Conclusion</h2>
|
106 |
-
<p>In this article, we have shown you how to download PS3 emulator for PC Windows 10 and how to play PS3 games on PC using RPCS3. We have explained what is PS3 emulator, what are the benefits and drawbacks of PS3 emulation, what are the requirements and compatibility of PS3 emulator, how to download and install RPCS3, how to obtain and dump PS3 game files legally, how to copy them to the emulator directory, and how to launch them from the game list.</p>
|
107 |
-
<p>We hope that this article has been helpful and informative for you. If you follow the steps and tips that we have provided, you should be able to enjoy some of the best PS3 games on your PC without buying a PS3 console. However, keep in mind that PS3 emulation is not perfect and may have some issues or limitations depending on your hardware and software configuration.</p>
|
108 |
-
<p>Some of the best PS3 games that we recommend you to try on PC are:</p>
|
109 |
-
<ul>
|
110 |
-
<li>The Last of Us: A post-apocalyptic action-adventure game that follows Joel and Ellie as they survive in a world infected by a fungal plague.</li>
|
111 |
-
<li>Uncharted 2: Among Thieves: A cinematic action-adventure game that follows Nathan Drake as he searches for the lost city of Shambhala.</li>
|
112 |
-
<li>God of War III: A hack-and-slash action-adventure game that follows Kratos as he seeks revenge against Zeus and the Olympian gods.</li>
|
113 |
-
<li>Metal Gear Solid 4: Guns of the Patriots: A stealth-action game that follows Solid Snake as he tries to stop Liquid Ocelot from launching a global war.</li>
|
114 |
-
<li>Red Dead Redemption: A western-themed action-adventure game that follows John Marston as he hunts down his former gang members across America and Mexico.</li>
|
115 |
-
</ul>
|
116 |
-
<p>If you have any feedback or questions about this article or PS3 emulation in general, please feel free to leave a comment below. We would love to hear from you and help you with any issues or doubts that you may have. Thank you for reading and happy gaming!</p>
|
117 |
-
<h2>Frequently Asked Questions</h2>
|
118 |
-
<h4>Q: Is PS3 emulation legal?</h4>
|
119 |
-
<p>A: PS3 emulation itself is legal, as long as you use a legitimate emulator like RPCS3 that does not infringe any copyrights or patents. However, downloading or distributing PS3 games without owning them or having a license is illegal and may result in legal consequences. Therefore, we advise you to only use PS3 games that you own legally or have a license for.</p>
|
120 |
-
<h4>Q: How can I improve the performance and compatibility of PS3 games on PC?</h4>
|
121 |
-
<p>A: There are several factors that affect the performance and compatibility of PS3 games on PC, such as your hardware specifications, your emulator settings, and your game files. To improve them, you can try the following tips:</p>
|
122 |
-
<ul>
|
123 |
-
<li>Upgrade your hardware components, especially your CPU, GPU, RAM, and SSD.</li>
|
124 |
-
<li>Update your drivers, operating system, and emulator to the latest versions.</li>
|
125 |
-
<li>Check the [24](https://rpcs3.net/compatibility) for the compatibility status and recommended settings of the games you want to play.</li>
|
126 |
-
<li>Use the Vulkan renderer and the LLVM recompiler for better graphics and speed.</li>
|
127 |
-
<li>Enable or disable some features like VSync, anti-aliasing, resolution scaling, or frame limit according to your preference and hardware capabilities.</li>
|
128 |
-
<li>Apply some patches or fixes for specific games that may have some issues or bugs. You can find them on the [25](https://wiki.rpcs3.net/index.php?title=Help:Game_Patches) or on the [26](https://forums.rpcs3.net/forum-18.html).</li>
|
129 |
-
</ul>
|
130 |
-
<h4>Q: Can I use PS4 or PS5 controllers to play PS3 games on PC?</h4>
|
131 |
-
<p>A: Yes, you can use PS4 or PS5 controllers to play PS3 games on PC using RPCS3. However, you may need to use some additional software or settings to make them work properly. For example, you can use [27](https://github.com/Ryochan7/DS4Windows) or [28](https://github.com/ViGEm/DsHidMini) for PS4 controllers, or [29](https://github.com/ViGEm/DsHidMini) or [30](https://github.com/Ohjurot/DualSense-Windows) for PS5 controllers. You can also check the [31](https://wiki.rpcs3.net/index.php?title=Help:Controller_Configuration) for more information and instructions on how to set up different controllers for RPCS3.</p>
|
132 |
-
<h4>Q: Can I play online multiplayer games on PC using RPCS3?</h4>
|
133 |
-
<p>A: Yes, you can play online multiplayer games on PC using RPCS3, but only with other RPCS3 users. You cannot play online with real PS3 users, as that would require connecting to the official PSN servers, which is not supported by RPCS3. To play online multiplayer games on PC using RPCS3, you need to use a feature called Netplay, which allows you to create or join a virtual LAN network with other RPCS3 users. You can find more details and instructions on how to use Netplay on the [32](https://wiki.rpcs3.net/index.php?title=Help:Netplay_Guide).</p>
|
134 |
-
<h4>Q: What are some alternatives to RPCS3 for PS3 emulation on PC?</h4>
|
135 |
-
<p>A: RPCS3 is the best and most popular PS3 emulator for PC, but it is not the only one. There are some other PS3 emulators available for PC, but they are less developed and less compatible than RPCS3. Some of them are:</p>
|
136 |
-
<ul>
|
137 |
-
<li>[33](https://esxemulator.com/): A closed-source PS3 emulator that claims to run most PS3 games at native resolution and 30fps.</li>
|
138 |
-
<li>[34](https://nucleuscoop.github.io/docs/): A tool that allows you to play local multiplayer games online with friends using different emulators, including RPCS3.</li>
|
139 |
-
<li>[35](https://www.playstation.com/en-us/ps-now/): A cloud gaming service that lets you stream hundreds of PS2, PS3, and PS4 games on your PC or other devices.</li>
|
140 |
-
</ul></p> 197e85843d<br />
|
141 |
-
<br />
|
142 |
-
<br />
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
spaces/1phancelerku/anime-remove-background/Download WhatsApp Business Status A Guide for Small Businesses.md
DELETED
@@ -1,218 +0,0 @@
|
|
1 |
-
<br />
|
2 |
-
<h1>How to Download WhatsApp Business Status</h1>
|
3 |
-
<p>WhatsApp Business is a free-to-download app that allows small businesses to communicate with their customers in an easy and efficient way. One of the features of WhatsApp Business is the status, which lets you share end-to-end encrypted text, photo, video, and GIF updates that disappear after 24 hours. In this article, we will show you how to download, edit, and share your own or someone else's WhatsApp Business status.</p>
|
4 |
-
<h2>download whatsapp business status</h2><br /><p><b><b>DOWNLOAD</b> »»» <a href="https://jinyurl.com/2uNPnz">https://jinyurl.com/2uNPnz</a></b></p><br /><br />
|
5 |
-
<h2>What Is WhatsApp Business Status?</h2>
|
6 |
-
<p>WhatsApp Business status is similar to the regular WhatsApp status, except that it is designed for businesses to showcase their products, services, offers, events, and more. You can use WhatsApp Business status to:</p>
|
7 |
-
<ul>
|
8 |
-
<li>Attract new customers by highlighting your unique selling points</li>
|
9 |
-
<li>Engage existing customers by providing useful information, tips, or feedback</li>
|
10 |
-
<li>Build trust and loyalty by showing your brand personality and values</li>
|
11 |
-
<li>Drive sales and conversions by creating urgency and scarcity</li>
|
12 |
-
<li>Measure your performance by tracking views and replies</li>
|
13 |
-
</ul>
|
14 |
-
<p>To send and receive status updates to and from your contacts, you and your contacts must have each other's numbers saved in your phone’s address books.</p>
|
15 |
-
<h2>How to Create and Send a WhatsApp Business Status</h2>
|
16 |
-
<p>Creating and sending a WhatsApp Business status is very easy. Here are the steps you need to follow:</p>
|
17 |
-
<p>How to download whatsapp business app and set up your profile<br />
|
18 |
-
Download whatsapp business status videos for free<br />
|
19 |
-
Whatsapp business features and benefits for small businesses<br />
|
20 |
-
How to migrate from whatsapp messenger to whatsapp business account<br />
|
21 |
-
Whatsapp business platform for medium and large businesses<br />
|
22 |
-
How to use whatsapp business API to communicate with customers<br />
|
23 |
-
Whatsapp business success stories and case studies<br />
|
24 |
-
How to download whatsapp business app on iPhone<br />
|
25 |
-
Whatsapp business app vs whatsapp messenger: what's the difference?<br />
|
26 |
-
How to create and manage whatsapp business catalog<br />
|
27 |
-
How to use whatsapp business labels and quick replies<br />
|
28 |
-
Whatsapp business app review and rating on Google Play Store<br />
|
29 |
-
How to backup and restore whatsapp business chat history<br />
|
30 |
-
Whatsapp business app download link and installation guide<br />
|
31 |
-
How to verify your whatsapp business number and name<br />
|
32 |
-
How to use whatsapp business web and desktop<br />
|
33 |
-
How to update the whatsapp business app to the latest version<br />
|
34 |
-
Whatsapp business app privacy and security settings<br />
|
35 |
-
How to delete or deactivate your whatsapp business account<br />
|
36 |
-
How to use whatsapp business analytics and insights<br />
|
37 |
-
How to download whatsapp business status images and quotes<br />
|
38 |
-
Whatsapp business app tips and tricks for better customer service<br />
|
39 |
-
How to integrate whatsapp business with other apps and tools<br />
|
40 |
-
Whatsapp business app FAQs and troubleshooting<br />
|
41 |
-
How to contact whatsapp business support team<br />
|
42 |
-
How to download whatsapp business beta version and test new features<br />
|
43 |
-
Whatsapp business app alternatives and competitors<br />
|
44 |
-
How to use whatsapp business broadcast and group chats<br />
|
45 |
-
How to create and share whatsapp business QR code<br />
|
46 |
-
How to use whatsapp business stickers and emojis<br />
|
47 |
-
How to download whatsapp business status saver app<br />
|
48 |
-
Whatsapp business app pricing and plans for different regions<br />
|
49 |
-
How to use whatsapp business payment feature and accept online payments<br />
|
50 |
-
Whatsapp business app terms of service and policies<br />
|
51 |
-
How to use whatsapp business voice and video calls<br />
|
52 |
-
How to download whatsapp business status downloader app<br />
|
53 |
-
Whatsapp business app advantages and disadvantages for different industries<br />
|
54 |
-
How to use whatsapp business stories and status updates<br />
|
55 |
-
How to create and join whatsapp business groups and communities<br />
|
56 |
-
How to use whatsapp business dark mode and customize your app theme<br />
|
57 |
-
How to download whatsapp business status maker app<br />
|
58 |
-
Whatsapp business app feedback and suggestions for improvement<br />
|
59 |
-
How to use whatsapp business notifications and sound settings<br />
|
60 |
-
Whatsapp business app awards and recognition in the market<br />
|
61 |
-
How to download whatsapp business status editor app<br />
|
62 |
-
Whatsapp business app challenges and opportunities in the future<br />
|
63 |
-
How to use whatsapp business location and live location features<br />
|
64 |
-
Whatsapp business app best practices and recommendations from experts</p>
|
65 |
-
<ol>
|
66 |
-
<li>Open WhatsApp Business > Status.</li>
|
67 |
-
<li>Tap one of the following options: <ul>
|
68 |
-
<li>Text to compose a written status update.</li>
|
69 |
-
<li>Emoji to add emoji or GIFs.</li>
|
70 |
-
<li>T to pick a font.</li>
|
71 |
-
<li>Color to pick a background color.</li>
|
72 |
-
<li>Voice and hold to record a voice status update.</li>
|
73 |
-
<li>Camera or My status to take or record a photo, video, or GIF, or choose media from the picker.</li>
|
74 |
-
</ul></li>
|
75 |
-
<li>You can also edit or add a caption to your photo, video, or GIF, as explained in the next section.</li>
|
76 |
-
<li>Select the audience for your status by tapping your default audience. Then, select your status contacts and tap Done.</li>
|
77 |
-
<li>Tap Send.</li>
|
78 |
-
</ol>
|
79 |
-
<h2>How to Download a WhatsApp Business Status</h2>
|
80 |
-
<p>If you want to save someone else's WhatsApp Business status to your phone, you have three methods to choose from:</p>
|
81 |
-
<h3>Method 1: Access the Hidden Statuses Folder</h3>
|
82 |
-
<p>Whenever you load a status from someone else, it is automatically saved in a hidden folder on your phone. To access this folder, you need to use a file manager app that can show hidden files. Here are the instructions for Android users:</p>
|
83 |
-
<ol>
|
84 |
-
<li>Download and install a file manager app that can show hidden files, such as ES File Explorer or Solid Explorer.</li>
|
85 |
-
<li>Open the file manager app and go to Internal Storage > WhatsApp > Media > .Statuses.</li>
|
86 |
-
<li>You will see all the status updates that you have viewed in the last 24 hours. You can copy or move them to another folder to save them permanently.</li>
|
87 |
-
</ol>
|
88 |
-
<p>Note that this method only works for status updates that you have already viewed. Also, the status updates will be deleted from the hidden folder after 24 hours, so you need to save them before they expire.</p>
|
89 |
-
<h3>Method 2: Use a Third-Party Downloader App</h3>
|
90 |
-
<p>Another way to download WhatsApp Business status is to use a third-party downloader app that can automatically save the status updates to your phone. There are many such apps available on the Google Play Store, such as Status Saver, Status Downloader, or Status Saver for WhatsApp Business. Here are the instructions for using one of these apps:</p>
|
91 |
-
<ol>
|
92 |
-
<li>Download and install a downloader app of your choice from the Google Play Store.</li>
|
93 |
-
<li>Open WhatsApp Business and view the status updates that you want to download.</li>
|
94 |
-
<li>Open the downloader app and tap on the status updates that you want to save. You can also select multiple status updates at once.</li>
|
95 |
-
<li>Tap on the download icon to save them to your phone. You can also share or repost them from the app.</li>
|
96 |
-
</ol>
|
97 |
-
<p>Note that this method also requires you to view the status updates before you can download them. Also, some downloader apps may contain ads or require permissions that may compromise your privacy or security.</p>
|
98 |
-
<h3>Method 3: Take a Screenshot or Screen Recording</h3>
|
99 |
-
<p>The simplest way to download WhatsApp Business status is to take a screenshot or screen recording of the status update that you want to save. This method works for both Android and iPhone users. Here are the instructions for each platform:</p>
|
100 |
-
<h4>Android</h4>
|
101 |
-
<ul>
|
102 |
-
<li>To take a screenshot, press and hold the power and volume down buttons at the same time. Alternatively, swipe down from the top of the screen and tap on the screenshot icon.</li>
|
103 |
-
<li>To take a screen recording, swipe down from the top of the screen and tap on the screen recorder icon. Alternatively, download and install a screen recorder app of your choice from the Google Play Store.</li>
|
104 |
-
<li>You can find your screenshots and screen recordings in your phone's gallery or photos app.</li>
|
105 |
-
</ul>
|
106 |
-
<h4>iPhone</h4>
|
107 |
-
<ul>
|
108 |
-
<li>To take a screenshot, press and release the side button and the volume up button at the same time. Alternatively, enable AssistiveTouch and tap on the screenshot button.</li>
|
109 |
-
<li>To take a screen recording, add the screen recording button to your Control Center by going to Settings > Control Center > Customize Controls. Then, swipe down from the top right corner of the screen and tap on the screen recording button.</li>
|
110 |
-
<li>You can find your screenshots and screen recordings in your phone's photos app.</li>
|
111 |
-
</ul>
|
112 |
-
<p>Note that this method may not capture the full quality or length of the status update. Also, some status updates may have privacy settings that prevent screenshots or screen recordings.</p>
|
113 |
-
<h2>How to Edit a WhatsApp Business Status</h2>
|
114 |
-
<p>If you want to edit your own or someone else's WhatsApp Business status before saving or sharing it, you have several options to choose from:</p>
|
115 |
-
<h3>How to Crop, Rotate, or Resize a WhatsApp Business Status</h3>
|
116 |
-
<p>If you want to crop, rotate, or resize a WhatsApp Business status, you can use either the built-in editor in WhatsApp Business or an online tool such as Crop Photo Online or Resize Image Online. Here are the instructions for each option:</p>
|
117 |
-
<h4>WhatsApp Business Editor</h4>
|
118 |
-
<ul>
|
119 |
-
<li>Open WhatsApp Business > Status.</li>
|
120 |
-
<li>Tap on the status update that you want to edit.</li>
|
121 |
-
<li>Tap on the edit icon at the top right corner of the screen.</li>
|
122 |
-
<li>Use the crop, rotate, or resize icons at the bottom of the screen to adjust the status update as you like.</li>
|
123 |
-
<li>Tap on Done and then Send to save and share your edited status update.</li>
|
124 |
-
</ul>
|
125 |
-
<h4>Online Tool</h4>
|
126 |
-
<ul>
|
127 |
-
<li>Download the status update that you want to edit using one of the methods explained in the previous section.</li>
|
128 |
-
<li>Go to an online tool such as Crop Photo Online or Resize Image Online and upload your status update.</li>
|
129 |
-
<li>Use the crop, rotate, or resize options on the tool to adjust the status update as you like.</li>
|
130 |
-
<li>Download your edited status update and save it to your phone.</li>
|
131 |
-
<li>Open WhatsApp Business > Status and tap on Camera or My status to upload your edited status update.</li>
|
132 |
-
<li>Add a caption if you want and select your audience.</li>
|
133 |
-
<li>Tap on Send to share your edited status update.</li>
|
134 |
-
</ul>
|
135 |
-
<h3>How to Add Text, Emoji, or Stickers to a WhatsApp Business Status</h3>
|
136 |
-
<p>If you want to add text, emoji, or stickers to a WhatsApp Business status, you can use either the built-in editor in WhatsApp Business or an online tool such as Add Text to Photo Online or Add Stickers to Photo Online. Here are the instructions for each option:</p>
|
137 |
-
<h4>WhatsApp Business Editor</h4>
|
138 |
-
<ul>
|
139 |
-
<li>Open WhatsApp Business > Status.</li>
|
140 |
-
<li>Tap on the status update that you want to edit.</li>
|
141 |
-
<li>Tap on the edit icon at the top right corner of the screen.</li>
|
142 |
-
<li>Use the text, emoji, or sticker icons at the top of the screen to add text, emoji, or stickers to your status update. You can also change the color, font, size, or alignment of your text.</li>
|
143 |
-
<li>Tap on Done and then Send to save and share your edited status update.</li>
|
144 |
-
</ul>
|
145 |
-
<h4>Online Tool</h4>
|
146 |
-
<ul>
|
147 |
-
<li>Download the status update that you want to edit using one of the methods explained in the previous section.</li>
|
148 |
-
<li>Go to an online tool such as Add Text to Photo Online or Add Stickers to Photo Online and upload your status update.</li>
|
149 |
-
<li>Use the text, emoji, or sticker options on the tool to add text, emoji, or stickers to your status update. You can also change the color, font, size, or alignment of your text.</li>
|
150 |
-
<li>Download your edited status update and save it to your phone.</li>
|
151 |
-
<li>Open WhatsApp Business > Status and tap on Camera or My status to upload your edited status update.</li>
|
152 |
-
<li>Add a caption if you want and select your audience.</li>
|
153 |
-
<li>Tap on Send to share your edited status update.</li>
|
154 |
-
</ul>
|
155 |
-
<h3>How to Add Filters or Effects to a WhatsApp Business Status</h3>
|
156 |
-
<p>If you want to add filters or effects to a WhatsApp Business status, you can use either the built-in editor in WhatsApp Business or an online tool such as Photo Filters Online or Photo Effects Online. Here are the instructions for each option:</p>
|
157 |
-
<h4>WhatsApp Business Editor</h4>
|
158 |
-
<ul>
|
159 |
-
<li>Open WhatsApp Business > Status.</li>
|
160 |
-
<li>Tap on the status update that you want to edit.</li>
|
161 |
-
<li>Tap on the edit icon at the top right corner of the screen.</li>
|
162 |
-
<li>Swipe left or right on the screen to choose a filter for your status update. You can also tap on the magic wand icon to apply an automatic enhancement.</li>
|
163 |
-
<li>Tap on Done and then Send to save and share your edited status update.</li>
|
164 |
-
</ul>
|
165 |
-
<h4>Online Tool</h4>
|
166 |
-
<ul>
|
167 |
-
<li>Download the status update that you want to edit using one of the methods explained in the previous section.</li>
|
168 |
-
<li>Go to an online tool such as Photo Filters Online or Photo Effects Online and upload your status update.</li>
|
169 |
-
<li>Use the filter or effect options on the tool to add filters or effects to your status update. You can also adjust the intensity, contrast, brightness, saturation, or hue of your status update.</li>
|
170 |
-
<li>Download your edited status update and save it to your phone.</li>
|
171 |
-
<li>Open WhatsApp Business > Status and tap on Camera or My status to upload your edited status update.</li>
|
172 |
-
<li>Add a caption if you want and select your audience.</li>
|
173 |
-
<li>Tap on Send to share your edited status update.</li>
|
174 |
-
</ul>
|
175 |
-
<h2>How to Share or Repost a WhatsApp Business Status</h2>
|
176 |
-
<p>If you want to share or repost your own or someone else's WhatsApp Business status to other apps or contacts, you have two options to choose from:</p>
|
177 |
-
<h3>Option 1: Use the Share Button</h3>
|
178 |
-
<p>This option allows you to share or repost a WhatsApp Business status directly from the app. Here are the steps you need to follow:</p>
|
179 |
-
<ol>
|
180 |
-
<li>Open WhatsApp Business > Status.</li>
|
181 |
-
<li>Tap on the status update that you want to share or repost.</li>
|
182 |
-
<li>Tap on the share icon at the bottom right corner of the screen.</li>
|
183 |
-
<li>Select the app or contact that you want to share or repost the status update with. You can also add a message if you want.</li>
|
184 |
-
<li>Tap on Send or Post to share or repost the status update.</li>
|
185 |
-
</ol>
|
186 |
-
<h3>Option 2: Use the Download Button</h3>
|
187 |
-
<p>This option allows you to download a WhatsApp Business status and then share or repost it from another app. Here are the steps you need to follow:</p>
|
188 |
-
<ol>
|
189 |
-
<li>Download the status update that you want to share or repost using one of the methods explained in the previous section.</li>
|
190 |
-
<li>Open the app that you want to share or repost the status update with, such as Facebook, Instagram, Twitter, etc.</li>
|
191 |
-
<li>Create a new post and upload the status update from your phone's gallery or photos app.</li>
|
192 |
-
<li>Add a caption, tag, location, or hashtag if you want.</li>
|
193 |
-
<li>Tap on Share or Post to share or repost the status update.</li>
|
194 |
-
</ol>
|
195 |
-
<h2>Conclusion</h2>
|
196 |
-
<p>In this article, we have shown you how to download, edit, and share WhatsApp Business status updates. WhatsApp Business status is a great way to promote your business and connect with your customers. You can use it to showcase your products, services, offers, events, and more. You can also download, edit, and share other people's status updates that are relevant to your business. We hope you found this article helpful and informative. If you have any questions or feedback, please let us know in the comments below. Thank you for reading!</p>
|
197 |
-
<h2>FAQs</h2>
|
198 |
-
<h3>Q: How can I delete a WhatsApp Business status?</h3>
|
199 |
-
<p>A: To delete a WhatsApp Business status, follow these steps:</p>
|
200 |
-
<ol>
|
201 |
-
<li>Open WhatsApp Business > Status.</li>
|
202 |
-
<li>Tap on My Status > More > Delete > Delete.</li>
|
203 |
-
</ol>
|
204 |
-
<h3>Q: How can I mute a WhatsApp Business status?</h3>
|
205 |
-
<p>A: To mute a WhatsApp Business status, follow these steps:</p>
|
206 |
-
<ol>
|
207 |
-
<li>Open WhatsApp Business > Status.</li>
|
208 |
-
<li>Tap and hold on a contact's name until a menu appears.</li>
|
209 |
-
<li>Select Mute > OK.</li>
|
210 |
-
</ol>
|
211 |
-
<h3>Q: How can I view who has seen my WhatsApp Business status?</h3>
|
212 |
-
<p>A: To view who has seen your WhatsApp Business status, follow these steps:</p>
|
213 |
-
<ol>
|
214 |
-
<li>Open WhatsApp Business > Status.</li>
|
215 |
-
<li>Tap on My Status > Eye icon.</li>
|
216 |
-
</ol></p> 401be4b1e0<br />
|
217 |
-
<br />
|
218 |
-
<br />
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
spaces/1toTree/lora_test/ppdiffusers/pipelines/alt_diffusion/pipeline_alt_diffusion.py
DELETED
@@ -1,496 +0,0 @@
|
|
1 |
-
# Copyright (c) 2022 PaddlePaddle Authors. All Rights Reserved.
|
2 |
-
# Copyright 2022 The HuggingFace Team. 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 |
-
import inspect
|
17 |
-
from typing import Callable, List, Optional, Union
|
18 |
-
|
19 |
-
import paddle
|
20 |
-
from packaging import version
|
21 |
-
|
22 |
-
from paddlenlp.transformers import CLIPFeatureExtractor, XLMRobertaTokenizer
|
23 |
-
|
24 |
-
from ...configuration_utils import FrozenDict
|
25 |
-
from ...models import AutoencoderKL, UNet2DConditionModel
|
26 |
-
from ...pipeline_utils import DiffusionPipeline
|
27 |
-
from ...schedulers import (
|
28 |
-
DDIMScheduler,
|
29 |
-
DPMSolverMultistepScheduler,
|
30 |
-
EulerAncestralDiscreteScheduler,
|
31 |
-
LMSDiscreteScheduler,
|
32 |
-
PNDMScheduler,
|
33 |
-
)
|
34 |
-
from ...utils import deprecate, logging
|
35 |
-
from ..stable_diffusion.safety_checker import StableDiffusionSafetyChecker
|
36 |
-
from . import AltDiffusionPipelineOutput, RobertaSeriesModelWithTransformation
|
37 |
-
|
38 |
-
logger = logging.get_logger(__name__) # pylint: disable=invalid-name
|
39 |
-
|
40 |
-
|
41 |
-
class AltDiffusionPipeline(DiffusionPipeline):
|
42 |
-
r"""
|
43 |
-
Pipeline for text-to-image generation using Alt Diffusion.
|
44 |
-
|
45 |
-
This model inherits from [`DiffusionPipeline`]. Check the superclass documentation for the generic methods the
|
46 |
-
library implements for all the pipelines (such as downloading or saving etc.)
|
47 |
-
|
48 |
-
Args:
|
49 |
-
vae ([`AutoencoderKL`]):
|
50 |
-
Variational Auto-Encoder (VAE) Model to encode and decode images to and from latent representations.
|
51 |
-
text_encoder ([`RobertaSeriesModelWithTransformation`]):
|
52 |
-
Frozen text-encoder. Alt Diffusion uses the text portion of
|
53 |
-
[CLIP](https://huggingface.co/docs/transformers/model_doc/clip#transformers.RobertaSeriesModelWithTransformation),
|
54 |
-
specifically the [clip-vit-large-patch14](https://huggingface.co/openai/clip-vit-large-patch14) variant.
|
55 |
-
tokenizer (`XLMRobertaTokenizer`):
|
56 |
-
Tokenizer of class
|
57 |
-
[XLMRobertaTokenizer](https://huggingface.co/docs/transformers/v4.21.0/en/model_doc/clip#transformers.XLMRobertaTokenizer).
|
58 |
-
unet ([`UNet2DConditionModel`]): Conditional U-Net architecture to denoise the encoded image latents.
|
59 |
-
scheduler ([`SchedulerMixin`]):
|
60 |
-
A scheduler to be used in combination with `unet` to denoise the encoded image latents. Can be one of
|
61 |
-
[`DDIMScheduler`], [`LMSDiscreteScheduler`], or [`PNDMScheduler`].
|
62 |
-
safety_checker ([`StableDiffusionSafetyChecker`]):
|
63 |
-
Classification module that estimates whether generated images could be considered offensive or harmful.
|
64 |
-
Please, refer to the [model card](https://huggingface.co/runwayml/stable-diffusion-v1-5) for details.
|
65 |
-
feature_extractor ([`CLIPFeatureExtractor`]):
|
66 |
-
Model that extracts features from generated images to be used as inputs for the `safety_checker`.
|
67 |
-
"""
|
68 |
-
_optional_components = ["safety_checker", "feature_extractor"]
|
69 |
-
|
70 |
-
def __init__(
|
71 |
-
self,
|
72 |
-
vae: AutoencoderKL,
|
73 |
-
text_encoder: RobertaSeriesModelWithTransformation,
|
74 |
-
tokenizer: XLMRobertaTokenizer,
|
75 |
-
unet: UNet2DConditionModel,
|
76 |
-
scheduler: Union[
|
77 |
-
DDIMScheduler,
|
78 |
-
PNDMScheduler,
|
79 |
-
LMSDiscreteScheduler,
|
80 |
-
EulerAncestralDiscreteScheduler,
|
81 |
-
DPMSolverMultistepScheduler,
|
82 |
-
],
|
83 |
-
safety_checker: StableDiffusionSafetyChecker,
|
84 |
-
feature_extractor: CLIPFeatureExtractor,
|
85 |
-
requires_safety_checker: bool = True,
|
86 |
-
):
|
87 |
-
super().__init__()
|
88 |
-
|
89 |
-
if hasattr(scheduler.config, "steps_offset") and scheduler.config.steps_offset != 1:
|
90 |
-
deprecation_message = (
|
91 |
-
f"The configuration file of this scheduler: {scheduler} is outdated. `steps_offset`"
|
92 |
-
f" should be set to 1 instead of {scheduler.config.steps_offset}. Please make sure "
|
93 |
-
"to update the config accordingly as leaving `steps_offset` might led to incorrect results"
|
94 |
-
" in future versions. If you have downloaded this checkpoint from the Hugging Face Hub,"
|
95 |
-
" it would be very nice if you could open a Pull request for the `scheduler/scheduler_config.json`"
|
96 |
-
" file"
|
97 |
-
)
|
98 |
-
deprecate("steps_offset!=1", "1.0.0", deprecation_message, standard_warn=False)
|
99 |
-
new_config = dict(scheduler.config)
|
100 |
-
new_config["steps_offset"] = 1
|
101 |
-
scheduler._internal_dict = FrozenDict(new_config)
|
102 |
-
|
103 |
-
if hasattr(scheduler.config, "clip_sample") and scheduler.config.clip_sample is True:
|
104 |
-
deprecation_message = (
|
105 |
-
f"The configuration file of this scheduler: {scheduler} has not set the configuration `clip_sample`."
|
106 |
-
" `clip_sample` should be set to False in the configuration file. Please make sure to update the"
|
107 |
-
" config accordingly as not setting `clip_sample` in the config might lead to incorrect results in"
|
108 |
-
" future versions. If you have downloaded this checkpoint from the Hugging Face Hub, it would be very"
|
109 |
-
" nice if you could open a Pull request for the `scheduler/scheduler_config.json` file"
|
110 |
-
)
|
111 |
-
deprecate("clip_sample not set", "1.0.0", deprecation_message, standard_warn=False)
|
112 |
-
new_config = dict(scheduler.config)
|
113 |
-
new_config["clip_sample"] = False
|
114 |
-
scheduler._internal_dict = FrozenDict(new_config)
|
115 |
-
|
116 |
-
if safety_checker is None and requires_safety_checker:
|
117 |
-
logger.warning(
|
118 |
-
f"You have disabled the safety checker for {self.__class__} by passing `safety_checker=None`. Ensure"
|
119 |
-
" that you abide to the conditions of the Alt Diffusion license and do not expose unfiltered"
|
120 |
-
" results in services or applications open to the public. PaddleNLP team, diffusers team and Hugging Face"
|
121 |
-
" strongly recommend to keep the safety filter enabled in all public facing circumstances, disabling"
|
122 |
-
" it only for use-cases that involve analyzing network behavior or auditing its results. For more"
|
123 |
-
" information, please have a look at https://github.com/huggingface/diffusers/pull/254 ."
|
124 |
-
)
|
125 |
-
if safety_checker is not None and feature_extractor is None:
|
126 |
-
raise ValueError(
|
127 |
-
"Make sure to define a feature extractor when loading {self.__class__} if you want to use the safety"
|
128 |
-
" checker. If you do not want to use the safety checker, you can pass `'safety_checker=None'` instead."
|
129 |
-
)
|
130 |
-
|
131 |
-
is_unet_version_less_0_9_0 = hasattr(unet.config, "_ppdiffusers_version") and version.parse(
|
132 |
-
version.parse(unet.config._ppdiffusers_version).base_version
|
133 |
-
) < version.parse("0.9.0.dev0")
|
134 |
-
is_unet_sample_size_less_64 = hasattr(unet.config, "sample_size") and unet.config.sample_size < 64
|
135 |
-
if is_unet_version_less_0_9_0 and is_unet_sample_size_less_64:
|
136 |
-
deprecation_message = (
|
137 |
-
"The configuration file of the unet has set the default `sample_size` to smaller than"
|
138 |
-
" 64 which seems highly unlikely. If your checkpoint is a fine-tuned version of any of the"
|
139 |
-
" following: \n- CompVis/stable-diffusion-v1-4 \n- CompVis/stable-diffusion-v1-3 \n-"
|
140 |
-
" CompVis/stable-diffusion-v1-2 \n- CompVis/stable-diffusion-v1-1 \n- runwayml/stable-diffusion-v1-5"
|
141 |
-
" \n- runwayml/stable-diffusion-inpainting \n you should change 'sample_size' to 64 in the"
|
142 |
-
" configuration file. Please make sure to update the config accordingly as leaving `sample_size=32`"
|
143 |
-
" in the config might lead to incorrect results in future versions. If you have downloaded this"
|
144 |
-
" checkpoint from the Hugging Face Hub, it would be very nice if you could open a Pull request for"
|
145 |
-
" the `unet/config.json` file"
|
146 |
-
)
|
147 |
-
deprecate("sample_size<64", "1.0.0", deprecation_message, standard_warn=False)
|
148 |
-
new_config = dict(unet.config)
|
149 |
-
new_config["sample_size"] = 64
|
150 |
-
unet._internal_dict = FrozenDict(new_config)
|
151 |
-
|
152 |
-
self.register_modules(
|
153 |
-
vae=vae,
|
154 |
-
text_encoder=text_encoder,
|
155 |
-
tokenizer=tokenizer,
|
156 |
-
unet=unet,
|
157 |
-
scheduler=scheduler,
|
158 |
-
safety_checker=safety_checker,
|
159 |
-
feature_extractor=feature_extractor,
|
160 |
-
)
|
161 |
-
self.vae_scale_factor = 2 ** (len(self.vae.config.block_out_channels) - 1)
|
162 |
-
self.register_to_config(requires_safety_checker=requires_safety_checker)
|
163 |
-
|
164 |
-
def _encode_prompt(self, prompt, num_images_per_prompt, do_classifier_free_guidance, negative_prompt):
|
165 |
-
r"""
|
166 |
-
Encodes the prompt into text encoder hidden states.
|
167 |
-
|
168 |
-
Args:
|
169 |
-
prompt (`str` or `list(int)`):
|
170 |
-
prompt to be encoded
|
171 |
-
num_images_per_prompt (`int`):
|
172 |
-
number of images that should be generated per prompt
|
173 |
-
do_classifier_free_guidance (`bool`):
|
174 |
-
whether to use classifier free guidance or not
|
175 |
-
negative_prompt (`str` or `List[str]`):
|
176 |
-
The prompt or prompts not to guide the image generation. Ignored when not using guidance (i.e., ignored
|
177 |
-
if `guidance_scale` is less than `1`).
|
178 |
-
"""
|
179 |
-
batch_size = len(prompt) if isinstance(prompt, list) else 1
|
180 |
-
|
181 |
-
text_inputs = self.tokenizer(
|
182 |
-
prompt,
|
183 |
-
padding="max_length",
|
184 |
-
max_length=self.tokenizer.model_max_length,
|
185 |
-
truncation=True,
|
186 |
-
return_tensors="pd",
|
187 |
-
)
|
188 |
-
text_input_ids = text_inputs.input_ids
|
189 |
-
untruncated_ids = self.tokenizer(prompt, padding="longest", return_tensors="pd").input_ids
|
190 |
-
|
191 |
-
if untruncated_ids.shape[-1] >= text_input_ids.shape[-1] and not paddle.equal_all(
|
192 |
-
text_input_ids, untruncated_ids
|
193 |
-
):
|
194 |
-
removed_text = self.tokenizer.batch_decode(untruncated_ids[:, self.tokenizer.model_max_length - 1 : -1])
|
195 |
-
logger.warning(
|
196 |
-
"The following part of your input was truncated because XLM-Roberta can only handle sequences up to"
|
197 |
-
f" {self.tokenizer.model_max_length} tokens: {removed_text}"
|
198 |
-
)
|
199 |
-
|
200 |
-
config = (
|
201 |
-
self.text_encoder.config
|
202 |
-
if isinstance(self.text_encoder.config, dict)
|
203 |
-
else self.text_encoder.config.to_dict()
|
204 |
-
)
|
205 |
-
if config.get("use_attention_mask", None) is not None and config["use_attention_mask"]:
|
206 |
-
attention_mask = text_inputs.attention_mask
|
207 |
-
else:
|
208 |
-
attention_mask = None
|
209 |
-
|
210 |
-
text_embeddings = self.text_encoder(
|
211 |
-
text_input_ids,
|
212 |
-
attention_mask=attention_mask,
|
213 |
-
)
|
214 |
-
text_embeddings = text_embeddings[0]
|
215 |
-
|
216 |
-
# duplicate text embeddings for each generation per prompt, using mps friendly method
|
217 |
-
bs_embed, seq_len, _ = text_embeddings.shape
|
218 |
-
text_embeddings = text_embeddings.tile([1, num_images_per_prompt, 1])
|
219 |
-
text_embeddings = text_embeddings.reshape([bs_embed * num_images_per_prompt, seq_len, -1])
|
220 |
-
|
221 |
-
# get unconditional embeddings for classifier free guidance
|
222 |
-
if do_classifier_free_guidance:
|
223 |
-
uncond_tokens: List[str]
|
224 |
-
if negative_prompt is None:
|
225 |
-
uncond_tokens = [""] * batch_size
|
226 |
-
elif type(prompt) is not type(negative_prompt):
|
227 |
-
raise TypeError(
|
228 |
-
f"`negative_prompt` should be the same type to `prompt`, but got {type(negative_prompt)} !="
|
229 |
-
f" {type(prompt)}."
|
230 |
-
)
|
231 |
-
elif isinstance(negative_prompt, str):
|
232 |
-
uncond_tokens = [negative_prompt]
|
233 |
-
elif batch_size != len(negative_prompt):
|
234 |
-
raise ValueError(
|
235 |
-
f"`negative_prompt`: {negative_prompt} has batch size {len(negative_prompt)}, but `prompt`:"
|
236 |
-
f" {prompt} has batch size {batch_size}. Please make sure that passed `negative_prompt` matches"
|
237 |
-
" the batch size of `prompt`."
|
238 |
-
)
|
239 |
-
else:
|
240 |
-
uncond_tokens = negative_prompt
|
241 |
-
|
242 |
-
max_length = text_input_ids.shape[-1]
|
243 |
-
uncond_input = self.tokenizer(
|
244 |
-
uncond_tokens,
|
245 |
-
padding="max_length",
|
246 |
-
max_length=max_length,
|
247 |
-
truncation=True,
|
248 |
-
return_tensors="pd",
|
249 |
-
)
|
250 |
-
|
251 |
-
if config.get("use_attention_mask", None) is not None and config["use_attention_mask"]:
|
252 |
-
attention_mask = uncond_input.attention_mask
|
253 |
-
else:
|
254 |
-
attention_mask = None
|
255 |
-
|
256 |
-
uncond_embeddings = self.text_encoder(
|
257 |
-
uncond_input.input_ids,
|
258 |
-
attention_mask=attention_mask,
|
259 |
-
)
|
260 |
-
uncond_embeddings = uncond_embeddings[0]
|
261 |
-
|
262 |
-
# duplicate unconditional embeddings for each generation per prompt, using mps friendly method
|
263 |
-
seq_len = uncond_embeddings.shape[1]
|
264 |
-
uncond_embeddings = uncond_embeddings.tile([1, num_images_per_prompt, 1])
|
265 |
-
uncond_embeddings = uncond_embeddings.reshape([batch_size * num_images_per_prompt, seq_len, -1])
|
266 |
-
|
267 |
-
# For classifier free guidance, we need to do two forward passes.
|
268 |
-
# Here we concatenate the unconditional and text embeddings into a single batch
|
269 |
-
# to avoid doing two forward passes
|
270 |
-
text_embeddings = paddle.concat([uncond_embeddings, text_embeddings])
|
271 |
-
|
272 |
-
return text_embeddings
|
273 |
-
|
274 |
-
def run_safety_checker(self, image, dtype):
|
275 |
-
if self.safety_checker is not None:
|
276 |
-
safety_checker_input = self.feature_extractor(self.numpy_to_pil(image), return_tensors="pd")
|
277 |
-
image, has_nsfw_concept = self.safety_checker(
|
278 |
-
images=image, clip_input=safety_checker_input.pixel_values.cast(dtype)
|
279 |
-
)
|
280 |
-
else:
|
281 |
-
has_nsfw_concept = None
|
282 |
-
return image, has_nsfw_concept
|
283 |
-
|
284 |
-
def decode_latents(self, latents):
|
285 |
-
latents = 1 / 0.18215 * latents
|
286 |
-
image = self.vae.decode(latents).sample
|
287 |
-
image = (image / 2 + 0.5).clip(0, 1)
|
288 |
-
# we always cast to float32 as this does not cause significant overhead and is compatible with bfloa16
|
289 |
-
image = image.transpose([0, 2, 3, 1]).cast("float32").numpy()
|
290 |
-
return image
|
291 |
-
|
292 |
-
def prepare_extra_step_kwargs(self, generator, eta):
|
293 |
-
# prepare extra kwargs for the scheduler step, since not all schedulers have the same signature
|
294 |
-
# eta (η) is only used with the DDIMScheduler, it will be ignored for other schedulers.
|
295 |
-
# eta corresponds to η in DDIM paper: https://arxiv.org/abs/2010.02502
|
296 |
-
# and should be between [0, 1]
|
297 |
-
|
298 |
-
accepts_eta = "eta" in set(inspect.signature(self.scheduler.step).parameters.keys())
|
299 |
-
extra_step_kwargs = {}
|
300 |
-
if accepts_eta:
|
301 |
-
extra_step_kwargs["eta"] = eta
|
302 |
-
|
303 |
-
# check if the scheduler accepts generator
|
304 |
-
accepts_generator = "generator" in set(inspect.signature(self.scheduler.step).parameters.keys())
|
305 |
-
if accepts_generator:
|
306 |
-
extra_step_kwargs["generator"] = generator
|
307 |
-
return extra_step_kwargs
|
308 |
-
|
309 |
-
def check_inputs(self, prompt, height, width, callback_steps):
|
310 |
-
if not isinstance(prompt, str) and not isinstance(prompt, list):
|
311 |
-
raise ValueError(f"`prompt` has to be of type `str` or `list` but is {type(prompt)}")
|
312 |
-
|
313 |
-
if height % 8 != 0 or width % 8 != 0:
|
314 |
-
raise ValueError(f"`height` and `width` have to be divisible by 8 but are {height} and {width}.")
|
315 |
-
|
316 |
-
if (callback_steps is None) or (
|
317 |
-
callback_steps is not None and (not isinstance(callback_steps, int) or callback_steps <= 0)
|
318 |
-
):
|
319 |
-
raise ValueError(
|
320 |
-
f"`callback_steps` has to be a positive integer but is {callback_steps} of type"
|
321 |
-
f" {type(callback_steps)}."
|
322 |
-
)
|
323 |
-
|
324 |
-
def prepare_latents(self, batch_size, num_channels_latents, height, width, dtype, generator, latents=None):
|
325 |
-
shape = [batch_size, num_channels_latents, height // self.vae_scale_factor, width // self.vae_scale_factor]
|
326 |
-
if isinstance(generator, list) and len(generator) != batch_size:
|
327 |
-
raise ValueError(
|
328 |
-
f"You have passed a list of generators of length {len(generator)}, but requested an effective batch"
|
329 |
-
f" size of {batch_size}. Make sure the batch size matches the length of the generators."
|
330 |
-
)
|
331 |
-
|
332 |
-
if latents is None:
|
333 |
-
if isinstance(generator, list):
|
334 |
-
shape = [
|
335 |
-
1,
|
336 |
-
] + shape[1:]
|
337 |
-
latents = [paddle.randn(shape, generator=generator[i], dtype=dtype) for i in range(batch_size)]
|
338 |
-
latents = paddle.concat(latents, axis=0)
|
339 |
-
else:
|
340 |
-
latents = paddle.randn(shape, generator=generator, dtype=dtype)
|
341 |
-
else:
|
342 |
-
if latents.shape != shape:
|
343 |
-
raise ValueError(f"Unexpected latents shape, got {latents.shape}, expected {shape}")
|
344 |
-
|
345 |
-
# scale the initial noise by the standard deviation required by the scheduler
|
346 |
-
latents = latents * self.scheduler.init_noise_sigma
|
347 |
-
return latents
|
348 |
-
|
349 |
-
@paddle.no_grad()
|
350 |
-
def __call__(
|
351 |
-
self,
|
352 |
-
prompt: Union[str, List[str]],
|
353 |
-
height: Optional[int] = None,
|
354 |
-
width: Optional[int] = None,
|
355 |
-
num_inference_steps: int = 50,
|
356 |
-
guidance_scale: float = 7.5,
|
357 |
-
negative_prompt: Optional[Union[str, List[str]]] = None,
|
358 |
-
num_images_per_prompt: Optional[int] = 1,
|
359 |
-
eta: float = 0.0,
|
360 |
-
generator: Optional[Union[paddle.Generator, List[paddle.Generator]]] = None,
|
361 |
-
latents: Optional[paddle.Tensor] = None,
|
362 |
-
output_type: Optional[str] = "pil",
|
363 |
-
return_dict: bool = True,
|
364 |
-
callback: Optional[Callable[[int, int, paddle.Tensor], None]] = None,
|
365 |
-
callback_steps: Optional[int] = 1,
|
366 |
-
):
|
367 |
-
r"""
|
368 |
-
Function invoked when calling the pipeline for generation.
|
369 |
-
|
370 |
-
Args:
|
371 |
-
prompt (`str` or `List[str]`):
|
372 |
-
The prompt or prompts to guide the image generation.
|
373 |
-
height (`int`, *optional*, defaults to self.unet.config.sample_size * self.vae_scale_factor):
|
374 |
-
The height in pixels of the generated image.
|
375 |
-
width (`int`, *optional*, defaults to self.unet.config.sample_size * self.vae_scale_factor):
|
376 |
-
The width in pixels of the generated image.
|
377 |
-
num_inference_steps (`int`, *optional*, defaults to 50):
|
378 |
-
The number of denoising steps. More denoising steps usually lead to a higher quality image at the
|
379 |
-
expense of slower inference.
|
380 |
-
guidance_scale (`float`, *optional*, defaults to 7.5):
|
381 |
-
Guidance scale as defined in [Classifier-Free Diffusion Guidance](https://arxiv.org/abs/2207.12598).
|
382 |
-
`guidance_scale` is defined as `w` of equation 2. of [Imagen
|
383 |
-
Paper](https://arxiv.org/pdf/2205.11487.pdf). Guidance scale is enabled by setting `guidance_scale >
|
384 |
-
1`. Higher guidance scale encourages to generate images that are closely linked to the text `prompt`,
|
385 |
-
usually at the expense of lower image quality.
|
386 |
-
negative_prompt (`str` or `List[str]`, *optional*):
|
387 |
-
The prompt or prompts not to guide the image generation. Ignored when not using guidance (i.e., ignored
|
388 |
-
if `guidance_scale` is less than `1`).
|
389 |
-
num_images_per_prompt (`int`, *optional*, defaults to 1):
|
390 |
-
The number of images to generate per prompt.
|
391 |
-
eta (`float`, *optional*, defaults to 0.0):
|
392 |
-
Corresponds to parameter eta (η) in the DDIM paper: https://arxiv.org/abs/2010.02502. Only applies to
|
393 |
-
[`schedulers.DDIMScheduler`], will be ignored for others.
|
394 |
-
generator (`paddle.Generator`, *optional*):
|
395 |
-
One or a list of paddle generator(s) to make generation deterministic.
|
396 |
-
latents (`paddle.Tensor`, *optional*):
|
397 |
-
Pre-generated noisy latents, sampled from a Gaussian distribution, to be used as inputs for image
|
398 |
-
generation. Can be used to tweak the same generation with different prompts. If not provided, a latents
|
399 |
-
tensor will ge generated by sampling using the supplied random `generator`.
|
400 |
-
output_type (`str`, *optional*, defaults to `"pil"`):
|
401 |
-
The output format of the generate image. Choose between
|
402 |
-
[PIL](https://pillow.readthedocs.io/en/stable/): `PIL.Image.Image` or `np.array`.
|
403 |
-
return_dict (`bool`, *optional*, defaults to `True`):
|
404 |
-
Whether or not to return a [`~pipelines.stable_diffusion.AltDiffusionPipelineOutput`] instead of a
|
405 |
-
plain tuple.
|
406 |
-
callback (`Callable`, *optional*):
|
407 |
-
A function that will be called every `callback_steps` steps during inference. The function will be
|
408 |
-
called with the following arguments: `callback(step: int, timestep: int, latents: paddle.Tensor)`.
|
409 |
-
callback_steps (`int`, *optional*, defaults to 1):
|
410 |
-
The frequency at which the `callback` function will be called. If not specified, the callback will be
|
411 |
-
called at every step.
|
412 |
-
|
413 |
-
Returns:
|
414 |
-
[`~pipelines.stable_diffusion.AltDiffusionPipelineOutput`] or `tuple`:
|
415 |
-
[`~pipelines.stable_diffusion.AltDiffusionPipelineOutput`] if `return_dict` is True, otherwise a `tuple.
|
416 |
-
When returning a tuple, the first element is a list with the generated images, and the second element is a
|
417 |
-
list of `bool`s denoting whether the corresponding generated image likely represents "not-safe-for-work"
|
418 |
-
(nsfw) content, according to the `safety_checker`.
|
419 |
-
"""
|
420 |
-
# 0. Default height and width to unet
|
421 |
-
height = height or self.unet.config.sample_size * self.vae_scale_factor
|
422 |
-
width = width or self.unet.config.sample_size * self.vae_scale_factor
|
423 |
-
|
424 |
-
# 1. Check inputs. Raise error if not correct
|
425 |
-
self.check_inputs(prompt, height, width, callback_steps)
|
426 |
-
|
427 |
-
# 2. Define call parameters
|
428 |
-
batch_size = 1 if isinstance(prompt, str) else len(prompt)
|
429 |
-
# here `guidance_scale` is defined analog to the guidance weight `w` of equation (2)
|
430 |
-
# of the Imagen paper: https://arxiv.org/pdf/2205.11487.pdf . `guidance_scale = 1`
|
431 |
-
# corresponds to doing no classifier free guidance.
|
432 |
-
do_classifier_free_guidance = guidance_scale > 1.0
|
433 |
-
|
434 |
-
# 3. Encode input prompt
|
435 |
-
text_embeddings = self._encode_prompt(
|
436 |
-
prompt, num_images_per_prompt, do_classifier_free_guidance, negative_prompt
|
437 |
-
)
|
438 |
-
|
439 |
-
# 4. Prepare timesteps
|
440 |
-
self.scheduler.set_timesteps(num_inference_steps)
|
441 |
-
timesteps = self.scheduler.timesteps
|
442 |
-
|
443 |
-
# 5. Prepare latent variables
|
444 |
-
num_channels_latents = self.unet.in_channels
|
445 |
-
latents = self.prepare_latents(
|
446 |
-
batch_size * num_images_per_prompt,
|
447 |
-
num_channels_latents,
|
448 |
-
height,
|
449 |
-
width,
|
450 |
-
text_embeddings.dtype,
|
451 |
-
generator,
|
452 |
-
latents,
|
453 |
-
)
|
454 |
-
|
455 |
-
# 6. Prepare extra step kwargs. TODO: Logic should ideally just be moved out of the pipeline
|
456 |
-
extra_step_kwargs = self.prepare_extra_step_kwargs(generator, eta)
|
457 |
-
|
458 |
-
# 7. Denoising loop
|
459 |
-
num_warmup_steps = len(timesteps) - num_inference_steps * self.scheduler.order
|
460 |
-
with self.progress_bar(total=num_inference_steps) as progress_bar:
|
461 |
-
for i, t in enumerate(timesteps):
|
462 |
-
# expand the latents if we are doing classifier free guidance
|
463 |
-
latent_model_input = paddle.concat([latents] * 2) if do_classifier_free_guidance else latents
|
464 |
-
latent_model_input = self.scheduler.scale_model_input(latent_model_input, t)
|
465 |
-
|
466 |
-
# predict the noise residual
|
467 |
-
noise_pred = self.unet(latent_model_input, t, encoder_hidden_states=text_embeddings).sample
|
468 |
-
|
469 |
-
# perform guidance
|
470 |
-
if do_classifier_free_guidance:
|
471 |
-
noise_pred_uncond, noise_pred_text = noise_pred.chunk(2)
|
472 |
-
noise_pred = noise_pred_uncond + guidance_scale * (noise_pred_text - noise_pred_uncond)
|
473 |
-
|
474 |
-
# compute the previous noisy sample x_t -> x_t-1
|
475 |
-
latents = self.scheduler.step(noise_pred, t, latents, **extra_step_kwargs).prev_sample
|
476 |
-
|
477 |
-
# call the callback, if provided
|
478 |
-
if i == len(timesteps) - 1 or ((i + 1) > num_warmup_steps and (i + 1) % self.scheduler.order == 0):
|
479 |
-
progress_bar.update()
|
480 |
-
if callback is not None and i % callback_steps == 0:
|
481 |
-
callback(i, t, latents)
|
482 |
-
|
483 |
-
# 8. Post-processing
|
484 |
-
image = self.decode_latents(latents)
|
485 |
-
|
486 |
-
# 9. Run safety checker
|
487 |
-
image, has_nsfw_concept = self.run_safety_checker(image, text_embeddings.dtype)
|
488 |
-
|
489 |
-
# 10. Convert to PIL
|
490 |
-
if output_type == "pil":
|
491 |
-
image = self.numpy_to_pil(image)
|
492 |
-
|
493 |
-
if not return_dict:
|
494 |
-
return (image, has_nsfw_concept)
|
495 |
-
|
496 |
-
return AltDiffusionPipelineOutput(images=image, nsfw_content_detected=has_nsfw_concept)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
spaces/4F22/text_generator/README.md
DELETED
@@ -1,12 +0,0 @@
|
|
1 |
-
---
|
2 |
-
title: Text Generator
|
3 |
-
emoji: 📈
|
4 |
-
colorFrom: gray
|
5 |
-
colorTo: yellow
|
6 |
-
sdk: gradio
|
7 |
-
sdk_version: 3.12.0
|
8 |
-
app_file: app.py
|
9 |
-
pinned: false
|
10 |
-
---
|
11 |
-
|
12 |
-
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
spaces/4Taps/SadTalker/src/face3d/extract_kp_videos.py
DELETED
@@ -1,107 +0,0 @@
|
|
1 |
-
import os
|
2 |
-
import cv2
|
3 |
-
import time
|
4 |
-
import glob
|
5 |
-
import argparse
|
6 |
-
import face_alignment
|
7 |
-
import numpy as np
|
8 |
-
from PIL import Image
|
9 |
-
from tqdm import tqdm
|
10 |
-
from itertools import cycle
|
11 |
-
|
12 |
-
from torch.multiprocessing import Pool, Process, set_start_method
|
13 |
-
|
14 |
-
class KeypointExtractor():
|
15 |
-
def __init__(self, device):
|
16 |
-
self.detector = face_alignment.FaceAlignment(face_alignment.LandmarksType._2D, device=device)
|
17 |
-
|
18 |
-
def extract_keypoint(self, images, name=None, info=True):
|
19 |
-
if isinstance(images, list):
|
20 |
-
keypoints = []
|
21 |
-
if info:
|
22 |
-
i_range = tqdm(images,desc='landmark Det:')
|
23 |
-
else:
|
24 |
-
i_range = images
|
25 |
-
|
26 |
-
for image in i_range:
|
27 |
-
current_kp = self.extract_keypoint(image)
|
28 |
-
if np.mean(current_kp) == -1 and keypoints:
|
29 |
-
keypoints.append(keypoints[-1])
|
30 |
-
else:
|
31 |
-
keypoints.append(current_kp[None])
|
32 |
-
|
33 |
-
keypoints = np.concatenate(keypoints, 0)
|
34 |
-
np.savetxt(os.path.splitext(name)[0]+'.txt', keypoints.reshape(-1))
|
35 |
-
return keypoints
|
36 |
-
else:
|
37 |
-
while True:
|
38 |
-
try:
|
39 |
-
keypoints = self.detector.get_landmarks_from_image(np.array(images))[0]
|
40 |
-
break
|
41 |
-
except RuntimeError as e:
|
42 |
-
if str(e).startswith('CUDA'):
|
43 |
-
print("Warning: out of memory, sleep for 1s")
|
44 |
-
time.sleep(1)
|
45 |
-
else:
|
46 |
-
print(e)
|
47 |
-
break
|
48 |
-
except TypeError:
|
49 |
-
print('No face detected in this image')
|
50 |
-
shape = [68, 2]
|
51 |
-
keypoints = -1. * np.ones(shape)
|
52 |
-
break
|
53 |
-
if name is not None:
|
54 |
-
np.savetxt(os.path.splitext(name)[0]+'.txt', keypoints.reshape(-1))
|
55 |
-
return keypoints
|
56 |
-
|
57 |
-
def read_video(filename):
|
58 |
-
frames = []
|
59 |
-
cap = cv2.VideoCapture(filename)
|
60 |
-
while cap.isOpened():
|
61 |
-
ret, frame = cap.read()
|
62 |
-
if ret:
|
63 |
-
frame = cv2.cvtColor(frame, cv2.COLOR_BGR2RGB)
|
64 |
-
frame = Image.fromarray(frame)
|
65 |
-
frames.append(frame)
|
66 |
-
else:
|
67 |
-
break
|
68 |
-
cap.release()
|
69 |
-
return frames
|
70 |
-
|
71 |
-
def run(data):
|
72 |
-
filename, opt, device = data
|
73 |
-
os.environ['CUDA_VISIBLE_DEVICES'] = device
|
74 |
-
kp_extractor = KeypointExtractor()
|
75 |
-
images = read_video(filename)
|
76 |
-
name = filename.split('/')[-2:]
|
77 |
-
os.makedirs(os.path.join(opt.output_dir, name[-2]), exist_ok=True)
|
78 |
-
kp_extractor.extract_keypoint(
|
79 |
-
images,
|
80 |
-
name=os.path.join(opt.output_dir, name[-2], name[-1])
|
81 |
-
)
|
82 |
-
|
83 |
-
if __name__ == '__main__':
|
84 |
-
set_start_method('spawn')
|
85 |
-
parser = argparse.ArgumentParser(formatter_class=argparse.ArgumentDefaultsHelpFormatter)
|
86 |
-
parser.add_argument('--input_dir', type=str, help='the folder of the input files')
|
87 |
-
parser.add_argument('--output_dir', type=str, help='the folder of the output files')
|
88 |
-
parser.add_argument('--device_ids', type=str, default='0,1')
|
89 |
-
parser.add_argument('--workers', type=int, default=4)
|
90 |
-
|
91 |
-
opt = parser.parse_args()
|
92 |
-
filenames = list()
|
93 |
-
VIDEO_EXTENSIONS_LOWERCASE = {'mp4'}
|
94 |
-
VIDEO_EXTENSIONS = VIDEO_EXTENSIONS_LOWERCASE.union({f.upper() for f in VIDEO_EXTENSIONS_LOWERCASE})
|
95 |
-
extensions = VIDEO_EXTENSIONS
|
96 |
-
|
97 |
-
for ext in extensions:
|
98 |
-
os.listdir(f'{opt.input_dir}')
|
99 |
-
print(f'{opt.input_dir}/*.{ext}')
|
100 |
-
filenames = sorted(glob.glob(f'{opt.input_dir}/*.{ext}'))
|
101 |
-
print('Total number of videos:', len(filenames))
|
102 |
-
pool = Pool(opt.workers)
|
103 |
-
args_list = cycle([opt])
|
104 |
-
device_ids = opt.device_ids.split(",")
|
105 |
-
device_ids = cycle(device_ids)
|
106 |
-
for data in tqdm(pool.imap_unordered(run, zip(filenames, args_list, device_ids))):
|
107 |
-
None
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
spaces/AIFILMS/StyleGANEX/README.md
DELETED
@@ -1,10 +0,0 @@
|
|
1 |
-
---
|
2 |
-
title: StyleGANEX
|
3 |
-
sdk: gradio
|
4 |
-
emoji: 🐨
|
5 |
-
colorFrom: pink
|
6 |
-
colorTo: yellow
|
7 |
-
app_file: app.py
|
8 |
-
pinned: false
|
9 |
-
duplicated_from: PKUWilliamYang/StyleGANEX
|
10 |
-
---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
spaces/AIGC-Audio/Make_An_Audio_inpaint/ldm/models/diffusion/ddpm.py
DELETED
@@ -1,1444 +0,0 @@
|
|
1 |
-
"""
|
2 |
-
wild mixture of
|
3 |
-
https://github.com/lucidrains/denoising-diffusion-pytorch/blob/7706bdfc6f527f58d33f84b7b522e61e6e3164b3/denoising_diffusion_pytorch/denoising_diffusion_pytorch.py
|
4 |
-
https://github.com/openai/improved-diffusion/blob/e94489283bb876ac1477d5dd7709bbbd2d9902ce/improved_diffusion/gaussian_diffusion.py
|
5 |
-
https://github.com/CompVis/taming-transformers
|
6 |
-
-- merci
|
7 |
-
"""
|
8 |
-
import torch
|
9 |
-
import torch.nn as nn
|
10 |
-
import numpy as np
|
11 |
-
import pytorch_lightning as pl
|
12 |
-
from torch.optim.lr_scheduler import LambdaLR
|
13 |
-
from einops import rearrange, repeat
|
14 |
-
from contextlib import contextmanager
|
15 |
-
from functools import partial
|
16 |
-
from tqdm import tqdm
|
17 |
-
from torchvision.utils import make_grid
|
18 |
-
from pytorch_lightning.utilities.distributed import rank_zero_only
|
19 |
-
|
20 |
-
from ldm.util import log_txt_as_img, exists, default, ismap, isimage, mean_flat, count_params, instantiate_from_config
|
21 |
-
from ldm.modules.ema import LitEma
|
22 |
-
from ldm.modules.distributions.distributions import normal_kl, DiagonalGaussianDistribution
|
23 |
-
from ldm.models.autoencoder import IdentityFirstStage, AutoencoderKL
|
24 |
-
from ldm.modules.diffusionmodules.util import make_beta_schedule, extract_into_tensor, noise_like
|
25 |
-
from ldm.models.diffusion.ddim import DDIMSampler
|
26 |
-
|
27 |
-
|
28 |
-
__conditioning_keys__ = {'concat': 'c_concat',
|
29 |
-
'crossattn': 'c_crossattn',
|
30 |
-
'adm': 'y'}
|
31 |
-
|
32 |
-
|
33 |
-
def disabled_train(self, mode=True):
|
34 |
-
"""Overwrite model.train with this function to make sure train/eval mode
|
35 |
-
does not change anymore."""
|
36 |
-
return self
|
37 |
-
|
38 |
-
|
39 |
-
def uniform_on_device(r1, r2, shape, device):
|
40 |
-
return (r1 - r2) * torch.rand(*shape, device=device) + r2
|
41 |
-
|
42 |
-
|
43 |
-
class DDPM(pl.LightningModule):
|
44 |
-
# classic DDPM with Gaussian diffusion, in image space
|
45 |
-
def __init__(self,
|
46 |
-
unet_config,
|
47 |
-
timesteps=1000,
|
48 |
-
beta_schedule="linear",
|
49 |
-
loss_type="l2",
|
50 |
-
ckpt_path=None,
|
51 |
-
ignore_keys=[],
|
52 |
-
load_only_unet=False,
|
53 |
-
monitor="val/loss",
|
54 |
-
use_ema=True,
|
55 |
-
first_stage_key="image",
|
56 |
-
image_size=256,
|
57 |
-
channels=3,
|
58 |
-
log_every_t=100,
|
59 |
-
clip_denoised=True,
|
60 |
-
linear_start=1e-4,
|
61 |
-
linear_end=2e-2,
|
62 |
-
cosine_s=8e-3,
|
63 |
-
given_betas=None,
|
64 |
-
original_elbo_weight=0.,
|
65 |
-
v_posterior=0., # weight for choosing posterior variance as sigma = (1-v) * beta_tilde + v * beta
|
66 |
-
l_simple_weight=1.,
|
67 |
-
conditioning_key=None,
|
68 |
-
parameterization="eps", # all config files uses "eps"
|
69 |
-
scheduler_config=None,
|
70 |
-
use_positional_encodings=False,
|
71 |
-
learn_logvar=False,
|
72 |
-
logvar_init=0.,
|
73 |
-
):
|
74 |
-
super().__init__()
|
75 |
-
assert parameterization in ["eps", "x0"], 'currently only supporting "eps" and "x0"'
|
76 |
-
self.parameterization = parameterization
|
77 |
-
print(f"{self.__class__.__name__}: Running in {self.parameterization}-prediction mode")
|
78 |
-
self.cond_stage_model = None
|
79 |
-
self.clip_denoised = clip_denoised
|
80 |
-
self.log_every_t = log_every_t
|
81 |
-
self.first_stage_key = first_stage_key
|
82 |
-
self.image_size = image_size # try conv?
|
83 |
-
self.channels = channels
|
84 |
-
self.use_positional_encodings = use_positional_encodings
|
85 |
-
self.model = DiffusionWrapper(unet_config, conditioning_key)
|
86 |
-
count_params(self.model, verbose=True)
|
87 |
-
self.use_ema = use_ema
|
88 |
-
if self.use_ema:
|
89 |
-
self.model_ema = LitEma(self.model)
|
90 |
-
print(f"Keeping EMAs of {len(list(self.model_ema.buffers()))}.")
|
91 |
-
|
92 |
-
self.use_scheduler = scheduler_config is not None
|
93 |
-
if self.use_scheduler:
|
94 |
-
self.scheduler_config = scheduler_config
|
95 |
-
|
96 |
-
self.v_posterior = v_posterior
|
97 |
-
self.original_elbo_weight = original_elbo_weight
|
98 |
-
self.l_simple_weight = l_simple_weight
|
99 |
-
|
100 |
-
if monitor is not None:
|
101 |
-
self.monitor = monitor
|
102 |
-
if ckpt_path is not None:
|
103 |
-
self.init_from_ckpt(ckpt_path, ignore_keys=ignore_keys, only_model=load_only_unet)
|
104 |
-
|
105 |
-
self.register_schedule(given_betas=given_betas, beta_schedule=beta_schedule, timesteps=timesteps,
|
106 |
-
linear_start=linear_start, linear_end=linear_end, cosine_s=cosine_s)
|
107 |
-
|
108 |
-
self.loss_type = loss_type
|
109 |
-
|
110 |
-
self.learn_logvar = learn_logvar
|
111 |
-
self.logvar = torch.full(fill_value=logvar_init, size=(self.num_timesteps,))
|
112 |
-
if self.learn_logvar:
|
113 |
-
self.logvar = nn.Parameter(self.logvar, requires_grad=True)
|
114 |
-
|
115 |
-
def register_schedule(self, given_betas=None, beta_schedule="linear", timesteps=1000,
|
116 |
-
linear_start=1e-4, linear_end=2e-2, cosine_s=8e-3):
|
117 |
-
if exists(given_betas):
|
118 |
-
betas = given_betas
|
119 |
-
else:
|
120 |
-
betas = make_beta_schedule(beta_schedule, timesteps, linear_start=linear_start, linear_end=linear_end,
|
121 |
-
cosine_s=cosine_s)
|
122 |
-
alphas = 1. - betas
|
123 |
-
alphas_cumprod = np.cumprod(alphas, axis=0)
|
124 |
-
alphas_cumprod_prev = np.append(1., alphas_cumprod[:-1])
|
125 |
-
|
126 |
-
timesteps, = betas.shape
|
127 |
-
self.num_timesteps = int(timesteps)
|
128 |
-
self.linear_start = linear_start
|
129 |
-
self.linear_end = linear_end
|
130 |
-
assert alphas_cumprod.shape[0] == self.num_timesteps, 'alphas have to be defined for each timestep'
|
131 |
-
|
132 |
-
to_torch = partial(torch.tensor, dtype=torch.float32)
|
133 |
-
|
134 |
-
self.register_buffer('betas', to_torch(betas))
|
135 |
-
self.register_buffer('alphas_cumprod', to_torch(alphas_cumprod))
|
136 |
-
self.register_buffer('alphas_cumprod_prev', to_torch(alphas_cumprod_prev))
|
137 |
-
|
138 |
-
# calculations for diffusion q(x_t | x_{t-1}) and others
|
139 |
-
self.register_buffer('sqrt_alphas_cumprod', to_torch(np.sqrt(alphas_cumprod)))
|
140 |
-
self.register_buffer('sqrt_one_minus_alphas_cumprod', to_torch(np.sqrt(1. - alphas_cumprod)))
|
141 |
-
self.register_buffer('log_one_minus_alphas_cumprod', to_torch(np.log(1. - alphas_cumprod)))
|
142 |
-
self.register_buffer('sqrt_recip_alphas_cumprod', to_torch(np.sqrt(1. / alphas_cumprod)))
|
143 |
-
self.register_buffer('sqrt_recipm1_alphas_cumprod', to_torch(np.sqrt(1. / alphas_cumprod - 1)))
|
144 |
-
|
145 |
-
# calculations for posterior q(x_{t-1} | x_t, x_0)
|
146 |
-
posterior_variance = (1 - self.v_posterior) * betas * (1. - alphas_cumprod_prev) / (
|
147 |
-
1. - alphas_cumprod) + self.v_posterior * betas
|
148 |
-
# above: equal to 1. / (1. / (1. - alpha_cumprod_tm1) + alpha_t / beta_t)
|
149 |
-
self.register_buffer('posterior_variance', to_torch(posterior_variance))
|
150 |
-
# below: log calculation clipped because the posterior variance is 0 at the beginning of the diffusion chain
|
151 |
-
self.register_buffer('posterior_log_variance_clipped', to_torch(np.log(np.maximum(posterior_variance, 1e-20))))
|
152 |
-
self.register_buffer('posterior_mean_coef1', to_torch(
|
153 |
-
betas * np.sqrt(alphas_cumprod_prev) / (1. - alphas_cumprod)))
|
154 |
-
self.register_buffer('posterior_mean_coef2', to_torch(
|
155 |
-
(1. - alphas_cumprod_prev) * np.sqrt(alphas) / (1. - alphas_cumprod)))
|
156 |
-
|
157 |
-
if self.parameterization == "eps":
|
158 |
-
lvlb_weights = self.betas ** 2 / (
|
159 |
-
2 * self.posterior_variance * to_torch(alphas) * (1 - self.alphas_cumprod))
|
160 |
-
elif self.parameterization == "x0":
|
161 |
-
lvlb_weights = 0.5 * np.sqrt(torch.Tensor(alphas_cumprod)) / (2. * 1 - torch.Tensor(alphas_cumprod))
|
162 |
-
else:
|
163 |
-
raise NotImplementedError("mu not supported")
|
164 |
-
# TODO how to choose this term
|
165 |
-
lvlb_weights[0] = lvlb_weights[1]
|
166 |
-
self.register_buffer('lvlb_weights', lvlb_weights, persistent=False)
|
167 |
-
assert not torch.isnan(self.lvlb_weights).all()
|
168 |
-
|
169 |
-
@contextmanager
|
170 |
-
def ema_scope(self, context=None):
|
171 |
-
if self.use_ema:
|
172 |
-
self.model_ema.store(self.model.parameters())
|
173 |
-
self.model_ema.copy_to(self.model)
|
174 |
-
if context is not None:
|
175 |
-
print(f"{context}: Switched to EMA weights")
|
176 |
-
try:
|
177 |
-
yield None
|
178 |
-
finally:
|
179 |
-
if self.use_ema:
|
180 |
-
self.model_ema.restore(self.model.parameters())
|
181 |
-
if context is not None:
|
182 |
-
print(f"{context}: Restored training weights")
|
183 |
-
|
184 |
-
def init_from_ckpt(self, path, ignore_keys=list(), only_model=False):
|
185 |
-
sd = torch.load(path, map_location="cpu")
|
186 |
-
if "state_dict" in list(sd.keys()):
|
187 |
-
sd = sd["state_dict"]
|
188 |
-
keys = list(sd.keys())
|
189 |
-
for k in keys:
|
190 |
-
for ik in ignore_keys:
|
191 |
-
if k.startswith(ik):
|
192 |
-
print("Deleting key {} from state_dict.".format(k))
|
193 |
-
del sd[k]
|
194 |
-
missing, unexpected = self.load_state_dict(sd, strict=False) if not only_model else self.model.load_state_dict(
|
195 |
-
sd, strict=False)
|
196 |
-
print(f"Restored from {path} with {len(missing)} missing and {len(unexpected)} unexpected keys")
|
197 |
-
if len(missing) > 0:
|
198 |
-
print(f"Missing Keys: {missing}")
|
199 |
-
if len(unexpected) > 0:
|
200 |
-
print(f"Unexpected Keys: {unexpected}")
|
201 |
-
|
202 |
-
def q_mean_variance(self, x_start, t):
|
203 |
-
"""
|
204 |
-
Get the distribution q(x_t | x_0).
|
205 |
-
:param x_start: the [N x C x ...] tensor of noiseless inputs.
|
206 |
-
:param t: the number of diffusion steps (minus 1). Here, 0 means one step.
|
207 |
-
:return: A tuple (mean, variance, log_variance), all of x_start's shape.
|
208 |
-
"""
|
209 |
-
mean = (extract_into_tensor(self.sqrt_alphas_cumprod, t, x_start.shape) * x_start)
|
210 |
-
variance = extract_into_tensor(1.0 - self.alphas_cumprod, t, x_start.shape)
|
211 |
-
log_variance = extract_into_tensor(self.log_one_minus_alphas_cumprod, t, x_start.shape)
|
212 |
-
return mean, variance, log_variance
|
213 |
-
|
214 |
-
def predict_start_from_noise(self, x_t, t, noise):
|
215 |
-
return (
|
216 |
-
extract_into_tensor(self.sqrt_recip_alphas_cumprod, t, x_t.shape) * x_t -
|
217 |
-
extract_into_tensor(self.sqrt_recipm1_alphas_cumprod, t, x_t.shape) * noise
|
218 |
-
)
|
219 |
-
|
220 |
-
def q_posterior(self, x_start, x_t, t):
|
221 |
-
posterior_mean = (
|
222 |
-
extract_into_tensor(self.posterior_mean_coef1, t, x_t.shape) * x_start +
|
223 |
-
extract_into_tensor(self.posterior_mean_coef2, t, x_t.shape) * x_t
|
224 |
-
)
|
225 |
-
posterior_variance = extract_into_tensor(self.posterior_variance, t, x_t.shape)
|
226 |
-
posterior_log_variance_clipped = extract_into_tensor(self.posterior_log_variance_clipped, t, x_t.shape)
|
227 |
-
return posterior_mean, posterior_variance, posterior_log_variance_clipped
|
228 |
-
|
229 |
-
def p_mean_variance(self, x, t, clip_denoised: bool):
|
230 |
-
model_out = self.model(x, t)
|
231 |
-
if self.parameterization == "eps":
|
232 |
-
x_recon = self.predict_start_from_noise(x, t=t, noise=model_out)
|
233 |
-
elif self.parameterization == "x0":
|
234 |
-
x_recon = model_out
|
235 |
-
if clip_denoised:
|
236 |
-
x_recon.clamp_(-1., 1.)
|
237 |
-
|
238 |
-
model_mean, posterior_variance, posterior_log_variance = self.q_posterior(x_start=x_recon, x_t=x, t=t)
|
239 |
-
return model_mean, posterior_variance, posterior_log_variance
|
240 |
-
|
241 |
-
@torch.no_grad()
|
242 |
-
def p_sample(self, x, t, clip_denoised=True, repeat_noise=False):
|
243 |
-
b, *_, device = *x.shape, x.device
|
244 |
-
model_mean, _, model_log_variance = self.p_mean_variance(x=x, t=t, clip_denoised=clip_denoised)
|
245 |
-
noise = noise_like(x.shape, device, repeat_noise)
|
246 |
-
# no noise when t == 0
|
247 |
-
nonzero_mask = (1 - (t == 0).float()).reshape(b, *((1,) * (len(x.shape) - 1)))
|
248 |
-
return model_mean + nonzero_mask * (0.5 * model_log_variance).exp() * noise
|
249 |
-
|
250 |
-
@torch.no_grad()
|
251 |
-
def p_sample_loop(self, shape, return_intermediates=False):
|
252 |
-
device = self.betas.device
|
253 |
-
b = shape[0]
|
254 |
-
img = torch.randn(shape, device=device)
|
255 |
-
intermediates = [img]
|
256 |
-
for i in tqdm(reversed(range(0, self.num_timesteps)), desc='Sampling t', total=self.num_timesteps):
|
257 |
-
img = self.p_sample(img, torch.full((b,), i, device=device, dtype=torch.long),
|
258 |
-
clip_denoised=self.clip_denoised)
|
259 |
-
if i % self.log_every_t == 0 or i == self.num_timesteps - 1:
|
260 |
-
intermediates.append(img)
|
261 |
-
if return_intermediates:
|
262 |
-
return img, intermediates
|
263 |
-
return img
|
264 |
-
|
265 |
-
@torch.no_grad()
|
266 |
-
def sample(self, batch_size=16, return_intermediates=False):
|
267 |
-
image_size = self.image_size
|
268 |
-
channels = self.channels
|
269 |
-
return self.p_sample_loop((batch_size, channels, image_size, image_size),
|
270 |
-
return_intermediates=return_intermediates)
|
271 |
-
|
272 |
-
def q_sample(self, x_start, t, noise=None):
|
273 |
-
noise = default(noise, lambda: torch.randn_like(x_start))
|
274 |
-
return (extract_into_tensor(self.sqrt_alphas_cumprod, t, x_start.shape) * x_start +
|
275 |
-
extract_into_tensor(self.sqrt_one_minus_alphas_cumprod, t, x_start.shape) * noise)
|
276 |
-
|
277 |
-
def get_loss(self, pred, target, mean=True):
|
278 |
-
if self.loss_type == 'l1':
|
279 |
-
loss = (target - pred).abs()
|
280 |
-
if mean:
|
281 |
-
loss = loss.mean()
|
282 |
-
elif self.loss_type == 'l2':
|
283 |
-
if mean:
|
284 |
-
loss = torch.nn.functional.mse_loss(target, pred)
|
285 |
-
else:
|
286 |
-
loss = torch.nn.functional.mse_loss(target, pred, reduction='none')
|
287 |
-
else:
|
288 |
-
raise NotImplementedError("unknown loss type '{loss_type}'")
|
289 |
-
|
290 |
-
return loss
|
291 |
-
|
292 |
-
def p_losses(self, x_start, t, noise=None):
|
293 |
-
noise = default(noise, lambda: torch.randn_like(x_start))
|
294 |
-
x_noisy = self.q_sample(x_start=x_start, t=t, noise=noise)
|
295 |
-
model_out = self.model(x_noisy, t)
|
296 |
-
|
297 |
-
loss_dict = {}
|
298 |
-
if self.parameterization == "eps":
|
299 |
-
target = noise
|
300 |
-
elif self.parameterization == "x0":
|
301 |
-
target = x_start
|
302 |
-
else:
|
303 |
-
raise NotImplementedError(f"Paramterization {self.parameterization} not yet supported")
|
304 |
-
|
305 |
-
loss = self.get_loss(model_out, target, mean=False).mean(dim=[1, 2, 3])
|
306 |
-
|
307 |
-
log_prefix = 'train' if self.training else 'val'
|
308 |
-
|
309 |
-
loss_dict.update({f'{log_prefix}/loss_simple': loss.mean()})
|
310 |
-
loss_simple = loss.mean() * self.l_simple_weight
|
311 |
-
|
312 |
-
loss_vlb = (self.lvlb_weights[t] * loss).mean()
|
313 |
-
loss_dict.update({f'{log_prefix}/loss_vlb': loss_vlb})
|
314 |
-
|
315 |
-
loss = loss_simple + self.original_elbo_weight * loss_vlb
|
316 |
-
|
317 |
-
loss_dict.update({f'{log_prefix}/loss': loss})
|
318 |
-
|
319 |
-
return loss, loss_dict
|
320 |
-
|
321 |
-
def forward(self, x, *args, **kwargs):
|
322 |
-
# b, c, h, w, device, img_size, = *x.shape, x.device, self.image_size
|
323 |
-
# assert h == img_size and w == img_size, f'height and width of image must be {img_size}'
|
324 |
-
t = torch.randint(0, self.num_timesteps, (x.shape[0],), device=self.device).long()
|
325 |
-
return self.p_losses(x, t, *args, **kwargs)
|
326 |
-
|
327 |
-
def get_input(self, batch, k):
|
328 |
-
x = batch[k]
|
329 |
-
if len(x.shape) == 3:
|
330 |
-
x = x[..., None]
|
331 |
-
x = rearrange(x, 'b h w c -> b c h w')
|
332 |
-
x = x.to(memory_format=torch.contiguous_format).float()
|
333 |
-
return x
|
334 |
-
|
335 |
-
def shared_step(self, batch):
|
336 |
-
x = self.get_input(batch, self.first_stage_key)
|
337 |
-
loss, loss_dict = self(x)
|
338 |
-
return loss, loss_dict
|
339 |
-
|
340 |
-
def training_step(self, batch, batch_idx):
|
341 |
-
loss, loss_dict = self.shared_step(batch)
|
342 |
-
|
343 |
-
self.log_dict(loss_dict, prog_bar=True,
|
344 |
-
logger=True, on_step=True, on_epoch=True)
|
345 |
-
|
346 |
-
self.log("global_step", self.global_step,
|
347 |
-
prog_bar=True, logger=True, on_step=True, on_epoch=False)
|
348 |
-
|
349 |
-
if self.use_scheduler:
|
350 |
-
lr = self.optimizers().param_groups[0]['lr']
|
351 |
-
self.log('lr_abs', lr, prog_bar=True, logger=True, on_step=True, on_epoch=False)
|
352 |
-
|
353 |
-
return loss
|
354 |
-
|
355 |
-
@torch.no_grad()
|
356 |
-
def validation_step(self, batch, batch_idx):
|
357 |
-
_, loss_dict_no_ema = self.shared_step(batch)
|
358 |
-
with self.ema_scope():
|
359 |
-
_, loss_dict_ema = self.shared_step(batch)
|
360 |
-
loss_dict_ema = {key + '_ema': loss_dict_ema[key] for key in loss_dict_ema}
|
361 |
-
self.log_dict(loss_dict_no_ema, prog_bar=False, logger=True, on_step=False, on_epoch=True)
|
362 |
-
self.log_dict(loss_dict_ema, prog_bar=False, logger=True, on_step=False, on_epoch=True)
|
363 |
-
|
364 |
-
def on_train_batch_end(self, *args, **kwargs):
|
365 |
-
if self.use_ema:
|
366 |
-
self.model_ema(self.model)
|
367 |
-
|
368 |
-
def _get_rows_from_list(self, samples):
|
369 |
-
n_imgs_per_row = len(samples)
|
370 |
-
denoise_grid = rearrange(samples, 'n b c h w -> b n c h w')
|
371 |
-
denoise_grid = rearrange(denoise_grid, 'b n c h w -> (b n) c h w')
|
372 |
-
denoise_grid = make_grid(denoise_grid, nrow=n_imgs_per_row)
|
373 |
-
return denoise_grid
|
374 |
-
|
375 |
-
@torch.no_grad()
|
376 |
-
def log_images(self, batch, N=8, n_row=2, sample=True, return_keys=None, **kwargs):
|
377 |
-
log = dict()
|
378 |
-
x = self.get_input(batch, self.first_stage_key)
|
379 |
-
N = min(x.shape[0], N)
|
380 |
-
n_row = min(x.shape[0], n_row)
|
381 |
-
x = x.to(self.device)[:N]
|
382 |
-
log["inputs"] = x
|
383 |
-
|
384 |
-
# get diffusion row
|
385 |
-
diffusion_row = list()
|
386 |
-
x_start = x[:n_row]
|
387 |
-
|
388 |
-
for t in range(self.num_timesteps):
|
389 |
-
if t % self.log_every_t == 0 or t == self.num_timesteps - 1:
|
390 |
-
t = repeat(torch.tensor([t]), '1 -> b', b=n_row)
|
391 |
-
t = t.to(self.device).long()
|
392 |
-
noise = torch.randn_like(x_start)
|
393 |
-
x_noisy = self.q_sample(x_start=x_start, t=t, noise=noise)
|
394 |
-
diffusion_row.append(x_noisy)
|
395 |
-
|
396 |
-
log["diffusion_row"] = self._get_rows_from_list(diffusion_row)
|
397 |
-
|
398 |
-
if sample:
|
399 |
-
# get denoise row
|
400 |
-
with self.ema_scope("Plotting"):
|
401 |
-
samples, denoise_row = self.sample(batch_size=N, return_intermediates=True)
|
402 |
-
|
403 |
-
log["samples"] = samples
|
404 |
-
log["denoise_row"] = self._get_rows_from_list(denoise_row)
|
405 |
-
|
406 |
-
if return_keys:
|
407 |
-
if np.intersect1d(list(log.keys()), return_keys).shape[0] == 0:
|
408 |
-
return log
|
409 |
-
else:
|
410 |
-
return {key: log[key] for key in return_keys}
|
411 |
-
return log
|
412 |
-
|
413 |
-
def configure_optimizers(self):
|
414 |
-
lr = self.learning_rate
|
415 |
-
params = list(self.model.parameters())
|
416 |
-
if self.learn_logvar:
|
417 |
-
params = params + [self.logvar]
|
418 |
-
opt = torch.optim.AdamW(params, lr=lr)
|
419 |
-
return opt
|
420 |
-
|
421 |
-
|
422 |
-
class LatentDiffusion(DDPM):
|
423 |
-
"""main class"""
|
424 |
-
def __init__(self,
|
425 |
-
first_stage_config,
|
426 |
-
cond_stage_config,
|
427 |
-
num_timesteps_cond=None,
|
428 |
-
cond_stage_key="image",# 'caption' for txt2image, 'masked_image' for inpainting
|
429 |
-
cond_stage_trainable=False,
|
430 |
-
concat_mode=True,# true for inpainting
|
431 |
-
cond_stage_forward=None,
|
432 |
-
conditioning_key=None, # 'crossattn' for txt2image, None for inpainting
|
433 |
-
scale_factor=1.0,
|
434 |
-
scale_by_std=False,
|
435 |
-
*args, **kwargs):
|
436 |
-
self.num_timesteps_cond = default(num_timesteps_cond, 1)
|
437 |
-
self.scale_by_std = scale_by_std
|
438 |
-
assert self.num_timesteps_cond <= kwargs['timesteps']
|
439 |
-
# for backwards compatibility after implementation of DiffusionWrapper
|
440 |
-
if conditioning_key is None:
|
441 |
-
conditioning_key = 'concat' if concat_mode else 'crossattn'
|
442 |
-
if cond_stage_config == '__is_unconditional__':
|
443 |
-
conditioning_key = None
|
444 |
-
ckpt_path = kwargs.pop("ckpt_path", None)
|
445 |
-
ignore_keys = kwargs.pop("ignore_keys", [])
|
446 |
-
super().__init__(conditioning_key=conditioning_key, *args, **kwargs)
|
447 |
-
self.concat_mode = concat_mode
|
448 |
-
self.cond_stage_trainable = cond_stage_trainable
|
449 |
-
self.cond_stage_key = cond_stage_key
|
450 |
-
try:
|
451 |
-
self.num_downs = len(first_stage_config.params.ddconfig.ch_mult) - 1
|
452 |
-
except:
|
453 |
-
self.num_downs = 0
|
454 |
-
if not scale_by_std:
|
455 |
-
self.scale_factor = scale_factor
|
456 |
-
else:
|
457 |
-
self.register_buffer('scale_factor', torch.tensor(scale_factor))
|
458 |
-
self.instantiate_first_stage(first_stage_config)
|
459 |
-
self.instantiate_cond_stage(cond_stage_config)
|
460 |
-
self.cond_stage_forward = cond_stage_forward
|
461 |
-
self.clip_denoised = False
|
462 |
-
self.bbox_tokenizer = None
|
463 |
-
|
464 |
-
self.restarted_from_ckpt = False
|
465 |
-
if ckpt_path is not None:
|
466 |
-
self.init_from_ckpt(ckpt_path, ignore_keys)
|
467 |
-
self.restarted_from_ckpt = True
|
468 |
-
|
469 |
-
def make_cond_schedule(self, ):
|
470 |
-
self.cond_ids = torch.full(size=(self.num_timesteps,), fill_value=self.num_timesteps - 1, dtype=torch.long)
|
471 |
-
ids = torch.round(torch.linspace(0, self.num_timesteps - 1, self.num_timesteps_cond)).long()
|
472 |
-
self.cond_ids[:self.num_timesteps_cond] = ids
|
473 |
-
|
474 |
-
@rank_zero_only
|
475 |
-
@torch.no_grad()
|
476 |
-
def on_train_batch_start(self, batch, batch_idx, dataloader_idx):
|
477 |
-
# only for very first batch
|
478 |
-
if self.scale_by_std and self.current_epoch == 0 and self.global_step == 0 and batch_idx == 0 and not self.restarted_from_ckpt:
|
479 |
-
assert self.scale_factor == 1., 'rather not use custom rescaling and std-rescaling simultaneously'
|
480 |
-
# set rescale weight to 1./std of encodings
|
481 |
-
print("### USING STD-RESCALING ###")
|
482 |
-
x = super().get_input(batch, self.first_stage_key)
|
483 |
-
x = x.to(self.device)
|
484 |
-
encoder_posterior = self.encode_first_stage(x)
|
485 |
-
z = self.get_first_stage_encoding(encoder_posterior).detach()
|
486 |
-
del self.scale_factor
|
487 |
-
self.register_buffer('scale_factor', 1. / z.flatten().std())
|
488 |
-
print(f"setting self.scale_factor to {self.scale_factor}")
|
489 |
-
print("### USING STD-RESCALING ###")
|
490 |
-
|
491 |
-
def register_schedule(self,
|
492 |
-
given_betas=None, beta_schedule="linear", timesteps=1000,
|
493 |
-
linear_start=1e-4, linear_end=2e-2, cosine_s=8e-3):
|
494 |
-
super().register_schedule(given_betas, beta_schedule, timesteps, linear_start, linear_end, cosine_s)
|
495 |
-
|
496 |
-
self.shorten_cond_schedule = self.num_timesteps_cond > 1
|
497 |
-
if self.shorten_cond_schedule:
|
498 |
-
self.make_cond_schedule()
|
499 |
-
|
500 |
-
def instantiate_first_stage(self, config):
|
501 |
-
model = instantiate_from_config(config)
|
502 |
-
self.first_stage_model = model.eval()
|
503 |
-
self.first_stage_model.train = disabled_train
|
504 |
-
for param in self.first_stage_model.parameters():
|
505 |
-
param.requires_grad = False
|
506 |
-
|
507 |
-
def instantiate_cond_stage(self, config):
|
508 |
-
if not self.cond_stage_trainable:
|
509 |
-
if config == "__is_first_stage__":# inpaint
|
510 |
-
print("Using first stage also as cond stage.")
|
511 |
-
self.cond_stage_model = self.first_stage_model
|
512 |
-
elif config == "__is_unconditional__":
|
513 |
-
print(f"Training {self.__class__.__name__} as an unconditional model.")
|
514 |
-
self.cond_stage_model = None
|
515 |
-
# self.be_unconditional = True
|
516 |
-
else:
|
517 |
-
model = instantiate_from_config(config)
|
518 |
-
self.cond_stage_model = model.eval()
|
519 |
-
self.cond_stage_model.train = disabled_train
|
520 |
-
for param in self.cond_stage_model.parameters():
|
521 |
-
param.requires_grad = False
|
522 |
-
else:
|
523 |
-
assert config != '__is_first_stage__'
|
524 |
-
assert config != '__is_unconditional__'
|
525 |
-
model = instantiate_from_config(config)
|
526 |
-
self.cond_stage_model = model
|
527 |
-
|
528 |
-
def _get_denoise_row_from_list(self, samples, desc='', force_no_decoder_quantization=False):
|
529 |
-
denoise_row = []
|
530 |
-
for zd in tqdm(samples, desc=desc):
|
531 |
-
denoise_row.append(self.decode_first_stage(zd.to(self.device),
|
532 |
-
force_not_quantize=force_no_decoder_quantization))
|
533 |
-
n_imgs_per_row = len(denoise_row)
|
534 |
-
denoise_row = torch.stack(denoise_row) # n_log_step, n_row, C, H, W
|
535 |
-
denoise_grid = rearrange(denoise_row, 'n b c h w -> b n c h w')
|
536 |
-
denoise_grid = rearrange(denoise_grid, 'b n c h w -> (b n) c h w')
|
537 |
-
denoise_grid = make_grid(denoise_grid, nrow=n_imgs_per_row)
|
538 |
-
return denoise_grid
|
539 |
-
|
540 |
-
def get_first_stage_encoding(self, encoder_posterior):
|
541 |
-
if isinstance(encoder_posterior, DiagonalGaussianDistribution):
|
542 |
-
z = encoder_posterior.sample()
|
543 |
-
elif isinstance(encoder_posterior, torch.Tensor):
|
544 |
-
z = encoder_posterior
|
545 |
-
else:
|
546 |
-
raise NotImplementedError(f"encoder_posterior of type '{type(encoder_posterior)}' not yet implemented")
|
547 |
-
return self.scale_factor * z
|
548 |
-
|
549 |
-
def get_learned_conditioning(self, c):
|
550 |
-
if self.cond_stage_forward is None:
|
551 |
-
if hasattr(self.cond_stage_model, 'encode') and callable(self.cond_stage_model.encode):
|
552 |
-
c = self.cond_stage_model.encode(c)
|
553 |
-
if isinstance(c, DiagonalGaussianDistribution):
|
554 |
-
c = c.mode()
|
555 |
-
else:
|
556 |
-
c = self.cond_stage_model(c)
|
557 |
-
else:
|
558 |
-
assert hasattr(self.cond_stage_model, self.cond_stage_forward)
|
559 |
-
c = getattr(self.cond_stage_model, self.cond_stage_forward)(c)
|
560 |
-
return c
|
561 |
-
|
562 |
-
def meshgrid(self, h, w):
|
563 |
-
y = torch.arange(0, h).view(h, 1, 1).repeat(1, w, 1)
|
564 |
-
x = torch.arange(0, w).view(1, w, 1).repeat(h, 1, 1)
|
565 |
-
|
566 |
-
arr = torch.cat([y, x], dim=-1)
|
567 |
-
return arr
|
568 |
-
|
569 |
-
def delta_border(self, h, w):
|
570 |
-
"""
|
571 |
-
:param h: height
|
572 |
-
:param w: width
|
573 |
-
:return: normalized distance to image border,
|
574 |
-
wtith min distance = 0 at border and max dist = 0.5 at image center
|
575 |
-
"""
|
576 |
-
lower_right_corner = torch.tensor([h - 1, w - 1]).view(1, 1, 2)
|
577 |
-
arr = self.meshgrid(h, w) / lower_right_corner
|
578 |
-
dist_left_up = torch.min(arr, dim=-1, keepdims=True)[0]
|
579 |
-
dist_right_down = torch.min(1 - arr, dim=-1, keepdims=True)[0]
|
580 |
-
edge_dist = torch.min(torch.cat([dist_left_up, dist_right_down], dim=-1), dim=-1)[0]
|
581 |
-
return edge_dist
|
582 |
-
|
583 |
-
def get_weighting(self, h, w, Ly, Lx, device):
|
584 |
-
weighting = self.delta_border(h, w)
|
585 |
-
weighting = torch.clip(weighting, self.split_input_params["clip_min_weight"],
|
586 |
-
self.split_input_params["clip_max_weight"], )
|
587 |
-
weighting = weighting.view(1, h * w, 1).repeat(1, 1, Ly * Lx).to(device)
|
588 |
-
|
589 |
-
if self.split_input_params["tie_braker"]:
|
590 |
-
L_weighting = self.delta_border(Ly, Lx)
|
591 |
-
L_weighting = torch.clip(L_weighting,
|
592 |
-
self.split_input_params["clip_min_tie_weight"],
|
593 |
-
self.split_input_params["clip_max_tie_weight"])
|
594 |
-
|
595 |
-
L_weighting = L_weighting.view(1, 1, Ly * Lx).to(device)
|
596 |
-
weighting = weighting * L_weighting
|
597 |
-
return weighting
|
598 |
-
|
599 |
-
def get_fold_unfold(self, x, kernel_size, stride, uf=1, df=1): # todo load once not every time, shorten code
|
600 |
-
"""
|
601 |
-
:param x: img of size (bs, c, h, w)
|
602 |
-
:return: n img crops of size (n, bs, c, kernel_size[0], kernel_size[1])
|
603 |
-
"""
|
604 |
-
bs, nc, h, w = x.shape
|
605 |
-
|
606 |
-
# number of crops in image
|
607 |
-
Ly = (h - kernel_size[0]) // stride[0] + 1
|
608 |
-
Lx = (w - kernel_size[1]) // stride[1] + 1
|
609 |
-
|
610 |
-
if uf == 1 and df == 1:
|
611 |
-
fold_params = dict(kernel_size=kernel_size, dilation=1, padding=0, stride=stride)
|
612 |
-
unfold = torch.nn.Unfold(**fold_params)
|
613 |
-
|
614 |
-
fold = torch.nn.Fold(output_size=x.shape[2:], **fold_params)
|
615 |
-
|
616 |
-
weighting = self.get_weighting(kernel_size[0], kernel_size[1], Ly, Lx, x.device).to(x.dtype)
|
617 |
-
normalization = fold(weighting).view(1, 1, h, w) # normalizes the overlap
|
618 |
-
weighting = weighting.view((1, 1, kernel_size[0], kernel_size[1], Ly * Lx))
|
619 |
-
|
620 |
-
elif uf > 1 and df == 1:
|
621 |
-
fold_params = dict(kernel_size=kernel_size, dilation=1, padding=0, stride=stride)
|
622 |
-
unfold = torch.nn.Unfold(**fold_params)
|
623 |
-
|
624 |
-
fold_params2 = dict(kernel_size=(kernel_size[0] * uf, kernel_size[0] * uf),
|
625 |
-
dilation=1, padding=0,
|
626 |
-
stride=(stride[0] * uf, stride[1] * uf))
|
627 |
-
fold = torch.nn.Fold(output_size=(x.shape[2] * uf, x.shape[3] * uf), **fold_params2)
|
628 |
-
|
629 |
-
weighting = self.get_weighting(kernel_size[0] * uf, kernel_size[1] * uf, Ly, Lx, x.device).to(x.dtype)
|
630 |
-
normalization = fold(weighting).view(1, 1, h * uf, w * uf) # normalizes the overlap
|
631 |
-
weighting = weighting.view((1, 1, kernel_size[0] * uf, kernel_size[1] * uf, Ly * Lx))
|
632 |
-
|
633 |
-
elif df > 1 and uf == 1:
|
634 |
-
fold_params = dict(kernel_size=kernel_size, dilation=1, padding=0, stride=stride)
|
635 |
-
unfold = torch.nn.Unfold(**fold_params)
|
636 |
-
|
637 |
-
fold_params2 = dict(kernel_size=(kernel_size[0] // df, kernel_size[0] // df),
|
638 |
-
dilation=1, padding=0,
|
639 |
-
stride=(stride[0] // df, stride[1] // df))
|
640 |
-
fold = torch.nn.Fold(output_size=(x.shape[2] // df, x.shape[3] // df), **fold_params2)
|
641 |
-
|
642 |
-
weighting = self.get_weighting(kernel_size[0] // df, kernel_size[1] // df, Ly, Lx, x.device).to(x.dtype)
|
643 |
-
normalization = fold(weighting).view(1, 1, h // df, w // df) # normalizes the overlap
|
644 |
-
weighting = weighting.view((1, 1, kernel_size[0] // df, kernel_size[1] // df, Ly * Lx))
|
645 |
-
|
646 |
-
else:
|
647 |
-
raise NotImplementedError
|
648 |
-
|
649 |
-
return fold, unfold, normalization, weighting
|
650 |
-
|
651 |
-
@torch.no_grad()
|
652 |
-
def get_input(self, batch, k, return_first_stage_outputs=False, force_c_encode=False,
|
653 |
-
cond_key=None, return_original_cond=False, bs=None):
|
654 |
-
x = super().get_input(batch, k)
|
655 |
-
if bs is not None:
|
656 |
-
x = x[:bs]
|
657 |
-
x = x.to(self.device)
|
658 |
-
encoder_posterior = self.encode_first_stage(x)
|
659 |
-
z = self.get_first_stage_encoding(encoder_posterior).detach()
|
660 |
-
|
661 |
-
if self.model.conditioning_key is not None:
|
662 |
-
if cond_key is None:
|
663 |
-
cond_key = self.cond_stage_key
|
664 |
-
if cond_key != self.first_stage_key:# cond_key is not image. for inapint it's masked_img
|
665 |
-
if cond_key in ['caption', 'coordinates_bbox']:
|
666 |
-
xc = batch[cond_key]
|
667 |
-
elif cond_key == 'class_label':
|
668 |
-
xc = batch
|
669 |
-
else:
|
670 |
-
xc = super().get_input(batch, cond_key).to(self.device)
|
671 |
-
else:
|
672 |
-
xc = x
|
673 |
-
if not self.cond_stage_trainable or force_c_encode:
|
674 |
-
if isinstance(xc, dict) or isinstance(xc, list):
|
675 |
-
# import pudb; pudb.set_trace()
|
676 |
-
c = self.get_learned_conditioning(xc)
|
677 |
-
else:
|
678 |
-
c = self.get_learned_conditioning(xc.to(self.device))
|
679 |
-
else:
|
680 |
-
c = xc
|
681 |
-
if bs is not None:
|
682 |
-
c = c[:bs]
|
683 |
-
|
684 |
-
if self.use_positional_encodings:
|
685 |
-
pos_x, pos_y = self.compute_latent_shifts(batch)
|
686 |
-
ckey = __conditioning_keys__[self.model.conditioning_key]
|
687 |
-
c = {ckey: c, 'pos_x': pos_x, 'pos_y': pos_y}
|
688 |
-
|
689 |
-
else:
|
690 |
-
c = None
|
691 |
-
xc = None
|
692 |
-
if self.use_positional_encodings:
|
693 |
-
pos_x, pos_y = self.compute_latent_shifts(batch)
|
694 |
-
c = {'pos_x': pos_x, 'pos_y': pos_y}
|
695 |
-
out = [z, c]
|
696 |
-
if return_first_stage_outputs:
|
697 |
-
xrec = self.decode_first_stage(z)
|
698 |
-
out.extend([x, xrec])
|
699 |
-
if return_original_cond:
|
700 |
-
out.append(xc)
|
701 |
-
return out
|
702 |
-
|
703 |
-
@torch.no_grad()
|
704 |
-
def decode_first_stage(self, z, predict_cids=False, force_not_quantize=False):
|
705 |
-
if predict_cids:
|
706 |
-
if z.dim() == 4:
|
707 |
-
z = torch.argmax(z.exp(), dim=1).long()
|
708 |
-
z = self.first_stage_model.quantize.get_codebook_entry(z, shape=None)
|
709 |
-
z = rearrange(z, 'b h w c -> b c h w').contiguous()
|
710 |
-
|
711 |
-
z = 1. / self.scale_factor * z
|
712 |
-
|
713 |
-
if hasattr(self, "split_input_params"):
|
714 |
-
if self.split_input_params["patch_distributed_vq"]:
|
715 |
-
ks = self.split_input_params["ks"] # eg. (128, 128)
|
716 |
-
stride = self.split_input_params["stride"] # eg. (64, 64)
|
717 |
-
uf = self.split_input_params["vqf"]
|
718 |
-
bs, nc, h, w = z.shape
|
719 |
-
if ks[0] > h or ks[1] > w:
|
720 |
-
ks = (min(ks[0], h), min(ks[1], w))
|
721 |
-
print("reducing Kernel")
|
722 |
-
|
723 |
-
if stride[0] > h or stride[1] > w:
|
724 |
-
stride = (min(stride[0], h), min(stride[1], w))
|
725 |
-
print("reducing stride")
|
726 |
-
|
727 |
-
fold, unfold, normalization, weighting = self.get_fold_unfold(z, ks, stride, uf=uf)
|
728 |
-
|
729 |
-
z = unfold(z) # (bn, nc * prod(**ks), L)
|
730 |
-
# 1. Reshape to img shape
|
731 |
-
z = z.view((z.shape[0], -1, ks[0], ks[1], z.shape[-1])) # (bn, nc, ks[0], ks[1], L )
|
732 |
-
|
733 |
-
# 2. apply model loop over last dim
|
734 |
-
if isinstance(self.first_stage_model, VQModelInterface):
|
735 |
-
output_list = [self.first_stage_model.decode(z[:, :, :, :, i],
|
736 |
-
force_not_quantize=predict_cids or force_not_quantize)
|
737 |
-
for i in range(z.shape[-1])]
|
738 |
-
else:
|
739 |
-
|
740 |
-
output_list = [self.first_stage_model.decode(z[:, :, :, :, i])
|
741 |
-
for i in range(z.shape[-1])]
|
742 |
-
|
743 |
-
o = torch.stack(output_list, axis=-1) # # (bn, nc, ks[0], ks[1], L)
|
744 |
-
o = o * weighting
|
745 |
-
# Reverse 1. reshape to img shape
|
746 |
-
o = o.view((o.shape[0], -1, o.shape[-1])) # (bn, nc * ks[0] * ks[1], L)
|
747 |
-
# stitch crops together
|
748 |
-
decoded = fold(o)
|
749 |
-
decoded = decoded / normalization # norm is shape (1, 1, h, w)
|
750 |
-
return decoded
|
751 |
-
else:
|
752 |
-
if isinstance(self.first_stage_model, VQModelInterface):
|
753 |
-
return self.first_stage_model.decode(z, force_not_quantize=predict_cids or force_not_quantize)
|
754 |
-
else:
|
755 |
-
return self.first_stage_model.decode(z)
|
756 |
-
|
757 |
-
else:
|
758 |
-
if isinstance(self.first_stage_model, VQModelInterface):
|
759 |
-
return self.first_stage_model.decode(z, force_not_quantize=predict_cids or force_not_quantize)
|
760 |
-
else:
|
761 |
-
return self.first_stage_model.decode(z)
|
762 |
-
|
763 |
-
# same as above but without decorator
|
764 |
-
def differentiable_decode_first_stage(self, z, predict_cids=False, force_not_quantize=False):
|
765 |
-
if predict_cids:
|
766 |
-
if z.dim() == 4:
|
767 |
-
z = torch.argmax(z.exp(), dim=1).long()
|
768 |
-
z = self.first_stage_model.quantize.get_codebook_entry(z, shape=None)
|
769 |
-
z = rearrange(z, 'b h w c -> b c h w').contiguous()
|
770 |
-
|
771 |
-
z = 1. / self.scale_factor * z
|
772 |
-
|
773 |
-
if hasattr(self, "split_input_params"):
|
774 |
-
if self.split_input_params["patch_distributed_vq"]:
|
775 |
-
ks = self.split_input_params["ks"] # eg. (128, 128)
|
776 |
-
stride = self.split_input_params["stride"] # eg. (64, 64)
|
777 |
-
uf = self.split_input_params["vqf"]
|
778 |
-
bs, nc, h, w = z.shape
|
779 |
-
if ks[0] > h or ks[1] > w:
|
780 |
-
ks = (min(ks[0], h), min(ks[1], w))
|
781 |
-
print("reducing Kernel")
|
782 |
-
|
783 |
-
if stride[0] > h or stride[1] > w:
|
784 |
-
stride = (min(stride[0], h), min(stride[1], w))
|
785 |
-
print("reducing stride")
|
786 |
-
|
787 |
-
fold, unfold, normalization, weighting = self.get_fold_unfold(z, ks, stride, uf=uf)
|
788 |
-
|
789 |
-
z = unfold(z) # (bn, nc * prod(**ks), L)
|
790 |
-
# 1. Reshape to img shape
|
791 |
-
z = z.view((z.shape[0], -1, ks[0], ks[1], z.shape[-1])) # (bn, nc, ks[0], ks[1], L )
|
792 |
-
|
793 |
-
# 2. apply model loop over last dim
|
794 |
-
if isinstance(self.first_stage_model, VQModelInterface):
|
795 |
-
output_list = [self.first_stage_model.decode(z[:, :, :, :, i],
|
796 |
-
force_not_quantize=predict_cids or force_not_quantize)
|
797 |
-
for i in range(z.shape[-1])]
|
798 |
-
else:
|
799 |
-
|
800 |
-
output_list = [self.first_stage_model.decode(z[:, :, :, :, i])
|
801 |
-
for i in range(z.shape[-1])]
|
802 |
-
|
803 |
-
o = torch.stack(output_list, axis=-1) # # (bn, nc, ks[0], ks[1], L)
|
804 |
-
o = o * weighting
|
805 |
-
# Reverse 1. reshape to img shape
|
806 |
-
o = o.view((o.shape[0], -1, o.shape[-1])) # (bn, nc * ks[0] * ks[1], L)
|
807 |
-
# stitch crops together
|
808 |
-
decoded = fold(o)
|
809 |
-
decoded = decoded / normalization # norm is shape (1, 1, h, w)
|
810 |
-
return decoded
|
811 |
-
else:
|
812 |
-
if isinstance(self.first_stage_model, VQModelInterface):
|
813 |
-
return self.first_stage_model.decode(z, force_not_quantize=predict_cids or force_not_quantize)
|
814 |
-
else:
|
815 |
-
return self.first_stage_model.decode(z)
|
816 |
-
|
817 |
-
else:
|
818 |
-
if isinstance(self.first_stage_model, VQModelInterface):
|
819 |
-
return self.first_stage_model.decode(z, force_not_quantize=predict_cids or force_not_quantize)
|
820 |
-
else:
|
821 |
-
return self.first_stage_model.decode(z)
|
822 |
-
|
823 |
-
@torch.no_grad()
|
824 |
-
def encode_first_stage(self, x):
|
825 |
-
if hasattr(self, "split_input_params"):
|
826 |
-
if self.split_input_params["patch_distributed_vq"]:
|
827 |
-
ks = self.split_input_params["ks"] # eg. (128, 128)
|
828 |
-
stride = self.split_input_params["stride"] # eg. (64, 64)
|
829 |
-
df = self.split_input_params["vqf"]
|
830 |
-
self.split_input_params['original_image_size'] = x.shape[-2:]
|
831 |
-
bs, nc, h, w = x.shape
|
832 |
-
if ks[0] > h or ks[1] > w:
|
833 |
-
ks = (min(ks[0], h), min(ks[1], w))
|
834 |
-
print("reducing Kernel")
|
835 |
-
|
836 |
-
if stride[0] > h or stride[1] > w:
|
837 |
-
stride = (min(stride[0], h), min(stride[1], w))
|
838 |
-
print("reducing stride")
|
839 |
-
|
840 |
-
fold, unfold, normalization, weighting = self.get_fold_unfold(x, ks, stride, df=df)
|
841 |
-
z = unfold(x) # (bn, nc * prod(**ks), L)
|
842 |
-
# Reshape to img shape
|
843 |
-
z = z.view((z.shape[0], -1, ks[0], ks[1], z.shape[-1])) # (bn, nc, ks[0], ks[1], L )
|
844 |
-
|
845 |
-
output_list = [self.first_stage_model.encode(z[:, :, :, :, i])
|
846 |
-
for i in range(z.shape[-1])]
|
847 |
-
|
848 |
-
o = torch.stack(output_list, axis=-1)
|
849 |
-
o = o * weighting
|
850 |
-
|
851 |
-
# Reverse reshape to img shape
|
852 |
-
o = o.view((o.shape[0], -1, o.shape[-1])) # (bn, nc * ks[0] * ks[1], L)
|
853 |
-
# stitch crops together
|
854 |
-
decoded = fold(o)
|
855 |
-
decoded = decoded / normalization
|
856 |
-
return decoded
|
857 |
-
|
858 |
-
else:
|
859 |
-
return self.first_stage_model.encode(x)
|
860 |
-
else:
|
861 |
-
return self.first_stage_model.encode(x)
|
862 |
-
|
863 |
-
def shared_step(self, batch, **kwargs):
|
864 |
-
x, c = self.get_input(batch, self.first_stage_key)
|
865 |
-
loss = self(x, c)
|
866 |
-
return loss
|
867 |
-
|
868 |
-
def forward(self, x, c, *args, **kwargs):
|
869 |
-
t = torch.randint(0, self.num_timesteps, (x.shape[0],), device=self.device).long()
|
870 |
-
if self.model.conditioning_key is not None:
|
871 |
-
assert c is not None
|
872 |
-
if self.cond_stage_trainable:# true when use text
|
873 |
-
c = self.get_learned_conditioning(c) # c: string list -> [B, T, Context_dim]
|
874 |
-
if self.shorten_cond_schedule: # TODO: drop this option
|
875 |
-
tc = self.cond_ids[t].to(self.device)
|
876 |
-
c = self.q_sample(x_start=c, t=tc, noise=torch.randn_like(c.float()))
|
877 |
-
return self.p_losses(x, c, t, *args, **kwargs)
|
878 |
-
|
879 |
-
def _rescale_annotations(self, bboxes, crop_coordinates): # TODO: move to dataset
|
880 |
-
def rescale_bbox(bbox):
|
881 |
-
x0 = clamp((bbox[0] - crop_coordinates[0]) / crop_coordinates[2])
|
882 |
-
y0 = clamp((bbox[1] - crop_coordinates[1]) / crop_coordinates[3])
|
883 |
-
w = min(bbox[2] / crop_coordinates[2], 1 - x0)
|
884 |
-
h = min(bbox[3] / crop_coordinates[3], 1 - y0)
|
885 |
-
return x0, y0, w, h
|
886 |
-
|
887 |
-
return [rescale_bbox(b) for b in bboxes]
|
888 |
-
|
889 |
-
def apply_model(self, x_noisy, t, cond, return_ids=False):
|
890 |
-
|
891 |
-
if isinstance(cond, dict):
|
892 |
-
# hybrid case, cond is exptected to be a dict
|
893 |
-
pass
|
894 |
-
else:
|
895 |
-
if not isinstance(cond, list):
|
896 |
-
cond = [cond]
|
897 |
-
key = 'c_concat' if self.model.conditioning_key == 'concat' else 'c_crossattn'
|
898 |
-
cond = {key: cond}
|
899 |
-
|
900 |
-
if hasattr(self, "split_input_params"):
|
901 |
-
assert len(cond) == 1 # todo can only deal with one conditioning atm
|
902 |
-
assert not return_ids
|
903 |
-
ks = self.split_input_params["ks"] # eg. (128, 128)
|
904 |
-
stride = self.split_input_params["stride"] # eg. (64, 64)
|
905 |
-
|
906 |
-
h, w = x_noisy.shape[-2:]
|
907 |
-
|
908 |
-
fold, unfold, normalization, weighting = self.get_fold_unfold(x_noisy, ks, stride)
|
909 |
-
|
910 |
-
z = unfold(x_noisy) # (bn, nc * prod(**ks), L)
|
911 |
-
# Reshape to img shape
|
912 |
-
z = z.view((z.shape[0], -1, ks[0], ks[1], z.shape[-1])) # (bn, nc, ks[0], ks[1], L )
|
913 |
-
z_list = [z[:, :, :, :, i] for i in range(z.shape[-1])]
|
914 |
-
|
915 |
-
if self.cond_stage_key in ["image", "LR_image", "segmentation",
|
916 |
-
'bbox_img'] and self.model.conditioning_key: # todo check for completeness
|
917 |
-
c_key = next(iter(cond.keys())) # get key
|
918 |
-
c = next(iter(cond.values())) # get value
|
919 |
-
assert (len(c) == 1) # todo extend to list with more than one elem
|
920 |
-
c = c[0] # get element
|
921 |
-
|
922 |
-
c = unfold(c)
|
923 |
-
c = c.view((c.shape[0], -1, ks[0], ks[1], c.shape[-1])) # (bn, nc, ks[0], ks[1], L )
|
924 |
-
|
925 |
-
cond_list = [{c_key: [c[:, :, :, :, i]]} for i in range(c.shape[-1])]
|
926 |
-
|
927 |
-
elif self.cond_stage_key == 'coordinates_bbox':
|
928 |
-
assert 'original_image_size' in self.split_input_params, 'BoudingBoxRescaling is missing original_image_size'
|
929 |
-
|
930 |
-
# assuming padding of unfold is always 0 and its dilation is always 1
|
931 |
-
n_patches_per_row = int((w - ks[0]) / stride[0] + 1)
|
932 |
-
full_img_h, full_img_w = self.split_input_params['original_image_size']
|
933 |
-
# as we are operating on latents, we need the factor from the original image size to the
|
934 |
-
# spatial latent size to properly rescale the crops for regenerating the bbox annotations
|
935 |
-
num_downs = self.first_stage_model.encoder.num_resolutions - 1
|
936 |
-
rescale_latent = 2 ** (num_downs)
|
937 |
-
|
938 |
-
# get top left postions of patches as conforming for the bbbox tokenizer, therefore we
|
939 |
-
# need to rescale the tl patch coordinates to be in between (0,1)
|
940 |
-
tl_patch_coordinates = [(rescale_latent * stride[0] * (patch_nr % n_patches_per_row) / full_img_w,
|
941 |
-
rescale_latent * stride[1] * (patch_nr // n_patches_per_row) / full_img_h)
|
942 |
-
for patch_nr in range(z.shape[-1])]
|
943 |
-
|
944 |
-
# patch_limits are tl_coord, width and height coordinates as (x_tl, y_tl, h, w)
|
945 |
-
patch_limits = [(x_tl, y_tl,
|
946 |
-
rescale_latent * ks[0] / full_img_w,
|
947 |
-
rescale_latent * ks[1] / full_img_h) for x_tl, y_tl in tl_patch_coordinates]
|
948 |
-
# patch_values = [(np.arange(x_tl,min(x_tl+ks, 1.)),np.arange(y_tl,min(y_tl+ks, 1.))) for x_tl, y_tl in tl_patch_coordinates]
|
949 |
-
|
950 |
-
# tokenize crop coordinates for the bounding boxes of the respective patches
|
951 |
-
patch_limits_tknzd = [torch.LongTensor(self.bbox_tokenizer._crop_encoder(bbox))[None].to(self.device)
|
952 |
-
for bbox in patch_limits] # list of length l with tensors of shape (1, 2)
|
953 |
-
print(patch_limits_tknzd[0].shape)
|
954 |
-
# cut tknzd crop position from conditioning
|
955 |
-
assert isinstance(cond, dict), 'cond must be dict to be fed into model'
|
956 |
-
cut_cond = cond['c_crossattn'][0][..., :-2].to(self.device)
|
957 |
-
print(cut_cond.shape)
|
958 |
-
|
959 |
-
adapted_cond = torch.stack([torch.cat([cut_cond, p], dim=1) for p in patch_limits_tknzd])
|
960 |
-
adapted_cond = rearrange(adapted_cond, 'l b n -> (l b) n')
|
961 |
-
print(adapted_cond.shape)
|
962 |
-
adapted_cond = self.get_learned_conditioning(adapted_cond)
|
963 |
-
print(adapted_cond.shape)
|
964 |
-
adapted_cond = rearrange(adapted_cond, '(l b) n d -> l b n d', l=z.shape[-1])
|
965 |
-
print(adapted_cond.shape)
|
966 |
-
|
967 |
-
cond_list = [{'c_crossattn': [e]} for e in adapted_cond]
|
968 |
-
|
969 |
-
else:
|
970 |
-
cond_list = [cond for i in range(z.shape[-1])] # Todo make this more efficient
|
971 |
-
|
972 |
-
# apply model by loop over crops
|
973 |
-
output_list = [self.model(z_list[i], t, **cond_list[i]) for i in range(z.shape[-1])]
|
974 |
-
assert not isinstance(output_list[0],
|
975 |
-
tuple) # todo cant deal with multiple model outputs check this never happens
|
976 |
-
|
977 |
-
o = torch.stack(output_list, axis=-1)
|
978 |
-
o = o * weighting
|
979 |
-
# Reverse reshape to img shape
|
980 |
-
o = o.view((o.shape[0], -1, o.shape[-1])) # (bn, nc * ks[0] * ks[1], L)
|
981 |
-
# stitch crops together
|
982 |
-
x_recon = fold(o) / normalization
|
983 |
-
|
984 |
-
else:
|
985 |
-
x_recon = self.model(x_noisy, t, **cond)
|
986 |
-
|
987 |
-
if isinstance(x_recon, tuple) and not return_ids:
|
988 |
-
return x_recon[0]
|
989 |
-
else:
|
990 |
-
return x_recon
|
991 |
-
|
992 |
-
def _predict_eps_from_xstart(self, x_t, t, pred_xstart):
|
993 |
-
return (extract_into_tensor(self.sqrt_recip_alphas_cumprod, t, x_t.shape) * x_t - pred_xstart) / \
|
994 |
-
extract_into_tensor(self.sqrt_recipm1_alphas_cumprod, t, x_t.shape)
|
995 |
-
|
996 |
-
def _prior_bpd(self, x_start):
|
997 |
-
"""
|
998 |
-
Get the prior KL term for the variational lower-bound, measured in
|
999 |
-
bits-per-dim.
|
1000 |
-
This term can't be optimized, as it only depends on the encoder.
|
1001 |
-
:param x_start: the [N x C x ...] tensor of inputs.
|
1002 |
-
:return: a batch of [N] KL values (in bits), one per batch element.
|
1003 |
-
"""
|
1004 |
-
batch_size = x_start.shape[0]
|
1005 |
-
t = torch.tensor([self.num_timesteps - 1] * batch_size, device=x_start.device)
|
1006 |
-
qt_mean, _, qt_log_variance = self.q_mean_variance(x_start, t)
|
1007 |
-
kl_prior = normal_kl(mean1=qt_mean, logvar1=qt_log_variance, mean2=0.0, logvar2=0.0)
|
1008 |
-
return mean_flat(kl_prior) / np.log(2.0)
|
1009 |
-
|
1010 |
-
def p_losses(self, x_start, cond, t, noise=None):
|
1011 |
-
noise = default(noise, lambda: torch.randn_like(x_start))
|
1012 |
-
x_noisy = self.q_sample(x_start=x_start, t=t, noise=noise)
|
1013 |
-
model_output = self.apply_model(x_noisy, t, cond)
|
1014 |
-
|
1015 |
-
loss_dict = {}
|
1016 |
-
prefix = 'train' if self.training else 'val'
|
1017 |
-
|
1018 |
-
if self.parameterization == "x0":
|
1019 |
-
target = x_start
|
1020 |
-
elif self.parameterization == "eps":
|
1021 |
-
target = noise
|
1022 |
-
else:
|
1023 |
-
raise NotImplementedError()
|
1024 |
-
|
1025 |
-
loss_simple = self.get_loss(model_output, target, mean=False).mean([1, 2, 3])
|
1026 |
-
loss_dict.update({f'{prefix}/loss_simple': loss_simple.mean()})
|
1027 |
-
|
1028 |
-
logvar_t = self.logvar[t].to(self.device)
|
1029 |
-
loss = loss_simple / torch.exp(logvar_t) + logvar_t
|
1030 |
-
# loss = loss_simple / torch.exp(self.logvar) + self.logvar
|
1031 |
-
if self.learn_logvar:
|
1032 |
-
loss_dict.update({f'{prefix}/loss_gamma': loss.mean()})
|
1033 |
-
loss_dict.update({'logvar': self.logvar.data.mean()})
|
1034 |
-
|
1035 |
-
loss = self.l_simple_weight * loss.mean()
|
1036 |
-
|
1037 |
-
loss_vlb = self.get_loss(model_output, target, mean=False).mean(dim=(1, 2, 3))
|
1038 |
-
loss_vlb = (self.lvlb_weights[t] * loss_vlb).mean()
|
1039 |
-
loss_dict.update({f'{prefix}/loss_vlb': loss_vlb})
|
1040 |
-
loss += (self.original_elbo_weight * loss_vlb)
|
1041 |
-
loss_dict.update({f'{prefix}/loss': loss})
|
1042 |
-
|
1043 |
-
return loss, loss_dict
|
1044 |
-
|
1045 |
-
def p_mean_variance(self, x, c, t, clip_denoised: bool, return_codebook_ids=False, quantize_denoised=False,
|
1046 |
-
return_x0=False, score_corrector=None, corrector_kwargs=None):
|
1047 |
-
t_in = t
|
1048 |
-
model_out = self.apply_model(x, t_in, c, return_ids=return_codebook_ids)
|
1049 |
-
|
1050 |
-
if score_corrector is not None:
|
1051 |
-
assert self.parameterization == "eps"
|
1052 |
-
model_out = score_corrector.modify_score(self, model_out, x, t, c, **corrector_kwargs)
|
1053 |
-
|
1054 |
-
if return_codebook_ids:
|
1055 |
-
model_out, logits = model_out
|
1056 |
-
|
1057 |
-
if self.parameterization == "eps":
|
1058 |
-
x_recon = self.predict_start_from_noise(x, t=t, noise=model_out)
|
1059 |
-
elif self.parameterization == "x0":
|
1060 |
-
x_recon = model_out
|
1061 |
-
else:
|
1062 |
-
raise NotImplementedError()
|
1063 |
-
|
1064 |
-
if clip_denoised:
|
1065 |
-
x_recon.clamp_(-1., 1.)
|
1066 |
-
if quantize_denoised:
|
1067 |
-
x_recon, _, [_, _, indices] = self.first_stage_model.quantize(x_recon)
|
1068 |
-
model_mean, posterior_variance, posterior_log_variance = self.q_posterior(x_start=x_recon, x_t=x, t=t)
|
1069 |
-
if return_codebook_ids:
|
1070 |
-
return model_mean, posterior_variance, posterior_log_variance, logits
|
1071 |
-
elif return_x0:
|
1072 |
-
return model_mean, posterior_variance, posterior_log_variance, x_recon
|
1073 |
-
else:
|
1074 |
-
return model_mean, posterior_variance, posterior_log_variance
|
1075 |
-
|
1076 |
-
@torch.no_grad()
|
1077 |
-
def p_sample(self, x, c, t, clip_denoised=False, repeat_noise=False,
|
1078 |
-
return_codebook_ids=False, quantize_denoised=False, return_x0=False,
|
1079 |
-
temperature=1., noise_dropout=0., score_corrector=None, corrector_kwargs=None):
|
1080 |
-
b, *_, device = *x.shape, x.device
|
1081 |
-
outputs = self.p_mean_variance(x=x, c=c, t=t, clip_denoised=clip_denoised,
|
1082 |
-
return_codebook_ids=return_codebook_ids,
|
1083 |
-
quantize_denoised=quantize_denoised,
|
1084 |
-
return_x0=return_x0,
|
1085 |
-
score_corrector=score_corrector, corrector_kwargs=corrector_kwargs)
|
1086 |
-
if return_codebook_ids:
|
1087 |
-
raise DeprecationWarning("Support dropped.")
|
1088 |
-
model_mean, _, model_log_variance, logits = outputs
|
1089 |
-
elif return_x0:
|
1090 |
-
model_mean, _, model_log_variance, x0 = outputs
|
1091 |
-
else:
|
1092 |
-
model_mean, _, model_log_variance = outputs
|
1093 |
-
|
1094 |
-
noise = noise_like(x.shape, device, repeat_noise) * temperature
|
1095 |
-
if noise_dropout > 0.:
|
1096 |
-
noise = torch.nn.functional.dropout(noise, p=noise_dropout)
|
1097 |
-
# no noise when t == 0
|
1098 |
-
nonzero_mask = (1 - (t == 0).float()).reshape(b, *((1,) * (len(x.shape) - 1)))
|
1099 |
-
|
1100 |
-
if return_codebook_ids:
|
1101 |
-
return model_mean + nonzero_mask * (0.5 * model_log_variance).exp() * noise, logits.argmax(dim=1)
|
1102 |
-
if return_x0:
|
1103 |
-
return model_mean + nonzero_mask * (0.5 * model_log_variance).exp() * noise, x0
|
1104 |
-
else:
|
1105 |
-
return model_mean + nonzero_mask * (0.5 * model_log_variance).exp() * noise
|
1106 |
-
|
1107 |
-
@torch.no_grad()
|
1108 |
-
def progressive_denoising(self, cond, shape, verbose=True, callback=None, quantize_denoised=False,
|
1109 |
-
img_callback=None, mask=None, x0=None, temperature=1., noise_dropout=0.,
|
1110 |
-
score_corrector=None, corrector_kwargs=None, batch_size=None, x_T=None, start_T=None,
|
1111 |
-
log_every_t=None):
|
1112 |
-
if not log_every_t:
|
1113 |
-
log_every_t = self.log_every_t
|
1114 |
-
timesteps = self.num_timesteps
|
1115 |
-
if batch_size is not None:
|
1116 |
-
b = batch_size if batch_size is not None else shape[0]
|
1117 |
-
shape = [batch_size] + list(shape)
|
1118 |
-
else:
|
1119 |
-
b = batch_size = shape[0]
|
1120 |
-
if x_T is None:
|
1121 |
-
img = torch.randn(shape, device=self.device)
|
1122 |
-
else:
|
1123 |
-
img = x_T
|
1124 |
-
intermediates = []
|
1125 |
-
if cond is not None:
|
1126 |
-
if isinstance(cond, dict):
|
1127 |
-
cond = {key: cond[key][:batch_size] if not isinstance(cond[key], list) else
|
1128 |
-
list(map(lambda x: x[:batch_size], cond[key])) for key in cond}
|
1129 |
-
else:
|
1130 |
-
cond = [c[:batch_size] for c in cond] if isinstance(cond, list) else cond[:batch_size]
|
1131 |
-
|
1132 |
-
if start_T is not None:
|
1133 |
-
timesteps = min(timesteps, start_T)
|
1134 |
-
iterator = tqdm(reversed(range(0, timesteps)), desc='Progressive Generation',
|
1135 |
-
total=timesteps) if verbose else reversed(
|
1136 |
-
range(0, timesteps))
|
1137 |
-
if type(temperature) == float:
|
1138 |
-
temperature = [temperature] * timesteps
|
1139 |
-
|
1140 |
-
for i in iterator:
|
1141 |
-
ts = torch.full((b,), i, device=self.device, dtype=torch.long)
|
1142 |
-
if self.shorten_cond_schedule:
|
1143 |
-
assert self.model.conditioning_key != 'hybrid'
|
1144 |
-
tc = self.cond_ids[ts].to(cond.device)
|
1145 |
-
cond = self.q_sample(x_start=cond, t=tc, noise=torch.randn_like(cond))
|
1146 |
-
|
1147 |
-
img, x0_partial = self.p_sample(img, cond, ts,
|
1148 |
-
clip_denoised=self.clip_denoised,
|
1149 |
-
quantize_denoised=quantize_denoised, return_x0=True,
|
1150 |
-
temperature=temperature[i], noise_dropout=noise_dropout,
|
1151 |
-
score_corrector=score_corrector, corrector_kwargs=corrector_kwargs)
|
1152 |
-
if mask is not None:
|
1153 |
-
assert x0 is not None
|
1154 |
-
img_orig = self.q_sample(x0, ts)
|
1155 |
-
img = img_orig * mask + (1. - mask) * img
|
1156 |
-
|
1157 |
-
if i % log_every_t == 0 or i == timesteps - 1:
|
1158 |
-
intermediates.append(x0_partial)
|
1159 |
-
if callback: callback(i)
|
1160 |
-
if img_callback: img_callback(img, i)
|
1161 |
-
return img, intermediates
|
1162 |
-
|
1163 |
-
@torch.no_grad()
|
1164 |
-
def p_sample_loop(self, cond, shape, return_intermediates=False,
|
1165 |
-
x_T=None, verbose=True, callback=None, timesteps=None, quantize_denoised=False,
|
1166 |
-
mask=None, x0=None, img_callback=None, start_T=None,
|
1167 |
-
log_every_t=None):
|
1168 |
-
|
1169 |
-
if not log_every_t:
|
1170 |
-
log_every_t = self.log_every_t
|
1171 |
-
device = self.betas.device
|
1172 |
-
b = shape[0]
|
1173 |
-
if x_T is None:
|
1174 |
-
img = torch.randn(shape, device=device)
|
1175 |
-
else:
|
1176 |
-
img = x_T
|
1177 |
-
|
1178 |
-
intermediates = [img]
|
1179 |
-
if timesteps is None:
|
1180 |
-
timesteps = self.num_timesteps
|
1181 |
-
|
1182 |
-
if start_T is not None:
|
1183 |
-
timesteps = min(timesteps, start_T)
|
1184 |
-
iterator = tqdm(reversed(range(0, timesteps)), desc='Sampling t', total=timesteps) if verbose else reversed(
|
1185 |
-
range(0, timesteps))
|
1186 |
-
|
1187 |
-
if mask is not None:
|
1188 |
-
assert x0 is not None
|
1189 |
-
assert x0.shape[2:3] == mask.shape[2:3] # spatial size has to match
|
1190 |
-
|
1191 |
-
for i in iterator:
|
1192 |
-
ts = torch.full((b,), i, device=device, dtype=torch.long)
|
1193 |
-
if self.shorten_cond_schedule:
|
1194 |
-
assert self.model.conditioning_key != 'hybrid'
|
1195 |
-
tc = self.cond_ids[ts].to(cond.device)
|
1196 |
-
cond = self.q_sample(x_start=cond, t=tc, noise=torch.randn_like(cond))
|
1197 |
-
|
1198 |
-
img = self.p_sample(img, cond, ts,
|
1199 |
-
clip_denoised=self.clip_denoised,
|
1200 |
-
quantize_denoised=quantize_denoised)
|
1201 |
-
if mask is not None:
|
1202 |
-
img_orig = self.q_sample(x0, ts)
|
1203 |
-
img = img_orig * mask + (1. - mask) * img
|
1204 |
-
|
1205 |
-
if i % log_every_t == 0 or i == timesteps - 1:
|
1206 |
-
intermediates.append(img)
|
1207 |
-
if callback: callback(i)
|
1208 |
-
if img_callback: img_callback(img, i)
|
1209 |
-
|
1210 |
-
if return_intermediates:
|
1211 |
-
return img, intermediates
|
1212 |
-
return img
|
1213 |
-
|
1214 |
-
@torch.no_grad()
|
1215 |
-
def sample(self, cond, batch_size=16, return_intermediates=False, x_T=None,
|
1216 |
-
verbose=True, timesteps=None, quantize_denoised=False,
|
1217 |
-
mask=None, x0=None, shape=None,**kwargs):
|
1218 |
-
if shape is None:
|
1219 |
-
shape = (batch_size, self.channels, self.image_size, self.image_size)
|
1220 |
-
if cond is not None:
|
1221 |
-
if isinstance(cond, dict):
|
1222 |
-
cond = {key: cond[key][:batch_size] if not isinstance(cond[key], list) else
|
1223 |
-
list(map(lambda x: x[:batch_size], cond[key])) for key in cond}
|
1224 |
-
else:
|
1225 |
-
cond = [c[:batch_size] for c in cond] if isinstance(cond, list) else cond[:batch_size]
|
1226 |
-
return self.p_sample_loop(cond,
|
1227 |
-
shape,
|
1228 |
-
return_intermediates=return_intermediates, x_T=x_T,
|
1229 |
-
verbose=verbose, timesteps=timesteps, quantize_denoised=quantize_denoised,
|
1230 |
-
mask=mask, x0=x0)
|
1231 |
-
|
1232 |
-
@torch.no_grad()
|
1233 |
-
def sample_log(self,cond,batch_size,ddim, ddim_steps,**kwargs):
|
1234 |
-
|
1235 |
-
if ddim:
|
1236 |
-
ddim_sampler = DDIMSampler(self)
|
1237 |
-
shape = (self.channels, self.image_size, self.image_size)
|
1238 |
-
samples, intermediates =ddim_sampler.sample(ddim_steps,batch_size,
|
1239 |
-
shape,cond,verbose=False,**kwargs)
|
1240 |
-
|
1241 |
-
else:
|
1242 |
-
samples, intermediates = self.sample(cond=cond, batch_size=batch_size,
|
1243 |
-
return_intermediates=True,**kwargs)
|
1244 |
-
|
1245 |
-
return samples, intermediates
|
1246 |
-
|
1247 |
-
|
1248 |
-
@torch.no_grad()
|
1249 |
-
def log_images(self, batch, N=8, n_row=4, sample=True, ddim_steps=200, ddim_eta=1., return_keys=None,
|
1250 |
-
quantize_denoised=True, inpaint=True, plot_denoise_rows=False, plot_progressive_rows=True,
|
1251 |
-
plot_diffusion_rows=True, **kwargs):
|
1252 |
-
|
1253 |
-
use_ddim = ddim_steps is not None
|
1254 |
-
|
1255 |
-
log = dict()
|
1256 |
-
z, c, x, xrec, xc = self.get_input(batch, self.first_stage_key,
|
1257 |
-
return_first_stage_outputs=True,
|
1258 |
-
force_c_encode=True,
|
1259 |
-
return_original_cond=True,
|
1260 |
-
bs=N)
|
1261 |
-
N = min(x.shape[0], N)
|
1262 |
-
n_row = min(x.shape[0], n_row)
|
1263 |
-
log["inputs"] = x
|
1264 |
-
log["reconstruction"] = xrec
|
1265 |
-
if self.model.conditioning_key is not None:
|
1266 |
-
if hasattr(self.cond_stage_model, "decode"):
|
1267 |
-
xc = self.cond_stage_model.decode(c)
|
1268 |
-
log["conditioning"] = xc
|
1269 |
-
elif self.cond_stage_key in ["caption"]:
|
1270 |
-
xc = log_txt_as_img((x.shape[2], x.shape[3]), batch["caption"])
|
1271 |
-
log["conditioning"] = xc
|
1272 |
-
elif self.cond_stage_key == 'class_label':
|
1273 |
-
xc = log_txt_as_img((x.shape[2], x.shape[3]), batch["human_label"])
|
1274 |
-
log['conditioning'] = xc
|
1275 |
-
elif isimage(xc):
|
1276 |
-
log["conditioning"] = xc
|
1277 |
-
if ismap(xc):
|
1278 |
-
log["original_conditioning"] = self.to_rgb(xc)
|
1279 |
-
|
1280 |
-
if plot_diffusion_rows:
|
1281 |
-
# get diffusion row
|
1282 |
-
diffusion_row = list()
|
1283 |
-
z_start = z[:n_row]
|
1284 |
-
for t in range(self.num_timesteps):
|
1285 |
-
if t % self.log_every_t == 0 or t == self.num_timesteps - 1:
|
1286 |
-
t = repeat(torch.tensor([t]), '1 -> b', b=n_row)
|
1287 |
-
t = t.to(self.device).long()
|
1288 |
-
noise = torch.randn_like(z_start)
|
1289 |
-
z_noisy = self.q_sample(x_start=z_start, t=t, noise=noise)
|
1290 |
-
diffusion_row.append(self.decode_first_stage(z_noisy))
|
1291 |
-
|
1292 |
-
diffusion_row = torch.stack(diffusion_row) # n_log_step, n_row, C, H, W
|
1293 |
-
diffusion_grid = rearrange(diffusion_row, 'n b c h w -> b n c h w')
|
1294 |
-
diffusion_grid = rearrange(diffusion_grid, 'b n c h w -> (b n) c h w')
|
1295 |
-
diffusion_grid = make_grid(diffusion_grid, nrow=diffusion_row.shape[0])
|
1296 |
-
log["diffusion_row"] = diffusion_grid
|
1297 |
-
|
1298 |
-
if sample:
|
1299 |
-
# get denoise row
|
1300 |
-
with self.ema_scope("Plotting"):
|
1301 |
-
samples, z_denoise_row = self.sample_log(cond=c,batch_size=N,ddim=use_ddim,
|
1302 |
-
ddim_steps=ddim_steps,eta=ddim_eta)
|
1303 |
-
# samples, z_denoise_row = self.sample(cond=c, batch_size=N, return_intermediates=True)
|
1304 |
-
x_samples = self.decode_first_stage(samples)
|
1305 |
-
log["samples"] = x_samples
|
1306 |
-
if plot_denoise_rows:
|
1307 |
-
denoise_grid = self._get_denoise_row_from_list(z_denoise_row)
|
1308 |
-
log["denoise_row"] = denoise_grid
|
1309 |
-
|
1310 |
-
if quantize_denoised and not isinstance(self.first_stage_model, AutoencoderKL) and not isinstance(
|
1311 |
-
self.first_stage_model, IdentityFirstStage):
|
1312 |
-
# also display when quantizing x0 while sampling
|
1313 |
-
with self.ema_scope("Plotting Quantized Denoised"):
|
1314 |
-
samples, z_denoise_row = self.sample_log(cond=c,batch_size=N,ddim=use_ddim,
|
1315 |
-
ddim_steps=ddim_steps,eta=ddim_eta,
|
1316 |
-
quantize_denoised=True)
|
1317 |
-
# samples, z_denoise_row = self.sample(cond=c, batch_size=N, return_intermediates=True,
|
1318 |
-
# quantize_denoised=True)
|
1319 |
-
x_samples = self.decode_first_stage(samples.to(self.device))
|
1320 |
-
log["samples_x0_quantized"] = x_samples
|
1321 |
-
|
1322 |
-
if inpaint:
|
1323 |
-
# make a simple center square
|
1324 |
-
b, h, w = z.shape[0], z.shape[2], z.shape[3]
|
1325 |
-
mask = torch.ones(N, h, w).to(self.device)
|
1326 |
-
# zeros will be filled in
|
1327 |
-
mask[:, h // 4:3 * h // 4, w // 4:3 * w // 4] = 0.
|
1328 |
-
mask = mask[:, None, ...]
|
1329 |
-
with self.ema_scope("Plotting Inpaint"):
|
1330 |
-
|
1331 |
-
samples, _ = self.sample_log(cond=c,batch_size=N,ddim=use_ddim, eta=ddim_eta,
|
1332 |
-
ddim_steps=ddim_steps, x0=z[:N], mask=mask)
|
1333 |
-
x_samples = self.decode_first_stage(samples.to(self.device))
|
1334 |
-
log["samples_inpainting"] = x_samples
|
1335 |
-
log["mask"] = mask
|
1336 |
-
|
1337 |
-
# outpaint
|
1338 |
-
with self.ema_scope("Plotting Outpaint"):
|
1339 |
-
samples, _ = self.sample_log(cond=c, batch_size=N, ddim=use_ddim,eta=ddim_eta,
|
1340 |
-
ddim_steps=ddim_steps, x0=z[:N], mask=mask)
|
1341 |
-
x_samples = self.decode_first_stage(samples.to(self.device))
|
1342 |
-
log["samples_outpainting"] = x_samples
|
1343 |
-
|
1344 |
-
if plot_progressive_rows:
|
1345 |
-
with self.ema_scope("Plotting Progressives"):
|
1346 |
-
img, progressives = self.progressive_denoising(c,
|
1347 |
-
shape=(self.channels, self.image_size, self.image_size),
|
1348 |
-
batch_size=N)
|
1349 |
-
prog_row = self._get_denoise_row_from_list(progressives, desc="Progressive Generation")
|
1350 |
-
log["progressive_row"] = prog_row
|
1351 |
-
|
1352 |
-
if return_keys:
|
1353 |
-
if np.intersect1d(list(log.keys()), return_keys).shape[0] == 0:
|
1354 |
-
return log
|
1355 |
-
else:
|
1356 |
-
return {key: log[key] for key in return_keys}
|
1357 |
-
return log
|
1358 |
-
|
1359 |
-
def configure_optimizers(self):
|
1360 |
-
lr = self.learning_rate
|
1361 |
-
params = list(self.model.parameters())
|
1362 |
-
if self.cond_stage_trainable:
|
1363 |
-
print(f"{self.__class__.__name__}: Also optimizing conditioner params!")
|
1364 |
-
params = params + list(self.cond_stage_model.parameters())
|
1365 |
-
if self.learn_logvar:
|
1366 |
-
print('Diffusion model optimizing logvar')
|
1367 |
-
params.append(self.logvar)
|
1368 |
-
opt = torch.optim.AdamW(params, lr=lr)
|
1369 |
-
if self.use_scheduler:
|
1370 |
-
assert 'target' in self.scheduler_config
|
1371 |
-
scheduler = instantiate_from_config(self.scheduler_config)
|
1372 |
-
|
1373 |
-
print("Setting up LambdaLR scheduler...")
|
1374 |
-
scheduler = [
|
1375 |
-
{
|
1376 |
-
'scheduler': LambdaLR(opt, lr_lambda=scheduler.schedule),
|
1377 |
-
'interval': 'step',
|
1378 |
-
'frequency': 1
|
1379 |
-
}]
|
1380 |
-
return [opt], scheduler
|
1381 |
-
return opt
|
1382 |
-
|
1383 |
-
@torch.no_grad()
|
1384 |
-
def to_rgb(self, x):
|
1385 |
-
x = x.float()
|
1386 |
-
if not hasattr(self, "colorize"):
|
1387 |
-
self.colorize = torch.randn(3, x.shape[1], 1, 1).to(x)
|
1388 |
-
x = nn.functional.conv2d(x, weight=self.colorize)
|
1389 |
-
x = 2. * (x - x.min()) / (x.max() - x.min()) - 1.
|
1390 |
-
return x
|
1391 |
-
|
1392 |
-
|
1393 |
-
class DiffusionWrapper(pl.LightningModule):
|
1394 |
-
def __init__(self, diff_model_config, conditioning_key):
|
1395 |
-
super().__init__()
|
1396 |
-
self.diffusion_model = instantiate_from_config(diff_model_config)
|
1397 |
-
self.conditioning_key = conditioning_key # 'crossattn' for txt2image, concat for inpainting
|
1398 |
-
assert self.conditioning_key in [None, 'concat', 'crossattn', 'hybrid', 'adm']
|
1399 |
-
|
1400 |
-
def forward(self, x, t, c_concat: list = None, c_crossattn: list = None):
|
1401 |
-
"""param x: tensor with shape:[B,C,mel_len,T]"""
|
1402 |
-
if self.conditioning_key is None:
|
1403 |
-
out = self.diffusion_model(x, t)
|
1404 |
-
elif self.conditioning_key == 'concat':
|
1405 |
-
xc = torch.cat([x] + c_concat, dim=1)# channel dim,x shape (b,3,64,64) c_concat shape(b,4,64,64)
|
1406 |
-
out = self.diffusion_model(xc, t)
|
1407 |
-
elif self.conditioning_key == 'crossattn':
|
1408 |
-
cc = torch.cat(c_crossattn, 1)# [b,seq_len,dim]
|
1409 |
-
out = self.diffusion_model(x, t, context=cc)
|
1410 |
-
elif self.conditioning_key == 'hybrid':# not implemented in the LatentDiffusion
|
1411 |
-
xc = torch.cat([x] + c_concat, dim=1)
|
1412 |
-
cc = torch.cat(c_crossattn, 1)
|
1413 |
-
out = self.diffusion_model(xc, t, context=cc)
|
1414 |
-
elif self.conditioning_key == 'adm':
|
1415 |
-
cc = c_crossattn[0]
|
1416 |
-
out = self.diffusion_model(x, t, y=cc)
|
1417 |
-
else:
|
1418 |
-
raise NotImplementedError()
|
1419 |
-
|
1420 |
-
return out
|
1421 |
-
|
1422 |
-
|
1423 |
-
class Layout2ImgDiffusion(LatentDiffusion):
|
1424 |
-
# TODO: move all layout-specific hacks to this class
|
1425 |
-
def __init__(self, cond_stage_key, *args, **kwargs):
|
1426 |
-
assert cond_stage_key == 'coordinates_bbox', 'Layout2ImgDiffusion only for cond_stage_key="coordinates_bbox"'
|
1427 |
-
super().__init__(cond_stage_key=cond_stage_key, *args, **kwargs)
|
1428 |
-
|
1429 |
-
def log_images(self, batch, N=8, *args, **kwargs):
|
1430 |
-
logs = super().log_images(batch=batch, N=N, *args, **kwargs)
|
1431 |
-
|
1432 |
-
key = 'train' if self.training else 'validation'
|
1433 |
-
dset = self.trainer.datamodule.datasets[key]
|
1434 |
-
mapper = dset.conditional_builders[self.cond_stage_key]
|
1435 |
-
|
1436 |
-
bbox_imgs = []
|
1437 |
-
map_fn = lambda catno: dset.get_textual_label(dset.get_category_id(catno))
|
1438 |
-
for tknzd_bbox in batch[self.cond_stage_key][:N]:
|
1439 |
-
bboximg = mapper.plot(tknzd_bbox.detach().cpu(), map_fn, (256, 256))
|
1440 |
-
bbox_imgs.append(bboximg)
|
1441 |
-
|
1442 |
-
cond_img = torch.stack(bbox_imgs, dim=0)
|
1443 |
-
logs['bbox_image'] = cond_img
|
1444 |
-
return logs
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
spaces/Aditya9790/yolo7-object-tracking/hubconf.py
DELETED
@@ -1,97 +0,0 @@
|
|
1 |
-
"""PyTorch Hub models
|
2 |
-
|
3 |
-
Usage:
|
4 |
-
import torch
|
5 |
-
model = torch.hub.load('repo', 'model')
|
6 |
-
"""
|
7 |
-
|
8 |
-
from pathlib import Path
|
9 |
-
|
10 |
-
import torch
|
11 |
-
|
12 |
-
from models.yolo import Model
|
13 |
-
from utils.general import check_requirements, set_logging
|
14 |
-
from utils.google_utils import attempt_download
|
15 |
-
from utils.torch_utils import select_device
|
16 |
-
|
17 |
-
dependencies = ['torch', 'yaml']
|
18 |
-
check_requirements(Path(__file__).parent / 'requirements.txt', exclude=('pycocotools', 'thop'))
|
19 |
-
set_logging()
|
20 |
-
|
21 |
-
|
22 |
-
def create(name, pretrained, channels, classes, autoshape):
|
23 |
-
"""Creates a specified model
|
24 |
-
|
25 |
-
Arguments:
|
26 |
-
name (str): name of model, i.e. 'yolov7'
|
27 |
-
pretrained (bool): load pretrained weights into the model
|
28 |
-
channels (int): number of input channels
|
29 |
-
classes (int): number of model classes
|
30 |
-
|
31 |
-
Returns:
|
32 |
-
pytorch model
|
33 |
-
"""
|
34 |
-
try:
|
35 |
-
cfg = list((Path(__file__).parent / 'cfg').rglob(f'{name}.yaml'))[0] # model.yaml path
|
36 |
-
model = Model(cfg, channels, classes)
|
37 |
-
if pretrained:
|
38 |
-
fname = f'{name}.pt' # checkpoint filename
|
39 |
-
attempt_download(fname) # download if not found locally
|
40 |
-
ckpt = torch.load(fname, map_location=torch.device('cpu')) # load
|
41 |
-
msd = model.state_dict() # model state_dict
|
42 |
-
csd = ckpt['model'].float().state_dict() # checkpoint state_dict as FP32
|
43 |
-
csd = {k: v for k, v in csd.items() if msd[k].shape == v.shape} # filter
|
44 |
-
model.load_state_dict(csd, strict=False) # load
|
45 |
-
if len(ckpt['model'].names) == classes:
|
46 |
-
model.names = ckpt['model'].names # set class names attribute
|
47 |
-
if autoshape:
|
48 |
-
model = model.autoshape() # for file/URI/PIL/cv2/np inputs and NMS
|
49 |
-
device = select_device('0' if torch.cuda.is_available() else 'cpu') # default to GPU if available
|
50 |
-
return model.to(device)
|
51 |
-
|
52 |
-
except Exception as e:
|
53 |
-
s = 'Cache maybe be out of date, try force_reload=True.'
|
54 |
-
raise Exception(s) from e
|
55 |
-
|
56 |
-
|
57 |
-
def custom(path_or_model='path/to/model.pt', autoshape=True):
|
58 |
-
"""custom mode
|
59 |
-
|
60 |
-
Arguments (3 options):
|
61 |
-
path_or_model (str): 'path/to/model.pt'
|
62 |
-
path_or_model (dict): torch.load('path/to/model.pt')
|
63 |
-
path_or_model (nn.Module): torch.load('path/to/model.pt')['model']
|
64 |
-
|
65 |
-
Returns:
|
66 |
-
pytorch model
|
67 |
-
"""
|
68 |
-
model = torch.load(path_or_model, map_location=torch.device('cpu')) if isinstance(path_or_model, str) else path_or_model # load checkpoint
|
69 |
-
if isinstance(model, dict):
|
70 |
-
model = model['ema' if model.get('ema') else 'model'] # load model
|
71 |
-
|
72 |
-
hub_model = Model(model.yaml).to(next(model.parameters()).device) # create
|
73 |
-
hub_model.load_state_dict(model.float().state_dict()) # load state_dict
|
74 |
-
hub_model.names = model.names # class names
|
75 |
-
if autoshape:
|
76 |
-
hub_model = hub_model.autoshape() # for file/URI/PIL/cv2/np inputs and NMS
|
77 |
-
device = select_device('0' if torch.cuda.is_available() else 'cpu') # default to GPU if available
|
78 |
-
return hub_model.to(device)
|
79 |
-
|
80 |
-
|
81 |
-
def yolov7(pretrained=True, channels=3, classes=80, autoshape=True):
|
82 |
-
return create('yolov7', pretrained, channels, classes, autoshape)
|
83 |
-
|
84 |
-
|
85 |
-
if __name__ == '__main__':
|
86 |
-
model = custom(path_or_model='yolov7.pt') # custom example
|
87 |
-
# model = create(name='yolov7', pretrained=True, channels=3, classes=80, autoshape=True) # pretrained example
|
88 |
-
|
89 |
-
# Verify inference
|
90 |
-
import numpy as np
|
91 |
-
from PIL import Image
|
92 |
-
|
93 |
-
imgs = [np.zeros((640, 480, 3))]
|
94 |
-
|
95 |
-
results = model(imgs) # batched inference
|
96 |
-
results.print()
|
97 |
-
results.save()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
spaces/AgentVerse/agentVerse/ui/src/phaser3-rex-plugins/templates/ui/menu/methods/Collapse.js
DELETED
@@ -1,16 +0,0 @@
|
|
1 |
-
var Collapse = function () {
|
2 |
-
var root = this.root;
|
3 |
-
root.emit('collapse', this, this.parentButton, root);
|
4 |
-
|
5 |
-
var duration = root.easeOut.duration;
|
6 |
-
// Don't destroy under transitOutCallback
|
7 |
-
root.transitOutCallback(this, duration);
|
8 |
-
this.collapseSubMenu();
|
9 |
-
|
10 |
-
// Destroy by delayCall
|
11 |
-
this.delayCall(duration, this.destroy, this);
|
12 |
-
|
13 |
-
return this;
|
14 |
-
}
|
15 |
-
|
16 |
-
export default Collapse;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
spaces/AlStable/Duke/README.md
DELETED
@@ -1,12 +0,0 @@
|
|
1 |
-
---
|
2 |
-
title: Duke
|
3 |
-
emoji: 🦀
|
4 |
-
colorFrom: purple
|
5 |
-
colorTo: red
|
6 |
-
sdk: gradio
|
7 |
-
sdk_version: 3.18.0
|
8 |
-
app_file: app.py
|
9 |
-
pinned: false
|
10 |
-
---
|
11 |
-
|
12 |
-
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
spaces/Amrrs/DragGan-Inversion/stylegan_human/dnnlib/tflib/optimizer.py
DELETED
@@ -1,389 +0,0 @@
|
|
1 |
-
# Copyright (c) SenseTime Research. All rights reserved.
|
2 |
-
|
3 |
-
# Copyright (c) 2019, NVIDIA Corporation. All rights reserved.
|
4 |
-
#
|
5 |
-
# This work is made available under the Nvidia Source Code License-NC.
|
6 |
-
# To view a copy of this license, visit
|
7 |
-
# https://nvlabs.github.io/stylegan2/license.html
|
8 |
-
|
9 |
-
"""Helper wrapper for a Tensorflow optimizer."""
|
10 |
-
|
11 |
-
import numpy as np
|
12 |
-
import tensorflow as tf
|
13 |
-
|
14 |
-
from collections import OrderedDict
|
15 |
-
from typing import List, Union
|
16 |
-
|
17 |
-
from . import autosummary
|
18 |
-
from . import tfutil
|
19 |
-
from .. import util
|
20 |
-
|
21 |
-
from .tfutil import TfExpression, TfExpressionEx
|
22 |
-
|
23 |
-
try:
|
24 |
-
# TensorFlow 1.13
|
25 |
-
from tensorflow.python.ops import nccl_ops
|
26 |
-
except:
|
27 |
-
# Older TensorFlow versions
|
28 |
-
import tensorflow.contrib.nccl as nccl_ops
|
29 |
-
|
30 |
-
|
31 |
-
class Optimizer:
|
32 |
-
"""A Wrapper for tf.train.Optimizer.
|
33 |
-
|
34 |
-
Automatically takes care of:
|
35 |
-
- Gradient averaging for multi-GPU training.
|
36 |
-
- Gradient accumulation for arbitrarily large minibatches.
|
37 |
-
- Dynamic loss scaling and typecasts for FP16 training.
|
38 |
-
- Ignoring corrupted gradients that contain NaNs/Infs.
|
39 |
-
- Reporting statistics.
|
40 |
-
- Well-chosen default settings.
|
41 |
-
"""
|
42 |
-
|
43 |
-
def __init__(self,
|
44 |
-
# Name string that will appear in TensorFlow graph.
|
45 |
-
name: str = "Train",
|
46 |
-
# Underlying optimizer class.
|
47 |
-
tf_optimizer: str = "tf.train.AdamOptimizer",
|
48 |
-
# Learning rate. Can vary over time.
|
49 |
-
learning_rate: TfExpressionEx = 0.001,
|
50 |
-
# Treat N consecutive minibatches as one by accumulating gradients.
|
51 |
-
minibatch_multiplier: TfExpressionEx = None,
|
52 |
-
# Share internal state with a previously created optimizer?
|
53 |
-
share: "Optimizer" = None,
|
54 |
-
# Enable dynamic loss scaling for robust mixed-precision training?
|
55 |
-
use_loss_scaling: bool = False,
|
56 |
-
# Log2 of initial loss scaling factor.
|
57 |
-
loss_scaling_init: float = 64.0,
|
58 |
-
# Log2 of per-minibatch loss scaling increment when there is no overflow.
|
59 |
-
loss_scaling_inc: float = 0.0005,
|
60 |
-
# Log2 of per-minibatch loss scaling decrement when there is an overflow.
|
61 |
-
loss_scaling_dec: float = 1.0,
|
62 |
-
# Report fine-grained memory usage statistics in TensorBoard?
|
63 |
-
report_mem_usage: bool = False,
|
64 |
-
**kwargs):
|
65 |
-
|
66 |
-
# Public fields.
|
67 |
-
self.name = name
|
68 |
-
self.learning_rate = learning_rate
|
69 |
-
self.minibatch_multiplier = minibatch_multiplier
|
70 |
-
self.id = self.name.replace("/", ".")
|
71 |
-
self.scope = tf.get_default_graph().unique_name(self.id)
|
72 |
-
self.optimizer_class = util.get_obj_by_name(tf_optimizer)
|
73 |
-
self.optimizer_kwargs = dict(kwargs)
|
74 |
-
self.use_loss_scaling = use_loss_scaling
|
75 |
-
self.loss_scaling_init = loss_scaling_init
|
76 |
-
self.loss_scaling_inc = loss_scaling_inc
|
77 |
-
self.loss_scaling_dec = loss_scaling_dec
|
78 |
-
|
79 |
-
# Private fields.
|
80 |
-
self._updates_applied = False
|
81 |
-
self._devices = OrderedDict() # device_name => EasyDict()
|
82 |
-
self._shared_optimizers = OrderedDict() # device_name => optimizer_class
|
83 |
-
self._gradient_shapes = None # [shape, ...]
|
84 |
-
self._report_mem_usage = report_mem_usage
|
85 |
-
|
86 |
-
# Validate arguments.
|
87 |
-
assert callable(self.optimizer_class)
|
88 |
-
|
89 |
-
# Share internal state if requested.
|
90 |
-
if share is not None:
|
91 |
-
assert isinstance(share, Optimizer)
|
92 |
-
assert self.optimizer_class is share.optimizer_class
|
93 |
-
assert self.learning_rate is share.learning_rate
|
94 |
-
assert self.optimizer_kwargs == share.optimizer_kwargs
|
95 |
-
self._shared_optimizers = share._shared_optimizers # pylint: disable=protected-access
|
96 |
-
|
97 |
-
def _get_device(self, device_name: str):
|
98 |
-
"""Get internal state for the given TensorFlow device."""
|
99 |
-
tfutil.assert_tf_initialized()
|
100 |
-
if device_name in self._devices:
|
101 |
-
return self._devices[device_name]
|
102 |
-
|
103 |
-
# Initialize fields.
|
104 |
-
device = util.EasyDict()
|
105 |
-
device.name = device_name
|
106 |
-
device.optimizer = None # Underlying optimizer: optimizer_class
|
107 |
-
device.loss_scaling_var = None # Log2 of loss scaling: tf.Variable
|
108 |
-
# Raw gradients: var => [grad, ...]
|
109 |
-
device.grad_raw = OrderedDict()
|
110 |
-
device.grad_clean = OrderedDict() # Clean gradients: var => grad
|
111 |
-
# Accumulation sums: var => tf.Variable
|
112 |
-
device.grad_acc_vars = OrderedDict()
|
113 |
-
device.grad_acc_count = None # Accumulation counter: tf.Variable
|
114 |
-
device.grad_acc = OrderedDict() # Accumulated gradients: var => grad
|
115 |
-
|
116 |
-
# Setup TensorFlow objects.
|
117 |
-
with tfutil.absolute_name_scope(self.scope + "/Devices"), tf.device(device_name), tf.control_dependencies(None):
|
118 |
-
if device_name not in self._shared_optimizers:
|
119 |
-
optimizer_name = self.scope.replace(
|
120 |
-
"/", "_") + "_opt%d" % len(self._shared_optimizers)
|
121 |
-
self._shared_optimizers[device_name] = self.optimizer_class(
|
122 |
-
name=optimizer_name, learning_rate=self.learning_rate, **self.optimizer_kwargs)
|
123 |
-
device.optimizer = self._shared_optimizers[device_name]
|
124 |
-
if self.use_loss_scaling:
|
125 |
-
device.loss_scaling_var = tf.Variable(np.float32(
|
126 |
-
self.loss_scaling_init), trainable=False, name="loss_scaling_var")
|
127 |
-
|
128 |
-
# Register device.
|
129 |
-
self._devices[device_name] = device
|
130 |
-
return device
|
131 |
-
|
132 |
-
def register_gradients(self, loss: TfExpression, trainable_vars: Union[List, dict]) -> None:
|
133 |
-
"""Register the gradients of the given loss function with respect to the given variables.
|
134 |
-
Intended to be called once per GPU."""
|
135 |
-
tfutil.assert_tf_initialized()
|
136 |
-
assert not self._updates_applied
|
137 |
-
device = self._get_device(loss.device)
|
138 |
-
|
139 |
-
# Validate trainables.
|
140 |
-
if isinstance(trainable_vars, dict):
|
141 |
-
# allow passing in Network.trainables as vars
|
142 |
-
trainable_vars = list(trainable_vars.values())
|
143 |
-
assert isinstance(trainable_vars, list) and len(trainable_vars) >= 1
|
144 |
-
assert all(tfutil.is_tf_expression(expr)
|
145 |
-
for expr in trainable_vars + [loss])
|
146 |
-
assert all(var.device == device.name for var in trainable_vars)
|
147 |
-
|
148 |
-
# Validate shapes.
|
149 |
-
if self._gradient_shapes is None:
|
150 |
-
self._gradient_shapes = [var.shape.as_list()
|
151 |
-
for var in trainable_vars]
|
152 |
-
assert len(trainable_vars) == len(self._gradient_shapes)
|
153 |
-
assert all(var.shape.as_list() == var_shape for var,
|
154 |
-
var_shape in zip(trainable_vars, self._gradient_shapes))
|
155 |
-
|
156 |
-
# Report memory usage if requested.
|
157 |
-
deps = []
|
158 |
-
if self._report_mem_usage:
|
159 |
-
self._report_mem_usage = False
|
160 |
-
try:
|
161 |
-
with tf.name_scope(self.id + '_mem'), tf.device(device.name), tf.control_dependencies([loss]):
|
162 |
-
deps.append(autosummary.autosummary(
|
163 |
-
self.id + "/mem_usage_gb", tf.contrib.memory_stats.BytesInUse() / 2**30))
|
164 |
-
except tf.errors.NotFoundError:
|
165 |
-
pass
|
166 |
-
|
167 |
-
# Compute gradients.
|
168 |
-
with tf.name_scope(self.id + "_grad"), tf.device(device.name), tf.control_dependencies(deps):
|
169 |
-
loss = self.apply_loss_scaling(tf.cast(loss, tf.float32))
|
170 |
-
gate = tf.train.Optimizer.GATE_NONE # disable gating to reduce memory usage
|
171 |
-
grad_list = device.optimizer.compute_gradients(
|
172 |
-
loss=loss, var_list=trainable_vars, gate_gradients=gate)
|
173 |
-
|
174 |
-
# Register gradients.
|
175 |
-
for grad, var in grad_list:
|
176 |
-
if var not in device.grad_raw:
|
177 |
-
device.grad_raw[var] = []
|
178 |
-
device.grad_raw[var].append(grad)
|
179 |
-
|
180 |
-
def apply_updates(self, allow_no_op: bool = False) -> tf.Operation:
|
181 |
-
"""Construct training op to update the registered variables based on their gradients."""
|
182 |
-
tfutil.assert_tf_initialized()
|
183 |
-
assert not self._updates_applied
|
184 |
-
self._updates_applied = True
|
185 |
-
all_ops = []
|
186 |
-
|
187 |
-
# Check for no-op.
|
188 |
-
if allow_no_op and len(self._devices) == 0:
|
189 |
-
with tfutil.absolute_name_scope(self.scope):
|
190 |
-
return tf.no_op(name='TrainingOp')
|
191 |
-
|
192 |
-
# Clean up gradients.
|
193 |
-
for device_idx, device in enumerate(self._devices.values()):
|
194 |
-
with tfutil.absolute_name_scope(self.scope + "/Clean%d" % device_idx), tf.device(device.name):
|
195 |
-
for var, grad in device.grad_raw.items():
|
196 |
-
|
197 |
-
# Filter out disconnected gradients and convert to float32.
|
198 |
-
grad = [g for g in grad if g is not None]
|
199 |
-
grad = [tf.cast(g, tf.float32) for g in grad]
|
200 |
-
|
201 |
-
# Sum within the device.
|
202 |
-
if len(grad) == 0:
|
203 |
-
grad = tf.zeros(var.shape) # No gradients => zero.
|
204 |
-
elif len(grad) == 1:
|
205 |
-
# Single gradient => use as is.
|
206 |
-
grad = grad[0]
|
207 |
-
else:
|
208 |
-
# Multiple gradients => sum.
|
209 |
-
grad = tf.add_n(grad)
|
210 |
-
|
211 |
-
# Scale as needed.
|
212 |
-
scale = 1.0 / \
|
213 |
-
len(device.grad_raw[var]) / len(self._devices)
|
214 |
-
scale = tf.constant(scale, dtype=tf.float32, name="scale")
|
215 |
-
if self.minibatch_multiplier is not None:
|
216 |
-
scale /= tf.cast(self.minibatch_multiplier, tf.float32)
|
217 |
-
scale = self.undo_loss_scaling(scale)
|
218 |
-
device.grad_clean[var] = grad * scale
|
219 |
-
|
220 |
-
# Sum gradients across devices.
|
221 |
-
if len(self._devices) > 1:
|
222 |
-
with tfutil.absolute_name_scope(self.scope + "/Broadcast"), tf.device(None):
|
223 |
-
for all_vars in zip(*[device.grad_clean.keys() for device in self._devices.values()]):
|
224 |
-
# NCCL does not support zero-sized tensors.
|
225 |
-
if len(all_vars) > 0 and all(dim > 0 for dim in all_vars[0].shape.as_list()):
|
226 |
-
all_grads = [device.grad_clean[var] for device, var in zip(
|
227 |
-
self._devices.values(), all_vars)]
|
228 |
-
all_grads = nccl_ops.all_sum(all_grads)
|
229 |
-
for device, var, grad in zip(self._devices.values(), all_vars, all_grads):
|
230 |
-
device.grad_clean[var] = grad
|
231 |
-
|
232 |
-
# Apply updates separately on each device.
|
233 |
-
for device_idx, device in enumerate(self._devices.values()):
|
234 |
-
with tfutil.absolute_name_scope(self.scope + "/Apply%d" % device_idx), tf.device(device.name):
|
235 |
-
# pylint: disable=cell-var-from-loop
|
236 |
-
|
237 |
-
# Accumulate gradients over time.
|
238 |
-
if self.minibatch_multiplier is None:
|
239 |
-
acc_ok = tf.constant(True, name='acc_ok')
|
240 |
-
device.grad_acc = OrderedDict(device.grad_clean)
|
241 |
-
else:
|
242 |
-
# Create variables.
|
243 |
-
with tf.control_dependencies(None):
|
244 |
-
for var in device.grad_clean.keys():
|
245 |
-
device.grad_acc_vars[var] = tf.Variable(
|
246 |
-
tf.zeros(var.shape), trainable=False, name="grad_acc_var")
|
247 |
-
device.grad_acc_count = tf.Variable(
|
248 |
-
tf.zeros([]), trainable=False, name="grad_acc_count")
|
249 |
-
|
250 |
-
# Track counter.
|
251 |
-
count_cur = device.grad_acc_count + 1.0
|
252 |
-
def count_inc_op(): return tf.assign(device.grad_acc_count, count_cur)
|
253 |
-
def count_reset_op(): return tf.assign(device.grad_acc_count, tf.zeros([]))
|
254 |
-
acc_ok = (count_cur >= tf.cast(
|
255 |
-
self.minibatch_multiplier, tf.float32))
|
256 |
-
all_ops.append(
|
257 |
-
tf.cond(acc_ok, count_reset_op, count_inc_op))
|
258 |
-
|
259 |
-
# Track gradients.
|
260 |
-
for var, grad in device.grad_clean.items():
|
261 |
-
acc_var = device.grad_acc_vars[var]
|
262 |
-
acc_cur = acc_var + grad
|
263 |
-
device.grad_acc[var] = acc_cur
|
264 |
-
with tf.control_dependencies([acc_cur]):
|
265 |
-
def acc_inc_op(): return tf.assign(acc_var, acc_cur)
|
266 |
-
def acc_reset_op(): return tf.assign(acc_var, tf.zeros(var.shape))
|
267 |
-
all_ops.append(
|
268 |
-
tf.cond(acc_ok, acc_reset_op, acc_inc_op))
|
269 |
-
|
270 |
-
# No overflow => apply gradients.
|
271 |
-
all_ok = tf.reduce_all(tf.stack(
|
272 |
-
[acc_ok] + [tf.reduce_all(tf.is_finite(g)) for g in device.grad_acc.values()]))
|
273 |
-
|
274 |
-
def apply_op(): return device.optimizer.apply_gradients(
|
275 |
-
[(tf.cast(grad, var.dtype), var) for var, grad in device.grad_acc.items()])
|
276 |
-
all_ops.append(tf.cond(all_ok, apply_op, tf.no_op))
|
277 |
-
|
278 |
-
# Adjust loss scaling.
|
279 |
-
if self.use_loss_scaling:
|
280 |
-
def ls_inc_op(): return tf.assign_add(
|
281 |
-
device.loss_scaling_var, self.loss_scaling_inc)
|
282 |
-
def ls_dec_op(): return tf.assign_sub(
|
283 |
-
device.loss_scaling_var, self.loss_scaling_dec)
|
284 |
-
|
285 |
-
def ls_update_op(): return tf.group(tf.cond(all_ok, ls_inc_op, ls_dec_op))
|
286 |
-
all_ops.append(tf.cond(acc_ok, ls_update_op, tf.no_op))
|
287 |
-
|
288 |
-
# Last device => report statistics.
|
289 |
-
if device_idx == len(self._devices) - 1:
|
290 |
-
all_ops.append(autosummary.autosummary(
|
291 |
-
self.id + "/learning_rate", self.learning_rate))
|
292 |
-
all_ops.append(autosummary.autosummary(
|
293 |
-
self.id + "/overflow_frequency", tf.where(all_ok, 0, 1), condition=acc_ok))
|
294 |
-
if self.use_loss_scaling:
|
295 |
-
all_ops.append(autosummary.autosummary(
|
296 |
-
self.id + "/loss_scaling_log2", device.loss_scaling_var))
|
297 |
-
|
298 |
-
# Initialize variables.
|
299 |
-
self.reset_optimizer_state()
|
300 |
-
if self.use_loss_scaling:
|
301 |
-
tfutil.init_uninitialized_vars(
|
302 |
-
[device.loss_scaling_var for device in self._devices.values()])
|
303 |
-
if self.minibatch_multiplier is not None:
|
304 |
-
tfutil.run([var.initializer for device in self._devices.values() for var in list(
|
305 |
-
device.grad_acc_vars.values()) + [device.grad_acc_count]])
|
306 |
-
|
307 |
-
# Group everything into a single op.
|
308 |
-
with tfutil.absolute_name_scope(self.scope):
|
309 |
-
return tf.group(*all_ops, name="TrainingOp")
|
310 |
-
|
311 |
-
def reset_optimizer_state(self) -> None:
|
312 |
-
"""Reset internal state of the underlying optimizer."""
|
313 |
-
tfutil.assert_tf_initialized()
|
314 |
-
tfutil.run([var.initializer for device in self._devices.values()
|
315 |
-
for var in device.optimizer.variables()])
|
316 |
-
|
317 |
-
def get_loss_scaling_var(self, device: str) -> Union[tf.Variable, None]:
|
318 |
-
"""Get or create variable representing log2 of the current dynamic loss scaling factor."""
|
319 |
-
return self._get_device(device).loss_scaling_var
|
320 |
-
|
321 |
-
def apply_loss_scaling(self, value: TfExpression) -> TfExpression:
|
322 |
-
"""Apply dynamic loss scaling for the given expression."""
|
323 |
-
assert tfutil.is_tf_expression(value)
|
324 |
-
if not self.use_loss_scaling:
|
325 |
-
return value
|
326 |
-
return value * tfutil.exp2(self.get_loss_scaling_var(value.device))
|
327 |
-
|
328 |
-
def undo_loss_scaling(self, value: TfExpression) -> TfExpression:
|
329 |
-
"""Undo the effect of dynamic loss scaling for the given expression."""
|
330 |
-
assert tfutil.is_tf_expression(value)
|
331 |
-
if not self.use_loss_scaling:
|
332 |
-
return value
|
333 |
-
return value * tfutil.exp2(-self.get_loss_scaling_var(value.device)) # pylint: disable=invalid-unary-operand-type
|
334 |
-
|
335 |
-
|
336 |
-
class SimpleAdam:
|
337 |
-
"""Simplified version of tf.train.AdamOptimizer that behaves identically when used with dnnlib.tflib.Optimizer."""
|
338 |
-
|
339 |
-
def __init__(self, name="Adam", learning_rate=0.001, beta1=0.9, beta2=0.999, epsilon=1e-8):
|
340 |
-
self.name = name
|
341 |
-
self.learning_rate = learning_rate
|
342 |
-
self.beta1 = beta1
|
343 |
-
self.beta2 = beta2
|
344 |
-
self.epsilon = epsilon
|
345 |
-
self.all_state_vars = []
|
346 |
-
|
347 |
-
def variables(self):
|
348 |
-
return self.all_state_vars
|
349 |
-
|
350 |
-
def compute_gradients(self, loss, var_list, gate_gradients=tf.train.Optimizer.GATE_NONE):
|
351 |
-
assert gate_gradients == tf.train.Optimizer.GATE_NONE
|
352 |
-
return list(zip(tf.gradients(loss, var_list), var_list))
|
353 |
-
|
354 |
-
def apply_gradients(self, grads_and_vars):
|
355 |
-
with tf.name_scope(self.name):
|
356 |
-
state_vars = []
|
357 |
-
update_ops = []
|
358 |
-
|
359 |
-
# Adjust learning rate to deal with startup bias.
|
360 |
-
with tf.control_dependencies(None):
|
361 |
-
b1pow_var = tf.Variable(
|
362 |
-
dtype=tf.float32, initial_value=1, trainable=False)
|
363 |
-
b2pow_var = tf.Variable(
|
364 |
-
dtype=tf.float32, initial_value=1, trainable=False)
|
365 |
-
state_vars += [b1pow_var, b2pow_var]
|
366 |
-
b1pow_new = b1pow_var * self.beta1
|
367 |
-
b2pow_new = b2pow_var * self.beta2
|
368 |
-
update_ops += [tf.assign(b1pow_var, b1pow_new),
|
369 |
-
tf.assign(b2pow_var, b2pow_new)]
|
370 |
-
lr_new = self.learning_rate * \
|
371 |
-
tf.sqrt(1 - b2pow_new) / (1 - b1pow_new)
|
372 |
-
|
373 |
-
# Construct ops to update each variable.
|
374 |
-
for grad, var in grads_and_vars:
|
375 |
-
with tf.control_dependencies(None):
|
376 |
-
m_var = tf.Variable(
|
377 |
-
dtype=tf.float32, initial_value=tf.zeros_like(var), trainable=False)
|
378 |
-
v_var = tf.Variable(
|
379 |
-
dtype=tf.float32, initial_value=tf.zeros_like(var), trainable=False)
|
380 |
-
state_vars += [m_var, v_var]
|
381 |
-
m_new = self.beta1 * m_var + (1 - self.beta1) * grad
|
382 |
-
v_new = self.beta2 * v_var + (1 - self.beta2) * tf.square(grad)
|
383 |
-
var_delta = lr_new * m_new / (tf.sqrt(v_new) + self.epsilon)
|
384 |
-
update_ops += [tf.assign(m_var, m_new), tf.assign(v_var,
|
385 |
-
v_new), tf.assign_sub(var, var_delta)]
|
386 |
-
|
387 |
-
# Group everything together.
|
388 |
-
self.all_state_vars += state_vars
|
389 |
-
return tf.group(*update_ops)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
spaces/Amrrs/DragGan-Inversion/viz/pickle_widget.py
DELETED
@@ -1,183 +0,0 @@
|
|
1 |
-
# Copyright (c) 2021, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
|
2 |
-
#
|
3 |
-
# NVIDIA CORPORATION and its licensors retain all intellectual property
|
4 |
-
# and proprietary rights in and to this software, related documentation
|
5 |
-
# and any modifications thereto. Any use, reproduction, disclosure or
|
6 |
-
# distribution of this software and related documentation without an express
|
7 |
-
# license agreement from NVIDIA CORPORATION is strictly prohibited.
|
8 |
-
|
9 |
-
import glob
|
10 |
-
import os
|
11 |
-
import re
|
12 |
-
|
13 |
-
import dnnlib
|
14 |
-
import imgui
|
15 |
-
import numpy as np
|
16 |
-
from gui_utils import imgui_utils
|
17 |
-
|
18 |
-
from . import renderer
|
19 |
-
|
20 |
-
# ----------------------------------------------------------------------------
|
21 |
-
|
22 |
-
|
23 |
-
def _locate_results(pattern):
|
24 |
-
return pattern
|
25 |
-
|
26 |
-
# ----------------------------------------------------------------------------
|
27 |
-
|
28 |
-
|
29 |
-
class PickleWidget:
|
30 |
-
def __init__(self, viz):
|
31 |
-
self.viz = viz
|
32 |
-
self.search_dirs = []
|
33 |
-
self.cur_pkl = None
|
34 |
-
self.user_pkl = ''
|
35 |
-
self.recent_pkls = []
|
36 |
-
# {tuple(path, ...): [dnnlib.EasyDict(), ...], ...}
|
37 |
-
self.browse_cache = dict()
|
38 |
-
self.browse_refocus = False
|
39 |
-
self.load('', ignore_errors=True)
|
40 |
-
|
41 |
-
def add_recent(self, pkl, ignore_errors=False):
|
42 |
-
try:
|
43 |
-
resolved = self.resolve_pkl(pkl)
|
44 |
-
if resolved not in self.recent_pkls:
|
45 |
-
self.recent_pkls.append(resolved)
|
46 |
-
except:
|
47 |
-
if not ignore_errors:
|
48 |
-
raise
|
49 |
-
|
50 |
-
def load(self, pkl, ignore_errors=False):
|
51 |
-
viz = self.viz
|
52 |
-
viz.clear_result()
|
53 |
-
viz.skip_frame() # The input field will change on next frame.
|
54 |
-
try:
|
55 |
-
resolved = self.resolve_pkl(pkl)
|
56 |
-
name = resolved.replace('\\', '/').split('/')[-1]
|
57 |
-
self.cur_pkl = resolved
|
58 |
-
self.user_pkl = resolved
|
59 |
-
viz.result.message = f'Loading {name}...'
|
60 |
-
viz.defer_rendering()
|
61 |
-
if resolved in self.recent_pkls:
|
62 |
-
self.recent_pkls.remove(resolved)
|
63 |
-
self.recent_pkls.insert(0, resolved)
|
64 |
-
except:
|
65 |
-
self.cur_pkl = None
|
66 |
-
self.user_pkl = pkl
|
67 |
-
if pkl == '':
|
68 |
-
viz.result = dnnlib.EasyDict(
|
69 |
-
message='No network pickle loaded')
|
70 |
-
else:
|
71 |
-
viz.result = dnnlib.EasyDict(
|
72 |
-
error=renderer.CapturedException())
|
73 |
-
if not ignore_errors:
|
74 |
-
raise
|
75 |
-
|
76 |
-
@imgui_utils.scoped_by_object_id
|
77 |
-
def __call__(self, show=True):
|
78 |
-
viz = self.viz
|
79 |
-
recent_pkls = [pkl for pkl in self.recent_pkls if pkl != self.user_pkl]
|
80 |
-
if show:
|
81 |
-
imgui.text('Pickle')
|
82 |
-
imgui.same_line(viz.label_w)
|
83 |
-
idx = self.user_pkl.rfind('/')
|
84 |
-
changed, self.user_pkl = imgui_utils.input_text('##pkl', self.user_pkl[idx+1:], 1024,
|
85 |
-
flags=(
|
86 |
-
imgui.INPUT_TEXT_AUTO_SELECT_ALL | imgui.INPUT_TEXT_ENTER_RETURNS_TRUE),
|
87 |
-
width=(-1),
|
88 |
-
help_text='<PATH> | <URL> | <RUN_DIR> | <RUN_ID> | <RUN_ID>/<KIMG>.pkl')
|
89 |
-
if changed:
|
90 |
-
self.load(self.user_pkl, ignore_errors=True)
|
91 |
-
if imgui.is_item_hovered() and not imgui.is_item_active() and self.user_pkl != '':
|
92 |
-
imgui.set_tooltip(self.user_pkl)
|
93 |
-
# imgui.same_line()
|
94 |
-
imgui.text(' ')
|
95 |
-
imgui.same_line(viz.label_w)
|
96 |
-
if imgui_utils.button('Recent...', width=viz.button_w, enabled=(len(recent_pkls) != 0)):
|
97 |
-
imgui.open_popup('recent_pkls_popup')
|
98 |
-
imgui.same_line()
|
99 |
-
if imgui_utils.button('Browse...', enabled=len(self.search_dirs) > 0, width=viz.button_w):
|
100 |
-
imgui.open_popup('browse_pkls_popup')
|
101 |
-
self.browse_cache.clear()
|
102 |
-
self.browse_refocus = True
|
103 |
-
|
104 |
-
if imgui.begin_popup('recent_pkls_popup'):
|
105 |
-
for pkl in recent_pkls:
|
106 |
-
clicked, _state = imgui.menu_item(pkl)
|
107 |
-
if clicked:
|
108 |
-
self.load(pkl, ignore_errors=True)
|
109 |
-
imgui.end_popup()
|
110 |
-
|
111 |
-
if imgui.begin_popup('browse_pkls_popup'):
|
112 |
-
def recurse(parents):
|
113 |
-
key = tuple(parents)
|
114 |
-
items = self.browse_cache.get(key, None)
|
115 |
-
if items is None:
|
116 |
-
items = self.list_runs_and_pkls(parents)
|
117 |
-
self.browse_cache[key] = items
|
118 |
-
for item in items:
|
119 |
-
if item.type == 'run' and imgui.begin_menu(item.name):
|
120 |
-
recurse([item.path])
|
121 |
-
imgui.end_menu()
|
122 |
-
if item.type == 'pkl':
|
123 |
-
clicked, _state = imgui.menu_item(item.name)
|
124 |
-
if clicked:
|
125 |
-
self.load(item.path, ignore_errors=True)
|
126 |
-
if len(items) == 0:
|
127 |
-
with imgui_utils.grayed_out():
|
128 |
-
imgui.menu_item('No results found')
|
129 |
-
recurse(self.search_dirs)
|
130 |
-
if self.browse_refocus:
|
131 |
-
imgui.set_scroll_here()
|
132 |
-
viz.skip_frame() # Focus will change on next frame.
|
133 |
-
self.browse_refocus = False
|
134 |
-
imgui.end_popup()
|
135 |
-
|
136 |
-
paths = viz.pop_drag_and_drop_paths()
|
137 |
-
if paths is not None and len(paths) >= 1:
|
138 |
-
self.load(paths[0], ignore_errors=True)
|
139 |
-
|
140 |
-
viz.args.pkl = self.cur_pkl
|
141 |
-
|
142 |
-
def list_runs_and_pkls(self, parents):
|
143 |
-
items = []
|
144 |
-
run_regex = re.compile(r'\d+-.*')
|
145 |
-
pkl_regex = re.compile(r'network-snapshot-\d+\.pkl')
|
146 |
-
for parent in set(parents):
|
147 |
-
if os.path.isdir(parent):
|
148 |
-
for entry in os.scandir(parent):
|
149 |
-
if entry.is_dir() and run_regex.fullmatch(entry.name):
|
150 |
-
items.append(dnnlib.EasyDict(
|
151 |
-
type='run', name=entry.name, path=os.path.join(parent, entry.name)))
|
152 |
-
if entry.is_file() and pkl_regex.fullmatch(entry.name):
|
153 |
-
items.append(dnnlib.EasyDict(
|
154 |
-
type='pkl', name=entry.name, path=os.path.join(parent, entry.name)))
|
155 |
-
|
156 |
-
items = sorted(items, key=lambda item: (
|
157 |
-
item.name.replace('_', ' '), item.path))
|
158 |
-
return items
|
159 |
-
|
160 |
-
def resolve_pkl(self, pattern):
|
161 |
-
assert isinstance(pattern, str)
|
162 |
-
assert pattern != ''
|
163 |
-
|
164 |
-
# URL => return as is.
|
165 |
-
if dnnlib.util.is_url(pattern):
|
166 |
-
return pattern
|
167 |
-
|
168 |
-
# Short-hand pattern => locate.
|
169 |
-
path = _locate_results(pattern)
|
170 |
-
|
171 |
-
# Run dir => pick the last saved snapshot.
|
172 |
-
if os.path.isdir(path):
|
173 |
-
pkl_files = sorted(
|
174 |
-
glob.glob(os.path.join(path, 'network-snapshot-*.pkl')))
|
175 |
-
if len(pkl_files) == 0:
|
176 |
-
raise IOError(f'No network pickle found in "{path}"')
|
177 |
-
path = pkl_files[-1]
|
178 |
-
|
179 |
-
# Normalize.
|
180 |
-
path = os.path.abspath(path)
|
181 |
-
return path
|
182 |
-
|
183 |
-
# ----------------------------------------------------------------------------
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
spaces/Androidonnxfork/CivitAi-to-Diffusers/diffusers/src/diffusers/models/lora.py
DELETED
@@ -1,123 +0,0 @@
|
|
1 |
-
# Copyright 2023 The HuggingFace Team. All rights reserved.
|
2 |
-
#
|
3 |
-
# Licensed under the Apache License, Version 2.0 (the "License");
|
4 |
-
# you may not use this file except in compliance with the License.
|
5 |
-
# You may obtain a copy of the License at
|
6 |
-
#
|
7 |
-
# http://www.apache.org/licenses/LICENSE-2.0
|
8 |
-
#
|
9 |
-
# Unless required by applicable law or agreed to in writing, software
|
10 |
-
# distributed under the License is distributed on an "AS IS" BASIS,
|
11 |
-
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
12 |
-
# See the License for the specific language governing permissions and
|
13 |
-
# limitations under the License.
|
14 |
-
|
15 |
-
from typing import Optional
|
16 |
-
|
17 |
-
import torch.nn.functional as F
|
18 |
-
from torch import nn
|
19 |
-
|
20 |
-
|
21 |
-
class LoRALinearLayer(nn.Module):
|
22 |
-
def __init__(self, in_features, out_features, rank=4, network_alpha=None, device=None, dtype=None):
|
23 |
-
super().__init__()
|
24 |
-
|
25 |
-
if rank > min(in_features, out_features):
|
26 |
-
raise ValueError(f"LoRA rank {rank} must be less or equal than {min(in_features, out_features)}")
|
27 |
-
|
28 |
-
self.down = nn.Linear(in_features, rank, bias=False, device=device, dtype=dtype)
|
29 |
-
self.up = nn.Linear(rank, out_features, bias=False, device=device, dtype=dtype)
|
30 |
-
# This value has the same meaning as the `--network_alpha` option in the kohya-ss trainer script.
|
31 |
-
# See https://github.com/darkstorm2150/sd-scripts/blob/main/docs/train_network_README-en.md#execute-learning
|
32 |
-
self.network_alpha = network_alpha
|
33 |
-
self.rank = rank
|
34 |
-
|
35 |
-
nn.init.normal_(self.down.weight, std=1 / rank)
|
36 |
-
nn.init.zeros_(self.up.weight)
|
37 |
-
|
38 |
-
def forward(self, hidden_states):
|
39 |
-
orig_dtype = hidden_states.dtype
|
40 |
-
dtype = self.down.weight.dtype
|
41 |
-
|
42 |
-
down_hidden_states = self.down(hidden_states.to(dtype))
|
43 |
-
up_hidden_states = self.up(down_hidden_states)
|
44 |
-
|
45 |
-
if self.network_alpha is not None:
|
46 |
-
up_hidden_states *= self.network_alpha / self.rank
|
47 |
-
|
48 |
-
return up_hidden_states.to(orig_dtype)
|
49 |
-
|
50 |
-
|
51 |
-
class LoRAConv2dLayer(nn.Module):
|
52 |
-
def __init__(
|
53 |
-
self, in_features, out_features, rank=4, kernel_size=(1, 1), stride=(1, 1), padding=0, network_alpha=None
|
54 |
-
):
|
55 |
-
super().__init__()
|
56 |
-
|
57 |
-
if rank > min(in_features, out_features):
|
58 |
-
raise ValueError(f"LoRA rank {rank} must be less or equal than {min(in_features, out_features)}")
|
59 |
-
|
60 |
-
self.down = nn.Conv2d(in_features, rank, kernel_size=kernel_size, stride=stride, padding=padding, bias=False)
|
61 |
-
# according to the official kohya_ss trainer kernel_size are always fixed for the up layer
|
62 |
-
# # see: https://github.com/bmaltais/kohya_ss/blob/2accb1305979ba62f5077a23aabac23b4c37e935/networks/lora_diffusers.py#L129
|
63 |
-
self.up = nn.Conv2d(rank, out_features, kernel_size=(1, 1), stride=(1, 1), bias=False)
|
64 |
-
|
65 |
-
# This value has the same meaning as the `--network_alpha` option in the kohya-ss trainer script.
|
66 |
-
# See https://github.com/darkstorm2150/sd-scripts/blob/main/docs/train_network_README-en.md#execute-learning
|
67 |
-
self.network_alpha = network_alpha
|
68 |
-
self.rank = rank
|
69 |
-
|
70 |
-
nn.init.normal_(self.down.weight, std=1 / rank)
|
71 |
-
nn.init.zeros_(self.up.weight)
|
72 |
-
|
73 |
-
def forward(self, hidden_states):
|
74 |
-
orig_dtype = hidden_states.dtype
|
75 |
-
dtype = self.down.weight.dtype
|
76 |
-
|
77 |
-
down_hidden_states = self.down(hidden_states.to(dtype))
|
78 |
-
up_hidden_states = self.up(down_hidden_states)
|
79 |
-
|
80 |
-
if self.network_alpha is not None:
|
81 |
-
up_hidden_states *= self.network_alpha / self.rank
|
82 |
-
|
83 |
-
return up_hidden_states.to(orig_dtype)
|
84 |
-
|
85 |
-
|
86 |
-
class LoRACompatibleConv(nn.Conv2d):
|
87 |
-
"""
|
88 |
-
A convolutional layer that can be used with LoRA.
|
89 |
-
"""
|
90 |
-
|
91 |
-
def __init__(self, *args, lora_layer: Optional[LoRAConv2dLayer] = None, **kwargs):
|
92 |
-
super().__init__(*args, **kwargs)
|
93 |
-
self.lora_layer = lora_layer
|
94 |
-
|
95 |
-
def set_lora_layer(self, lora_layer: Optional[LoRAConv2dLayer]):
|
96 |
-
self.lora_layer = lora_layer
|
97 |
-
|
98 |
-
def forward(self, x):
|
99 |
-
if self.lora_layer is None:
|
100 |
-
# make sure to the functional Conv2D function as otherwise torch.compile's graph will break
|
101 |
-
# see: https://github.com/huggingface/diffusers/pull/4315
|
102 |
-
return F.conv2d(x, self.weight, self.bias, self.stride, self.padding, self.dilation, self.groups)
|
103 |
-
else:
|
104 |
-
return super().forward(x) + self.lora_layer(x)
|
105 |
-
|
106 |
-
|
107 |
-
class LoRACompatibleLinear(nn.Linear):
|
108 |
-
"""
|
109 |
-
A Linear layer that can be used with LoRA.
|
110 |
-
"""
|
111 |
-
|
112 |
-
def __init__(self, *args, lora_layer: Optional[LoRALinearLayer] = None, **kwargs):
|
113 |
-
super().__init__(*args, **kwargs)
|
114 |
-
self.lora_layer = lora_layer
|
115 |
-
|
116 |
-
def set_lora_layer(self, lora_layer: Optional[LoRAConv2dLayer]):
|
117 |
-
self.lora_layer = lora_layer
|
118 |
-
|
119 |
-
def forward(self, x):
|
120 |
-
if self.lora_layer is None:
|
121 |
-
return super().forward(x)
|
122 |
-
else:
|
123 |
-
return super().forward(x) + self.lora_layer(x)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
spaces/Andy1621/UniFormerV2_mit_demo/transforms.py
DELETED
@@ -1,443 +0,0 @@
|
|
1 |
-
import torchvision
|
2 |
-
import random
|
3 |
-
from PIL import Image, ImageOps
|
4 |
-
import numpy as np
|
5 |
-
import numbers
|
6 |
-
import math
|
7 |
-
import torch
|
8 |
-
|
9 |
-
|
10 |
-
class GroupRandomCrop(object):
|
11 |
-
def __init__(self, size):
|
12 |
-
if isinstance(size, numbers.Number):
|
13 |
-
self.size = (int(size), int(size))
|
14 |
-
else:
|
15 |
-
self.size = size
|
16 |
-
|
17 |
-
def __call__(self, img_group):
|
18 |
-
|
19 |
-
w, h = img_group[0].size
|
20 |
-
th, tw = self.size
|
21 |
-
|
22 |
-
out_images = list()
|
23 |
-
|
24 |
-
x1 = random.randint(0, w - tw)
|
25 |
-
y1 = random.randint(0, h - th)
|
26 |
-
|
27 |
-
for img in img_group:
|
28 |
-
assert(img.size[0] == w and img.size[1] == h)
|
29 |
-
if w == tw and h == th:
|
30 |
-
out_images.append(img)
|
31 |
-
else:
|
32 |
-
out_images.append(img.crop((x1, y1, x1 + tw, y1 + th)))
|
33 |
-
|
34 |
-
return out_images
|
35 |
-
|
36 |
-
|
37 |
-
class MultiGroupRandomCrop(object):
|
38 |
-
def __init__(self, size, groups=1):
|
39 |
-
if isinstance(size, numbers.Number):
|
40 |
-
self.size = (int(size), int(size))
|
41 |
-
else:
|
42 |
-
self.size = size
|
43 |
-
self.groups = groups
|
44 |
-
|
45 |
-
def __call__(self, img_group):
|
46 |
-
|
47 |
-
w, h = img_group[0].size
|
48 |
-
th, tw = self.size
|
49 |
-
|
50 |
-
out_images = list()
|
51 |
-
|
52 |
-
for i in range(self.groups):
|
53 |
-
x1 = random.randint(0, w - tw)
|
54 |
-
y1 = random.randint(0, h - th)
|
55 |
-
|
56 |
-
for img in img_group:
|
57 |
-
assert(img.size[0] == w and img.size[1] == h)
|
58 |
-
if w == tw and h == th:
|
59 |
-
out_images.append(img)
|
60 |
-
else:
|
61 |
-
out_images.append(img.crop((x1, y1, x1 + tw, y1 + th)))
|
62 |
-
|
63 |
-
return out_images
|
64 |
-
|
65 |
-
|
66 |
-
class GroupCenterCrop(object):
|
67 |
-
def __init__(self, size):
|
68 |
-
self.worker = torchvision.transforms.CenterCrop(size)
|
69 |
-
|
70 |
-
def __call__(self, img_group):
|
71 |
-
return [self.worker(img) for img in img_group]
|
72 |
-
|
73 |
-
|
74 |
-
class GroupRandomHorizontalFlip(object):
|
75 |
-
"""Randomly horizontally flips the given PIL.Image with a probability of 0.5
|
76 |
-
"""
|
77 |
-
|
78 |
-
def __init__(self, is_flow=False):
|
79 |
-
self.is_flow = is_flow
|
80 |
-
|
81 |
-
def __call__(self, img_group, is_flow=False):
|
82 |
-
v = random.random()
|
83 |
-
if v < 0.5:
|
84 |
-
ret = [img.transpose(Image.FLIP_LEFT_RIGHT) for img in img_group]
|
85 |
-
if self.is_flow:
|
86 |
-
for i in range(0, len(ret), 2):
|
87 |
-
# invert flow pixel values when flipping
|
88 |
-
ret[i] = ImageOps.invert(ret[i])
|
89 |
-
return ret
|
90 |
-
else:
|
91 |
-
return img_group
|
92 |
-
|
93 |
-
|
94 |
-
class GroupNormalize(object):
|
95 |
-
def __init__(self, mean, std):
|
96 |
-
self.mean = mean
|
97 |
-
self.std = std
|
98 |
-
|
99 |
-
def __call__(self, tensor):
|
100 |
-
rep_mean = self.mean * (tensor.size()[0] // len(self.mean))
|
101 |
-
rep_std = self.std * (tensor.size()[0] // len(self.std))
|
102 |
-
|
103 |
-
# TODO: make efficient
|
104 |
-
for t, m, s in zip(tensor, rep_mean, rep_std):
|
105 |
-
t.sub_(m).div_(s)
|
106 |
-
|
107 |
-
return tensor
|
108 |
-
|
109 |
-
|
110 |
-
class GroupScale(object):
|
111 |
-
""" Rescales the input PIL.Image to the given 'size'.
|
112 |
-
'size' will be the size of the smaller edge.
|
113 |
-
For example, if height > width, then image will be
|
114 |
-
rescaled to (size * height / width, size)
|
115 |
-
size: size of the smaller edge
|
116 |
-
interpolation: Default: PIL.Image.BILINEAR
|
117 |
-
"""
|
118 |
-
|
119 |
-
def __init__(self, size, interpolation=Image.BILINEAR):
|
120 |
-
self.worker = torchvision.transforms.Resize(size, interpolation)
|
121 |
-
|
122 |
-
def __call__(self, img_group):
|
123 |
-
return [self.worker(img) for img in img_group]
|
124 |
-
|
125 |
-
|
126 |
-
class GroupOverSample(object):
|
127 |
-
def __init__(self, crop_size, scale_size=None, flip=True):
|
128 |
-
self.crop_size = crop_size if not isinstance(
|
129 |
-
crop_size, int) else (crop_size, crop_size)
|
130 |
-
|
131 |
-
if scale_size is not None:
|
132 |
-
self.scale_worker = GroupScale(scale_size)
|
133 |
-
else:
|
134 |
-
self.scale_worker = None
|
135 |
-
self.flip = flip
|
136 |
-
|
137 |
-
def __call__(self, img_group):
|
138 |
-
|
139 |
-
if self.scale_worker is not None:
|
140 |
-
img_group = self.scale_worker(img_group)
|
141 |
-
|
142 |
-
image_w, image_h = img_group[0].size
|
143 |
-
crop_w, crop_h = self.crop_size
|
144 |
-
|
145 |
-
offsets = GroupMultiScaleCrop.fill_fix_offset(
|
146 |
-
False, image_w, image_h, crop_w, crop_h)
|
147 |
-
oversample_group = list()
|
148 |
-
for o_w, o_h in offsets:
|
149 |
-
normal_group = list()
|
150 |
-
flip_group = list()
|
151 |
-
for i, img in enumerate(img_group):
|
152 |
-
crop = img.crop((o_w, o_h, o_w + crop_w, o_h + crop_h))
|
153 |
-
normal_group.append(crop)
|
154 |
-
flip_crop = crop.copy().transpose(Image.FLIP_LEFT_RIGHT)
|
155 |
-
|
156 |
-
if img.mode == 'L' and i % 2 == 0:
|
157 |
-
flip_group.append(ImageOps.invert(flip_crop))
|
158 |
-
else:
|
159 |
-
flip_group.append(flip_crop)
|
160 |
-
|
161 |
-
oversample_group.extend(normal_group)
|
162 |
-
if self.flip:
|
163 |
-
oversample_group.extend(flip_group)
|
164 |
-
return oversample_group
|
165 |
-
|
166 |
-
|
167 |
-
class GroupFullResSample(object):
|
168 |
-
def __init__(self, crop_size, scale_size=None, flip=True):
|
169 |
-
self.crop_size = crop_size if not isinstance(
|
170 |
-
crop_size, int) else (crop_size, crop_size)
|
171 |
-
|
172 |
-
if scale_size is not None:
|
173 |
-
self.scale_worker = GroupScale(scale_size)
|
174 |
-
else:
|
175 |
-
self.scale_worker = None
|
176 |
-
self.flip = flip
|
177 |
-
|
178 |
-
def __call__(self, img_group):
|
179 |
-
|
180 |
-
if self.scale_worker is not None:
|
181 |
-
img_group = self.scale_worker(img_group)
|
182 |
-
|
183 |
-
image_w, image_h = img_group[0].size
|
184 |
-
crop_w, crop_h = self.crop_size
|
185 |
-
|
186 |
-
w_step = (image_w - crop_w) // 4
|
187 |
-
h_step = (image_h - crop_h) // 4
|
188 |
-
|
189 |
-
offsets = list()
|
190 |
-
offsets.append((0 * w_step, 2 * h_step)) # left
|
191 |
-
offsets.append((4 * w_step, 2 * h_step)) # right
|
192 |
-
offsets.append((2 * w_step, 2 * h_step)) # center
|
193 |
-
|
194 |
-
oversample_group = list()
|
195 |
-
for o_w, o_h in offsets:
|
196 |
-
normal_group = list()
|
197 |
-
flip_group = list()
|
198 |
-
for i, img in enumerate(img_group):
|
199 |
-
crop = img.crop((o_w, o_h, o_w + crop_w, o_h + crop_h))
|
200 |
-
normal_group.append(crop)
|
201 |
-
if self.flip:
|
202 |
-
flip_crop = crop.copy().transpose(Image.FLIP_LEFT_RIGHT)
|
203 |
-
|
204 |
-
if img.mode == 'L' and i % 2 == 0:
|
205 |
-
flip_group.append(ImageOps.invert(flip_crop))
|
206 |
-
else:
|
207 |
-
flip_group.append(flip_crop)
|
208 |
-
|
209 |
-
oversample_group.extend(normal_group)
|
210 |
-
oversample_group.extend(flip_group)
|
211 |
-
return oversample_group
|
212 |
-
|
213 |
-
|
214 |
-
class GroupMultiScaleCrop(object):
|
215 |
-
|
216 |
-
def __init__(self, input_size, scales=None, max_distort=1,
|
217 |
-
fix_crop=True, more_fix_crop=True):
|
218 |
-
self.scales = scales if scales is not None else [1, .875, .75, .66]
|
219 |
-
self.max_distort = max_distort
|
220 |
-
self.fix_crop = fix_crop
|
221 |
-
self.more_fix_crop = more_fix_crop
|
222 |
-
self.input_size = input_size if not isinstance(input_size, int) else [
|
223 |
-
input_size, input_size]
|
224 |
-
self.interpolation = Image.BILINEAR
|
225 |
-
|
226 |
-
def __call__(self, img_group):
|
227 |
-
|
228 |
-
im_size = img_group[0].size
|
229 |
-
|
230 |
-
crop_w, crop_h, offset_w, offset_h = self._sample_crop_size(im_size)
|
231 |
-
crop_img_group = [
|
232 |
-
img.crop(
|
233 |
-
(offset_w,
|
234 |
-
offset_h,
|
235 |
-
offset_w +
|
236 |
-
crop_w,
|
237 |
-
offset_h +
|
238 |
-
crop_h)) for img in img_group]
|
239 |
-
ret_img_group = [img.resize((self.input_size[0], self.input_size[1]), self.interpolation)
|
240 |
-
for img in crop_img_group]
|
241 |
-
return ret_img_group
|
242 |
-
|
243 |
-
def _sample_crop_size(self, im_size):
|
244 |
-
image_w, image_h = im_size[0], im_size[1]
|
245 |
-
|
246 |
-
# find a crop size
|
247 |
-
base_size = min(image_w, image_h)
|
248 |
-
crop_sizes = [int(base_size * x) for x in self.scales]
|
249 |
-
crop_h = [
|
250 |
-
self.input_size[1] if abs(
|
251 |
-
x - self.input_size[1]) < 3 else x for x in crop_sizes]
|
252 |
-
crop_w = [
|
253 |
-
self.input_size[0] if abs(
|
254 |
-
x - self.input_size[0]) < 3 else x for x in crop_sizes]
|
255 |
-
|
256 |
-
pairs = []
|
257 |
-
for i, h in enumerate(crop_h):
|
258 |
-
for j, w in enumerate(crop_w):
|
259 |
-
if abs(i - j) <= self.max_distort:
|
260 |
-
pairs.append((w, h))
|
261 |
-
|
262 |
-
crop_pair = random.choice(pairs)
|
263 |
-
if not self.fix_crop:
|
264 |
-
w_offset = random.randint(0, image_w - crop_pair[0])
|
265 |
-
h_offset = random.randint(0, image_h - crop_pair[1])
|
266 |
-
else:
|
267 |
-
w_offset, h_offset = self._sample_fix_offset(
|
268 |
-
image_w, image_h, crop_pair[0], crop_pair[1])
|
269 |
-
|
270 |
-
return crop_pair[0], crop_pair[1], w_offset, h_offset
|
271 |
-
|
272 |
-
def _sample_fix_offset(self, image_w, image_h, crop_w, crop_h):
|
273 |
-
offsets = self.fill_fix_offset(
|
274 |
-
self.more_fix_crop, image_w, image_h, crop_w, crop_h)
|
275 |
-
return random.choice(offsets)
|
276 |
-
|
277 |
-
@staticmethod
|
278 |
-
def fill_fix_offset(more_fix_crop, image_w, image_h, crop_w, crop_h):
|
279 |
-
w_step = (image_w - crop_w) // 4
|
280 |
-
h_step = (image_h - crop_h) // 4
|
281 |
-
|
282 |
-
ret = list()
|
283 |
-
ret.append((0, 0)) # upper left
|
284 |
-
ret.append((4 * w_step, 0)) # upper right
|
285 |
-
ret.append((0, 4 * h_step)) # lower left
|
286 |
-
ret.append((4 * w_step, 4 * h_step)) # lower right
|
287 |
-
ret.append((2 * w_step, 2 * h_step)) # center
|
288 |
-
|
289 |
-
if more_fix_crop:
|
290 |
-
ret.append((0, 2 * h_step)) # center left
|
291 |
-
ret.append((4 * w_step, 2 * h_step)) # center right
|
292 |
-
ret.append((2 * w_step, 4 * h_step)) # lower center
|
293 |
-
ret.append((2 * w_step, 0 * h_step)) # upper center
|
294 |
-
|
295 |
-
ret.append((1 * w_step, 1 * h_step)) # upper left quarter
|
296 |
-
ret.append((3 * w_step, 1 * h_step)) # upper right quarter
|
297 |
-
ret.append((1 * w_step, 3 * h_step)) # lower left quarter
|
298 |
-
ret.append((3 * w_step, 3 * h_step)) # lower righ quarter
|
299 |
-
|
300 |
-
return ret
|
301 |
-
|
302 |
-
|
303 |
-
class GroupRandomSizedCrop(object):
|
304 |
-
"""Random crop the given PIL.Image to a random size of (0.08 to 1.0) of the original size
|
305 |
-
and and a random aspect ratio of 3/4 to 4/3 of the original aspect ratio
|
306 |
-
This is popularly used to train the Inception networks
|
307 |
-
size: size of the smaller edge
|
308 |
-
interpolation: Default: PIL.Image.BILINEAR
|
309 |
-
"""
|
310 |
-
|
311 |
-
def __init__(self, size, interpolation=Image.BILINEAR):
|
312 |
-
self.size = size
|
313 |
-
self.interpolation = interpolation
|
314 |
-
|
315 |
-
def __call__(self, img_group):
|
316 |
-
for attempt in range(10):
|
317 |
-
area = img_group[0].size[0] * img_group[0].size[1]
|
318 |
-
target_area = random.uniform(0.08, 1.0) * area
|
319 |
-
aspect_ratio = random.uniform(3. / 4, 4. / 3)
|
320 |
-
|
321 |
-
w = int(round(math.sqrt(target_area * aspect_ratio)))
|
322 |
-
h = int(round(math.sqrt(target_area / aspect_ratio)))
|
323 |
-
|
324 |
-
if random.random() < 0.5:
|
325 |
-
w, h = h, w
|
326 |
-
|
327 |
-
if w <= img_group[0].size[0] and h <= img_group[0].size[1]:
|
328 |
-
x1 = random.randint(0, img_group[0].size[0] - w)
|
329 |
-
y1 = random.randint(0, img_group[0].size[1] - h)
|
330 |
-
found = True
|
331 |
-
break
|
332 |
-
else:
|
333 |
-
found = False
|
334 |
-
x1 = 0
|
335 |
-
y1 = 0
|
336 |
-
|
337 |
-
if found:
|
338 |
-
out_group = list()
|
339 |
-
for img in img_group:
|
340 |
-
img = img.crop((x1, y1, x1 + w, y1 + h))
|
341 |
-
assert(img.size == (w, h))
|
342 |
-
out_group.append(
|
343 |
-
img.resize(
|
344 |
-
(self.size, self.size), self.interpolation))
|
345 |
-
return out_group
|
346 |
-
else:
|
347 |
-
# Fallback
|
348 |
-
scale = GroupScale(self.size, interpolation=self.interpolation)
|
349 |
-
crop = GroupRandomCrop(self.size)
|
350 |
-
return crop(scale(img_group))
|
351 |
-
|
352 |
-
|
353 |
-
class ConvertDataFormat(object):
|
354 |
-
def __init__(self, model_type):
|
355 |
-
self.model_type = model_type
|
356 |
-
|
357 |
-
def __call__(self, images):
|
358 |
-
if self.model_type == '2D':
|
359 |
-
return images
|
360 |
-
tc, h, w = images.size()
|
361 |
-
t = tc // 3
|
362 |
-
images = images.view(t, 3, h, w)
|
363 |
-
images = images.permute(1, 0, 2, 3)
|
364 |
-
return images
|
365 |
-
|
366 |
-
|
367 |
-
class Stack(object):
|
368 |
-
|
369 |
-
def __init__(self, roll=False):
|
370 |
-
self.roll = roll
|
371 |
-
|
372 |
-
def __call__(self, img_group):
|
373 |
-
if img_group[0].mode == 'L':
|
374 |
-
return np.concatenate([np.expand_dims(x, 2)
|
375 |
-
for x in img_group], axis=2)
|
376 |
-
elif img_group[0].mode == 'RGB':
|
377 |
-
if self.roll:
|
378 |
-
return np.concatenate([np.array(x)[:, :, ::-1]
|
379 |
-
for x in img_group], axis=2)
|
380 |
-
else:
|
381 |
-
#print(np.concatenate(img_group, axis=2).shape)
|
382 |
-
# print(img_group[0].shape)
|
383 |
-
return np.concatenate(img_group, axis=2)
|
384 |
-
|
385 |
-
|
386 |
-
class ToTorchFormatTensor(object):
|
387 |
-
""" Converts a PIL.Image (RGB) or numpy.ndarray (H x W x C) in the range [0, 255]
|
388 |
-
to a torch.FloatTensor of shape (C x H x W) in the range [0.0, 1.0] """
|
389 |
-
|
390 |
-
def __init__(self, div=True):
|
391 |
-
self.div = div
|
392 |
-
|
393 |
-
def __call__(self, pic):
|
394 |
-
if isinstance(pic, np.ndarray):
|
395 |
-
# handle numpy array
|
396 |
-
img = torch.from_numpy(pic).permute(2, 0, 1).contiguous()
|
397 |
-
else:
|
398 |
-
# handle PIL Image
|
399 |
-
img = torch.ByteTensor(
|
400 |
-
torch.ByteStorage.from_buffer(
|
401 |
-
pic.tobytes()))
|
402 |
-
img = img.view(pic.size[1], pic.size[0], len(pic.mode))
|
403 |
-
# put it from HWC to CHW format
|
404 |
-
# yikes, this transpose takes 80% of the loading time/CPU
|
405 |
-
img = img.transpose(0, 1).transpose(0, 2).contiguous()
|
406 |
-
return img.float().div(255) if self.div else img.float()
|
407 |
-
|
408 |
-
|
409 |
-
class IdentityTransform(object):
|
410 |
-
|
411 |
-
def __call__(self, data):
|
412 |
-
return data
|
413 |
-
|
414 |
-
|
415 |
-
if __name__ == "__main__":
|
416 |
-
trans = torchvision.transforms.Compose([
|
417 |
-
GroupScale(256),
|
418 |
-
GroupRandomCrop(224),
|
419 |
-
Stack(),
|
420 |
-
ToTorchFormatTensor(),
|
421 |
-
GroupNormalize(
|
422 |
-
mean=[.485, .456, .406],
|
423 |
-
std=[.229, .224, .225]
|
424 |
-
)]
|
425 |
-
)
|
426 |
-
|
427 |
-
im = Image.open('../tensorflow-model-zoo.torch/lena_299.png')
|
428 |
-
|
429 |
-
color_group = [im] * 3
|
430 |
-
rst = trans(color_group)
|
431 |
-
|
432 |
-
gray_group = [im.convert('L')] * 9
|
433 |
-
gray_rst = trans(gray_group)
|
434 |
-
|
435 |
-
trans2 = torchvision.transforms.Compose([
|
436 |
-
GroupRandomSizedCrop(256),
|
437 |
-
Stack(),
|
438 |
-
ToTorchFormatTensor(),
|
439 |
-
GroupNormalize(
|
440 |
-
mean=[.485, .456, .406],
|
441 |
-
std=[.229, .224, .225])
|
442 |
-
])
|
443 |
-
print(trans2(color_group))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
spaces/Andy1621/uniformer_image_segmentation/configs/ocrnet/ocrnet_hr18_512x512_80k_ade20k.py
DELETED
@@ -1,35 +0,0 @@
|
|
1 |
-
_base_ = [
|
2 |
-
'../_base_/models/ocrnet_hr18.py', '../_base_/datasets/ade20k.py',
|
3 |
-
'../_base_/default_runtime.py', '../_base_/schedules/schedule_80k.py'
|
4 |
-
]
|
5 |
-
norm_cfg = dict(type='SyncBN', requires_grad=True)
|
6 |
-
model = dict(decode_head=[
|
7 |
-
dict(
|
8 |
-
type='FCNHead',
|
9 |
-
in_channels=[18, 36, 72, 144],
|
10 |
-
channels=sum([18, 36, 72, 144]),
|
11 |
-
in_index=(0, 1, 2, 3),
|
12 |
-
input_transform='resize_concat',
|
13 |
-
kernel_size=1,
|
14 |
-
num_convs=1,
|
15 |
-
concat_input=False,
|
16 |
-
dropout_ratio=-1,
|
17 |
-
num_classes=150,
|
18 |
-
norm_cfg=norm_cfg,
|
19 |
-
align_corners=False,
|
20 |
-
loss_decode=dict(
|
21 |
-
type='CrossEntropyLoss', use_sigmoid=False, loss_weight=0.4)),
|
22 |
-
dict(
|
23 |
-
type='OCRHead',
|
24 |
-
in_channels=[18, 36, 72, 144],
|
25 |
-
in_index=(0, 1, 2, 3),
|
26 |
-
input_transform='resize_concat',
|
27 |
-
channels=512,
|
28 |
-
ocr_channels=256,
|
29 |
-
dropout_ratio=-1,
|
30 |
-
num_classes=150,
|
31 |
-
norm_cfg=norm_cfg,
|
32 |
-
align_corners=False,
|
33 |
-
loss_decode=dict(
|
34 |
-
type='CrossEntropyLoss', use_sigmoid=False, loss_weight=1.0)),
|
35 |
-
])
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
spaces/Anonymous-sub/Rerender/ControlNet/annotator/uniformer/mmcv/ops/__init__.py
DELETED
@@ -1,81 +0,0 @@
|
|
1 |
-
# Copyright (c) OpenMMLab. All rights reserved.
|
2 |
-
from .assign_score_withk import assign_score_withk
|
3 |
-
from .ball_query import ball_query
|
4 |
-
from .bbox import bbox_overlaps
|
5 |
-
from .border_align import BorderAlign, border_align
|
6 |
-
from .box_iou_rotated import box_iou_rotated
|
7 |
-
from .carafe import CARAFE, CARAFENaive, CARAFEPack, carafe, carafe_naive
|
8 |
-
from .cc_attention import CrissCrossAttention
|
9 |
-
from .contour_expand import contour_expand
|
10 |
-
from .corner_pool import CornerPool
|
11 |
-
from .correlation import Correlation
|
12 |
-
from .deform_conv import DeformConv2d, DeformConv2dPack, deform_conv2d
|
13 |
-
from .deform_roi_pool import (DeformRoIPool, DeformRoIPoolPack,
|
14 |
-
ModulatedDeformRoIPoolPack, deform_roi_pool)
|
15 |
-
from .deprecated_wrappers import Conv2d_deprecated as Conv2d
|
16 |
-
from .deprecated_wrappers import ConvTranspose2d_deprecated as ConvTranspose2d
|
17 |
-
from .deprecated_wrappers import Linear_deprecated as Linear
|
18 |
-
from .deprecated_wrappers import MaxPool2d_deprecated as MaxPool2d
|
19 |
-
from .focal_loss import (SigmoidFocalLoss, SoftmaxFocalLoss,
|
20 |
-
sigmoid_focal_loss, softmax_focal_loss)
|
21 |
-
from .furthest_point_sample import (furthest_point_sample,
|
22 |
-
furthest_point_sample_with_dist)
|
23 |
-
from .fused_bias_leakyrelu import FusedBiasLeakyReLU, fused_bias_leakyrelu
|
24 |
-
from .gather_points import gather_points
|
25 |
-
from .group_points import GroupAll, QueryAndGroup, grouping_operation
|
26 |
-
from .info import (get_compiler_version, get_compiling_cuda_version,
|
27 |
-
get_onnxruntime_op_path)
|
28 |
-
from .iou3d import boxes_iou_bev, nms_bev, nms_normal_bev
|
29 |
-
from .knn import knn
|
30 |
-
from .masked_conv import MaskedConv2d, masked_conv2d
|
31 |
-
from .modulated_deform_conv import (ModulatedDeformConv2d,
|
32 |
-
ModulatedDeformConv2dPack,
|
33 |
-
modulated_deform_conv2d)
|
34 |
-
from .multi_scale_deform_attn import MultiScaleDeformableAttention
|
35 |
-
from .nms import batched_nms, nms, nms_match, nms_rotated, soft_nms
|
36 |
-
from .pixel_group import pixel_group
|
37 |
-
from .point_sample import (SimpleRoIAlign, point_sample,
|
38 |
-
rel_roi_point_to_rel_img_point)
|
39 |
-
from .points_in_boxes import (points_in_boxes_all, points_in_boxes_cpu,
|
40 |
-
points_in_boxes_part)
|
41 |
-
from .points_sampler import PointsSampler
|
42 |
-
from .psa_mask import PSAMask
|
43 |
-
from .roi_align import RoIAlign, roi_align
|
44 |
-
from .roi_align_rotated import RoIAlignRotated, roi_align_rotated
|
45 |
-
from .roi_pool import RoIPool, roi_pool
|
46 |
-
from .roiaware_pool3d import RoIAwarePool3d
|
47 |
-
from .roipoint_pool3d import RoIPointPool3d
|
48 |
-
from .saconv import SAConv2d
|
49 |
-
from .scatter_points import DynamicScatter, dynamic_scatter
|
50 |
-
from .sync_bn import SyncBatchNorm
|
51 |
-
from .three_interpolate import three_interpolate
|
52 |
-
from .three_nn import three_nn
|
53 |
-
from .tin_shift import TINShift, tin_shift
|
54 |
-
from .upfirdn2d import upfirdn2d
|
55 |
-
from .voxelize import Voxelization, voxelization
|
56 |
-
|
57 |
-
__all__ = [
|
58 |
-
'bbox_overlaps', 'CARAFE', 'CARAFENaive', 'CARAFEPack', 'carafe',
|
59 |
-
'carafe_naive', 'CornerPool', 'DeformConv2d', 'DeformConv2dPack',
|
60 |
-
'deform_conv2d', 'DeformRoIPool', 'DeformRoIPoolPack',
|
61 |
-
'ModulatedDeformRoIPoolPack', 'deform_roi_pool', 'SigmoidFocalLoss',
|
62 |
-
'SoftmaxFocalLoss', 'sigmoid_focal_loss', 'softmax_focal_loss',
|
63 |
-
'get_compiler_version', 'get_compiling_cuda_version',
|
64 |
-
'get_onnxruntime_op_path', 'MaskedConv2d', 'masked_conv2d',
|
65 |
-
'ModulatedDeformConv2d', 'ModulatedDeformConv2dPack',
|
66 |
-
'modulated_deform_conv2d', 'batched_nms', 'nms', 'soft_nms', 'nms_match',
|
67 |
-
'RoIAlign', 'roi_align', 'RoIPool', 'roi_pool', 'SyncBatchNorm', 'Conv2d',
|
68 |
-
'ConvTranspose2d', 'Linear', 'MaxPool2d', 'CrissCrossAttention', 'PSAMask',
|
69 |
-
'point_sample', 'rel_roi_point_to_rel_img_point', 'SimpleRoIAlign',
|
70 |
-
'SAConv2d', 'TINShift', 'tin_shift', 'assign_score_withk',
|
71 |
-
'box_iou_rotated', 'RoIPointPool3d', 'nms_rotated', 'knn', 'ball_query',
|
72 |
-
'upfirdn2d', 'FusedBiasLeakyReLU', 'fused_bias_leakyrelu',
|
73 |
-
'RoIAlignRotated', 'roi_align_rotated', 'pixel_group', 'QueryAndGroup',
|
74 |
-
'GroupAll', 'grouping_operation', 'contour_expand', 'three_nn',
|
75 |
-
'three_interpolate', 'MultiScaleDeformableAttention', 'BorderAlign',
|
76 |
-
'border_align', 'gather_points', 'furthest_point_sample',
|
77 |
-
'furthest_point_sample_with_dist', 'PointsSampler', 'Correlation',
|
78 |
-
'boxes_iou_bev', 'nms_bev', 'nms_normal_bev', 'Voxelization',
|
79 |
-
'voxelization', 'dynamic_scatter', 'DynamicScatter', 'RoIAwarePool3d',
|
80 |
-
'points_in_boxes_part', 'points_in_boxes_cpu', 'points_in_boxes_all'
|
81 |
-
]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
spaces/Anonymous-sub/Rerender/ControlNet/annotator/uniformer/mmseg/datasets/pipelines/compose.py
DELETED
@@ -1,51 +0,0 @@
|
|
1 |
-
import collections
|
2 |
-
|
3 |
-
from annotator.uniformer.mmcv.utils import build_from_cfg
|
4 |
-
|
5 |
-
from ..builder import PIPELINES
|
6 |
-
|
7 |
-
|
8 |
-
@PIPELINES.register_module()
|
9 |
-
class Compose(object):
|
10 |
-
"""Compose multiple transforms sequentially.
|
11 |
-
|
12 |
-
Args:
|
13 |
-
transforms (Sequence[dict | callable]): Sequence of transform object or
|
14 |
-
config dict to be composed.
|
15 |
-
"""
|
16 |
-
|
17 |
-
def __init__(self, transforms):
|
18 |
-
assert isinstance(transforms, collections.abc.Sequence)
|
19 |
-
self.transforms = []
|
20 |
-
for transform in transforms:
|
21 |
-
if isinstance(transform, dict):
|
22 |
-
transform = build_from_cfg(transform, PIPELINES)
|
23 |
-
self.transforms.append(transform)
|
24 |
-
elif callable(transform):
|
25 |
-
self.transforms.append(transform)
|
26 |
-
else:
|
27 |
-
raise TypeError('transform must be callable or a dict')
|
28 |
-
|
29 |
-
def __call__(self, data):
|
30 |
-
"""Call function to apply transforms sequentially.
|
31 |
-
|
32 |
-
Args:
|
33 |
-
data (dict): A result dict contains the data to transform.
|
34 |
-
|
35 |
-
Returns:
|
36 |
-
dict: Transformed data.
|
37 |
-
"""
|
38 |
-
|
39 |
-
for t in self.transforms:
|
40 |
-
data = t(data)
|
41 |
-
if data is None:
|
42 |
-
return None
|
43 |
-
return data
|
44 |
-
|
45 |
-
def __repr__(self):
|
46 |
-
format_string = self.__class__.__name__ + '('
|
47 |
-
for t in self.transforms:
|
48 |
-
format_string += '\n'
|
49 |
-
format_string += f' {t}'
|
50 |
-
format_string += '\n)'
|
51 |
-
return format_string
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
spaces/AquaSuisei/ChatGPTXE/modules/chat_func.py
DELETED
@@ -1,497 +0,0 @@
|
|
1 |
-
# -*- coding:utf-8 -*-
|
2 |
-
from __future__ import annotations
|
3 |
-
from typing import TYPE_CHECKING, List
|
4 |
-
|
5 |
-
import logging
|
6 |
-
import json
|
7 |
-
import os
|
8 |
-
import requests
|
9 |
-
import urllib3
|
10 |
-
|
11 |
-
from tqdm import tqdm
|
12 |
-
import colorama
|
13 |
-
from duckduckgo_search import ddg
|
14 |
-
import asyncio
|
15 |
-
import aiohttp
|
16 |
-
|
17 |
-
|
18 |
-
from modules.presets import *
|
19 |
-
from modules.llama_func import *
|
20 |
-
from modules.utils import *
|
21 |
-
from . import shared
|
22 |
-
from modules.config import retrieve_proxy
|
23 |
-
|
24 |
-
# logging.basicConfig(level=logging.INFO, format="%(asctime)s [%(levelname)s] [%(filename)s:%(lineno)d] %(message)s")
|
25 |
-
|
26 |
-
if TYPE_CHECKING:
|
27 |
-
from typing import TypedDict
|
28 |
-
|
29 |
-
class DataframeData(TypedDict):
|
30 |
-
headers: List[str]
|
31 |
-
data: List[List[str | int | bool]]
|
32 |
-
|
33 |
-
|
34 |
-
initial_prompt = "You are a helpful assistant."
|
35 |
-
HISTORY_DIR = "history"
|
36 |
-
TEMPLATES_DIR = "templates"
|
37 |
-
|
38 |
-
@shared.state.switching_api_key # 在不开启多账号模式的时候,这个装饰器不会起作用
|
39 |
-
def get_response(
|
40 |
-
openai_api_key, system_prompt, history, temperature, top_p, stream, selected_model
|
41 |
-
):
|
42 |
-
headers = {
|
43 |
-
"Content-Type": "application/json",
|
44 |
-
"Authorization": f"Bearer {openai_api_key}",
|
45 |
-
}
|
46 |
-
|
47 |
-
history = [construct_system(system_prompt), *history]
|
48 |
-
|
49 |
-
payload = {
|
50 |
-
"model": selected_model,
|
51 |
-
"messages": history, # [{"role": "user", "content": f"{inputs}"}],
|
52 |
-
"temperature": temperature, # 1.0,
|
53 |
-
"top_p": top_p, # 1.0,
|
54 |
-
"n": 1,
|
55 |
-
"stream": stream,
|
56 |
-
"presence_penalty": 0,
|
57 |
-
"frequency_penalty": 0,
|
58 |
-
}
|
59 |
-
if stream:
|
60 |
-
timeout = timeout_streaming
|
61 |
-
else:
|
62 |
-
timeout = timeout_all
|
63 |
-
|
64 |
-
|
65 |
-
# 如果有自定义的api-host,使用自定义host发送请求,否则使用默认设置发送请求
|
66 |
-
if shared.state.completion_url != COMPLETION_URL:
|
67 |
-
logging.info(f"使用自定义API URL: {shared.state.completion_url}")
|
68 |
-
|
69 |
-
with retrieve_proxy():
|
70 |
-
response = requests.post(
|
71 |
-
shared.state.completion_url,
|
72 |
-
headers=headers,
|
73 |
-
json=payload,
|
74 |
-
stream=True,
|
75 |
-
timeout=timeout,
|
76 |
-
)
|
77 |
-
|
78 |
-
return response
|
79 |
-
|
80 |
-
|
81 |
-
def stream_predict(
|
82 |
-
openai_api_key,
|
83 |
-
system_prompt,
|
84 |
-
history,
|
85 |
-
inputs,
|
86 |
-
chatbot,
|
87 |
-
all_token_counts,
|
88 |
-
top_p,
|
89 |
-
temperature,
|
90 |
-
selected_model,
|
91 |
-
fake_input=None,
|
92 |
-
display_append=""
|
93 |
-
):
|
94 |
-
def get_return_value():
|
95 |
-
return chatbot, history, status_text, all_token_counts
|
96 |
-
|
97 |
-
logging.info("实时回答模式")
|
98 |
-
partial_words = ""
|
99 |
-
counter = 0
|
100 |
-
status_text = "开始实时传输回答……"
|
101 |
-
history.append(construct_user(inputs))
|
102 |
-
history.append(construct_assistant(""))
|
103 |
-
if fake_input:
|
104 |
-
chatbot.append((fake_input, ""))
|
105 |
-
else:
|
106 |
-
chatbot.append((inputs, ""))
|
107 |
-
user_token_count = 0
|
108 |
-
if fake_input is not None:
|
109 |
-
input_token_count = count_token(construct_user(fake_input))
|
110 |
-
else:
|
111 |
-
input_token_count = count_token(construct_user(inputs))
|
112 |
-
if len(all_token_counts) == 0:
|
113 |
-
system_prompt_token_count = count_token(construct_system(system_prompt))
|
114 |
-
user_token_count = (
|
115 |
-
input_token_count + system_prompt_token_count
|
116 |
-
)
|
117 |
-
else:
|
118 |
-
user_token_count = input_token_count
|
119 |
-
all_token_counts.append(user_token_count)
|
120 |
-
logging.info(f"输入token计数: {user_token_count}")
|
121 |
-
yield get_return_value()
|
122 |
-
try:
|
123 |
-
response = get_response(
|
124 |
-
openai_api_key,
|
125 |
-
system_prompt,
|
126 |
-
history,
|
127 |
-
temperature,
|
128 |
-
top_p,
|
129 |
-
True,
|
130 |
-
selected_model,
|
131 |
-
)
|
132 |
-
except requests.exceptions.ConnectTimeout:
|
133 |
-
status_text = (
|
134 |
-
standard_error_msg + connection_timeout_prompt + error_retrieve_prompt
|
135 |
-
)
|
136 |
-
yield get_return_value()
|
137 |
-
return
|
138 |
-
except requests.exceptions.ReadTimeout:
|
139 |
-
status_text = standard_error_msg + read_timeout_prompt + error_retrieve_prompt
|
140 |
-
yield get_return_value()
|
141 |
-
return
|
142 |
-
|
143 |
-
yield get_return_value()
|
144 |
-
error_json_str = ""
|
145 |
-
|
146 |
-
if fake_input is not None:
|
147 |
-
history[-2] = construct_user(fake_input)
|
148 |
-
for chunk in tqdm(response.iter_lines()):
|
149 |
-
if counter == 0:
|
150 |
-
counter += 1
|
151 |
-
continue
|
152 |
-
counter += 1
|
153 |
-
# check whether each line is non-empty
|
154 |
-
if chunk:
|
155 |
-
chunk = chunk.decode()
|
156 |
-
chunklength = len(chunk)
|
157 |
-
try:
|
158 |
-
chunk = json.loads(chunk[6:])
|
159 |
-
except json.JSONDecodeError:
|
160 |
-
logging.info(chunk)
|
161 |
-
error_json_str += chunk
|
162 |
-
status_text = f"JSON解析错误。请重置对话。收到的内容: {error_json_str}"
|
163 |
-
yield get_return_value()
|
164 |
-
continue
|
165 |
-
# decode each line as response data is in bytes
|
166 |
-
if chunklength > 6 and "delta" in chunk["choices"][0]:
|
167 |
-
finish_reason = chunk["choices"][0]["finish_reason"]
|
168 |
-
status_text = construct_token_message(all_token_counts)
|
169 |
-
if finish_reason == "stop":
|
170 |
-
yield get_return_value()
|
171 |
-
break
|
172 |
-
try:
|
173 |
-
partial_words = (
|
174 |
-
partial_words + chunk["choices"][0]["delta"]["content"]
|
175 |
-
)
|
176 |
-
except KeyError:
|
177 |
-
status_text = (
|
178 |
-
standard_error_msg
|
179 |
-
+ "API回复中找不到内容。很可能是Token计数达到上限了。请重置对话。当前Token计数: "
|
180 |
-
+ str(sum(all_token_counts))
|
181 |
-
)
|
182 |
-
yield get_return_value()
|
183 |
-
break
|
184 |
-
history[-1] = construct_assistant(partial_words)
|
185 |
-
chatbot[-1] = (chatbot[-1][0], partial_words+display_append)
|
186 |
-
all_token_counts[-1] += 1
|
187 |
-
yield get_return_value()
|
188 |
-
|
189 |
-
|
190 |
-
def predict_all(
|
191 |
-
openai_api_key,
|
192 |
-
system_prompt,
|
193 |
-
history,
|
194 |
-
inputs,
|
195 |
-
chatbot,
|
196 |
-
all_token_counts,
|
197 |
-
top_p,
|
198 |
-
temperature,
|
199 |
-
selected_model,
|
200 |
-
fake_input=None,
|
201 |
-
display_append=""
|
202 |
-
):
|
203 |
-
logging.info("一次性回答模式")
|
204 |
-
history.append(construct_user(inputs))
|
205 |
-
history.append(construct_assistant(""))
|
206 |
-
if fake_input:
|
207 |
-
chatbot.append((fake_input, ""))
|
208 |
-
else:
|
209 |
-
chatbot.append((inputs, ""))
|
210 |
-
if fake_input is not None:
|
211 |
-
all_token_counts.append(count_token(construct_user(fake_input)))
|
212 |
-
else:
|
213 |
-
all_token_counts.append(count_token(construct_user(inputs)))
|
214 |
-
try:
|
215 |
-
response = get_response(
|
216 |
-
openai_api_key,
|
217 |
-
system_prompt,
|
218 |
-
history,
|
219 |
-
temperature,
|
220 |
-
top_p,
|
221 |
-
False,
|
222 |
-
selected_model,
|
223 |
-
)
|
224 |
-
except requests.exceptions.ConnectTimeout:
|
225 |
-
status_text = (
|
226 |
-
standard_error_msg + connection_timeout_prompt + error_retrieve_prompt
|
227 |
-
)
|
228 |
-
return chatbot, history, status_text, all_token_counts
|
229 |
-
except requests.exceptions.ProxyError:
|
230 |
-
status_text = standard_error_msg + proxy_error_prompt + error_retrieve_prompt
|
231 |
-
return chatbot, history, status_text, all_token_counts
|
232 |
-
except requests.exceptions.SSLError:
|
233 |
-
status_text = standard_error_msg + ssl_error_prompt + error_retrieve_prompt
|
234 |
-
return chatbot, history, status_text, all_token_counts
|
235 |
-
response = json.loads(response.text)
|
236 |
-
if fake_input is not None:
|
237 |
-
history[-2] = construct_user(fake_input)
|
238 |
-
try:
|
239 |
-
content = response["choices"][0]["message"]["content"]
|
240 |
-
history[-1] = construct_assistant(content)
|
241 |
-
chatbot[-1] = (chatbot[-1][0], content+display_append)
|
242 |
-
total_token_count = response["usage"]["total_tokens"]
|
243 |
-
if fake_input is not None:
|
244 |
-
all_token_counts[-1] += count_token(construct_assistant(content))
|
245 |
-
else:
|
246 |
-
all_token_counts[-1] = total_token_count - sum(all_token_counts)
|
247 |
-
status_text = construct_token_message(total_token_count)
|
248 |
-
return chatbot, history, status_text, all_token_counts
|
249 |
-
except KeyError:
|
250 |
-
status_text = standard_error_msg + str(response)
|
251 |
-
return chatbot, history, status_text, all_token_counts
|
252 |
-
|
253 |
-
|
254 |
-
def predict(
|
255 |
-
openai_api_key,
|
256 |
-
system_prompt,
|
257 |
-
history,
|
258 |
-
inputs,
|
259 |
-
chatbot,
|
260 |
-
all_token_counts,
|
261 |
-
top_p,
|
262 |
-
temperature,
|
263 |
-
stream=False,
|
264 |
-
selected_model=MODELS[0],
|
265 |
-
use_websearch=False,
|
266 |
-
files = None,
|
267 |
-
reply_language="中文",
|
268 |
-
should_check_token_count=True,
|
269 |
-
): # repetition_penalty, top_k
|
270 |
-
from llama_index.indices.vector_store.base_query import GPTVectorStoreIndexQuery
|
271 |
-
from llama_index.indices.query.schema import QueryBundle
|
272 |
-
from langchain.llms import OpenAIChat
|
273 |
-
|
274 |
-
|
275 |
-
logging.info("输入为:" + colorama.Fore.BLUE + f"{inputs}" + colorama.Style.RESET_ALL)
|
276 |
-
if should_check_token_count:
|
277 |
-
yield chatbot+[(inputs, "")], history, "开始生成回答……", all_token_counts
|
278 |
-
if reply_language == "跟随问题语言(不稳定)":
|
279 |
-
reply_language = "the same language as the question, such as English, 中文, 日本語, Español, Français, or Deutsch."
|
280 |
-
old_inputs = None
|
281 |
-
display_reference = []
|
282 |
-
limited_context = False
|
283 |
-
if files:
|
284 |
-
limited_context = True
|
285 |
-
old_inputs = inputs
|
286 |
-
msg = "加载索引中……(这可能需要几分钟)"
|
287 |
-
logging.info(msg)
|
288 |
-
yield chatbot+[(inputs, "")], history, msg, all_token_counts
|
289 |
-
index = construct_index(openai_api_key, file_src=files)
|
290 |
-
msg = "索引构建完成,获取回答中……"
|
291 |
-
logging.info(msg)
|
292 |
-
yield chatbot+[(inputs, "")], history, msg, all_token_counts
|
293 |
-
with retrieve_proxy():
|
294 |
-
llm_predictor = LLMPredictor(llm=OpenAIChat(temperature=0, model_name=selected_model))
|
295 |
-
prompt_helper = PromptHelper(max_input_size = 4096, num_output = 5, max_chunk_overlap = 20, chunk_size_limit=600)
|
296 |
-
from llama_index import ServiceContext
|
297 |
-
service_context = ServiceContext.from_defaults(llm_predictor=llm_predictor, prompt_helper=prompt_helper)
|
298 |
-
query_object = GPTVectorStoreIndexQuery(index.index_struct, service_context=service_context, similarity_top_k=5, vector_store=index._vector_store, docstore=index._docstore)
|
299 |
-
query_bundle = QueryBundle(inputs)
|
300 |
-
nodes = query_object.retrieve(query_bundle)
|
301 |
-
reference_results = [n.node.text for n in nodes]
|
302 |
-
reference_results = add_source_numbers(reference_results, use_source=False)
|
303 |
-
display_reference = add_details(reference_results)
|
304 |
-
display_reference = "\n\n" + "".join(display_reference)
|
305 |
-
inputs = (
|
306 |
-
replace_today(PROMPT_TEMPLATE)
|
307 |
-
.replace("{query_str}", inputs)
|
308 |
-
.replace("{context_str}", "\n\n".join(reference_results))
|
309 |
-
.replace("{reply_language}", reply_language )
|
310 |
-
)
|
311 |
-
elif use_websearch:
|
312 |
-
limited_context = True
|
313 |
-
search_results = ddg(inputs, max_results=5)
|
314 |
-
old_inputs = inputs
|
315 |
-
reference_results = []
|
316 |
-
for idx, result in enumerate(search_results):
|
317 |
-
logging.info(f"搜索结果{idx + 1}:{result}")
|
318 |
-
domain_name = urllib3.util.parse_url(result["href"]).host
|
319 |
-
reference_results.append([result["body"], result["href"]])
|
320 |
-
display_reference.append(f"{idx+1}. [{domain_name}]({result['href']})\n")
|
321 |
-
reference_results = add_source_numbers(reference_results)
|
322 |
-
display_reference = "\n\n" + "".join(display_reference)
|
323 |
-
inputs = (
|
324 |
-
replace_today(WEBSEARCH_PTOMPT_TEMPLATE)
|
325 |
-
.replace("{query}", inputs)
|
326 |
-
.replace("{web_results}", "\n\n".join(reference_results))
|
327 |
-
.replace("{reply_language}", reply_language )
|
328 |
-
)
|
329 |
-
else:
|
330 |
-
display_reference = ""
|
331 |
-
|
332 |
-
if len(openai_api_key) == 0 and not shared.state.multi_api_key:
|
333 |
-
status_text = standard_error_msg + no_apikey_msg
|
334 |
-
logging.info(status_text)
|
335 |
-
chatbot.append((inputs, ""))
|
336 |
-
if len(history) == 0:
|
337 |
-
history.append(construct_user(inputs))
|
338 |
-
history.append("")
|
339 |
-
all_token_counts.append(0)
|
340 |
-
else:
|
341 |
-
history[-2] = construct_user(inputs)
|
342 |
-
yield chatbot+[(inputs, "")], history, status_text, all_token_counts
|
343 |
-
return
|
344 |
-
elif len(inputs.strip()) == 0:
|
345 |
-
status_text = standard_error_msg + no_input_msg
|
346 |
-
logging.info(status_text)
|
347 |
-
yield chatbot+[(inputs, "")], history, status_text, all_token_counts
|
348 |
-
return
|
349 |
-
|
350 |
-
if stream:
|
351 |
-
logging.info("使用流式传输")
|
352 |
-
iter = stream_predict(
|
353 |
-
openai_api_key,
|
354 |
-
system_prompt,
|
355 |
-
history,
|
356 |
-
inputs,
|
357 |
-
chatbot,
|
358 |
-
all_token_counts,
|
359 |
-
top_p,
|
360 |
-
temperature,
|
361 |
-
selected_model,
|
362 |
-
fake_input=old_inputs,
|
363 |
-
display_append=display_reference
|
364 |
-
)
|
365 |
-
for chatbot, history, status_text, all_token_counts in iter:
|
366 |
-
if shared.state.interrupted:
|
367 |
-
shared.state.recover()
|
368 |
-
return
|
369 |
-
yield chatbot, history, status_text, all_token_counts
|
370 |
-
else:
|
371 |
-
logging.info("不使用流式传输")
|
372 |
-
chatbot, history, status_text, all_token_counts = predict_all(
|
373 |
-
openai_api_key,
|
374 |
-
system_prompt,
|
375 |
-
history,
|
376 |
-
inputs,
|
377 |
-
chatbot,
|
378 |
-
all_token_counts,
|
379 |
-
top_p,
|
380 |
-
temperature,
|
381 |
-
selected_model,
|
382 |
-
fake_input=old_inputs,
|
383 |
-
display_append=display_reference
|
384 |
-
)
|
385 |
-
yield chatbot, history, status_text, all_token_counts
|
386 |
-
|
387 |
-
logging.info(f"传输完毕。当前token计数为{all_token_counts}")
|
388 |
-
if len(history) > 1 and history[-1]["content"] != inputs:
|
389 |
-
logging.info(
|
390 |
-
"回答为:"
|
391 |
-
+ colorama.Fore.BLUE
|
392 |
-
+ f"{history[-1]['content']}"
|
393 |
-
+ colorama.Style.RESET_ALL
|
394 |
-
)
|
395 |
-
|
396 |
-
if limited_context:
|
397 |
-
history = history[-4:]
|
398 |
-
all_token_counts = all_token_counts[-2:]
|
399 |
-
yield chatbot, history, status_text, all_token_counts
|
400 |
-
|
401 |
-
if stream:
|
402 |
-
max_token = MODEL_SOFT_TOKEN_LIMIT[selected_model]["streaming"]
|
403 |
-
else:
|
404 |
-
max_token = MODEL_SOFT_TOKEN_LIMIT[selected_model]["all"]
|
405 |
-
|
406 |
-
if sum(all_token_counts) > max_token and should_check_token_count:
|
407 |
-
print(all_token_counts)
|
408 |
-
count = 0
|
409 |
-
while sum(all_token_counts) > max_token - 500 and sum(all_token_counts) > 0:
|
410 |
-
count += 1
|
411 |
-
del all_token_counts[0]
|
412 |
-
del history[:2]
|
413 |
-
logging.info(status_text)
|
414 |
-
status_text = f"为了防止token超限,模型忘记了早期的 {count} 轮对话"
|
415 |
-
yield chatbot, history, status_text, all_token_counts
|
416 |
-
|
417 |
-
|
418 |
-
def retry(
|
419 |
-
openai_api_key,
|
420 |
-
system_prompt,
|
421 |
-
history,
|
422 |
-
chatbot,
|
423 |
-
token_count,
|
424 |
-
top_p,
|
425 |
-
temperature,
|
426 |
-
stream=False,
|
427 |
-
selected_model=MODELS[0],
|
428 |
-
reply_language="中文",
|
429 |
-
):
|
430 |
-
logging.info("重试中……")
|
431 |
-
if len(history) == 0:
|
432 |
-
yield chatbot, history, f"{standard_error_msg}上下文是空的", token_count
|
433 |
-
return
|
434 |
-
history.pop()
|
435 |
-
inputs = history.pop()["content"]
|
436 |
-
token_count.pop()
|
437 |
-
iter = predict(
|
438 |
-
openai_api_key,
|
439 |
-
system_prompt,
|
440 |
-
history,
|
441 |
-
inputs,
|
442 |
-
chatbot,
|
443 |
-
token_count,
|
444 |
-
top_p,
|
445 |
-
temperature,
|
446 |
-
stream=stream,
|
447 |
-
selected_model=selected_model,
|
448 |
-
reply_language=reply_language,
|
449 |
-
)
|
450 |
-
logging.info("重试中……")
|
451 |
-
for x in iter:
|
452 |
-
yield x
|
453 |
-
logging.info("重试完毕")
|
454 |
-
|
455 |
-
|
456 |
-
def reduce_token_size(
|
457 |
-
openai_api_key,
|
458 |
-
system_prompt,
|
459 |
-
history,
|
460 |
-
chatbot,
|
461 |
-
token_count,
|
462 |
-
top_p,
|
463 |
-
temperature,
|
464 |
-
max_token_count,
|
465 |
-
selected_model=MODELS[0],
|
466 |
-
reply_language="中文",
|
467 |
-
):
|
468 |
-
logging.info("开始减少token数量……")
|
469 |
-
iter = predict(
|
470 |
-
openai_api_key,
|
471 |
-
system_prompt,
|
472 |
-
history,
|
473 |
-
summarize_prompt,
|
474 |
-
chatbot,
|
475 |
-
token_count,
|
476 |
-
top_p,
|
477 |
-
temperature,
|
478 |
-
selected_model=selected_model,
|
479 |
-
should_check_token_count=False,
|
480 |
-
reply_language=reply_language,
|
481 |
-
)
|
482 |
-
logging.info(f"chatbot: {chatbot}")
|
483 |
-
flag = False
|
484 |
-
for chatbot, history, status_text, previous_token_count in iter:
|
485 |
-
num_chat = find_n(previous_token_count, max_token_count)
|
486 |
-
logging.info(f"previous_token_count: {previous_token_count}, keeping {num_chat} chats")
|
487 |
-
if flag:
|
488 |
-
chatbot = chatbot[:-1]
|
489 |
-
flag = True
|
490 |
-
history = history[-2*num_chat:] if num_chat > 0 else []
|
491 |
-
token_count = previous_token_count[-num_chat:] if num_chat > 0 else []
|
492 |
-
msg = f"保留了最近{num_chat}轮对话"
|
493 |
-
yield chatbot, history, msg + "," + construct_token_message(
|
494 |
-
token_count if len(token_count) > 0 else [0],
|
495 |
-
), token_count
|
496 |
-
logging.info(msg)
|
497 |
-
logging.info("减少token数量完毕")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
spaces/Armaliltril/qbee/app.py
DELETED
@@ -1,206 +0,0 @@
|
|
1 |
-
import gradio as gr
|
2 |
-
import sympy as sp
|
3 |
-
from lark import Lark, Transformer
|
4 |
-
from markdown_katex.extension import tex2html
|
5 |
-
from bs4 import BeautifulSoup
|
6 |
-
from qbee import *
|
7 |
-
from examples_selector import Example
|
8 |
-
|
9 |
-
|
10 |
-
def get_eq_grammar():
|
11 |
-
with open("equations.lark", 'r') as f:
|
12 |
-
return f.read()
|
13 |
-
|
14 |
-
|
15 |
-
diff_eq_parser = Lark(get_eq_grammar())
|
16 |
-
|
17 |
-
|
18 |
-
def eval_quadratization(system_str: str) -> str:
|
19 |
-
tree = diff_eq_parser.parse(system_str)
|
20 |
-
system = DiffEqTransformer().transform(tree)
|
21 |
-
res = polynomialize_and_quadratize(system)
|
22 |
-
# CONTRACT: single line break is used in prepare_for_render
|
23 |
-
return res.introduced_variables_str().strip() + "\n\n" + str(res)
|
24 |
-
|
25 |
-
|
26 |
-
def change_input_with_example(example_name: str) -> str:
|
27 |
-
return Example(example_name).to_system()
|
28 |
-
|
29 |
-
|
30 |
-
def prepare_for_render(out: str) -> str:
|
31 |
-
out_subs = out.replace("**", '^').replace('*', '')
|
32 |
-
intr_vars, system = out_subs.split("\n\n")
|
33 |
-
len_diff = len(system.splitlines()) - len(intr_vars.splitlines())
|
34 |
-
|
35 |
-
intr_vars_vert_indent = [" "] * len_diff + intr_vars.splitlines()
|
36 |
-
zip_equations = [fr"{left} & {right} \\" for left, right in
|
37 |
-
zip(intr_vars_vert_indent, system.splitlines())]
|
38 |
-
|
39 |
-
return rf"""
|
40 |
-
\quad
|
41 |
-
\begin{{array}}{{l | l}} \\
|
42 |
-
\text{{Introduced variables}} & \text{{Quadratized system}} \\
|
43 |
-
& \\
|
44 |
-
{''.join(zip_equations)}
|
45 |
-
\end{{array}}
|
46 |
-
"""
|
47 |
-
|
48 |
-
|
49 |
-
def render_output(out: str):
|
50 |
-
options = {'no_inline_svg': True, 'insert_fonts_css': False}
|
51 |
-
html = tex2html(prepare_for_render(out), options)
|
52 |
-
soup = BeautifulSoup(html, 'html.parser')
|
53 |
-
for tag in soup.find_all("span", class_="katex-html"):
|
54 |
-
tag.decompose()
|
55 |
-
return soup.prettify()
|
56 |
-
|
57 |
-
|
58 |
-
def launch_gradio():
|
59 |
-
with gr.Blocks() as demo:
|
60 |
-
gr.Markdown("Start typing below and then click **Quadratize** to see the output.")
|
61 |
-
examples = gr.Dropdown(list(map(str, Example)),
|
62 |
-
value=str(Example.CIRCULAR),
|
63 |
-
label="System")
|
64 |
-
with gr.Column():
|
65 |
-
inp = gr.Textbox(placeholder="Enter a system of equations",
|
66 |
-
value=Example.CIRCULAR.to_system(),
|
67 |
-
label="Input system")
|
68 |
-
|
69 |
-
with gr.Row():
|
70 |
-
out = gr.Textbox(label="Quadratized system")
|
71 |
-
out_html = gr.HTML()
|
72 |
-
btn = gr.Button("Quadratize")
|
73 |
-
|
74 |
-
btn.click(fn=eval_quadratization, inputs=inp, outputs=out)
|
75 |
-
examples.change(change_input_with_example, inputs=examples, outputs=inp)
|
76 |
-
out.change(render_output, inputs=out, outputs=out_html)
|
77 |
-
|
78 |
-
demo.launch()
|
79 |
-
|
80 |
-
|
81 |
-
def is_symbol(expr: sp.Expr):
|
82 |
-
return isinstance(expr, sp.Symbol)
|
83 |
-
|
84 |
-
|
85 |
-
def decide_vars_and_params(equations: list[sp.Symbol, sp.Expr]) -> list[sp.Function, sp.Expr]:
|
86 |
-
lhs, rhs = list(zip(*equations))
|
87 |
-
|
88 |
-
def decide(e: sp.Symbol):
|
89 |
-
return functions(e.name) if e in lhs else parameters(e.name)
|
90 |
-
|
91 |
-
lhs_res = [functions(expr.name) for expr in lhs]
|
92 |
-
rhs_res = [expr.replace(is_symbol, decide)
|
93 |
-
for expr in rhs]
|
94 |
-
return list(zip(lhs_res, rhs_res))
|
95 |
-
|
96 |
-
|
97 |
-
class DiffEqTransformer(Transformer):
|
98 |
-
def start(self, equations):
|
99 |
-
return decide_vars_and_params(equations)
|
100 |
-
|
101 |
-
def equation(self, eq):
|
102 |
-
lhs, rhs = eq
|
103 |
-
return (lhs, rhs)
|
104 |
-
|
105 |
-
def number(self, n):
|
106 |
-
return sp.Number(n[0])
|
107 |
-
|
108 |
-
def varname(self, name):
|
109 |
-
name, other = name
|
110 |
-
match name:
|
111 |
-
case "e":
|
112 |
-
return sp.E
|
113 |
-
case "pi":
|
114 |
-
return sp.pi
|
115 |
-
case _:
|
116 |
-
tail = str(other) if other else ""
|
117 |
-
return sp.Symbol(str(name) + tail)
|
118 |
-
|
119 |
-
def sum(self, terms):
|
120 |
-
return sp.Add(terms[0], terms[1])
|
121 |
-
|
122 |
-
def diff(self, terms):
|
123 |
-
return sp.Add(terms[0], -terms[1])
|
124 |
-
|
125 |
-
def mul(self, terms):
|
126 |
-
return sp.Mul(terms[0], terms[1])
|
127 |
-
|
128 |
-
def div(self, terms):
|
129 |
-
return sp.Mul(terms[0], sp.Number(1) / terms[1])
|
130 |
-
|
131 |
-
def pow(self, terms):
|
132 |
-
return sp.Pow(terms[0], terms[1])
|
133 |
-
|
134 |
-
def cbraced(self, expr):
|
135 |
-
return '{' + str(expr[0]) + '}'
|
136 |
-
|
137 |
-
def braced(self, expr):
|
138 |
-
return expr[0]
|
139 |
-
|
140 |
-
def function(self, expr):
|
141 |
-
fname, *args = expr
|
142 |
-
return functions(fname.name)
|
143 |
-
|
144 |
-
def ln(self, expr):
|
145 |
-
return sp.ln(expr[0])
|
146 |
-
|
147 |
-
def log(self, expr):
|
148 |
-
return sp.log(expr[0])
|
149 |
-
|
150 |
-
def sin(self, expr):
|
151 |
-
return sp.sin(expr[0])
|
152 |
-
|
153 |
-
def cos(self, expr):
|
154 |
-
return sp.cos(expr[0])
|
155 |
-
|
156 |
-
def tan(self, expr):
|
157 |
-
return sp.tan(expr[0])
|
158 |
-
|
159 |
-
def cot(self, expr):
|
160 |
-
return sp.cot(expr[0])
|
161 |
-
|
162 |
-
def asin(self, expr):
|
163 |
-
return sp.asin(expr[0])
|
164 |
-
|
165 |
-
def acos(self, expr):
|
166 |
-
return sp.acos(expr[0])
|
167 |
-
|
168 |
-
def atan(self, expr):
|
169 |
-
return sp.atan(expr[0])
|
170 |
-
|
171 |
-
def acot(self, expr):
|
172 |
-
return sp.acot(expr[0])
|
173 |
-
|
174 |
-
def sinh(self, expr):
|
175 |
-
return sp.sinh(expr[0])
|
176 |
-
|
177 |
-
def cosh(self, expr):
|
178 |
-
return sp.cosh(expr[0])
|
179 |
-
|
180 |
-
def tanh(self, expr):
|
181 |
-
return sp.tanh(expr[0])
|
182 |
-
|
183 |
-
def coth(self, expr):
|
184 |
-
return sp.coth(expr[0])
|
185 |
-
|
186 |
-
def asinh(self, expr):
|
187 |
-
return sp.asinh(expr[0])
|
188 |
-
|
189 |
-
def acosh(self, expr):
|
190 |
-
return sp.acosh(expr[0])
|
191 |
-
|
192 |
-
def atanh(self, expr):
|
193 |
-
return sp.atanh(expr[0])
|
194 |
-
|
195 |
-
def acoth(self, expr):
|
196 |
-
return sp.acoth(expr[0])
|
197 |
-
|
198 |
-
def exp(self, expr):
|
199 |
-
return sp.exp(expr[0])
|
200 |
-
|
201 |
-
def sqrt(self, expr):
|
202 |
-
return sp.sqrt(expr[0])
|
203 |
-
|
204 |
-
|
205 |
-
if __name__ == '__main__':
|
206 |
-
launch_gradio()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
spaces/Ataturk-Chatbot/HuggingFaceChat/venv/lib/python3.11/site-packages/setuptools/_vendor/importlib_metadata/_compat.py
DELETED
@@ -1,71 +0,0 @@
|
|
1 |
-
import sys
|
2 |
-
import platform
|
3 |
-
|
4 |
-
|
5 |
-
__all__ = ['install', 'NullFinder', 'Protocol']
|
6 |
-
|
7 |
-
|
8 |
-
try:
|
9 |
-
from typing import Protocol
|
10 |
-
except ImportError: # pragma: no cover
|
11 |
-
from ..typing_extensions import Protocol # type: ignore
|
12 |
-
|
13 |
-
|
14 |
-
def install(cls):
|
15 |
-
"""
|
16 |
-
Class decorator for installation on sys.meta_path.
|
17 |
-
|
18 |
-
Adds the backport DistributionFinder to sys.meta_path and
|
19 |
-
attempts to disable the finder functionality of the stdlib
|
20 |
-
DistributionFinder.
|
21 |
-
"""
|
22 |
-
sys.meta_path.append(cls())
|
23 |
-
disable_stdlib_finder()
|
24 |
-
return cls
|
25 |
-
|
26 |
-
|
27 |
-
def disable_stdlib_finder():
|
28 |
-
"""
|
29 |
-
Give the backport primacy for discovering path-based distributions
|
30 |
-
by monkey-patching the stdlib O_O.
|
31 |
-
|
32 |
-
See #91 for more background for rationale on this sketchy
|
33 |
-
behavior.
|
34 |
-
"""
|
35 |
-
|
36 |
-
def matches(finder):
|
37 |
-
return getattr(
|
38 |
-
finder, '__module__', None
|
39 |
-
) == '_frozen_importlib_external' and hasattr(finder, 'find_distributions')
|
40 |
-
|
41 |
-
for finder in filter(matches, sys.meta_path): # pragma: nocover
|
42 |
-
del finder.find_distributions
|
43 |
-
|
44 |
-
|
45 |
-
class NullFinder:
|
46 |
-
"""
|
47 |
-
A "Finder" (aka "MetaClassFinder") that never finds any modules,
|
48 |
-
but may find distributions.
|
49 |
-
"""
|
50 |
-
|
51 |
-
@staticmethod
|
52 |
-
def find_spec(*args, **kwargs):
|
53 |
-
return None
|
54 |
-
|
55 |
-
# In Python 2, the import system requires finders
|
56 |
-
# to have a find_module() method, but this usage
|
57 |
-
# is deprecated in Python 3 in favor of find_spec().
|
58 |
-
# For the purposes of this finder (i.e. being present
|
59 |
-
# on sys.meta_path but having no other import
|
60 |
-
# system functionality), the two methods are identical.
|
61 |
-
find_module = find_spec
|
62 |
-
|
63 |
-
|
64 |
-
def pypy_partial(val):
|
65 |
-
"""
|
66 |
-
Adjust for variable stacklevel on partial under PyPy.
|
67 |
-
|
68 |
-
Workaround for #327.
|
69 |
-
"""
|
70 |
-
is_pypy = platform.python_implementation() == 'PyPy'
|
71 |
-
return val + is_pypy
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
spaces/Ataturk-Chatbot/HuggingFaceChat/venv/lib/python3.11/site-packages/setuptools/command/upload.py
DELETED
@@ -1,17 +0,0 @@
|
|
1 |
-
from distutils import log
|
2 |
-
from distutils.command import upload as orig
|
3 |
-
|
4 |
-
from setuptools.errors import RemovedCommandError
|
5 |
-
|
6 |
-
|
7 |
-
class upload(orig.upload):
|
8 |
-
"""Formerly used to upload packages to PyPI."""
|
9 |
-
|
10 |
-
def run(self):
|
11 |
-
msg = (
|
12 |
-
"The upload command has been removed, use twine to upload "
|
13 |
-
+ "instead (https://pypi.org/p/twine)"
|
14 |
-
)
|
15 |
-
|
16 |
-
self.announce("ERROR: " + msg, log.ERROR)
|
17 |
-
raise RemovedCommandError(msg)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
spaces/AutoLLM/AutoAgents/autoagents/utils/__init__.py
DELETED
File without changes
|
spaces/Awiny/Image2Paragraph/models/grit_src/third_party/CenterNet2/tests/test_solver.py
DELETED
@@ -1,66 +0,0 @@
|
|
1 |
-
import unittest
|
2 |
-
|
3 |
-
from detectron2.solver.build import _expand_param_groups, reduce_param_groups
|
4 |
-
|
5 |
-
|
6 |
-
class TestOptimizer(unittest.TestCase):
|
7 |
-
def testExpandParamsGroups(self):
|
8 |
-
params = [
|
9 |
-
{
|
10 |
-
"params": ["p1", "p2", "p3", "p4"],
|
11 |
-
"lr": 1.0,
|
12 |
-
"weight_decay": 3.0,
|
13 |
-
},
|
14 |
-
{
|
15 |
-
"params": ["p2", "p3", "p5"],
|
16 |
-
"lr": 2.0,
|
17 |
-
"momentum": 2.0,
|
18 |
-
},
|
19 |
-
{
|
20 |
-
"params": ["p1"],
|
21 |
-
"weight_decay": 4.0,
|
22 |
-
},
|
23 |
-
]
|
24 |
-
out = _expand_param_groups(params)
|
25 |
-
gt = [
|
26 |
-
dict(params=["p1"], lr=1.0, weight_decay=4.0), # noqa
|
27 |
-
dict(params=["p2"], lr=2.0, weight_decay=3.0, momentum=2.0), # noqa
|
28 |
-
dict(params=["p3"], lr=2.0, weight_decay=3.0, momentum=2.0), # noqa
|
29 |
-
dict(params=["p4"], lr=1.0, weight_decay=3.0), # noqa
|
30 |
-
dict(params=["p5"], lr=2.0, momentum=2.0), # noqa
|
31 |
-
]
|
32 |
-
self.assertEqual(out, gt)
|
33 |
-
|
34 |
-
def testReduceParamGroups(self):
|
35 |
-
params = [
|
36 |
-
dict(params=["p1"], lr=1.0, weight_decay=4.0), # noqa
|
37 |
-
dict(params=["p2", "p6"], lr=2.0, weight_decay=3.0, momentum=2.0), # noqa
|
38 |
-
dict(params=["p3"], lr=2.0, weight_decay=3.0, momentum=2.0), # noqa
|
39 |
-
dict(params=["p4"], lr=1.0, weight_decay=3.0), # noqa
|
40 |
-
dict(params=["p5"], lr=2.0, momentum=2.0), # noqa
|
41 |
-
]
|
42 |
-
gt_groups = [
|
43 |
-
{
|
44 |
-
"lr": 1.0,
|
45 |
-
"weight_decay": 4.0,
|
46 |
-
"params": ["p1"],
|
47 |
-
},
|
48 |
-
{
|
49 |
-
"lr": 2.0,
|
50 |
-
"weight_decay": 3.0,
|
51 |
-
"momentum": 2.0,
|
52 |
-
"params": ["p2", "p6", "p3"],
|
53 |
-
},
|
54 |
-
{
|
55 |
-
"lr": 1.0,
|
56 |
-
"weight_decay": 3.0,
|
57 |
-
"params": ["p4"],
|
58 |
-
},
|
59 |
-
{
|
60 |
-
"lr": 2.0,
|
61 |
-
"momentum": 2.0,
|
62 |
-
"params": ["p5"],
|
63 |
-
},
|
64 |
-
]
|
65 |
-
out = reduce_param_groups(params)
|
66 |
-
self.assertEqual(out, gt_groups)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
spaces/AzumaSeren100/XuanShen-Bert-VITS2/losses.py
DELETED
@@ -1,61 +0,0 @@
|
|
1 |
-
import torch
|
2 |
-
from torch.nn import functional as F
|
3 |
-
|
4 |
-
import commons
|
5 |
-
|
6 |
-
|
7 |
-
def feature_loss(fmap_r, fmap_g):
|
8 |
-
loss = 0
|
9 |
-
for dr, dg in zip(fmap_r, fmap_g):
|
10 |
-
for rl, gl in zip(dr, dg):
|
11 |
-
rl = rl.float().detach()
|
12 |
-
gl = gl.float()
|
13 |
-
loss += torch.mean(torch.abs(rl - gl))
|
14 |
-
|
15 |
-
return loss * 2
|
16 |
-
|
17 |
-
|
18 |
-
def discriminator_loss(disc_real_outputs, disc_generated_outputs):
|
19 |
-
loss = 0
|
20 |
-
r_losses = []
|
21 |
-
g_losses = []
|
22 |
-
for dr, dg in zip(disc_real_outputs, disc_generated_outputs):
|
23 |
-
dr = dr.float()
|
24 |
-
dg = dg.float()
|
25 |
-
r_loss = torch.mean((1-dr)**2)
|
26 |
-
g_loss = torch.mean(dg**2)
|
27 |
-
loss += (r_loss + g_loss)
|
28 |
-
r_losses.append(r_loss.item())
|
29 |
-
g_losses.append(g_loss.item())
|
30 |
-
|
31 |
-
return loss, r_losses, g_losses
|
32 |
-
|
33 |
-
|
34 |
-
def generator_loss(disc_outputs):
|
35 |
-
loss = 0
|
36 |
-
gen_losses = []
|
37 |
-
for dg in disc_outputs:
|
38 |
-
dg = dg.float()
|
39 |
-
l = torch.mean((1-dg)**2)
|
40 |
-
gen_losses.append(l)
|
41 |
-
loss += l
|
42 |
-
|
43 |
-
return loss, gen_losses
|
44 |
-
|
45 |
-
|
46 |
-
def kl_loss(z_p, logs_q, m_p, logs_p, z_mask):
|
47 |
-
"""
|
48 |
-
z_p, logs_q: [b, h, t_t]
|
49 |
-
m_p, logs_p: [b, h, t_t]
|
50 |
-
"""
|
51 |
-
z_p = z_p.float()
|
52 |
-
logs_q = logs_q.float()
|
53 |
-
m_p = m_p.float()
|
54 |
-
logs_p = logs_p.float()
|
55 |
-
z_mask = z_mask.float()
|
56 |
-
|
57 |
-
kl = logs_p - logs_q - 0.5
|
58 |
-
kl += 0.5 * ((z_p - m_p)**2) * torch.exp(-2. * logs_p)
|
59 |
-
kl = torch.sum(kl * z_mask)
|
60 |
-
l = kl / torch.sum(z_mask)
|
61 |
-
return l
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
spaces/Benson/text-generation/Examples/Descargar Choque De Clanes Nulls Mod Apk.md
DELETED
@@ -1,117 +0,0 @@
|
|
1 |
-
|
2 |
-
<h1>Descargar Clash of Clans Nulls Mod APK: La guía definitiva</h1>
|
3 |
-
<p>¿Eres fan de Clash of Clans, el adictivo juego de estrategia que tiene millones de jugadores en todo el mundo? ¿Quieres disfrutar de recursos ilimitados, mods personalizados y más diversión en tu juego? Si es así, entonces deberías probar Nulls Clash, un servidor privado para Clash of Clans que te permite jugar el juego con más libertad y flexibilidad. En este artículo, le diremos todo lo que necesita saber sobre Nulls Clash mod APK, cómo descargarlo e instalarlo en su dispositivo, y cómo jugarlo como un profesional. ¡Vamos a empezar! </p>
|
4 |
-
<h2>¿Qué es el Choque de Clanes? </h2>
|
5 |
-
<h3>Una breve introducción al popular juego de estrategia</h3>
|
6 |
-
<p>Clash of Clans es un juego gratuito de estrategia móvil desarrollado y publicado por Supercell, una compañía finlandesa de juegos. Fue lanzado en 2012 para iOS y en 2013 para dispositivos Android. El juego ha sido uno de los juegos más exitosos y populares en la industria de los juegos móviles, con más de 500 millones de descargas y miles de millones de dólares en ingresos. </p>
|
7 |
-
<h2>descargar choque de clanes nulls mod apk</h2><br /><p><b><b>Download Zip</b> ››››› <a href="https://bltlly.com/2v6KuM">https://bltlly.com/2v6KuM</a></b></p><br /><br />
|
8 |
-
<h3>Las principales características y jugabilidad de Clash of Clans</h3>
|
9 |
-
<p>El juego se desarrolla en un mundo de fantasía donde puedes construir tu propia aldea, entrenar a tu ejército, unirte a un clan y luchar contra otros jugadores o enemigos generados por ordenador. También puede participar en varios eventos, desafíos, guerras y ligas para ganar recompensas y trofeos. El juego tiene varios recursos que necesitas recolectar y administrar, como oro, elixir, elixir oscuro, gemas y recursos de base de constructor. Puedes usar estos recursos para mejorar tus edificios, tropas, hechizos, héroes y defensas. El juego también tiene varios modos que puedes jugar, como una campaña para un jugador, batallas multijugador, guerras de clanes, juegos de clanes, batallas de base de constructores, desafíos de temporada y eventos especiales. </p>
|
10 |
-
<h2>¿Qué es Nulls Clash? </h2>
|
11 |
-
<h3>Un servidor privado para Clash of Clans con recursos ilimitados y mods personalizados</h3>
|
12 |
-
|
13 |
-
<h3>Los beneficios y desventajas de usar Nulls Clash</h3>
|
14 |
-
<p>Hay muchos beneficios de usar Nulls Clash mod APK para jugar Clash of Clans. Algunos de ellos son:</p>
|
15 |
-
<ul>
|
16 |
-
<li>Puedes disfrutar del juego sin gastar dinero ni tiempo en recolectar recursos. </li>
|
17 |
-
<li>Puedes experimentar con diferentes estrategias y combinaciones sin preocuparte por perder recursos o trofeos. </li>
|
18 |
-
<li>Puedes acceder a contenido nuevo y exclusivo que no está disponible en el juego oficial. </li>
|
19 |
-
<li>Puedes tener más diversión y emoción en tu juego. </li>
|
20 |
-
</ul>
|
21 |
-
<p>Sin embargo, también hay algunos inconvenientes de usar Nulls Clash mod APK para jugar Clash of Clans. Algunos de ellos son:</p>
|
22 |
-
<ul>
|
23 |
-
<li>No puedes jugar con o contra jugadores que estén usando el juego oficial. </li> <li>Puedes enfrentarte a algunos errores, fallas o errores mientras juegas el juego. </li>
|
24 |
-
<li>Puedes arriesgarte a que te prohíban o suspendan del juego oficial si usas la misma cuenta o dispositivo. </li>
|
25 |
-
<li>Puedes perderte algunas de las actualizaciones y características que se agregan al juego oficial. </li>
|
26 |
-
</ul>
|
27 |
-
<p>Por lo tanto, debe sopesar los pros y los contras de usar Nulls Clash mod APK antes de decidir descargarlo e instalarlo en su dispositivo. </p>
|
28 |
-
<h2>¿Cómo descargar e instalar Nulls Clash mod APK? </h2>
|
29 |
-
<h3>Los requisitos y precauciones para descargar Nulls Clash mod APK</h3>
|
30 |
-
<p>Antes de descargar e instalar Nulls Clash mod APK en su dispositivo, debe asegurarse de que cumple con los siguientes requisitos y tomar las siguientes precauciones:</p>
|
31 |
-
<ul>
|
32 |
-
<li> Usted debe tener un dispositivo Android que se ejecuta en Android 4.4 o superior. </li>
|
33 |
-
<li> Usted debe tener suficiente espacio de almacenamiento en el dispositivo para descargar e instalar el archivo APK. </li>
|
34 |
-
<li> Usted debe tener una conexión a Internet estable para descargar el archivo APK y jugar el juego en línea. </li>
|
35 |
-
<li> Usted debe hacer una copia de seguridad de los datos originales del juego Clash of Clans y desinstalarlo desde su dispositivo. </li>
|
36 |
-
|
37 |
-
<li>Usted debe descargar el archivo APK solo desde el sitio web oficial de Nulls Clash, ya que otras fuentes pueden contener virus o malware. </li>
|
38 |
-
</ul>
|
39 |
-
<h3>La guía paso a paso para instalar Nulls Clash mod APK en su dispositivo</h3>
|
40 |
-
<h4>Descargar APK desde el sitio web oficial</h4>
|
41 |
-
<p>El primer paso es descargar el archivo APK desde el sitio web oficial de Nulls Clash. Puede visitar el sitio web haciendo clic [aquí]. Verá un botón de descarga en la página principal. Haga clic en él y espere a que se complete la descarga. El tamaño del archivo es de unos 150 MB, por lo que puede llevar algún tiempo dependiendo de la velocidad de Internet. </p>
|
42 |
-
<h4>Permitir fuentes desconocidas en la configuración del dispositivo</h4>
|
43 |
-
<p>El siguiente paso es permitir fuentes desconocidas en la configuración del dispositivo. Esto es necesario porque Nulls Clash mod APK no está disponible en el Google Play Store, por lo que debe habilitar esta opción para instalarlo. Para hacer esto, vaya a la configuración del dispositivo y busque opciones de seguridad o privacidad. Luego, encuentra la opción que dice "permitir la instalación de aplicaciones de fuentes desconocidas" o algo similar. Enciéndela y confirma tu elección. </p>
|
44 |
-
<h4>Instalar el archivo APK y lanzar el juego</h4>
|
45 |
-
<p>El paso final es instalar el archivo APK y lanzar el juego. Para hacer esto, busque el archivo descargado en el almacenamiento del dispositivo y toque en él. Verá una ventana emergente que le pide que instale la aplicación. Haga clic en "instalar" y espere a que termine la instalación. Una vez que se hace, verá un icono de Nulls Clash en la pantalla del dispositivo. Toque en él y disfrutar jugando Nulls Clash mod APK! </p>
|
46 |
-
<p></p>
|
47 |
-
<h2>¿Cómo se juega Nulls Clash mod APK? </h2>
|
48 |
-
<h3>Los consejos y trucos básicos para jugar Nulls Clash mod APK</h3>
|
49 |
-
<p>Si eres nuevo en Nulls Clash mod APK, es posible que necesite algunos consejos y trucos básicos para jugarlo bien. Estos son algunos de ellos:</p>
|
50 |
-
<ul>
|
51 |
-
|
52 |
-
<li>También puedes usar mods personalizados, como edificios personalizados, tropas, hechizos, héroes y defensas. Puedes encontrarlos en tu tienda o cuartel. Algunos de ellos son muy poderosos y únicos, como la torre del dragón, el rey duende, súper pekka, mago de hielo, etc.</li>
|
53 |
-
<li>Puedes crear o unirte a cualquier clan que quieras, sin restricciones o limitaciones. También puedes chatear con otros jugadores de tu clan o chat global. También puedes participar en guerras de clanes, juegos de clanes, desafíos de temporada y eventos especiales con tus compañeros de clan. </li>
|
54 |
-
<li> También puede cambiar entre diferentes servidores de Nulls Clash mod APK mediante el uso de un comando en el cuadro de chat. Por ejemplo, puede escribir "/server 1" para cambiar al servidor 1, "/server 2" para cambiar al servidor 2, etc. Cada servidor tiene diferentes características y reproductores. </li>
|
55 |
-
</ul>
|
56 |
-
<h3>Las estrategias avanzadas y características de Nulls Clash mod APK</h3>
|
57 |
-
<p>Si usted es un jugador experimentado de Nulls Clash mod APK, es posible que desee saber algunas estrategias avanzadas y características del juego. Estos son algunos de ellos:</p>
|
58 |
-
<ul>
|
59 |
-
<li> Puede utilizar una tabla para comparar las estadísticas y capacidades de diferentes mods personalizados en Nulls Clash mod APK. Por ejemplo, puede utilizar la siguiente tabla para comparar los héroes personalizados en Nulls Clash mod APK:</p>
|
60 |
-
<tabla>
|
61 |
-
<tr>
|
62 |
-
<th>Héroe</th>
|
63 |
-
<th>Capacidad</th>
|
64 |
-
<th>Daño</th>
|
65 |
-
<th>Salud</th>
|
66 |
-
</tr>
|
67 |
-
<tr>
|
68 |
-
<td>Rey duende</td>
|
69 |
-
<td>Invocar duendes</td>
|
70 |
-
<td>300</td>
|
71 |
-
<td>5000</td>
|
72 |
-
</tr>
|
73 |
-
<tr>
|
74 |
-
<td>Asistente de hielo</td>
|
75 |
-
<td>Congelar enemigos</td>
|
76 |
-
<td>200</td>
|
77 |
-
<td>4000</td>
|
78 |
-
</tr>
|
79 |
-
<tr>
|
80 |
-
<td>Super Pekka</td>
|
81 |
-
<td>Electrocutar enemigos</td>
|
82 |
-
<td>500</td>
|
83 |
-
<td>6000</td>
|
84 |
-
</tr>
|
85 |
-
<tr>
|
86 |
-
<td>Rey del Perro de Lava</td>
|
87 |
-
<td>Invocar cachorros de lava</td>
|
88 |
-
<td>400</td>
|
89 |
-
<td>7000</td>
|
90 |
-
</tr>
|
91 |
-
<tr>
|
92 |
-
<td>Bowser King</td>
|
93 |
-
<td>Disparar bolas de fuego</td>
|
94 |
-
<td>600</td>
|
95 |
-
<td>8000</td>
|
96 |
-
</tr>
|
97 |
-
</tabla>
|
98 |
-
<p>Puedes usar esta tabla para decidir qué héroe usar en tus ataques o defensas, dependiendo de sus habilidades y estadísticas. </p>
|
99 |
-
|
100 |
-
<li>También puede personalizar la configuración del juego y las preferencias en Nulls Clash mod APK. Por ejemplo, puedes cambiar el idioma, sonido, gráficos, notificaciones, etc. del juego. También puede activar o desactivar el modo nocturno, la actualización automática, la prohibición, etc. del juego. </li>
|
101 |
-
<li> También puede informar de cualquier error, problemas técnicos o errores que se encuentre al jugar Nulls Clash mod APK. Puede hacer esto poniéndose en contacto con los desarrolladores de Nulls Clash mod APK a través de su sitio web, correo electrónico o redes sociales. Intentarán solucionar los problemas lo antes posible. </li>
|
102 |
-
<h2>Conclusión</h2>
|
103 |
-
<p>En conclusión, Nulls Clash mod APK es un servidor privado para Clash of Clans que le permite jugar el juego con recursos ilimitados y mods personalizados. Es una forma divertida y emocionante de disfrutar del juego sin limitaciones ni restricciones. Sin embargo, también tiene algunos inconvenientes y riesgos que debe tener en cuenta antes de descargarlo e instalarlo en su dispositivo. Si desea probar Nulls Clash mod APK, puede seguir los pasos dados en este artículo para descargarlo e instalarlo en su dispositivo. También puede seguir los consejos y trucos dados en este artículo para jugar como un profesional. Esperamos que haya encontrado este artículo útil e informativo. ¡Feliz broche! </p>
|
104 |
-
<h2>Preguntas frecuentes (preguntas frecuentes)</h2>
|
105 |
-
<p>Aquí están algunas de las preguntas más frecuentes sobre Nulls Clash mod APK:</p>
|
106 |
-
<h3>Q: ¿Es seguro usar Nulls Clash mod APK? </h3>
|
107 |
-
<p>A: Nulls Clash mod APK es seguro de usar siempre y cuando lo descargue desde el sitio web oficial y siga las precauciones dadas en este artículo. Sin embargo, no hay garantía de que no dañará su dispositivo o cuenta de ninguna manera. Por lo tanto, debe usarlo bajo su propio riesgo y responsabilidad. </p>
|
108 |
-
<h3>Q: ¿Es Nulls Clash mod APK legal de usar? </h3>
|
109 |
-
<p>A: Nulls Clash mod APK no es legal de usar, ya que viola los términos y condiciones de Supercell, el desarrollador de Clash of Clans. Por lo tanto, puede enfrentar acciones legales o consecuencias si lo usa. </p>
|
110 |
-
|
111 |
-
<p>A: Nulls Clash mod APK se actualiza regularmente por sus desarrolladores para que coincida con la última versión y características del juego oficial. Puede comprobar el estado de actualización y descargar la última versión desde el sitio web oficial de Nulls Clash mod APK.</p>
|
112 |
-
<h3>Q: ¿Puedo jugar Nulls Clash mod APK offline? </h3>
|
113 |
-
<p>A: No, no se puede jugar sin conexión Nulls Clash mod APK ya que requiere una conexión a Internet para conectarse a su servidor y otros jugadores. </p>
|
114 |
-
<h3>Q: ¿Puedo transferir mi progreso de Nulls Clash mod APK al juego oficial? </h3>
|
115 |
-
<p>A: No, no se puede transferir su progreso de Nulls Clash mod APK al juego oficial, ya que no son compatibles entre sí. </p> 64aa2da5cf<br />
|
116 |
-
<br />
|
117 |
-
<br />
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
spaces/Benson/text-generation/Examples/Descargar Gratis Titanes De Ajedrez Para Windows Xp Versin Completa.md
DELETED
@@ -1,107 +0,0 @@
|
|
1 |
-
<br />
|
2 |
-
<h1>Descargar gratis Chess Titans para Windows XP Versión completa</h1>
|
3 |
-
<p>¿Te gusta jugar al ajedrez y quieres disfrutarlo en tu computadora con Windows XP? Si es así, entonces usted podría estar interesado en descargar Chess Titans, uno de los juegos de ajedrez más populares y clásicos de todos los tiempos. En este artículo, te diremos qué es Chess Titans, por qué deberías descargarlo para Windows XP y cómo hacerlo de forma segura y fácil. También le proporcionaremos algunas alternativas y consejos de solución de problemas en caso de que encuentre algún problema. ¡Comencemos! </p>
|
4 |
-
<h2>descargar gratis titanes de ajedrez para windows xp versión completa</h2><br /><p><b><b>Download File</b> — <a href="https://bltlly.com/2v6Mdc">https://bltlly.com/2v6Mdc</a></b></p><br /><br />
|
5 |
-
<h2>¿Qué es Titanes de Ajedrez? </h2>
|
6 |
-
<p>Chess Titans es un juego de ajedrez que fue desarrollado por Oberon Games e incluido en Windows Vista y Windows 7. Es un juego de ajedrez en 3D que te permite jugar contra el ordenador u otro jugador humano. Puedes elegir entre 10 niveles diferentes de dificultad, desde principiante hasta gran maestro. También puede personalizar la apariencia de la placa y las piezas, así como los efectos de sonido y la música. Chess Titans tiene una interfaz simple e intuitiva que hace que sea fácil de aprender y jugar. </p>
|
7 |
-
<h3>Características de los Titanes de Ajedrez</h3>
|
8 |
-
<p>Algunas de las características que hacen de Chess Titans un gran juego de ajedrez son:</p>
|
9 |
-
<ul>
|
10 |
-
<li>Puedes deshacer y rehacer tus movimientos, así como guardar y cargar tus juegos. </li>
|
11 |
-
<li>Puedes usar pistas y retirar movimientos si te quedas atascado o cometes un error. </li>
|
12 |
-
<li> Puedes ver el historial de tus movimientos y las piezas capturadas. </li>
|
13 |
-
<li> Puedes girar el tablero y acercar y alejar para obtener una mejor vista del juego. </li>
|
14 |
-
<li> Puedes jugar en modo de pantalla completa o en modo ventana. </li>
|
15 |
-
<li>Puedes jugar online con otros jugadores o offline con el ordenador u otra persona. </li>
|
16 |
-
</ul>
|
17 |
-
<h3>Cómo jugar Titanes de Ajedrez</h3>
|
18 |
-
<p>Jugar Titanes de Ajedrez es muy fácil y divertido. Aquí están los pasos básicos para comenzar una partida:</p>
|
19 |
-
<ol>
|
20 |
-
<li>Lanza Titanes de Ajedrez desde el menú Inicio o el acceso directo del escritorio. </li>
|
21 |
-
<li> Seleccione el modo de juego que desea jugar: un solo jugador, dos jugadores, o en línea. </li>
|
22 |
-
|
23 |
-
<li>Si eliges dos jugadores, decide quién jugará como blanco y quién jugará como negro. </li>
|
24 |
-
<li>Si elige en línea, inicie sesión con su cuenta de Microsoft y encuentre un oponente en línea. </li>
|
25 |
-
<li>Haga clic en Iniciar juego para comenzar a jugar. </li>
|
26 |
-
<li>Usa el ratón para arrastrar y soltar las piezas en el tablero. También puedes usar los atajos de teclado para mover las piezas. </li>
|
27 |
-
<li>Sigue las reglas del ajedrez e intenta hacer jaque mate al rey de tu oponente. </li>
|
28 |
-
</ol>
|
29 |
-
<h2>¿Por qué descargar Chess Titans para Windows XP? </h2>
|
30 |
-
<p>Es posible que se pregunte por qué debería descargar Chess Titans para Windows XP cuando hay tantos otros juegos de ajedrez disponibles. Bueno, hay varias razones por las que Chess Titans es una gran opción para los usuarios de Windows XP. Aquí están algunas de ellas:</p>
|
31 |
-
<h3>Beneficios de jugar ajedrez</h3>
|
32 |
-
<p>El ajedrez no es solo un juego divertido y desafiante, sino también beneficioso. Jugar al ajedrez puede ayudarte a mejorar tu:</p>
|
33 |
-
<p></p>
|
34 |
-
<ul>
|
35 |
-
<li>Memoria y concentración</li>
|
36 |
-
<li>Pensamiento crítico y habilidades para resolver problemas</li>
|
37 |
-
<li>Creatividad e imaginación</li>
|
38 |
-
<li>Razonamiento lógico y capacidades analíticas</li>
|
39 |
-
<li>Habilidades de planificación estratégica y toma de decisiones</li>
|
40 |
-
</ul>
|
41 |
-
<h3>Compatibilidad y rendimiento de los Titanes de Ajedrez en Windows XP</h3>
|
42 |
-
<p>Chess Titans fue originalmente diseñado para Windows Vista y Windows 7, pero también puede funcionar sin problemas en Windows XP con algunos ajustes. No necesitas una computadora potente o una tarjeta gráfica de alta gama para disfrutar de Chess Titans en Windows XP. Solo necesita un mínimo de 256 MB de RAM, 50 MB de espacio en el disco duro y una tarjeta de video compatible con DirectX 9.0c. Chess Titans se ejecutará rápida y sin problemas en su sistema Windows XP sin ningún retraso o se bloquea. </p>
|
43 |
-
<h3>Seguridad de los Titanes de Ajedrez descarga</h3>
|
44 |
-
|
45 |
-
<h2>¿Cómo descargar la versión completa de Chess Titans para Windows XP? </h2>
|
46 |
-
<p>Ahora que sabes por qué deberías descargar Chess Titans para Windows XP, te estarás preguntando cómo hacerlo. Bueno, no es muy difícil ni complicado. Solo tienes que seguir estos sencillos pasos:</p>
|
47 |
-
<h3>Requisitos y pasos para descargar Chess Titans</h3>
|
48 |
-
<p>Antes de descargar Chess Titans, debe asegurarse de que su sistema Windows XP cumple con los siguientes requisitos:</p>
|
49 |
-
<ul>
|
50 |
-
<li> Tiene Windows XP Service Pack 3 (SP3) instalado en su computadora. </li>
|
51 |
-
<li>Tiene . NET Framework 3.5 o superior instalado en su computadora. </li>
|
52 |
-
<li>Tiene privilegios de administrador en su computadora. </li>
|
53 |
-
</ul>
|
54 |
-
<p>Una vez que haya comprobado estos requisitos, puede proceder a descargar Chess Titans siguiendo estos pasos:</p>
|
55 |
-
<ol>
|
56 |
-
<li>Ir a uno de los sitios de descarga mencionados anteriormente, como Softonic, Softpedia, o FileHippo.</li>
|
57 |
-
<li>Haga clic en el botón de descarga o enlace para Chess Titans.</li>
|
58 |
-
<li>Guarde el archivo en su computadora y encuéntrelo en su carpeta de descargas. </li>
|
59 |
-
<li>Haga doble clic en el archivo para iniciar el asistente de instalación. </li>
|
60 |
-
<li>Siga las instrucciones en la pantalla para instalar Titanes de Ajedrez en su computadora. </li>
|
61 |
-
<li>Reinicie su computadora si se le solicita. </li>
|
62 |
-
<li>Disfruta jugando Titanes de Ajedrez en tu Windows XP! </li>
|
63 |
-
</ol>
|
64 |
-
<h3>Alternativas a Titanes de Ajedrez para Windows XP</h3>
|
65 |
-
<p>Si usted está buscando algunas alternativas a Chess Titans para Windows XP, es posible que desee probar estos otros juegos de ajedrez:</p>
|
66 |
-
<tabla>
|
67 |
-
<tr><th>Nombre</th><th>Descripción</th></tr>
|
68 |
-
<tr><td>GNU Chess</td><td>Un juego de ajedrez libre y de código abierto que se ejecuta en varias plataformas, incluyendo Windows XP. Tiene una interfaz sencilla y un potente motor que puede desafiar a cualquier nivel de jugador. </td></tr>
|
69 |
-
|
70 |
-
<tr><td>Chessmaster 10th Edition</td><td>Un juego de ajedrez profesional que ofrece un sistema integral de aprendizaje y entrenamiento. Tiene más de 2000 juegos clásicos, 900 rompecabezas de grandes maestros y 150 oponentes diferentes. También tiene una variedad de estilos de tablero y temas. </td></tr>
|
71 |
-
</tabla>
|
72 |
-
<h3>Consejos de solución de problemas para instalar y ejecutar Chess Titans</h3>
|
73 |
-
<p>En caso de que encuentre algún problema al instalar o ejecutar Chess Titans en su Windows XP, puede probar estos consejos de solución de problemas:</p>
|
74 |
-
<ul>
|
75 |
-
<li>Asegúrese de que ha descargado la versión correcta de Chess Titans para Windows XP.</li>
|
76 |
-
<li>Asegúrese de que tiene suficiente espacio en disco y memoria disponible en su computadora. </li>
|
77 |
-
<li>Asegúrese de haber actualizado sus controladores y software a las últimas versiones. </li>
|
78 |
-
<li>Asegúrese de que ha desactivado cualquier programa antivirus o firewall que pueda interferir con la instalación o ejecución de Chess Titans.</li>
|
79 |
-
<li>Asegúrese de haber ejecutado el juego como administrador. </li>
|
80 |
-
<li>Si el juego no se inicia o se bloquea, intente ejecutarlo en modo de compatibilidad para Windows Vista o Windows 7.</li>
|
81 |
-
<li> Si el juego no se muestra correctamente o tiene problemas gráficos, intente cambiar la resolución o la configuración de profundidad de color de su monitor. </li>
|
82 |
-
<li>Si el juego no responde a las entradas del ratón o del teclado, intenta desconectar y responder a tus dispositivos o usar diferentes puertos. </li>
|
83 |
-
<li>Si el juego no reproduce sonido o música, intente ajustar la configuración de volumen de sus altavoces o auriculares. </li>
|
84 |
-
<li>Si ninguno de estos consejos funciona, intente desinstalar y reinstalar el juego o póngase en contacto con el desarrollador o el sitio de descarga para obtener soporte. </li>
|
85 |
-
</ul>
|
86 |
-
<h2>Conclusión</h2>
|
87 |
-
|
88 |
-
<h4>Resumen del artículo</h4>
|
89 |
-
<p>Este artículo ha cubierto los siguientes temas:</p>
|
90 |
-
<ul>
|
91 |
-
<li>¿Qué es Titanes de Ajedrez y cuáles son sus características? </li>
|
92 |
-
<li>¿Por qué descargar Chess Titans para Windows XP y cuáles son los beneficios de jugar al ajedrez? </li>
|
93 |
-
<li> ¿Cómo descargar la versión completa de Chess Titans para Windows XP y cuáles son los requisitos y pasos? </li>
|
94 |
-
<li>¿Cuáles son algunas alternativas a los Titanes de Ajedrez para Windows XP y cuáles son sus descripciones? </li>
|
95 |
-
<li>¿Cuáles son algunos consejos de solución de problemas para instalar y ejecutar Chess Titans en Windows XP? </li>
|
96 |
-
</ul>
|
97 |
-
<h4>Preguntas frecuentes</h4>
|
98 |
-
<p>Aquí hay algunas preguntas frecuentes sobre los Titanes de Ajedrez y sus respuestas:</p>
|
99 |
-
<ol>
|
100 |
-
<li><b>Es Chess Titans gratis? </b><br>Sí, Chess Titans es gratis para descargar y jugar. Sin embargo, no es un producto oficial de Microsoft y no es compatible con ellos. Puede descargarlo de sitios de terceros bajo su propio riesgo. </li>
|
101 |
-
<li><b>¿Puedo jugar Titanes de Ajedrez en línea? </b><br>Sí, puedes jugar Titanes de Ajedrez en línea con otros jugadores si tienes una cuenta de Microsoft y una conexión a Internet. También puede jugar sin conexión con el ordenador u otra persona. </li>
|
102 |
-
¿Puedo cambiar el nivel de dificultad de los Titanes de Ajedrez? </b><br>Sí, puedes cambiar el nivel de dificultad de los Titanes de Ajedrez del 1 al 10, donde 1 es el más fácil y 10 el más difícil. También puede ajustar el límite de tiempo y el hándicap de cada jugador. </li>
|
103 |
-
<li><b>¿Puedo personalizar la apariencia de los Titanes de Ajedrez? </b><br>Sí, puede personalizar la apariencia de los Titanes de Ajedrez cambiando el estilo del tablero, el conjunto de piezas, el color de fondo y los efectos de sonido. También puede elegir entre vistas 2D y 3D. </li>
|
104 |
-
<li><b>¿Puedo guardar y cargar mis partidas en Titanes de Ajedrez? </b><br>Sí, puedes guardar y cargar tus partidas en Titanes de Ajedrez usando las opciones del menú. También puedes deshacer y rehacer tus movimientos, así como ver el historial de tus movimientos y las piezas capturadas. </li>
|
105 |
-
</ol></p> 64aa2da5cf<br />
|
106 |
-
<br />
|
107 |
-
<br />
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
spaces/Billyosoro/ESRGAN/realesrgan/data/realesrgan_paired_dataset.py
DELETED
@@ -1,108 +0,0 @@
|
|
1 |
-
import os
|
2 |
-
from basicsr.data.data_util import paired_paths_from_folder, paired_paths_from_lmdb
|
3 |
-
from basicsr.data.transforms import augment, paired_random_crop
|
4 |
-
from basicsr.utils import FileClient, imfrombytes, img2tensor
|
5 |
-
from basicsr.utils.registry import DATASET_REGISTRY
|
6 |
-
from torch.utils import data as data
|
7 |
-
from torchvision.transforms.functional import normalize
|
8 |
-
|
9 |
-
|
10 |
-
@DATASET_REGISTRY.register()
|
11 |
-
class RealESRGANPairedDataset(data.Dataset):
|
12 |
-
"""Paired image dataset for image restoration.
|
13 |
-
|
14 |
-
Read LQ (Low Quality, e.g. LR (Low Resolution), blurry, noisy, etc) and GT image pairs.
|
15 |
-
|
16 |
-
There are three modes:
|
17 |
-
1. 'lmdb': Use lmdb files.
|
18 |
-
If opt['io_backend'] == lmdb.
|
19 |
-
2. 'meta_info': Use meta information file to generate paths.
|
20 |
-
If opt['io_backend'] != lmdb and opt['meta_info'] is not None.
|
21 |
-
3. 'folder': Scan folders to generate paths.
|
22 |
-
The rest.
|
23 |
-
|
24 |
-
Args:
|
25 |
-
opt (dict): Config for train datasets. It contains the following keys:
|
26 |
-
dataroot_gt (str): Data root path for gt.
|
27 |
-
dataroot_lq (str): Data root path for lq.
|
28 |
-
meta_info (str): Path for meta information file.
|
29 |
-
io_backend (dict): IO backend type and other kwarg.
|
30 |
-
filename_tmpl (str): Template for each filename. Note that the template excludes the file extension.
|
31 |
-
Default: '{}'.
|
32 |
-
gt_size (int): Cropped patched size for gt patches.
|
33 |
-
use_hflip (bool): Use horizontal flips.
|
34 |
-
use_rot (bool): Use rotation (use vertical flip and transposing h
|
35 |
-
and w for implementation).
|
36 |
-
|
37 |
-
scale (bool): Scale, which will be added automatically.
|
38 |
-
phase (str): 'train' or 'val'.
|
39 |
-
"""
|
40 |
-
|
41 |
-
def __init__(self, opt):
|
42 |
-
super(RealESRGANPairedDataset, self).__init__()
|
43 |
-
self.opt = opt
|
44 |
-
self.file_client = None
|
45 |
-
self.io_backend_opt = opt['io_backend']
|
46 |
-
# mean and std for normalizing the input images
|
47 |
-
self.mean = opt['mean'] if 'mean' in opt else None
|
48 |
-
self.std = opt['std'] if 'std' in opt else None
|
49 |
-
|
50 |
-
self.gt_folder, self.lq_folder = opt['dataroot_gt'], opt['dataroot_lq']
|
51 |
-
self.filename_tmpl = opt['filename_tmpl'] if 'filename_tmpl' in opt else '{}'
|
52 |
-
|
53 |
-
# file client (lmdb io backend)
|
54 |
-
if self.io_backend_opt['type'] == 'lmdb':
|
55 |
-
self.io_backend_opt['db_paths'] = [self.lq_folder, self.gt_folder]
|
56 |
-
self.io_backend_opt['client_keys'] = ['lq', 'gt']
|
57 |
-
self.paths = paired_paths_from_lmdb([self.lq_folder, self.gt_folder], ['lq', 'gt'])
|
58 |
-
elif 'meta_info' in self.opt and self.opt['meta_info'] is not None:
|
59 |
-
# disk backend with meta_info
|
60 |
-
# Each line in the meta_info describes the relative path to an image
|
61 |
-
with open(self.opt['meta_info']) as fin:
|
62 |
-
paths = [line.strip() for line in fin]
|
63 |
-
self.paths = []
|
64 |
-
for path in paths:
|
65 |
-
gt_path, lq_path = path.split(', ')
|
66 |
-
gt_path = os.path.join(self.gt_folder, gt_path)
|
67 |
-
lq_path = os.path.join(self.lq_folder, lq_path)
|
68 |
-
self.paths.append(dict([('gt_path', gt_path), ('lq_path', lq_path)]))
|
69 |
-
else:
|
70 |
-
# disk backend
|
71 |
-
# it will scan the whole folder to get meta info
|
72 |
-
# it will be time-consuming for folders with too many files. It is recommended using an extra meta txt file
|
73 |
-
self.paths = paired_paths_from_folder([self.lq_folder, self.gt_folder], ['lq', 'gt'], self.filename_tmpl)
|
74 |
-
|
75 |
-
def __getitem__(self, index):
|
76 |
-
if self.file_client is None:
|
77 |
-
self.file_client = FileClient(self.io_backend_opt.pop('type'), **self.io_backend_opt)
|
78 |
-
|
79 |
-
scale = self.opt['scale']
|
80 |
-
|
81 |
-
# Load gt and lq images. Dimension order: HWC; channel order: BGR;
|
82 |
-
# image range: [0, 1], float32.
|
83 |
-
gt_path = self.paths[index]['gt_path']
|
84 |
-
img_bytes = self.file_client.get(gt_path, 'gt')
|
85 |
-
img_gt = imfrombytes(img_bytes, float32=True)
|
86 |
-
lq_path = self.paths[index]['lq_path']
|
87 |
-
img_bytes = self.file_client.get(lq_path, 'lq')
|
88 |
-
img_lq = imfrombytes(img_bytes, float32=True)
|
89 |
-
|
90 |
-
# augmentation for training
|
91 |
-
if self.opt['phase'] == 'train':
|
92 |
-
gt_size = self.opt['gt_size']
|
93 |
-
# random crop
|
94 |
-
img_gt, img_lq = paired_random_crop(img_gt, img_lq, gt_size, scale, gt_path)
|
95 |
-
# flip, rotation
|
96 |
-
img_gt, img_lq = augment([img_gt, img_lq], self.opt['use_hflip'], self.opt['use_rot'])
|
97 |
-
|
98 |
-
# BGR to RGB, HWC to CHW, numpy to tensor
|
99 |
-
img_gt, img_lq = img2tensor([img_gt, img_lq], bgr2rgb=True, float32=True)
|
100 |
-
# normalize
|
101 |
-
if self.mean is not None or self.std is not None:
|
102 |
-
normalize(img_lq, self.mean, self.std, inplace=True)
|
103 |
-
normalize(img_gt, self.mean, self.std, inplace=True)
|
104 |
-
|
105 |
-
return {'lq': img_lq, 'gt': img_gt, 'lq_path': lq_path, 'gt_path': gt_path}
|
106 |
-
|
107 |
-
def __len__(self):
|
108 |
-
return len(self.paths)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
spaces/BraydenMoore/MARCI-NFL-Betting/Source/Train/xgboost_OU.py
DELETED
@@ -1,70 +0,0 @@
|
|
1 |
-
import xgboost as xgb
|
2 |
-
import pandas as pd
|
3 |
-
import pickle as pkl
|
4 |
-
import numpy as np
|
5 |
-
from tqdm import tqdm
|
6 |
-
from IPython.display import clear_output
|
7 |
-
from sklearn.metrics import accuracy_score
|
8 |
-
from sklearn.model_selection import train_test_split
|
9 |
-
import os
|
10 |
-
|
11 |
-
current_directory = os.path.dirname(os.path.abspath(__file__))
|
12 |
-
parent_directory = os.path.dirname(current_directory)
|
13 |
-
data_directory = os.path.join(parent_directory, 'Data')
|
14 |
-
model_directory = os.path.join(parent_directory, 'Models')
|
15 |
-
pickle_directory = os.path.join(parent_directory, 'Pickles')
|
16 |
-
|
17 |
-
file_path = os.path.join(data_directory, 'gbg_and_odds.csv')
|
18 |
-
data = pd.read_csv(file_path).dropna()
|
19 |
-
|
20 |
-
OU = data['Over']
|
21 |
-
data.drop(columns=['Home-Team-Win','Over','Season','home_team','away_team','game_date','Key','Home Score','Away Score','Home Odds Close','Away Odds Close','Home Winnings','Away Winnings','Away Odds','Home Odds'], inplace=True)
|
22 |
-
|
23 |
-
acc_results = []
|
24 |
-
|
25 |
-
for x in tqdm(range(100)):
|
26 |
-
X_train, X_test, y_train, y_test = train_test_split(data, OU, test_size=.1)
|
27 |
-
|
28 |
-
train_games = X_train['game_id']
|
29 |
-
test_games = X_test['game_id']
|
30 |
-
|
31 |
-
X_train.drop(columns=['game_id'], inplace=True)
|
32 |
-
X_test.drop(columns=['game_id'], inplace=True)
|
33 |
-
|
34 |
-
train = xgb.DMatrix(X_train.astype(float).values, label=y_train)
|
35 |
-
test = xgb.DMatrix(X_test.astype(float).values, label=y_test)
|
36 |
-
|
37 |
-
param = {
|
38 |
-
'max_depth': 6,
|
39 |
-
'eta': 0.05,
|
40 |
-
'objective': 'multi:softprob',
|
41 |
-
'num_class': 3
|
42 |
-
}
|
43 |
-
epochs = 300
|
44 |
-
|
45 |
-
model = xgb.train(param, train, epochs)
|
46 |
-
predictions = model.predict(test)
|
47 |
-
y = []
|
48 |
-
|
49 |
-
for z in predictions:
|
50 |
-
y.append(np.argmax(z))
|
51 |
-
|
52 |
-
acc = round(accuracy_score(y_test, y)*100, 1)
|
53 |
-
acc_results.append(acc)
|
54 |
-
clear_output(wait=True)
|
55 |
-
print(f"Best accuracy: {max(acc_results)}%")
|
56 |
-
|
57 |
-
# only save results if they are the best so far
|
58 |
-
if acc == max(acc_results):
|
59 |
-
file_path = os.path.join(pickle_directory, 'train_games_OU_no_odds.pkl')
|
60 |
-
with open(file_path,'wb') as f:
|
61 |
-
pkl.dump(train_games,f)
|
62 |
-
|
63 |
-
file_path = os.path.join(pickle_directory, 'test_games_OU_no_odds.pkl')
|
64 |
-
with open(file_path,'wb') as f:
|
65 |
-
pkl.dump(test_games,f)
|
66 |
-
|
67 |
-
file_path = os.path.join(model_directory, f'xgboost_OU_no_odds_{acc}%.json')
|
68 |
-
model.save_model(file_path)
|
69 |
-
|
70 |
-
print('Done')
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
spaces/CVPR/Dual-Key_Backdoor_Attacks/datagen/detectron2/detectron2/model_zoo/model_zoo.py
DELETED
@@ -1,150 +0,0 @@
|
|
1 |
-
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved
|
2 |
-
import os
|
3 |
-
import pkg_resources
|
4 |
-
import torch
|
5 |
-
|
6 |
-
from detectron2.checkpoint import DetectionCheckpointer
|
7 |
-
from detectron2.config import get_cfg
|
8 |
-
from detectron2.modeling import build_model
|
9 |
-
|
10 |
-
|
11 |
-
class _ModelZooUrls(object):
|
12 |
-
"""
|
13 |
-
Mapping from names to officially released Detectron2 pre-trained models.
|
14 |
-
"""
|
15 |
-
|
16 |
-
S3_PREFIX = "https://dl.fbaipublicfiles.com/detectron2/"
|
17 |
-
|
18 |
-
# format: {config_path.yaml} -> model_id/model_final_{commit}.pkl
|
19 |
-
CONFIG_PATH_TO_URL_SUFFIX = {
|
20 |
-
# COCO Detection with Faster R-CNN
|
21 |
-
"COCO-Detection/faster_rcnn_R_50_C4_1x.yaml": "137257644/model_final_721ade.pkl",
|
22 |
-
"COCO-Detection/faster_rcnn_R_50_DC5_1x.yaml": "137847829/model_final_51d356.pkl",
|
23 |
-
"COCO-Detection/faster_rcnn_R_50_FPN_1x.yaml": "137257794/model_final_b275ba.pkl",
|
24 |
-
"COCO-Detection/faster_rcnn_R_50_C4_3x.yaml": "137849393/model_final_f97cb7.pkl",
|
25 |
-
"COCO-Detection/faster_rcnn_R_50_DC5_3x.yaml": "137849425/model_final_68d202.pkl",
|
26 |
-
"COCO-Detection/faster_rcnn_R_50_FPN_3x.yaml": "137849458/model_final_280758.pkl",
|
27 |
-
"COCO-Detection/faster_rcnn_R_101_C4_3x.yaml": "138204752/model_final_298dad.pkl",
|
28 |
-
"COCO-Detection/faster_rcnn_R_101_DC5_3x.yaml": "138204841/model_final_3e0943.pkl",
|
29 |
-
"COCO-Detection/faster_rcnn_R_101_FPN_3x.yaml": "137851257/model_final_f6e8b1.pkl",
|
30 |
-
"COCO-Detection/faster_rcnn_X_101_32x8d_FPN_3x.yaml": "139173657/model_final_68b088.pkl",
|
31 |
-
# COCO Detection with RetinaNet
|
32 |
-
"COCO-Detection/retinanet_R_50_FPN_1x.yaml": "137593951/model_final_b796dc.pkl",
|
33 |
-
"COCO-Detection/retinanet_R_50_FPN_3x.yaml": "137849486/model_final_4cafe0.pkl",
|
34 |
-
"COCO-Detection/retinanet_R_101_FPN_3x.yaml": "138363263/model_final_59f53c.pkl",
|
35 |
-
# COCO Detection with RPN and Fast R-CNN
|
36 |
-
"COCO-Detection/rpn_R_50_C4_1x.yaml": "137258005/model_final_450694.pkl",
|
37 |
-
"COCO-Detection/rpn_R_50_FPN_1x.yaml": "137258492/model_final_02ce48.pkl",
|
38 |
-
"COCO-Detection/fast_rcnn_R_50_FPN_1x.yaml": "137635226/model_final_e5f7ce.pkl",
|
39 |
-
# COCO Instance Segmentation Baselines with Mask R-CNN
|
40 |
-
"COCO-InstanceSegmentation/mask_rcnn_R_50_C4_1x.yaml": "137259246/model_final_9243eb.pkl",
|
41 |
-
"COCO-InstanceSegmentation/mask_rcnn_R_50_DC5_1x.yaml": "137260150/model_final_4f86c3.pkl",
|
42 |
-
"COCO-InstanceSegmentation/mask_rcnn_R_50_FPN_1x.yaml": "137260431/model_final_a54504.pkl",
|
43 |
-
"COCO-InstanceSegmentation/mask_rcnn_R_50_C4_3x.yaml": "137849525/model_final_4ce675.pkl",
|
44 |
-
"COCO-InstanceSegmentation/mask_rcnn_R_50_DC5_3x.yaml": "137849551/model_final_84107b.pkl",
|
45 |
-
"COCO-InstanceSegmentation/mask_rcnn_R_50_FPN_3x.yaml": "137849600/model_final_f10217.pkl",
|
46 |
-
"COCO-InstanceSegmentation/mask_rcnn_R_101_C4_3x.yaml": "138363239/model_final_a2914c.pkl",
|
47 |
-
"COCO-InstanceSegmentation/mask_rcnn_R_101_DC5_3x.yaml": "138363294/model_final_0464b7.pkl",
|
48 |
-
"COCO-InstanceSegmentation/mask_rcnn_R_101_FPN_3x.yaml": "138205316/model_final_a3ec72.pkl",
|
49 |
-
"COCO-InstanceSegmentation/mask_rcnn_X_101_32x8d_FPN_3x.yaml": "139653917/model_final_2d9806.pkl", # noqa
|
50 |
-
# COCO Person Keypoint Detection Baselines with Keypoint R-CNN
|
51 |
-
"COCO-Keypoints/keypoint_rcnn_R_50_FPN_1x.yaml": "137261548/model_final_04e291.pkl",
|
52 |
-
"COCO-Keypoints/keypoint_rcnn_R_50_FPN_3x.yaml": "137849621/model_final_a6e10b.pkl",
|
53 |
-
"COCO-Keypoints/keypoint_rcnn_R_101_FPN_3x.yaml": "138363331/model_final_997cc7.pkl",
|
54 |
-
"COCO-Keypoints/keypoint_rcnn_X_101_32x8d_FPN_3x.yaml": "139686956/model_final_5ad38f.pkl",
|
55 |
-
# COCO Panoptic Segmentation Baselines with Panoptic FPN
|
56 |
-
"COCO-PanopticSegmentation/panoptic_fpn_R_50_1x.yaml": "139514544/model_final_dbfeb4.pkl",
|
57 |
-
"COCO-PanopticSegmentation/panoptic_fpn_R_50_3x.yaml": "139514569/model_final_c10459.pkl",
|
58 |
-
"COCO-PanopticSegmentation/panoptic_fpn_R_101_3x.yaml": "139514519/model_final_cafdb1.pkl",
|
59 |
-
# LVIS Instance Segmentation Baselines with Mask R-CNN
|
60 |
-
"LVIS-InstanceSegmentation/mask_rcnn_R_50_FPN_1x.yaml": "144219072/model_final_571f7c.pkl",
|
61 |
-
"LVIS-InstanceSegmentation/mask_rcnn_R_101_FPN_1x.yaml": "144219035/model_final_824ab5.pkl",
|
62 |
-
"LVIS-InstanceSegmentation/mask_rcnn_X_101_32x8d_FPN_1x.yaml": "144219108/model_final_5e3439.pkl", # noqa
|
63 |
-
# Cityscapes & Pascal VOC Baselines
|
64 |
-
"Cityscapes/mask_rcnn_R_50_FPN.yaml": "142423278/model_final_af9cf5.pkl",
|
65 |
-
"PascalVOC-Detection/faster_rcnn_R_50_C4.yaml": "142202221/model_final_b1acc2.pkl",
|
66 |
-
# Other Settings
|
67 |
-
"Misc/mask_rcnn_R_50_FPN_1x_dconv_c3-c5.yaml": "138602867/model_final_65c703.pkl",
|
68 |
-
"Misc/mask_rcnn_R_50_FPN_3x_dconv_c3-c5.yaml": "144998336/model_final_821d0b.pkl",
|
69 |
-
"Misc/cascade_mask_rcnn_R_50_FPN_1x.yaml": "138602847/model_final_e9d89b.pkl",
|
70 |
-
"Misc/cascade_mask_rcnn_R_50_FPN_3x.yaml": "144998488/model_final_480dd8.pkl",
|
71 |
-
"Misc/mask_rcnn_R_50_FPN_3x_syncbn.yaml": "169527823/model_final_3b3c51.pkl",
|
72 |
-
"Misc/mask_rcnn_R_50_FPN_3x_gn.yaml": "138602888/model_final_dc5d9e.pkl",
|
73 |
-
"Misc/scratch_mask_rcnn_R_50_FPN_3x_gn.yaml": "138602908/model_final_01ca85.pkl",
|
74 |
-
"Misc/panoptic_fpn_R_101_dconv_cascade_gn_3x.yaml": "139797668/model_final_be35db.pkl",
|
75 |
-
"Misc/cascade_mask_rcnn_X_152_32x8d_FPN_IN5k_gn_dconv.yaml": "18131413/model_0039999_e76410.pkl", # noqa
|
76 |
-
# D1 Comparisons
|
77 |
-
"Detectron1-Comparisons/faster_rcnn_R_50_FPN_noaug_1x.yaml": "137781054/model_final_7ab50c.pkl", # noqa
|
78 |
-
"Detectron1-Comparisons/mask_rcnn_R_50_FPN_noaug_1x.yaml": "137781281/model_final_62ca52.pkl", # noqa
|
79 |
-
"Detectron1-Comparisons/keypoint_rcnn_R_50_FPN_1x.yaml": "137781195/model_final_cce136.pkl",
|
80 |
-
}
|
81 |
-
|
82 |
-
|
83 |
-
def get_checkpoint_url(config_path):
|
84 |
-
"""
|
85 |
-
Returns the URL to the model trained using the given config
|
86 |
-
|
87 |
-
Args:
|
88 |
-
config_path (str): config file name relative to detectron2's "configs/"
|
89 |
-
directory, e.g., "COCO-InstanceSegmentation/mask_rcnn_R_50_FPN_1x.yaml"
|
90 |
-
|
91 |
-
Returns:
|
92 |
-
str: a URL to the model
|
93 |
-
"""
|
94 |
-
name = config_path.replace(".yaml", "")
|
95 |
-
if config_path in _ModelZooUrls.CONFIG_PATH_TO_URL_SUFFIX:
|
96 |
-
suffix = _ModelZooUrls.CONFIG_PATH_TO_URL_SUFFIX[config_path]
|
97 |
-
return _ModelZooUrls.S3_PREFIX + name + "/" + suffix
|
98 |
-
raise RuntimeError("{} not available in Model Zoo!".format(name))
|
99 |
-
|
100 |
-
|
101 |
-
def get_config_file(config_path):
|
102 |
-
"""
|
103 |
-
Returns path to a builtin config file.
|
104 |
-
|
105 |
-
Args:
|
106 |
-
config_path (str): config file name relative to detectron2's "configs/"
|
107 |
-
directory, e.g., "COCO-InstanceSegmentation/mask_rcnn_R_50_FPN_1x.yaml"
|
108 |
-
|
109 |
-
Returns:
|
110 |
-
str: the real path to the config file.
|
111 |
-
"""
|
112 |
-
cfg_file = pkg_resources.resource_filename(
|
113 |
-
"detectron2.model_zoo", os.path.join("configs", config_path)
|
114 |
-
)
|
115 |
-
if not os.path.exists(cfg_file):
|
116 |
-
raise RuntimeError("{} not available in Model Zoo!".format(config_path))
|
117 |
-
return cfg_file
|
118 |
-
|
119 |
-
|
120 |
-
def get(config_path, trained: bool = False):
|
121 |
-
"""
|
122 |
-
Get a model specified by relative path under Detectron2's official ``configs/`` directory.
|
123 |
-
|
124 |
-
Args:
|
125 |
-
config_path (str): config file name relative to detectron2's "configs/"
|
126 |
-
directory, e.g., "COCO-InstanceSegmentation/mask_rcnn_R_50_FPN_1x.yaml"
|
127 |
-
trained (bool): If True, will initialize the model with the trained model zoo weights.
|
128 |
-
If False, the checkpoint specified in the config file's ``MODEL.WEIGHTS`` is used
|
129 |
-
instead; this will typically (though not always) initialize a subset of weights using
|
130 |
-
an ImageNet pre-trained model, while randomly initializing the other weights.
|
131 |
-
|
132 |
-
Example:
|
133 |
-
|
134 |
-
.. code-block:: python
|
135 |
-
|
136 |
-
from detectron2 import model_zoo
|
137 |
-
model = model_zoo.get("COCO-InstanceSegmentation/mask_rcnn_R_50_FPN_1x.yaml", trained=True)
|
138 |
-
"""
|
139 |
-
cfg_file = get_config_file(config_path)
|
140 |
-
|
141 |
-
cfg = get_cfg()
|
142 |
-
cfg.merge_from_file(cfg_file)
|
143 |
-
if trained:
|
144 |
-
cfg.MODEL.WEIGHTS = get_checkpoint_url(config_path)
|
145 |
-
if not torch.cuda.is_available():
|
146 |
-
cfg.MODEL.DEVICE = "cpu"
|
147 |
-
|
148 |
-
model = build_model(cfg)
|
149 |
-
DetectionCheckpointer(model).load(cfg.MODEL.WEIGHTS)
|
150 |
-
return model
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
spaces/CVPR/LIVE/pybind11/README.md
DELETED
@@ -1,143 +0,0 @@
|
|
1 |
-

|
2 |
-
|
3 |
-
# pybind11 — Seamless operability between C++11 and Python
|
4 |
-
|
5 |
-
[](http://pybind11.readthedocs.org/en/master/?badge=master)
|
6 |
-
[](http://pybind11.readthedocs.org/en/stable/?badge=stable)
|
7 |
-
[](https://gitter.im/pybind/Lobby)
|
8 |
-
[](https://github.com/pybind/pybind11/actions)
|
9 |
-
[](https://ci.appveyor.com/project/wjakob/pybind11)
|
10 |
-
|
11 |
-
**pybind11** is a lightweight header-only library that exposes C++ types in
|
12 |
-
Python and vice versa, mainly to create Python bindings of existing C++ code.
|
13 |
-
Its goals and syntax are similar to the excellent [Boost.Python][] library by
|
14 |
-
David Abrahams: to minimize boilerplate code in traditional extension modules
|
15 |
-
by inferring type information using compile-time introspection.
|
16 |
-
|
17 |
-
The main issue with Boost.Python—and the reason for creating such a similar
|
18 |
-
project—is Boost. Boost is an enormously large and complex suite of utility
|
19 |
-
libraries that works with almost every C++ compiler in existence. This
|
20 |
-
compatibility has its cost: arcane template tricks and workarounds are
|
21 |
-
necessary to support the oldest and buggiest of compiler specimens. Now that
|
22 |
-
C++11-compatible compilers are widely available, this heavy machinery has
|
23 |
-
become an excessively large and unnecessary dependency.
|
24 |
-
|
25 |
-
Think of this library as a tiny self-contained version of Boost.Python with
|
26 |
-
everything stripped away that isn't relevant for binding generation. Without
|
27 |
-
comments, the core header files only require ~4K lines of code and depend on
|
28 |
-
Python (2.7 or 3.5+, or PyPy) and the C++ standard library. This compact
|
29 |
-
implementation was possible thanks to some of the new C++11 language features
|
30 |
-
(specifically: tuples, lambda functions and variadic templates). Since its
|
31 |
-
creation, this library has grown beyond Boost.Python in many ways, leading to
|
32 |
-
dramatically simpler binding code in many common situations.
|
33 |
-
|
34 |
-
Tutorial and reference documentation is provided at
|
35 |
-
[pybind11.readthedocs.org][]. A PDF version of the manual is available
|
36 |
-
[here][docs-pdf].
|
37 |
-
|
38 |
-
## Core features
|
39 |
-
pybind11 can map the following core C++ features to Python:
|
40 |
-
|
41 |
-
- Functions accepting and returning custom data structures per value, reference, or pointer
|
42 |
-
- Instance methods and static methods
|
43 |
-
- Overloaded functions
|
44 |
-
- Instance attributes and static attributes
|
45 |
-
- Arbitrary exception types
|
46 |
-
- Enumerations
|
47 |
-
- Callbacks
|
48 |
-
- Iterators and ranges
|
49 |
-
- Custom operators
|
50 |
-
- Single and multiple inheritance
|
51 |
-
- STL data structures
|
52 |
-
- Smart pointers with reference counting like `std::shared_ptr`
|
53 |
-
- Internal references with correct reference counting
|
54 |
-
- C++ classes with virtual (and pure virtual) methods can be extended in Python
|
55 |
-
|
56 |
-
## Goodies
|
57 |
-
In addition to the core functionality, pybind11 provides some extra goodies:
|
58 |
-
|
59 |
-
- Python 2.7, 3.5+, and PyPy (tested on 7.3) are supported with an implementation-agnostic
|
60 |
-
interface.
|
61 |
-
|
62 |
-
- It is possible to bind C++11 lambda functions with captured variables. The
|
63 |
-
lambda capture data is stored inside the resulting Python function object.
|
64 |
-
|
65 |
-
- pybind11 uses C++11 move constructors and move assignment operators whenever
|
66 |
-
possible to efficiently transfer custom data types.
|
67 |
-
|
68 |
-
- It's easy to expose the internal storage of custom data types through
|
69 |
-
Pythons' buffer protocols. This is handy e.g. for fast conversion between
|
70 |
-
C++ matrix classes like Eigen and NumPy without expensive copy operations.
|
71 |
-
|
72 |
-
- pybind11 can automatically vectorize functions so that they are transparently
|
73 |
-
applied to all entries of one or more NumPy array arguments.
|
74 |
-
|
75 |
-
- Python's slice-based access and assignment operations can be supported with
|
76 |
-
just a few lines of code.
|
77 |
-
|
78 |
-
- Everything is contained in just a few header files; there is no need to link
|
79 |
-
against any additional libraries.
|
80 |
-
|
81 |
-
- Binaries are generally smaller by a factor of at least 2 compared to
|
82 |
-
equivalent bindings generated by Boost.Python. A recent pybind11 conversion
|
83 |
-
of PyRosetta, an enormous Boost.Python binding project,
|
84 |
-
[reported][pyrosetta-report] a binary size reduction of **5.4x** and compile
|
85 |
-
time reduction by **5.8x**.
|
86 |
-
|
87 |
-
- Function signatures are precomputed at compile time (using `constexpr`),
|
88 |
-
leading to smaller binaries.
|
89 |
-
|
90 |
-
- With little extra effort, C++ types can be pickled and unpickled similar to
|
91 |
-
regular Python objects.
|
92 |
-
|
93 |
-
## Supported compilers
|
94 |
-
|
95 |
-
1. Clang/LLVM 3.3 or newer (for Apple Xcode's clang, this is 5.0.0 or newer)
|
96 |
-
2. GCC 4.8 or newer
|
97 |
-
3. Microsoft Visual Studio 2015 Update 3 or newer
|
98 |
-
4. Intel C++ compiler 17 or newer (16 with pybind11 v2.0 and 15 with pybind11
|
99 |
-
v2.0 and a [workaround][intel-15-workaround])
|
100 |
-
5. Cygwin/GCC (tested on 2.5.1)
|
101 |
-
|
102 |
-
## About
|
103 |
-
|
104 |
-
This project was created by [Wenzel Jakob](http://rgl.epfl.ch/people/wjakob).
|
105 |
-
Significant features and/or improvements to the code were contributed by
|
106 |
-
Jonas Adler,
|
107 |
-
Lori A. Burns,
|
108 |
-
Sylvain Corlay,
|
109 |
-
Trent Houliston,
|
110 |
-
Axel Huebl,
|
111 |
-
@hulucc,
|
112 |
-
Sergey Lyskov
|
113 |
-
Johan Mabille,
|
114 |
-
Tomasz Miąsko,
|
115 |
-
Dean Moldovan,
|
116 |
-
Ben Pritchard,
|
117 |
-
Jason Rhinelander,
|
118 |
-
Boris Schäling,
|
119 |
-
Pim Schellart,
|
120 |
-
Henry Schreiner,
|
121 |
-
Ivan Smirnov, and
|
122 |
-
Patrick Stewart.
|
123 |
-
|
124 |
-
### Contributing
|
125 |
-
|
126 |
-
See the [contributing guide][] for information on building and contributing to
|
127 |
-
pybind11.
|
128 |
-
|
129 |
-
|
130 |
-
### License
|
131 |
-
|
132 |
-
pybind11 is provided under a BSD-style license that can be found in the
|
133 |
-
[`LICENSE`][] file. By using, distributing, or contributing to this project,
|
134 |
-
you agree to the terms and conditions of this license.
|
135 |
-
|
136 |
-
|
137 |
-
[pybind11.readthedocs.org]: http://pybind11.readthedocs.org/en/master
|
138 |
-
[docs-pdf]: https://media.readthedocs.org/pdf/pybind11/master/pybind11.pdf
|
139 |
-
[Boost.Python]: http://www.boost.org/doc/libs/1_58_0/libs/python/doc/
|
140 |
-
[pyrosetta-report]: http://graylab.jhu.edu/RosettaCon2016/PyRosetta-4.pdf
|
141 |
-
[contributing guide]: https://github.com/pybind/pybind11/blob/master/.github/CONTRIBUTING.md
|
142 |
-
[`LICENSE`]: https://github.com/pybind/pybind11/blob/master/LICENSE
|
143 |
-
[intel-15-workaround]: https://github.com/pybind/pybind11/issues/276
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
spaces/CVPR/LIVE/thrust/thrust/detail/complex/ccosh.h
DELETED
@@ -1,213 +0,0 @@
|
|
1 |
-
/*
|
2 |
-
* Copyright 2008-2013 NVIDIA Corporation
|
3 |
-
* Copyright 2013 Filipe RNC Maia
|
4 |
-
*
|
5 |
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
6 |
-
* you may not use this file except in compliance with the License.
|
7 |
-
* You may obtain a copy of the License at
|
8 |
-
*
|
9 |
-
* http://www.apache.org/licenses/LICENSE-2.0
|
10 |
-
*
|
11 |
-
* Unless required by applicable law or agreed to in writing, software
|
12 |
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
13 |
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
14 |
-
* See the License for the specific language governing permissions and
|
15 |
-
* limitations under the License.
|
16 |
-
*/
|
17 |
-
|
18 |
-
/*-
|
19 |
-
* Copyright (c) 2005 Bruce D. Evans and Steven G. Kargl
|
20 |
-
* All rights reserved.
|
21 |
-
*
|
22 |
-
* Redistribution and use in source and binary forms, with or without
|
23 |
-
* modification, are permitted provided that the following conditions
|
24 |
-
* are met:
|
25 |
-
* 1. Redistributions of source code must retain the above copyright
|
26 |
-
* notice unmodified, this list of conditions, and the following
|
27 |
-
* disclaimer.
|
28 |
-
* 2. Redistributions in binary form must reproduce the above copyright
|
29 |
-
* notice, this list of conditions and the following disclaimer in the
|
30 |
-
* documentation and/or other materials provided with the distribution.
|
31 |
-
*
|
32 |
-
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
33 |
-
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
34 |
-
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
35 |
-
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
|
36 |
-
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
37 |
-
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
38 |
-
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
39 |
-
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
40 |
-
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
41 |
-
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
42 |
-
*/
|
43 |
-
|
44 |
-
/* adapted from FreeBSD:
|
45 |
-
* lib/msun/src/s_ccosh.c
|
46 |
-
*/
|
47 |
-
|
48 |
-
#pragma once
|
49 |
-
|
50 |
-
#include <thrust/complex.h>
|
51 |
-
#include <thrust/detail/complex/math_private.h>
|
52 |
-
|
53 |
-
namespace thrust{
|
54 |
-
namespace detail{
|
55 |
-
namespace complex{
|
56 |
-
|
57 |
-
/*
|
58 |
-
* Hyperbolic cosine of a complex argument z = x + i y.
|
59 |
-
*
|
60 |
-
* cosh(z) = cosh(x+iy)
|
61 |
-
* = cosh(x) cos(y) + i sinh(x) sin(y).
|
62 |
-
*
|
63 |
-
* Exceptional values are noted in the comments within the source code.
|
64 |
-
* These values and the return value were taken from n1124.pdf.
|
65 |
-
*/
|
66 |
-
|
67 |
-
__host__ __device__ inline
|
68 |
-
thrust::complex<double> ccosh(const thrust::complex<double>& z){
|
69 |
-
|
70 |
-
|
71 |
-
const double huge = 8.98846567431157953864652595395e+307; // 0x1p1023
|
72 |
-
double x, y, h;
|
73 |
-
uint32_t hx, hy, ix, iy, lx, ly;
|
74 |
-
|
75 |
-
x = z.real();
|
76 |
-
y = z.imag();
|
77 |
-
|
78 |
-
extract_words(hx, lx, x);
|
79 |
-
extract_words(hy, ly, y);
|
80 |
-
|
81 |
-
ix = 0x7fffffff & hx;
|
82 |
-
iy = 0x7fffffff & hy;
|
83 |
-
|
84 |
-
/* Handle the nearly-non-exceptional cases where x and y are finite. */
|
85 |
-
if (ix < 0x7ff00000 && iy < 0x7ff00000) {
|
86 |
-
if ((iy | ly) == 0)
|
87 |
-
return (thrust::complex<double>(::cosh(x), x * y));
|
88 |
-
if (ix < 0x40360000) /* small x: normal case */
|
89 |
-
return (thrust::complex<double>(::cosh(x) * ::cos(y), ::sinh(x) * ::sin(y)));
|
90 |
-
|
91 |
-
/* |x| >= 22, so cosh(x) ~= exp(|x|) */
|
92 |
-
if (ix < 0x40862e42) {
|
93 |
-
/* x < 710: exp(|x|) won't overflow */
|
94 |
-
h = ::exp(::fabs(x)) * 0.5;
|
95 |
-
return (thrust::complex<double>(h * cos(y), copysign(h, x) * sin(y)));
|
96 |
-
} else if (ix < 0x4096bbaa) {
|
97 |
-
/* x < 1455: scale to avoid overflow */
|
98 |
-
thrust::complex<double> z_;
|
99 |
-
z_ = ldexp_cexp(thrust::complex<double>(fabs(x), y), -1);
|
100 |
-
return (thrust::complex<double>(z_.real(), z_.imag() * copysign(1.0, x)));
|
101 |
-
} else {
|
102 |
-
/* x >= 1455: the result always overflows */
|
103 |
-
h = huge * x;
|
104 |
-
return (thrust::complex<double>(h * h * cos(y), h * sin(y)));
|
105 |
-
}
|
106 |
-
}
|
107 |
-
|
108 |
-
/*
|
109 |
-
* cosh(+-0 +- I Inf) = dNaN + I sign(d(+-0, dNaN))0.
|
110 |
-
* The sign of 0 in the result is unspecified. Choice = normally
|
111 |
-
* the same as dNaN. Raise the invalid floating-point exception.
|
112 |
-
*
|
113 |
-
* cosh(+-0 +- I NaN) = d(NaN) + I sign(d(+-0, NaN))0.
|
114 |
-
* The sign of 0 in the result is unspecified. Choice = normally
|
115 |
-
* the same as d(NaN).
|
116 |
-
*/
|
117 |
-
if ((ix | lx) == 0 && iy >= 0x7ff00000)
|
118 |
-
return (thrust::complex<double>(y - y, copysign(0.0, x * (y - y))));
|
119 |
-
|
120 |
-
/*
|
121 |
-
* cosh(+-Inf +- I 0) = +Inf + I (+-)(+-)0.
|
122 |
-
*
|
123 |
-
* cosh(NaN +- I 0) = d(NaN) + I sign(d(NaN, +-0))0.
|
124 |
-
* The sign of 0 in the result is unspecified.
|
125 |
-
*/
|
126 |
-
if ((iy | ly) == 0 && ix >= 0x7ff00000) {
|
127 |
-
if (((hx & 0xfffff) | lx) == 0)
|
128 |
-
return (thrust::complex<double>(x * x, copysign(0.0, x) * y));
|
129 |
-
return (thrust::complex<double>(x * x, copysign(0.0, (x + x) * y)));
|
130 |
-
}
|
131 |
-
|
132 |
-
/*
|
133 |
-
* cosh(x +- I Inf) = dNaN + I dNaN.
|
134 |
-
* Raise the invalid floating-point exception for finite nonzero x.
|
135 |
-
*
|
136 |
-
* cosh(x + I NaN) = d(NaN) + I d(NaN).
|
137 |
-
* Optionally raises the invalid floating-point exception for finite
|
138 |
-
* nonzero x. Choice = don't raise (except for signaling NaNs).
|
139 |
-
*/
|
140 |
-
if (ix < 0x7ff00000 && iy >= 0x7ff00000)
|
141 |
-
return (thrust::complex<double>(y - y, x * (y - y)));
|
142 |
-
|
143 |
-
/*
|
144 |
-
* cosh(+-Inf + I NaN) = +Inf + I d(NaN).
|
145 |
-
*
|
146 |
-
* cosh(+-Inf +- I Inf) = +Inf + I dNaN.
|
147 |
-
* The sign of Inf in the result is unspecified. Choice = always +.
|
148 |
-
* Raise the invalid floating-point exception.
|
149 |
-
*
|
150 |
-
* cosh(+-Inf + I y) = +Inf cos(y) +- I Inf sin(y)
|
151 |
-
*/
|
152 |
-
if (ix >= 0x7ff00000 && ((hx & 0xfffff) | lx) == 0) {
|
153 |
-
if (iy >= 0x7ff00000)
|
154 |
-
return (thrust::complex<double>(x * x, x * (y - y)));
|
155 |
-
return (thrust::complex<double>((x * x) * cos(y), x * sin(y)));
|
156 |
-
}
|
157 |
-
|
158 |
-
/*
|
159 |
-
* cosh(NaN + I NaN) = d(NaN) + I d(NaN).
|
160 |
-
*
|
161 |
-
* cosh(NaN +- I Inf) = d(NaN) + I d(NaN).
|
162 |
-
* Optionally raises the invalid floating-point exception.
|
163 |
-
* Choice = raise.
|
164 |
-
*
|
165 |
-
* cosh(NaN + I y) = d(NaN) + I d(NaN).
|
166 |
-
* Optionally raises the invalid floating-point exception for finite
|
167 |
-
* nonzero y. Choice = don't raise (except for signaling NaNs).
|
168 |
-
*/
|
169 |
-
return (thrust::complex<double>((x * x) * (y - y), (x + x) * (y - y)));
|
170 |
-
}
|
171 |
-
|
172 |
-
|
173 |
-
__host__ __device__ inline
|
174 |
-
thrust::complex<double> ccos(const thrust::complex<double>& z){
|
175 |
-
/* ccos(z) = ccosh(I * z) */
|
176 |
-
return (ccosh(thrust::complex<double>(-z.imag(), z.real())));
|
177 |
-
}
|
178 |
-
|
179 |
-
} // namespace complex
|
180 |
-
|
181 |
-
} // namespace detail
|
182 |
-
|
183 |
-
template <typename ValueType>
|
184 |
-
__host__ __device__
|
185 |
-
inline complex<ValueType> cos(const complex<ValueType>& z){
|
186 |
-
const ValueType re = z.real();
|
187 |
-
const ValueType im = z.imag();
|
188 |
-
return complex<ValueType>(std::cos(re) * std::cosh(im),
|
189 |
-
-std::sin(re) * std::sinh(im));
|
190 |
-
}
|
191 |
-
|
192 |
-
template <typename ValueType>
|
193 |
-
__host__ __device__
|
194 |
-
inline complex<ValueType> cosh(const complex<ValueType>& z){
|
195 |
-
const ValueType re = z.real();
|
196 |
-
const ValueType im = z.imag();
|
197 |
-
return complex<ValueType>(std::cosh(re) * std::cos(im),
|
198 |
-
std::sinh(re) * std::sin(im));
|
199 |
-
}
|
200 |
-
|
201 |
-
template <>
|
202 |
-
__host__ __device__
|
203 |
-
inline thrust::complex<double> cos(const thrust::complex<double>& z){
|
204 |
-
return detail::complex::ccos(z);
|
205 |
-
}
|
206 |
-
|
207 |
-
template <>
|
208 |
-
__host__ __device__
|
209 |
-
inline thrust::complex<double> cosh(const thrust::complex<double>& z){
|
210 |
-
return detail::complex::ccosh(z);
|
211 |
-
}
|
212 |
-
|
213 |
-
} // namespace thrust
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
spaces/CVPR/LIVE/thrust/thrust/logical.h
DELETED
@@ -1,279 +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 |
-
/*! \file logical.h
|
19 |
-
* \brief Logical operations on ranges
|
20 |
-
*/
|
21 |
-
|
22 |
-
#pragma once
|
23 |
-
|
24 |
-
#include <thrust/detail/config.h>
|
25 |
-
#include <thrust/detail/execution_policy.h>
|
26 |
-
|
27 |
-
namespace thrust
|
28 |
-
{
|
29 |
-
|
30 |
-
|
31 |
-
/*! \addtogroup reductions
|
32 |
-
* \{
|
33 |
-
* \addtogroup logical
|
34 |
-
* \ingroup reductions
|
35 |
-
* \{
|
36 |
-
*/
|
37 |
-
|
38 |
-
|
39 |
-
/*! \p all_of determines whether all elements in a range satify a predicate.
|
40 |
-
* Specifically, \p all_of returns \c true if <tt>pred(*i)</tt> is \c true
|
41 |
-
* for every iterator \c i in the range <tt>[first, last)</tt> and
|
42 |
-
* \c false otherwise.
|
43 |
-
*
|
44 |
-
* The algorithm's execution is parallelized as determined by \p exec.
|
45 |
-
*
|
46 |
-
* \param exec The execution policy to use for parallelization.
|
47 |
-
* \param first The beginning of the sequence.
|
48 |
-
* \param last The end of the sequence.
|
49 |
-
* \param pred A predicate used to test range elements.
|
50 |
-
* \return \c true, if all elements satisfy the predicate; \c false, otherwise.
|
51 |
-
*
|
52 |
-
* \tparam DerivedPolicy The name of the derived execution policy.
|
53 |
-
* \tparam InputIterator is a model of <a href="http://www.sgi.com/tech/stl/InputIterator.html">Input Iterator</a>,
|
54 |
-
* \tparam Predicate must be a model of <a href="http://www.sgi.com/tech/stl/Predicate.html">Predicate</a>.
|
55 |
-
*
|
56 |
-
* \code
|
57 |
-
* #include <thrust/logical.h>
|
58 |
-
* #include <thrust/functional.h>
|
59 |
-
* #include <thrust/execution_policy.h>
|
60 |
-
* ...
|
61 |
-
* bool A[3] = {true, true, false};
|
62 |
-
*
|
63 |
-
* thrust::all_of(thrust::host, A, A + 2, thrust::identity<bool>()); // returns true
|
64 |
-
* thrust::all_of(thrust::host, A, A + 3, thrust::identity<bool>()); // returns false
|
65 |
-
*
|
66 |
-
* // empty range
|
67 |
-
* thrust::all_of(thrust::host, A, A, thrust::identity<bool>()); // returns false
|
68 |
-
*
|
69 |
-
* \endcode
|
70 |
-
*
|
71 |
-
* \see any_of
|
72 |
-
* \see none_of
|
73 |
-
* \see transform_reduce
|
74 |
-
*/
|
75 |
-
template<typename DerivedPolicy, typename InputIterator, typename Predicate>
|
76 |
-
__host__ __device__
|
77 |
-
bool all_of(const thrust::detail::execution_policy_base<DerivedPolicy> &exec, InputIterator first, InputIterator last, Predicate pred);
|
78 |
-
|
79 |
-
|
80 |
-
/*! \p all_of determines whether all elements in a range satify a predicate.
|
81 |
-
* Specifically, \p all_of returns \c true if <tt>pred(*i)</tt> is \c true
|
82 |
-
* for every iterator \c i in the range <tt>[first, last)</tt> and
|
83 |
-
* \c false otherwise.
|
84 |
-
*
|
85 |
-
* \param first The beginning of the sequence.
|
86 |
-
* \param last The end of the sequence.
|
87 |
-
* \param pred A predicate used to test range elements.
|
88 |
-
* \return \c true, if all elements satisfy the predicate; \c false, otherwise.
|
89 |
-
*
|
90 |
-
* \tparam InputIterator is a model of <a href="http://www.sgi.com/tech/stl/InputIterator.html">Input Iterator</a>,
|
91 |
-
* \tparam Predicate must be a model of <a href="http://www.sgi.com/tech/stl/Predicate.html">Predicate</a>.
|
92 |
-
*
|
93 |
-
* \code
|
94 |
-
* #include <thrust/logical.h>
|
95 |
-
* #include <thrust/functional.h>
|
96 |
-
* ...
|
97 |
-
* bool A[3] = {true, true, false};
|
98 |
-
*
|
99 |
-
* thrust::all_of(A, A + 2, thrust::identity<bool>()); // returns true
|
100 |
-
* thrust::all_of(A, A + 3, thrust::identity<bool>()); // returns false
|
101 |
-
*
|
102 |
-
* // empty range
|
103 |
-
* thrust::all_of(A, A, thrust::identity<bool>()); // returns false
|
104 |
-
*
|
105 |
-
* \endcode
|
106 |
-
*
|
107 |
-
* \see any_of
|
108 |
-
* \see none_of
|
109 |
-
* \see transform_reduce
|
110 |
-
*/
|
111 |
-
template<typename InputIterator, typename Predicate>
|
112 |
-
bool all_of(InputIterator first, InputIterator last, Predicate pred);
|
113 |
-
|
114 |
-
|
115 |
-
/*! \p any_of determines whether any element in a range satifies a predicate.
|
116 |
-
* Specifically, \p any_of returns \c true if <tt>pred(*i)</tt> is \c true
|
117 |
-
* for any iterator \c i in the range <tt>[first, last)</tt> and
|
118 |
-
* \c false otherwise.
|
119 |
-
*
|
120 |
-
* The algorithm's execution is parallelized as determined by \p exec.
|
121 |
-
*
|
122 |
-
* \param exec The execution policy to use for parallelization.
|
123 |
-
* \param first The beginning of the sequence.
|
124 |
-
* \param last The end of the sequence.
|
125 |
-
* \param pred A predicate used to test range elements.
|
126 |
-
* \return \c true, if any element satisfies the predicate; \c false, otherwise.
|
127 |
-
*
|
128 |
-
* \tparam DerivedPolicy The name of the derived execution policy.
|
129 |
-
* \tparam InputIterator is a model of <a href="http://www.sgi.com/tech/stl/InputIterator.html">Input Iterator</a>,
|
130 |
-
* \tparam Predicate must be a model of <a href="http://www.sgi.com/tech/stl/Predicate.html">Predicate</a>.
|
131 |
-
*
|
132 |
-
* \code
|
133 |
-
* #include <thrust/logical.h>
|
134 |
-
* #include <thrust/functional.h>
|
135 |
-
* #include <thrust/execution_policy.h>
|
136 |
-
* ...
|
137 |
-
* bool A[3] = {true, true, false};
|
138 |
-
*
|
139 |
-
* thrust::any_of(thrust::host, A, A + 2, thrust::identity<bool>()); // returns true
|
140 |
-
* thrust::any_of(thrust::host, A, A + 3, thrust::identity<bool>()); // returns true
|
141 |
-
*
|
142 |
-
* thrust::any_of(thrust::host, A + 2, A + 3, thrust::identity<bool>()); // returns false
|
143 |
-
*
|
144 |
-
* // empty range
|
145 |
-
* thrust::any_of(thrust::host, A, A, thrust::identity<bool>()); // returns false
|
146 |
-
* \endcode
|
147 |
-
*
|
148 |
-
* \see all_of
|
149 |
-
* \see none_of
|
150 |
-
* \see transform_reduce
|
151 |
-
*/
|
152 |
-
template<typename DerivedPolicy, typename InputIterator, typename Predicate>
|
153 |
-
__host__ __device__
|
154 |
-
bool any_of(const thrust::detail::execution_policy_base<DerivedPolicy> &exec, InputIterator first, InputIterator last, Predicate pred);
|
155 |
-
|
156 |
-
|
157 |
-
/*! \p any_of determines whether any element in a range satifies a predicate.
|
158 |
-
* Specifically, \p any_of returns \c true if <tt>pred(*i)</tt> is \c true
|
159 |
-
* for any iterator \c i in the range <tt>[first, last)</tt> and
|
160 |
-
* \c false otherwise.
|
161 |
-
*
|
162 |
-
* \param first The beginning of the sequence.
|
163 |
-
* \param last The end of the sequence.
|
164 |
-
* \param pred A predicate used to test range elements.
|
165 |
-
* \return \c true, if any element satisfies the predicate; \c false, otherwise.
|
166 |
-
*
|
167 |
-
* \tparam InputIterator is a model of <a href="http://www.sgi.com/tech/stl/InputIterator.html">Input Iterator</a>,
|
168 |
-
* \tparam Predicate must be a model of <a href="http://www.sgi.com/tech/stl/Predicate.html">Predicate</a>.
|
169 |
-
*
|
170 |
-
* \code
|
171 |
-
* #include <thrust/logical.h>
|
172 |
-
* #include <thrust/functional.h>
|
173 |
-
* ...
|
174 |
-
* bool A[3] = {true, true, false};
|
175 |
-
*
|
176 |
-
* thrust::any_of(A, A + 2, thrust::identity<bool>()); // returns true
|
177 |
-
* thrust::any_of(A, A + 3, thrust::identity<bool>()); // returns true
|
178 |
-
*
|
179 |
-
* thrust::any_of(A + 2, A + 3, thrust::identity<bool>()); // returns false
|
180 |
-
*
|
181 |
-
* // empty range
|
182 |
-
* thrust::any_of(A, A, thrust::identity<bool>()); // returns false
|
183 |
-
* \endcode
|
184 |
-
*
|
185 |
-
* \see all_of
|
186 |
-
* \see none_of
|
187 |
-
* \see transform_reduce
|
188 |
-
*/
|
189 |
-
template<typename InputIterator, typename Predicate>
|
190 |
-
bool any_of(InputIterator first, InputIterator last, Predicate pred);
|
191 |
-
|
192 |
-
|
193 |
-
/*! \p none_of determines whether no element in a range satifies a predicate.
|
194 |
-
* Specifically, \p none_of returns \c true if there is no iterator \c i in
|
195 |
-
* the range <tt>[first, last)</tt> such that <tt>pred(*i)</tt> is \c true,
|
196 |
-
* and \c false otherwise.
|
197 |
-
*
|
198 |
-
* The algorithm's execution is parallelized as determined by \p exec.
|
199 |
-
*
|
200 |
-
* \param exec The execution policy to use for parallelization.
|
201 |
-
* \param first The beginning of the sequence.
|
202 |
-
* \param last The end of the sequence.
|
203 |
-
* \param pred A predicate used to test range elements.
|
204 |
-
* \return \c true, if no element satisfies the predicate; \c false, otherwise.
|
205 |
-
*
|
206 |
-
* \tparam DerivedPolicy The name of the derived execution policy.
|
207 |
-
* \tparam InputIterator is a model of <a href="http://www.sgi.com/tech/stl/InputIterator.html">Input Iterator</a>,
|
208 |
-
* \tparam Predicate must be a model of <a href="http://www.sgi.com/tech/stl/Predicate.html">Predicate</a>.
|
209 |
-
*
|
210 |
-
* \code
|
211 |
-
* #include <thrust/logical.h>
|
212 |
-
* #include <thrust/functional.h>
|
213 |
-
* #include <thrust/execution_policy.h>
|
214 |
-
* ...
|
215 |
-
* bool A[3] = {true, true, false};
|
216 |
-
*
|
217 |
-
* thrust::none_of(thrust::host, A, A + 2, thrust::identity<bool>()); // returns false
|
218 |
-
* thrust::none_of(thrust::host, A, A + 3, thrust::identity<bool>()); // returns false
|
219 |
-
*
|
220 |
-
* thrust::none_of(thrust::host, A + 2, A + 3, thrust::identity<bool>()); // returns true
|
221 |
-
*
|
222 |
-
* // empty range
|
223 |
-
* thrust::none_of(thrust::host, A, A, thrust::identity<bool>()); // returns true
|
224 |
-
* \endcode
|
225 |
-
*
|
226 |
-
* \see all_of
|
227 |
-
* \see any_of
|
228 |
-
* \see transform_reduce
|
229 |
-
*/
|
230 |
-
template<typename DerivedPolicy, typename InputIterator, typename Predicate>
|
231 |
-
__host__ __device__
|
232 |
-
bool none_of(const thrust::detail::execution_policy_base<DerivedPolicy> &exec, InputIterator first, InputIterator last, Predicate pred);
|
233 |
-
|
234 |
-
|
235 |
-
/*! \p none_of determines whether no element in a range satifies a predicate.
|
236 |
-
* Specifically, \p none_of returns \c true if there is no iterator \c i in
|
237 |
-
* the range <tt>[first, last)</tt> such that <tt>pred(*i)</tt> is \c true,
|
238 |
-
* and \c false otherwise.
|
239 |
-
*
|
240 |
-
* \param first The beginning of the sequence.
|
241 |
-
* \param last The end of the sequence.
|
242 |
-
* \param pred A predicate used to test range elements.
|
243 |
-
* \return \c true, if no element satisfies the predicate; \c false, otherwise.
|
244 |
-
*
|
245 |
-
* \tparam InputIterator is a model of <a href="http://www.sgi.com/tech/stl/InputIterator.html">Input Iterator</a>,
|
246 |
-
* \tparam Predicate must be a model of <a href="http://www.sgi.com/tech/stl/Predicate.html">Predicate</a>.
|
247 |
-
*
|
248 |
-
* \code
|
249 |
-
* #include <thrust/logical.h>
|
250 |
-
* #include <thrust/functional.h>
|
251 |
-
* ...
|
252 |
-
* bool A[3] = {true, true, false};
|
253 |
-
*
|
254 |
-
* thrust::none_of(A, A + 2, thrust::identity<bool>()); // returns false
|
255 |
-
* thrust::none_of(A, A + 3, thrust::identity<bool>()); // returns false
|
256 |
-
*
|
257 |
-
* thrust::none_of(A + 2, A + 3, thrust::identity<bool>()); // returns true
|
258 |
-
*
|
259 |
-
* // empty range
|
260 |
-
* thrust::none_of(A, A, thrust::identity<bool>()); // returns true
|
261 |
-
* \endcode
|
262 |
-
*
|
263 |
-
* \see all_of
|
264 |
-
* \see any_of
|
265 |
-
* \see transform_reduce
|
266 |
-
*/
|
267 |
-
template<typename InputIterator, typename Predicate>
|
268 |
-
bool none_of(InputIterator first, InputIterator last, Predicate pred);
|
269 |
-
|
270 |
-
|
271 |
-
/*! \} // end logical
|
272 |
-
* \} // end reductions
|
273 |
-
*/
|
274 |
-
|
275 |
-
|
276 |
-
} // end namespace thrust
|
277 |
-
|
278 |
-
#include <thrust/detail/logical.inl>
|
279 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
spaces/CVPR/LIVE/thrust/thrust/system/cuda/detail/iter_swap.h
DELETED
@@ -1,66 +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 |
-
#pragma once
|
18 |
-
|
19 |
-
#if THRUST_DEVICE_COMPILER == THRUST_DEVICE_COMPILER_NVCC
|
20 |
-
#include <thrust/detail/config.h>
|
21 |
-
#include <thrust/system/cuda/config.h>
|
22 |
-
|
23 |
-
#include <thrust/detail/raw_pointer_cast.h>
|
24 |
-
#include <thrust/system/cuda/detail/execution_policy.h>
|
25 |
-
#include <thrust/swap.h>
|
26 |
-
|
27 |
-
namespace thrust
|
28 |
-
{
|
29 |
-
namespace cuda_cub {
|
30 |
-
|
31 |
-
|
32 |
-
template<typename DerivedPolicy, typename Pointer1, typename Pointer2>
|
33 |
-
inline __host__ __device__
|
34 |
-
void iter_swap(thrust::cuda::execution_policy<DerivedPolicy> &, Pointer1 a, Pointer2 b)
|
35 |
-
{
|
36 |
-
// XXX war nvbugs/881631
|
37 |
-
struct war_nvbugs_881631
|
38 |
-
{
|
39 |
-
__host__ inline static void host_path(Pointer1 a, Pointer2 b)
|
40 |
-
{
|
41 |
-
thrust::swap_ranges(a, a + 1, b);
|
42 |
-
}
|
43 |
-
|
44 |
-
__device__ inline static void device_path(Pointer1 a, Pointer2 b)
|
45 |
-
{
|
46 |
-
using thrust::swap;
|
47 |
-
swap(*thrust::raw_pointer_cast(a),
|
48 |
-
*thrust::raw_pointer_cast(b));
|
49 |
-
}
|
50 |
-
};
|
51 |
-
|
52 |
-
if (THRUST_IS_HOST_CODE) {
|
53 |
-
#if THRUST_INCLUDE_HOST_CODE
|
54 |
-
war_nvbugs_881631::host_path(a, b);
|
55 |
-
#endif
|
56 |
-
} else {
|
57 |
-
#if THRUST_INCLUDE_DEVICE_CODE
|
58 |
-
war_nvbugs_881631::device_path(a, b);
|
59 |
-
#endif
|
60 |
-
}
|
61 |
-
} // end iter_swap()
|
62 |
-
|
63 |
-
|
64 |
-
} // end cuda_cub
|
65 |
-
} // end namespace thrust
|
66 |
-
#endif
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
spaces/CVPR/Text2Human/Text2Human/train_sampler.py
DELETED
@@ -1,122 +0,0 @@
|
|
1 |
-
import argparse
|
2 |
-
import logging
|
3 |
-
import os
|
4 |
-
import os.path as osp
|
5 |
-
import random
|
6 |
-
import time
|
7 |
-
|
8 |
-
import torch
|
9 |
-
|
10 |
-
from data.segm_attr_dataset import DeepFashionAttrSegmDataset
|
11 |
-
from models import create_model
|
12 |
-
from utils.logger import MessageLogger, get_root_logger, init_tb_logger
|
13 |
-
from utils.options import dict2str, dict_to_nonedict, parse
|
14 |
-
from utils.util import make_exp_dirs
|
15 |
-
|
16 |
-
|
17 |
-
def main():
|
18 |
-
# options
|
19 |
-
parser = argparse.ArgumentParser()
|
20 |
-
parser.add_argument('-opt', type=str, help='Path to option YAML file.')
|
21 |
-
args = parser.parse_args()
|
22 |
-
opt = parse(args.opt, is_train=True)
|
23 |
-
|
24 |
-
# mkdir and loggers
|
25 |
-
make_exp_dirs(opt)
|
26 |
-
log_file = osp.join(opt['path']['log'], f"train_{opt['name']}.log")
|
27 |
-
logger = get_root_logger(
|
28 |
-
logger_name='base', log_level=logging.INFO, log_file=log_file)
|
29 |
-
logger.info(dict2str(opt))
|
30 |
-
# initialize tensorboard logger
|
31 |
-
tb_logger = None
|
32 |
-
if opt['use_tb_logger'] and 'debug' not in opt['name']:
|
33 |
-
tb_logger = init_tb_logger(log_dir='./tb_logger/' + opt['name'])
|
34 |
-
|
35 |
-
# convert to NoneDict, which returns None for missing keys
|
36 |
-
opt = dict_to_nonedict(opt)
|
37 |
-
|
38 |
-
# set up data loader
|
39 |
-
train_dataset = DeepFashionAttrSegmDataset(
|
40 |
-
img_dir=opt['train_img_dir'],
|
41 |
-
segm_dir=opt['segm_dir'],
|
42 |
-
pose_dir=opt['pose_dir'],
|
43 |
-
ann_dir=opt['train_ann_file'],
|
44 |
-
xflip=True)
|
45 |
-
train_loader = torch.utils.data.DataLoader(
|
46 |
-
dataset=train_dataset,
|
47 |
-
batch_size=opt['batch_size'],
|
48 |
-
shuffle=True,
|
49 |
-
num_workers=opt['num_workers'],
|
50 |
-
persistent_workers=True,
|
51 |
-
drop_last=True)
|
52 |
-
logger.info(f'Number of train set: {len(train_dataset)}.')
|
53 |
-
opt['max_iters'] = opt['num_epochs'] * len(
|
54 |
-
train_dataset) // opt['batch_size']
|
55 |
-
|
56 |
-
val_dataset = DeepFashionAttrSegmDataset(
|
57 |
-
img_dir=opt['train_img_dir'],
|
58 |
-
segm_dir=opt['segm_dir'],
|
59 |
-
pose_dir=opt['pose_dir'],
|
60 |
-
ann_dir=opt['val_ann_file'])
|
61 |
-
val_loader = torch.utils.data.DataLoader(
|
62 |
-
dataset=val_dataset, batch_size=opt['batch_size'], shuffle=False)
|
63 |
-
logger.info(f'Number of val set: {len(val_dataset)}.')
|
64 |
-
|
65 |
-
test_dataset = DeepFashionAttrSegmDataset(
|
66 |
-
img_dir=opt['test_img_dir'],
|
67 |
-
segm_dir=opt['segm_dir'],
|
68 |
-
pose_dir=opt['pose_dir'],
|
69 |
-
ann_dir=opt['test_ann_file'])
|
70 |
-
test_loader = torch.utils.data.DataLoader(
|
71 |
-
dataset=test_dataset, batch_size=opt['batch_size'], shuffle=False)
|
72 |
-
logger.info(f'Number of test set: {len(test_dataset)}.')
|
73 |
-
|
74 |
-
current_iter = 0
|
75 |
-
|
76 |
-
model = create_model(opt)
|
77 |
-
|
78 |
-
data_time, iter_time = 0, 0
|
79 |
-
current_iter = 0
|
80 |
-
|
81 |
-
# create message logger (formatted outputs)
|
82 |
-
msg_logger = MessageLogger(opt, current_iter, tb_logger)
|
83 |
-
|
84 |
-
for epoch in range(opt['num_epochs']):
|
85 |
-
lr = model.update_learning_rate(epoch, current_iter)
|
86 |
-
|
87 |
-
for _, batch_data in enumerate(train_loader):
|
88 |
-
data_time = time.time() - data_time
|
89 |
-
|
90 |
-
current_iter += 1
|
91 |
-
|
92 |
-
model.feed_data(batch_data)
|
93 |
-
model.optimize_parameters()
|
94 |
-
|
95 |
-
iter_time = time.time() - iter_time
|
96 |
-
if current_iter % opt['print_freq'] == 0:
|
97 |
-
log_vars = {'epoch': epoch, 'iter': current_iter}
|
98 |
-
log_vars.update({'lrs': [lr]})
|
99 |
-
log_vars.update({'time': iter_time, 'data_time': data_time})
|
100 |
-
log_vars.update(model.get_current_log())
|
101 |
-
msg_logger(log_vars)
|
102 |
-
|
103 |
-
data_time = time.time()
|
104 |
-
iter_time = time.time()
|
105 |
-
|
106 |
-
if epoch % opt['val_freq'] == 0 and epoch != 0:
|
107 |
-
save_dir = f'{opt["path"]["visualization"]}/valset/epoch_{epoch:03d}' # noqa
|
108 |
-
os.makedirs(save_dir, exist_ok=opt['debug'])
|
109 |
-
model.inference(val_loader, save_dir)
|
110 |
-
|
111 |
-
save_dir = f'{opt["path"]["visualization"]}/testset/epoch_{epoch:03d}' # noqa
|
112 |
-
os.makedirs(save_dir, exist_ok=opt['debug'])
|
113 |
-
model.inference(test_loader, save_dir)
|
114 |
-
|
115 |
-
# save model
|
116 |
-
model.save_network(
|
117 |
-
model._denoise_fn,
|
118 |
-
f'{opt["path"]["models"]}/sampler_epoch{epoch}.pth')
|
119 |
-
|
120 |
-
|
121 |
-
if __name__ == '__main__':
|
122 |
-
main()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
spaces/CVPR/WALT/mmdet/models/losses/mse_loss.py
DELETED
@@ -1,49 +0,0 @@
|
|
1 |
-
import torch.nn as nn
|
2 |
-
import torch.nn.functional as F
|
3 |
-
|
4 |
-
from ..builder import LOSSES
|
5 |
-
from .utils import weighted_loss
|
6 |
-
|
7 |
-
|
8 |
-
@weighted_loss
|
9 |
-
def mse_loss(pred, target):
|
10 |
-
"""Warpper of mse loss."""
|
11 |
-
return F.mse_loss(pred, target, reduction='none')
|
12 |
-
|
13 |
-
|
14 |
-
@LOSSES.register_module()
|
15 |
-
class MSELoss(nn.Module):
|
16 |
-
"""MSELoss.
|
17 |
-
|
18 |
-
Args:
|
19 |
-
reduction (str, optional): The method that reduces the loss to a
|
20 |
-
scalar. Options are "none", "mean" and "sum".
|
21 |
-
loss_weight (float, optional): The weight of the loss. Defaults to 1.0
|
22 |
-
"""
|
23 |
-
|
24 |
-
def __init__(self, reduction='mean', loss_weight=1.0):
|
25 |
-
super().__init__()
|
26 |
-
self.reduction = reduction
|
27 |
-
self.loss_weight = loss_weight
|
28 |
-
|
29 |
-
def forward(self, pred, target, weight=None, avg_factor=None):
|
30 |
-
"""Forward function of loss.
|
31 |
-
|
32 |
-
Args:
|
33 |
-
pred (torch.Tensor): The prediction.
|
34 |
-
target (torch.Tensor): The learning target of the prediction.
|
35 |
-
weight (torch.Tensor, optional): Weight of the loss for each
|
36 |
-
prediction. Defaults to None.
|
37 |
-
avg_factor (int, optional): Average factor that is used to average
|
38 |
-
the loss. Defaults to None.
|
39 |
-
|
40 |
-
Returns:
|
41 |
-
torch.Tensor: The calculated loss
|
42 |
-
"""
|
43 |
-
loss = self.loss_weight * mse_loss(
|
44 |
-
pred,
|
45 |
-
target,
|
46 |
-
weight,
|
47 |
-
reduction=self.reduction,
|
48 |
-
avg_factor=avg_factor)
|
49 |
-
return loss
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
spaces/Caoyunkang/Segment-Any-Anomaly/GroundingDINO/groundingdino/models/GroundingDINO/transformer_vanilla.py
DELETED
@@ -1,123 +0,0 @@
|
|
1 |
-
# ------------------------------------------------------------------------
|
2 |
-
# Grounding DINO
|
3 |
-
# url: https://github.com/IDEA-Research/GroundingDINO
|
4 |
-
# Copyright (c) 2023 IDEA. All Rights Reserved.
|
5 |
-
# Licensed under the Apache License, Version 2.0 [see LICENSE for details]
|
6 |
-
# ------------------------------------------------------------------------
|
7 |
-
# Copyright (c) Aishwarya Kamath & Nicolas Carion. Licensed under the Apache License 2.0. All Rights Reserved
|
8 |
-
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved
|
9 |
-
"""
|
10 |
-
DETR Transformer class.
|
11 |
-
|
12 |
-
Copy-paste from torch.nn.Transformer with modifications:
|
13 |
-
* positional encodings are passed in MHattention
|
14 |
-
* extra LN at the end of encoder is removed
|
15 |
-
* decoder returns a stack of activations from all decoding layers
|
16 |
-
"""
|
17 |
-
from typing import Optional
|
18 |
-
|
19 |
-
import torch
|
20 |
-
import torch.nn.functional as F
|
21 |
-
from torch import Tensor, nn
|
22 |
-
|
23 |
-
from .utils import (
|
24 |
-
MLP,
|
25 |
-
_get_activation_fn,
|
26 |
-
_get_clones,
|
27 |
-
gen_encoder_output_proposals,
|
28 |
-
gen_sineembed_for_position,
|
29 |
-
sigmoid_focal_loss,
|
30 |
-
)
|
31 |
-
|
32 |
-
|
33 |
-
class TextTransformer(nn.Module):
|
34 |
-
def __init__(self, num_layers, d_model=256, nheads=8, dim_feedforward=2048, dropout=0.1):
|
35 |
-
super().__init__()
|
36 |
-
self.num_layers = num_layers
|
37 |
-
self.d_model = d_model
|
38 |
-
self.nheads = nheads
|
39 |
-
self.dim_feedforward = dim_feedforward
|
40 |
-
self.norm = None
|
41 |
-
|
42 |
-
single_encoder_layer = TransformerEncoderLayer(
|
43 |
-
d_model=d_model, nhead=nheads, dim_feedforward=dim_feedforward, dropout=dropout
|
44 |
-
)
|
45 |
-
self.layers = _get_clones(single_encoder_layer, num_layers)
|
46 |
-
|
47 |
-
def forward(self, memory_text: torch.Tensor, text_attention_mask: torch.Tensor):
|
48 |
-
"""
|
49 |
-
|
50 |
-
Args:
|
51 |
-
text_attention_mask: bs, num_token
|
52 |
-
memory_text: bs, num_token, d_model
|
53 |
-
|
54 |
-
Raises:
|
55 |
-
RuntimeError: _description_
|
56 |
-
|
57 |
-
Returns:
|
58 |
-
output: bs, num_token, d_model
|
59 |
-
"""
|
60 |
-
|
61 |
-
output = memory_text.transpose(0, 1)
|
62 |
-
|
63 |
-
for layer in self.layers:
|
64 |
-
output = layer(output, src_key_padding_mask=text_attention_mask)
|
65 |
-
|
66 |
-
if self.norm is not None:
|
67 |
-
output = self.norm(output)
|
68 |
-
|
69 |
-
return output.transpose(0, 1)
|
70 |
-
|
71 |
-
|
72 |
-
class TransformerEncoderLayer(nn.Module):
|
73 |
-
def __init__(
|
74 |
-
self,
|
75 |
-
d_model,
|
76 |
-
nhead,
|
77 |
-
dim_feedforward=2048,
|
78 |
-
dropout=0.1,
|
79 |
-
activation="relu",
|
80 |
-
normalize_before=False,
|
81 |
-
):
|
82 |
-
super().__init__()
|
83 |
-
self.self_attn = nn.MultiheadAttention(d_model, nhead, dropout=dropout)
|
84 |
-
# Implementation of Feedforward model
|
85 |
-
self.linear1 = nn.Linear(d_model, dim_feedforward)
|
86 |
-
self.dropout = nn.Dropout(dropout)
|
87 |
-
self.linear2 = nn.Linear(dim_feedforward, d_model)
|
88 |
-
|
89 |
-
self.norm1 = nn.LayerNorm(d_model)
|
90 |
-
self.norm2 = nn.LayerNorm(d_model)
|
91 |
-
self.dropout1 = nn.Dropout(dropout)
|
92 |
-
self.dropout2 = nn.Dropout(dropout)
|
93 |
-
|
94 |
-
self.activation = _get_activation_fn(activation)
|
95 |
-
self.normalize_before = normalize_before
|
96 |
-
self.nhead = nhead
|
97 |
-
|
98 |
-
def with_pos_embed(self, tensor, pos: Optional[Tensor]):
|
99 |
-
return tensor if pos is None else tensor + pos
|
100 |
-
|
101 |
-
def forward(
|
102 |
-
self,
|
103 |
-
src,
|
104 |
-
src_mask: Optional[Tensor] = None,
|
105 |
-
src_key_padding_mask: Optional[Tensor] = None,
|
106 |
-
pos: Optional[Tensor] = None,
|
107 |
-
):
|
108 |
-
# repeat attn mask
|
109 |
-
if src_mask.dim() == 3 and src_mask.shape[0] == src.shape[1]:
|
110 |
-
# bs, num_q, num_k
|
111 |
-
src_mask = src_mask.repeat(self.nhead, 1, 1)
|
112 |
-
|
113 |
-
q = k = self.with_pos_embed(src, pos)
|
114 |
-
|
115 |
-
src2 = self.self_attn(q, k, value=src, attn_mask=src_mask)[0]
|
116 |
-
|
117 |
-
# src2 = self.self_attn(q, k, value=src, attn_mask=src_mask, key_padding_mask=src_key_padding_mask)[0]
|
118 |
-
src = src + self.dropout1(src2)
|
119 |
-
src = self.norm1(src)
|
120 |
-
src2 = self.linear2(self.dropout(self.activation(self.linear1(src))))
|
121 |
-
src = src + self.dropout2(src2)
|
122 |
-
src = self.norm2(src)
|
123 |
-
return src
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
spaces/CikeyQI/Yunzai/Yunzai/plugins/ws-plugin/resources/help/index.css
DELETED
@@ -1,83 +0,0 @@
|
|
1 |
-
body {
|
2 |
-
transform: scale(1);
|
3 |
-
width: 830px;
|
4 |
-
background: url("../common/theme/bg-01.jpg");
|
5 |
-
}
|
6 |
-
.container {
|
7 |
-
background: url(../common/theme/main-01.png) top left no-repeat;
|
8 |
-
background-size: 100% auto;
|
9 |
-
width: 830px;
|
10 |
-
}
|
11 |
-
.head-box {
|
12 |
-
margin: 60px 0 0 0;
|
13 |
-
padding-bottom: 0;
|
14 |
-
}
|
15 |
-
.head-box .title {
|
16 |
-
font-size: 50px;
|
17 |
-
}
|
18 |
-
.cont-box {
|
19 |
-
border-radius: 15px;
|
20 |
-
margin-top: 20px;
|
21 |
-
margin-bottom: 20px;
|
22 |
-
overflow: hidden;
|
23 |
-
box-shadow: 0 5px 10px 0 rgba(0, 0, 0, 0.15);
|
24 |
-
position: relative;
|
25 |
-
}
|
26 |
-
.help-group {
|
27 |
-
font-size: 18px;
|
28 |
-
font-weight: bold;
|
29 |
-
padding: 15px 15px 10px 20px;
|
30 |
-
}
|
31 |
-
.help-table {
|
32 |
-
text-align: center;
|
33 |
-
border-collapse: collapse;
|
34 |
-
margin: 0;
|
35 |
-
border-radius: 0 0 10px 10px;
|
36 |
-
display: table;
|
37 |
-
overflow: hidden;
|
38 |
-
width: 100%;
|
39 |
-
color: #fff;
|
40 |
-
}
|
41 |
-
.help-table .tr {
|
42 |
-
display: table-row;
|
43 |
-
}
|
44 |
-
.help-table .td,
|
45 |
-
.help-table .th {
|
46 |
-
font-size: 14px;
|
47 |
-
display: table-cell;
|
48 |
-
box-shadow: 0 0 1px 0 #888 inset;
|
49 |
-
padding: 12px 0 12px 50px;
|
50 |
-
line-height: 24px;
|
51 |
-
position: relative;
|
52 |
-
text-align: left;
|
53 |
-
}
|
54 |
-
.help-table .tr:last-child .td {
|
55 |
-
padding-bottom: 12px;
|
56 |
-
}
|
57 |
-
.help-table .th {
|
58 |
-
background: rgba(34, 41, 51, 0.5);
|
59 |
-
}
|
60 |
-
.help-icon {
|
61 |
-
width: 40px;
|
62 |
-
height: 40px;
|
63 |
-
display: block;
|
64 |
-
position: absolute;
|
65 |
-
background: url("icon.png") 0 0 no-repeat;
|
66 |
-
background-size: 500px auto;
|
67 |
-
border-radius: 5px;
|
68 |
-
left: 6px;
|
69 |
-
top: 12px;
|
70 |
-
transform: scale(0.85);
|
71 |
-
}
|
72 |
-
.help-title {
|
73 |
-
display: block;
|
74 |
-
color: #d3bc8e;
|
75 |
-
font-size: 16px;
|
76 |
-
line-height: 24px;
|
77 |
-
}
|
78 |
-
.help-desc {
|
79 |
-
display: block;
|
80 |
-
font-size: 13px;
|
81 |
-
line-height: 18px;
|
82 |
-
}
|
83 |
-
/*# sourceMappingURL=index.css.map */
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
spaces/CobaltZvc/sherlocks_pheonix/README.md
DELETED
@@ -1,10 +0,0 @@
|
|
1 |
-
---
|
2 |
-
title: Sherlocks Pheonix
|
3 |
-
emoji: 📊
|
4 |
-
colorFrom: blue
|
5 |
-
colorTo: yellow
|
6 |
-
sdk: static
|
7 |
-
pinned: false
|
8 |
-
---
|
9 |
-
|
10 |
-
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|