parquet-converter commited on
Commit
c90abc8
·
1 Parent(s): f7766fb

Update parquet files (step 41 of 296)

Browse files
This view is limited to 50 files because it contains too many changes.   See raw diff
Files changed (50) hide show
  1. spaces/1acneusushi/gradio-2dmoleculeeditor/data/Crack For Kerio Winroute Firewall 670.md +0 -25
  2. spaces/1acneusushi/gradio-2dmoleculeeditor/data/Epson PX660 Adjustment Program A Utility Program for Printer Maintenance and Repair.md +0 -157
  3. spaces/1acneusushi/gradio-2dmoleculeeditor/data/Free Download Tally ERP 9 with Crack Pros and Cons.md +0 -34
  4. spaces/1gistliPinn/ChatGPT4/Examples/Activation Key PhotoStage Slideshow Producer Keygen.epubhttps Scoutmails.com Index301.php K Activa.md +0 -6
  5. spaces/1gistliPinn/ChatGPT4/Examples/Automatabookbyadeshkpandeypdfdownload.md +0 -6
  6. spaces/1pelhydcardo/ChatGPT-prompt-generator/assets/1v1 LOL Mod Menu APK How to Get God Mode Unlimited Ammo and Fly Mode on Your Device.md +0 -88
  7. spaces/1pelhydcardo/ChatGPT-prompt-generator/assets/AetherSX2 Everything You Need to Know to Download and Play PS2 Games on Android.md +0 -136
  8. spaces/1phancelerku/anime-remove-background/Download and Play Real Drag Bike Racing Mod APK for Free.md +0 -90
  9. spaces/AB-TW/team-ai/agents/tools/smart_domain/domain_layer_code_tool.py +0 -56
  10. spaces/AIConsultant/MusicGen/audiocraft/data/audio.py +0 -216
  11. spaces/AIGC-Audio/AudioGPT/text_to_audio/Make_An_Audio/ldm/modules/diffusionmodules/util.py +0 -267
  12. spaces/Abhilashvj/planogram-compliance/utils/aws/mime.sh +0 -26
  13. spaces/Adapter/T2I-Adapter/ldm/modules/extra_condition/model_edge.py +0 -653
  14. spaces/AgentVerse/agentVerse/ui/src/phaser3-rex-plugins/templates/spinner/grid/Factory.js +0 -13
  15. spaces/Al-Chan/Vits_League_of_Legends_Yuumi_TTS/cmd_inference.py +0 -106
  16. spaces/AlhitawiMohammed22/HTD_HTR/README.md +0 -20
  17. spaces/Andy1621/uniformer_image_detection/configs/gfl/gfl_r50_fpn_1x_coco.py +0 -57
  18. spaces/Andy1621/uniformer_image_detection/configs/regnet/retinanet_regnetx-1.6GF_fpn_1x_coco.py +0 -16
  19. spaces/Andy1621/uniformer_image_detection/configs/sabl/sabl_faster_rcnn_r50_fpn_1x_coco.py +0 -34
  20. spaces/Andy1621/uniformer_image_segmentation/configs/pspnet/pspnet_r50-d8_512x1024_40k_cityscapes.py +0 -4
  21. spaces/Andy1621/uniformer_image_segmentation/configs/resnest/deeplabv3plus_s101-d8_512x512_160k_ade20k.py +0 -9
  22. spaces/AnishKumbhar/ChatBot/app.py +0 -1
  23. spaces/AnishKumbhar/ChatBot/text-generation-webui-main/docs/One-Click-Installers.md +0 -72
  24. spaces/Anonymous-123/ImageNet-Editing/object_removal/TFill/util/util.py +0 -76
  25. spaces/Anonymous-sub/Rerender/ControlNet/annotator/uniformer/mmcv/cnn/utils/__init__.py +0 -19
  26. spaces/Arnx/MusicGenXvAKN/audiocraft/utils/export.py +0 -56
  27. spaces/Ataturk-Chatbot/HuggingFaceChat/venv/lib/python3.11/site-packages/pip/_vendor/rich/console.py +0 -0
  28. spaces/Awiny/Image2Paragraph/models/grit_src/third_party/CenterNet2/detectron2/modeling/anchor_generator.py +0 -382
  29. spaces/Awiny/Image2Paragraph/models/grit_src/third_party/CenterNet2/detectron2/structures/rotated_boxes.py +0 -503
  30. spaces/BartPoint/VoiceChange/infer_pack/models.py +0 -1124
  31. spaces/Benson/text-generation/Examples/Dani Among Us 3d Download.md +0 -53
  32. spaces/Big-Web/MMSD/env/Lib/site-packages/pip/_vendor/pygments/formatters/irc.py +0 -154
  33. spaces/Big-Web/MMSD/env/Lib/site-packages/setuptools/_distutils/archive_util.py +0 -280
  34. spaces/Big-Web/MMSD/env/Lib/site-packages/setuptools/_distutils/dist.py +0 -1286
  35. spaces/Boranbruh/ehartford-WizardLM-7B-Uncensored/app.py +0 -3
  36. spaces/CVPR/LIVE/thrust/examples/cpp_integration/device.h +0 -7
  37. spaces/CVPR/LIVE/thrust/thrust/iterator/detail/is_iterator_category.h +0 -60
  38. spaces/CVPR/lama-example/bin/report_from_tb.py +0 -83
  39. spaces/ChallengeHub/Chinese-LangChain/assets/custom.js +0 -1
  40. spaces/ChrisCaviar/ControlNet-v1-1/app_scribble_interactive.py +0 -112
  41. spaces/CikeyQI/Yunzai/Yunzai/plugins/ws-plugin/apps/request/request.js +0 -65
  42. spaces/CofAI/tv/README.md +0 -44
  43. spaces/Dagfinn1962/stablediffusion-models/appworks.py +0 -80
  44. spaces/Detomo/Depth_estimation/layers.py +0 -55
  45. spaces/Dinoking/Garbage-Classifier-V4/app.py +0 -31
  46. spaces/DragGan/DragGan/stylegan_human/dnnlib/tflib/custom_ops.py +0 -171
  47. spaces/ECCV2022/storydalle/dalle/models/stage1/layers.py +0 -373
  48. spaces/Eduger/webui/app.py +0 -72
  49. spaces/ElainaFanBoy/IRONY-Real-ESRGAN/FAQ.md +0 -9
  50. spaces/EuroPython2022/mmocr-demo/configs/_base_/recog_pipelines/satrn_pipeline.py +0 -44
spaces/1acneusushi/gradio-2dmoleculeeditor/data/Crack For Kerio Winroute Firewall 670.md DELETED
@@ -1,25 +0,0 @@
1
- <br />
2
- <h1>Kerio WinRoute Firewall 670: A Comprehensive Network Security Solution</h1>
3
- <p>Kerio WinRoute Firewall 670 is a software product that provides advanced protection for your network and data. It is an all-in-one Unified Threat Management (UTM) solution that includes a next-generation firewall and router, Intrusion Detection and Prevention (IPS), gateway anti-virus, VPN and web content and application filtering[^3^].</p>
4
- <p>In this article, we will review some of the key features and benefits of Kerio WinRoute Firewall 670 and why you should consider it for your network security needs.</p>
5
- <h2>Crack For Kerio Winroute Firewall 670</h2><br /><p><b><b>Download File</b> &#10004; <a href="https://byltly.com/2uKwvw">https://byltly.com/2uKwvw</a></b></p><br /><br />
6
- <h2>Next-Generation Firewall and Router</h2>
7
- <p>Kerio WinRoute Firewall 670 offers a variety of content security features such as MP3 music download blocking, filtering for potentially dangerous executable files or blocking of annoying pop-up windows[^1^]. It also allows you to create custom rules and policies to control the traffic on your network based on user, group, time, protocol, port, source or destination IP address, URL or domain name.</p>
8
- <p>Kerio WinRoute Firewall 670 also acts as a router that supports multiple Internet connections, load balancing, failover, bandwidth management and quality of service (QoS). You can optimize the performance and reliability of your network by distributing the traffic among different Internet links or prioritizing the traffic based on the type of application or service.</p>
9
- <h2>Intrusion Detection and Prevention (IPS)</h2>
10
- <p>Kerio WinRoute Firewall 670 monitors the network traffic for any signs of malicious activity or attacks. It uses a signature-based engine that can detect and block known threats such as worms, trojans, denial-of-service attacks, port scans, buffer overflows and more. It also uses a behavior-based engine that can identify and stop unknown or zero-day attacks based on their abnormal patterns or anomalies.</p>
11
- <p>Kerio WinRoute Firewall 670 can also prevent intrusions by applying security patches to vulnerable applications or systems on your network. It can automatically update itself with the latest signatures and patches from Kerio Technologies or third-party vendors.</p>
12
- <h2>Gateway Anti-Virus</h2>
13
- <p>Kerio WinRoute Firewall 670 scans all incoming and outgoing traffic for viruses, spyware, malware and other malicious code. It uses a dual-engine approach that combines the power of BitDefender and Kerio antivirus engines to provide maximum detection and prevention. It can also scan email attachments, web downloads, FTP transfers and VPN tunnels.</p>
14
- <p>Kerio WinRoute Firewall 670 can also quarantine or delete infected files, notify the administrator or user, or block the source of infection. It can also update itself with the latest virus definitions from Kerio Technologies or third-party vendors.</p>
15
- <h2>VPN</h2>
16
- <p>Kerio WinRoute Firewall 670 allows you to create secure connections between your network and remote sites or users. It supports various VPN protocols such as IPsec, L2TP, PPTP and SSL. It also supports Kerio VPN Client, a proprietary software that provides easy-to-use and secure VPN access for Windows, Mac OS X and Linux users.</p>
17
- <p>Kerio WinRoute Firewall 670 can also integrate with Active Directory or LDAP servers to authenticate VPN users. It can also encrypt VPN traffic with strong algorithms such as AES or 3DES.</p>
18
- <p></p>
19
- <h2>Web Content and Application Filtering</h2>
20
- <p>Kerio WinRoute Firewall 670 allows you to control what websites or applications your users can access on the Internet. It uses a category-based filtering system that can block or allow access to over 141 million websites in 74 categories such as adult content, gambling, social networking, gaming, shopping and more[^3^]. You can also create custom categories or lists to suit your specific needs.</p>
21
- <p>Kerio WinRoute Firewall 670 can also filter applications based on their type or protocol such as instant messaging, peer-to-peer file sharing, VoIP, streaming media and more. You can also limit the bandwidth usage or time spent on certain applications or websites.</p>
22
- <h2>Conclusion</h2>
23
- <p>Kerio WinRoute Firewall 670 is a comprehensive network security solution that provides advanced protection for your network and data. It is an all-in-one Unified Threat Management (UTM) solution that includes a next-generation firewall and router, Intrusion Detection and Prevention (IPS), gateway anti-virus, VPN and web content and application filtering.</p> 7b8c122e87<br />
24
- <br />
25
- <br />
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
spaces/1acneusushi/gradio-2dmoleculeeditor/data/Epson PX660 Adjustment Program A Utility Program for Printer Maintenance and Repair.md DELETED
@@ -1,157 +0,0 @@
1
- <br />
2
- <table>
3
- <tr>
4
- <th>Heading</th>
5
- <th>Subheading</th>
6
- </tr>
7
- <tr>
8
- <h1>Epson PX660 Adjustment Program: How to Reset Your Printer and Fix Common Problems</h1></td>
9
- <td></td>
10
- </tr>
11
- <tr>
12
- <td><h2>Introduction</h2></td>
13
- <td>
14
- <ul>
15
- <li>Explain what is Epson PX660 Adjustment Program and what it can do</li>
16
- <li>Mention some common problems that can be solved by using the program</li>
17
- <li>Provide a brief overview of the article</li>
18
- </ul>
19
- </td>
20
- </tr>
21
- <tr>
22
- <td><h2>What is Epson PX660 Adjustment Program?</h2></td>
23
- <td>
24
- <ul>
25
- <li>Describe the program as a utility tool for Epson Stylus Photo PX660 printer model</li>
26
- <li>Explain that the program can reset the waste ink pad counter, prescribe the print head ID, do printer initialization and other functions</li>
27
- <li>Mention that the program is original and works only with USB on Windows</li>
28
- </ul>
29
- </td>
30
- </tr>
31
- <tr>
32
- <td><h2>Why Do You Need Epson PX660 Adjustment Program?</h2></td>
33
- <td>
34
- <ul>
35
- <li>Explain that the waste ink pad counter is a feature that prevents the printer from overflowing with ink</li>
36
- <li>Mention that when the counter reaches a certain limit, the printer stops working and displays an error message</li>
37
- <li>Explain that the program can reset the counter and allow the printer to work again</li>
38
- <li>Mention some other benefits of using the program, such as improving print quality, saving ink and paper, etc.</li>
39
- </ul>
40
- </td>
41
- </tr>
42
- <tr>
43
- <td><h2>How to Download and Install Epson PX660 Adjustment Program?</h2></td>
44
- <td>
45
- <ul>
46
- <li>Provide a link to download the program from a reliable source (e.g. ORPYS)</li>
47
- <li>Explain how to install the program on the computer</li>
48
- <li>Mention some requirements and precautions, such as disabling antivirus, binding to one PC, etc.</li>
49
- </ul>
50
- </td>
51
- </tr>
52
- <tr>
53
- <td><h2>How to Use Epson PX660 Adjustment Program?</h2></td>
54
- <td>
55
- <ul>
56
- <li>Explain how to connect the printer to the computer via USB</li>
57
- <li>Explain how to run the program and select the printer model</li>
58
- <li>Explain how to access different functions and settings of the program</li>
59
- <li>Provide some screenshots and examples of using the program</li>
60
- </ul>
61
- </td>
62
- </tr>
63
- <tr>
64
- <td><h2>Conclusion</h2></td>
65
- <td>
66
- <ul>
67
- <li>Summarize the main points of the article</li>
68
- <li>Emphasize the benefits and advantages of using Epson PX660 Adjustment Program</li>
69
- <li>Provide some tips and recommendations for maintaining the printer</li>
70
- <li>Invite readers to share their feedback and questions</li>
71
- </ul>
72
- </td>
73
- </tr>
74
- <tr>
75
- <td><h2>FAQs</h2></td>
76
- <td>
77
- <ul>
78
- <li>Provide some frequently asked questions and answers about Epson PX660 Adjustment Program - What are the advantages of using this program over other methods? - How often do I need to reset my waste ink pad counter? - How can I check if my print head ID is correct? - What should I do if I encounter any errors or problems while using this program? - Where can I find more information or support for this program? </li>
79
- </ul>
80
- </td>
81
- </tr>
82
- </table>
83
- Here is the article based on the outline: <h1><strong>Epson PX660 Adjustment Program: How to Reset Your Printer and Fix Common Problems </strong></h1>
84
- <p>If you own an Epson Stylus Photo PX660 printer, you may have encountered some issues that prevent you from printing your photos or documents. For example, you may see an error message saying that your printer's ink pads are at the end of their service life, or that your print head needs alignment or cleaning. These problems can be frustrating and costly, but there is a simple solution: Epson PX660 Adjustment Program.</p>
85
- <p>Epson PX660 Adjustment Program is a utility tool that allows you to reset your printer's waste ink pad counter, prescribe the print head ID, do printer initialization and other functions. It is an original program that works only with USB on Windows computers. By using this program, you can fix common problems with your printer and improve its performance and quality.</p>
86
- <h2>epson px660 adjustment program free download.rar</h2><br /><p><b><b>Download File</b> &#10022;&#10022;&#10022; <a href="https://byltly.com/2uKxUd">https://byltly.com/2uKxUd</a></b></p><br /><br />
87
- <p>In this article, we will explain what Epson PX660 Adjustment Program is, why you need it, how to download and install it, and how to use it. We will also provide some frequently asked questions and answers about this program. Read on to learn more!</p>
88
- <h2><strong>What is Epson PX660 Adjustment Program?</strong></h2>
89
- <p>Epson PX660 Adjustment Program is a utility tool for Epson Stylus Photo PX660 printer model. It is a service adjustment program that allows you to perform various functions on your printer. Some of these functions are:</p>
90
- <ul>
91
- <li>Resetting the waste ink pad counter: This feature prevents your printer from overflowing with ink by counting how much ink is used during printing and cleaning cycles. When the counter reaches a certain limit, your printer stops working and displays an error message. By using this program, you can reset the counter and continue printing.</li>
92
- <li>Prescribing the print head ID: This feature allows you to assign a unique ID to your print head, which helps your printer recognize it and adjust its settings accordingly. This can improve your print quality and prevent errors such as missing colors or lines.</li>
93
- <li>Doing printer initialization: This feature allows you to reset your printer's settings to their factory defaults. This can help you solve some problems that may occur due to incorrect or corrupted settings.</li>
94
- <li>Other functions: The program also allows you to perform other functions such as checking nozzle patterns, cleaning print heads, reading or writing EEPROM data, etc.</li>
95
- </ul>
96
- <p>Epson PX660 Adjustment Program is an original program that works only with USB on Windows computers. It is not compatible with other operating systems or connection methods. It is also attached to one PC only, which means you cannot use it on multiple computers. You need to purchase a license key for each PC you want to use it on.</p>
97
- <p>epson px660 resetter software free download<br />
98
- epson px660 printer adjustment tool rar file<br />
99
- epson px660 waste ink pad counter reset program<br />
100
- how to download and use epson px660 adjustment utility<br />
101
- epson px660 service required error fix software<br />
102
- epson px660 ink level resetter free download<br />
103
- epson px660 head cleaning program download<br />
104
- epson px660 maintenance mode software rar<br />
105
- epson px660 firmware update tool free download<br />
106
- epson px660 print quality adjustment program<br />
107
- epson px660 paper feed adjustment software<br />
108
- epson px660 nozzle check program download<br />
109
- epson px660 alignment program free download<br />
110
- epson px660 color calibration software rar<br />
111
- epson px660 ink cartridge replacement program<br />
112
- epson px660 scanner adjustment tool free download<br />
113
- epson px660 network settings program rar<br />
114
- epson px660 wireless setup software download<br />
115
- epson px660 driver installation program free<br />
116
- epson px660 troubleshooting guide software rar<br />
117
- epson px660 manual pdf download program<br />
118
- epson px660 cd printing software free download<br />
119
- epson px660 photo editing program rar file<br />
120
- epson px660 copy settings adjustment tool<br />
121
- epson px660 scan to email program free download<br />
122
- epson px660 borderless printing software rar<br />
123
- epson px660 duplex printing program download<br />
124
- epson px660 print speed adjustment tool free<br />
125
- epson px660 memory card slot program rar file<br />
126
- epson px660 lcd screen replacement software download<br />
127
- epson px660 power saving mode program free<br />
128
- epson px660 error codes software rar file<br />
129
- epson px660 parts list and diagram program download<br />
130
- epson px660 cleaning and lubrication software free<br />
131
- epson px660 disassembly and assembly program rar<br />
132
- epson px660 firmware downgrade software download<br />
133
- epson px660 chipless conversion program free<br />
134
- epson px660 continuous ink system installation software rar<br />
135
- epson px660 sublimation printing program download<br />
136
- epson px660 refillable ink cartridges program free<br />
137
- epson px660 compatible ink cartridges software rar file<br />
138
- epson px660 black ink only printing program download<br />
139
- epson px660 grayscale printing software free download<br />
140
- epson px660 draft mode printing program rar file<br />
141
- epson px660 high resolution printing software download<br />
142
- epson px660 glossy paper printing program free<br />
143
- epson px660 matte paper printing software rar file<br />
144
- epson px660 iron-on transfer printing program download<br />
145
- epson px660 sticker printing software free download</p>
146
- <h2><strong>Why Do You Need Epson PX660 Adjustment Program?</strong></h2>
147
- settings to their factory defaults. This can help you solve some problems that may occur due to incorrect or corrupted settings. For example, if your printer prints too dark or too light, or if it does not respond properly to commands. Other benefits of using this program include: - Saving ink and paper by optimizing your print settings and cleaning cycles - Extending your printer's lifespan by maintaining its parts in good condition - Troubleshooting your printer's problems by accessing various diagnostic tools - Updating your printer's firmware by downloading new versions from online sources <h2><strong>How to Download and Install Epson PX660 Adjustment Program?</strong></h2>
148
- To use Epson PX660 Adjustment Program, you need to download it from a reliable source and install it on your computer. Here are the steps: 1. Download Epson PX660 Adjustment Program from ORPYS website (https://orpys.com/en/epson/164-px660-adjustment-program.html). This website offers original programs for various Epson printer models at affordable prices. You can also find more information about each program's features and requirements on this website. 2. After downloading the file (px660_adjustment_program.zip), extract it using a zip extractor software such as WinRAR or 7-Zip. 3. Open the extracted folder and run AdjProg.exe file as administrator. 4. Follow the instructions on the screen to install the program on your computer. 5. After installation, you will receive a license key via email. You need this key to activate the program and access its functions. 6. To activate the program, run AdjProg.exe file again as administrator and enter your license key when prompted. 7. After activation, you can start using Epson PX660 Adjustment Program. Some requirements and precautions for downloading and installing this program are: - You need a Windows computer with USB port to use this program. - You need to disable your antivirus software before installing this program as some antivirus programs may block or delete it. - You need to bind this program to one PC only as it will not work on multiple computers. - You need to purchase a new license key for each PC you want to use this program on. <h2><strong>How to Use Epson PX660 Adjustment Program?</strong></h2>
149
- To use Epson PX660 Adjustment Program, you need to connect your printer to your computer via USB cable and run AdjProg.exe file as administrator. Then you can access different functions and settings of this program by following these steps: 1. Select Particular adjustment mode from the main menu. 2. Select Waste ink pad counter from Maintenance menu. 3. Click Check button to see how much ink has been used by your printer. 4. Click Initialization button to reset the waste ink pad counter. 5. Turn off your printer when prompted and turn it back on after 10 seconds. 6. Click Finish button when done. To prescribe your print head ID, follow these steps: 1. Select Particular adjustment mode from the main menu. 2. Select Head ID input from Head maintenance menu. 3. Enter your print head ID in hexadecimal format (e.g., 0A0B0C0D) or click Get button to read it from EEPROM data. 4. Click Set button to write it into EEPROM data. 5. Turn off your printer when prompted and turn it back on after 10 seconds. 6. Click Finish button when done. To do printer initialization, follow these steps: 1. Select Particular adjustment mode from the main menu. 2. Select Initialize (PF deterioration offset) from Initial setting menu. 3. Click OK button to confirm the initialization process. 4. Turn off your printer when prompted and turn it back on after 10 seconds. 5. Click Finish button when done. You can also use other functions and settings of this program by exploring different menus and options. For example, you can check nozzle patterns, clean print heads, read or write EEPROM data, etc. Here are some screenshots and examples of using this program: <img src="https://orpys.com/img/cms/px660/px660_1.jpg" alt="Epson PX660 Adjustment Program Main Menu">
150
- <img src="https://orpys.com/img/cms/px660/px660_2.jpg" alt="Epson PX660 Adjustment Program Waste Ink Pad Counter">
151
- <img src="https://orpys.com/img/cms/px660/px660_3.jpg" alt="Epson PX660 Adjustment Program Head ID Input">
152
- <img src="https://orpys.com/img/cms/px660/px660_4.jpg" alt="Epson PX660 Adjustment Program Initialize">
153
- <h2><strong>Conclusion</strong></h2>
154
- In conclusion, Epson PX660 Adjustment Program is a useful tool that can help you reset your printer and fix common problems. By using this program, you can reset your waste ink pad counter, prescribe your print head ID, do printer initialization and other functions. This can improve your print quality, save ink and paper, extend your printer's lifespan, troubleshoot your printer's problems, and update your printer's firmware. If you own an Epson Stylus Photo PX660 printer, we recommend you download and install this program from ORPYS website (https://orpys.com/en/epson/164-px660-adjustment-program.html). This website offers original programs for various Epson printer models at affordable prices. You can also find more information about each program's features and requirements on this website. We hope this article has been helpful and informative for you. If you have any feedback or questions about Epson PX660 Adjustment Program, please feel free to share them with us in the comments section below. We would love to hear from you! <h2><strong>FAQs</strong></h2>
155
- Here are some frequently asked questions and answers about Epson PX660 Adjustment Program: - What are the advantages of using this program over other methods? - This program is an original program that works only with USB on Windows computers. It is not compatible with other operating systems or connection methods. It is also attached to one PC only, which means you cannot use it on multiple computers. You need to purchase a license key for each PC you want to use it on. - This program allows you to reset the waste ink pad counter, prescribe the print head ID, do printer initialization and other functions that may not be available or easy to perform with other methods. - This program is easy to use and has a user-friendly interface that guides you through each step of the process. - How often do I need to reset my waste ink pad counter? - The waste ink pad counter is a feature that prevents your printer from overflowing with ink by counting how much ink is used during printing and cleaning cycles. When the counter reaches a certain limit (usually around 6700 pages), your printer stops working and displays an error message saying that your ink pads are at the end of their service life. - The frequency of resetting your waste ink pad counter depends on how often you use your printer and how much ink is used during each cycle. Generally speaking, you may need to reset it once every few months or years depending on your usage patterns. - How can I check if my print head ID is correct? - The print head ID is a unique ID that helps your printer recognize your print head and adjust its settings accordingly. This can improve your print quality and prevent errors such as missing colors or lines. - You can check if your print head ID is correct by using Epson PX660 Adjustment Program. To do so, follow these steps: - Select Particular adjustment mode from the main menu. - Select Head ID input from Head maintenance menu. - Enter your print head ID in hexadecimal format (e.g., 0A0B0C0D) or click Get button to read it from EEPROM data. - Compare the entered or read ID with the one printed on your print head label (usually located under the cartridge cover). - If they match, then your print head ID is correct. If they don't match, then you need to write the correct ID into EEPROM data by clicking Set button. - What should I do if I encounter any errors or problems while using this program? - If you encounter any errors or problems while using this program, you should try the following solutions: - Make sure you have downloaded and installed the correct version of this program for your printer model from ORPYS website (https://orpys.com/en/epson/164-px660-adjustment-program.html). - Make sure you have disabled your antivirus software before installing this program as some antivirus programs may block or delete it. - Make sure you have connected your printer to your computer via USB cable and turned it on before running this program. - Make sure you have entered the correct license key when activating this program. - Make sure you have followed the instructions on the screen carefully when using this program. - Where can I find more information or support for this program? - You can find more information or support for this program by visiting ORPYS website (https://orpys.com/en/epson/164-px660-adjustment-program.html). This website offers original programs for various Epson printer models at affordable prices. You can also find more information about each program's features and requirements on this website. - You can also contact ORPYS customer service by email ([email protected]) or phone (+380636000000) if you have any questions or issues regarding this program. </p> 0a6ba089eb<br />
156
- <br />
157
- <br />
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
spaces/1acneusushi/gradio-2dmoleculeeditor/data/Free Download Tally ERP 9 with Crack Pros and Cons.md DELETED
@@ -1,34 +0,0 @@
1
- <br />
2
- <h1>How to Free Download Tally ERP 9 with Crack Full Version</h1>
3
- <p>Tally ERP 9 is a popular business software for accounting, inventory, and payroll. It is used by millions of small and medium enterprises in India and abroad. Tally ERP 9 helps you manage your finances and operations efficiently and easily. It also offers features like statutory compliance, GST filing, remote access, and customization.</p>
4
- <h2>free download tally erp 9 with crack full version</h2><br /><p><b><b>Download File</b> &#9999; &#9999; &#9999; <a href="https://byltly.com/2uKzRI">https://byltly.com/2uKzRI</a></b></p><br /><br />
5
- <p>However, Tally ERP 9 is not a free software. You need to purchase a license to use it legally and get updates and support. The license fee depends on the edition and the number of users you need. For example, the Silver edition for a single user costs Rs. 18,000 plus GST, while the Gold edition for unlimited users costs Rs. 54,000 plus GST.</p>
6
- <p>But what if you want to use Tally ERP 9 without paying anything? Is there a way to get it for free? The answer is yes, but it comes with a lot of risks and drawbacks. In this article, we will explain how to free download Tally ERP 9 with crack full version, what are the dangers of using a cracked software, and what are the alternatives to Tally ERP 9.</p>
7
- <h2>How to Free Download Tally ERP 9 with Crack Full Version</h2>
8
- <p>A crack is a modified version of a software that bypasses its security features and allows you to use it without a license. There are many websites that claim to offer Tally ERP 9 with crack full version for free download. Some of them are:</p>
9
- <ul>
10
- <li><a href="https://www.thepiratecity.co/softwares/tally-erp-crack/">Tally ERP 9 With Crack Full Version [LATEST] - ThePirateCity</a></li>
11
- <li><a href="https://pesktop.com/en/windows/tally-erp-9">Download Tally ERP 9 2.14 Free Full Activated - pesktop.com</a></li>
12
- <li><a href="https://drive.google.com/file/d/1IpvvLzxmHfhqsaqhUSdMBylx4AsBKvAY/view">tally erp 9.6.4..zip - Google Drive</a></li>
13
- </ul>
14
- <p>To download Tally ERP 9 with crack from these websites, you need to follow these steps:</p>
15
- <p></p>
16
- <ol>
17
- <li>Click on the download link or button on the website.</li>
18
- <li>Wait for the file to be downloaded on your computer.</li>
19
- <li>Extract the zip file using WinRAR or any other software.</li>
20
- <li>Run the setup file and follow the instructions.</li>
21
- <li>Replace the original tally.exe file with the cracked one in the installation folder.</li>
22
- <li>Run Tally ERP 9 as administrator and activate it using any fake serial number and email address.</li>
23
- </ol>
24
- <p>Congratulations! You have successfully installed Tally ERP 9 with crack full version on your computer. You can now use it without any restrictions.</p>
25
- <h2>What are the Dangers of Using Tally ERP 9 with Crack Full Version</h2>
26
- <p>While using Tally ERP 9 with crack may seem tempting, it is not a wise decision. There are many risks and disadvantages of using a cracked software that can harm your business and your computer. Some of them are:</p>
27
- <ul>
28
- <li>You are violating the intellectual property rights of Tally Solutions Pvt Ltd, the developer of Tally ERP 9. This is illegal and unethical, and can result in legal action against you.</li>
29
- <li>You are exposing your computer to viruses, malware, spyware, ransomware, and other malicious programs that can damage your data and system. Cracked software often contains hidden codes that can infect your computer and compromise your security.</li>
30
- <li>You are missing out on important updates and patches that fix bugs, improve performance, and add new features to Tally ERP 9. Cracked software cannot be updated online, and you have to rely on outdated versions that may not work properly or support new requirements.</li>
31
- <li>You are losing access to technical support and customer service from Tally Solutions Pvt Ltd. If you face any problem or issue with Tally ERP 9, you cannot contact the official support team or get any assistance from them.</li>
32
- <li>You are risking your business reputation and credibility by using a pirated software. Your customers, suppliers,</p> ddb901b051<br />
33
- <br />
34
- <br />
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
spaces/1gistliPinn/ChatGPT4/Examples/Activation Key PhotoStage Slideshow Producer Keygen.epubhttps Scoutmails.com Index301.php K Activa.md DELETED
@@ -1,6 +0,0 @@
1
- <h2>Activation Key PhotoStage Slideshow Producer Keygen.epubhttps: scoutmails.com index301.php k Activa</h2><br /><p><b><b>DOWNLOAD</b> &raquo; <a href="https://imgfil.com/2uxZQU">https://imgfil.com/2uxZQU</a></b></p><br /><br />
2
- <br />
3
- Activation Key PhotoStage Slideshow Producer Keygen.epubhttps: scoutmails.com index301.php k Activa · download film diaspora cinta di ... 1fdad05405<br />
4
- <br />
5
- <br />
6
- <p></p>
 
 
 
 
 
 
 
spaces/1gistliPinn/ChatGPT4/Examples/Automatabookbyadeshkpandeypdfdownload.md DELETED
@@ -1,6 +0,0 @@
1
- <h2>automatabookbyadeshkpandeypdfdownload</h2><br /><p><b><b>Download</b> &hArr; <a href="https://imgfil.com/2uxZ4W">https://imgfil.com/2uxZ4W</a></b></p><br /><br />
2
-
3
- automatabookbyadeshkpandeypdfdownload · HD Online Player (tenggelamnya kapal van der wijck 201). 좋아요공감. 공유하기. 글 요소. 구독하기 hair, there and ... 1fdad05405<br />
4
- <br />
5
- <br />
6
- <p></p>
 
 
 
 
 
 
 
spaces/1pelhydcardo/ChatGPT-prompt-generator/assets/1v1 LOL Mod Menu APK How to Get God Mode Unlimited Ammo and Fly Mode on Your Device.md DELETED
@@ -1,88 +0,0 @@
1
-
2
- <h1>How to Download 1v1 Lol Mod Menu and Enjoy Unlimited Features</h1>
3
- <p>If you are a fan of online shooter games, you might have heard of 1v1 Lol, a popular browser-based game that lets you compete with other players in various modes and maps. But did you know that you can also download 1v1 Lol mod menu, a hack script that gives you access to cheats and mods that can make your gameplay more fun and exciting? In this article, we will tell you what 1v1 Lol is, what 1v1 Lol mod menu offers, and how to download and install it on your device.</p>
4
- <h2>What is 1v1 Lol and Why You Should Play It</h2>
5
- <h3>A Fun and Fast-Paced Online Shooter Game</h3>
6
- <p>1v1 Lol is a free online shooter game that combines elements of Fortnite and PUBG. You can play as a solo player or team up with your friends in different game modes such as 1v1, 2v2, 4v4, Battle Royale, Box Fight, Party, and more. You can also customize your character's appearance, weapons, skins, and emotes. The game is easy to play but hard to master, as you need to have good aim, reflexes, and building skills to survive.</p>
7
- <h2>download 1v1 lol mod menu</h2><br /><p><b><b>DOWNLOAD</b> &#10003; <a href="https://urlin.us/2uT15B">https://urlin.us/2uT15B</a></b></p><br /><br />
8
- <h3>A Variety of Game Modes and Maps to Choose From</h3>
9
- <p>One of the best things about 1v1 Lol is that it offers a variety of game modes and maps to suit your preferences and mood. You can choose from different modes such as:</p>
10
- <ul>
11
- <li><b>1v1:</b> A classic mode where you face off against another player in a small map. The first one to eliminate the other wins.</li>
12
- <li><b>2v2:</b> A team mode where you pair up with another player and fight against another duo in a medium-sized map. The team with the most kills wins.</li>
13
- <li><b>4v4:</b> A squad mode where you join a team of four players and battle against another team of four in a large map. The team with the most kills wins.</li>
14
- <li><b>Battle Royale:</b> A survival mode where you join a lobby of up to 10 players and parachute into a random map. You have to loot weapons, ammo, health kits, shields, and materials while avoiding the storm that shrinks the map. The last one standing wins.</li>
15
- <li><b>Box Fight:</b> A creative mode where you spawn in a box-shaped map with walls that you can edit. You have to use your building skills and weapons to eliminate your opponents.</li>
16
- <li><b>Party:</b> A casual mode where you can join or create a room with up to 10 players and play any mode or map you want. You can also chat with your friends and invite them to your room.</li>
17
- </ul>
18
- <h2>What is 1v1 Lol Mod Menu and What Does It Offer</h2>
19
- <h3>A Hack Script That Gives You Access to Cheats and Mods</h3>
20
- <p>If you want to spice up your gameplay and have an edge over your opponents, you might want to try 1v1 Lol mod menu, a hack script that gives you access to cheats and mods that can enhance your gaming experience. 1v1 Lol mod menu is a cheat engine script that you can download and run on your device. It allows you to enable or disable various cheats and mods that can affect your gameplay, such as god mode, infinite ammo, rapid fire, free fly, no clip, no recoil, and more. With 1v1 Lol mod menu, you can have more fun and dominate your opponents in any mode or map.</p>
21
- <p>How to download 1v1 lol mod menu for free<br />
22
- 1v1 lol mod menu cheat engine download link<br />
23
- 1v1 lol mod menu script gui tutorial<br />
24
- 1v1 lol mod menu god mode rapid fire fly mode<br />
25
- 1v1 lol mod menu hacks cheats scripts<br />
26
- Best 1v1 lol mod menu for pc and mobile<br />
27
- 1v1 lol mod menu unlimited ammo and health<br />
28
- 1v1 lol mod menu aimbot wallhack esp<br />
29
- 1v1 lol mod menu no virus no survey<br />
30
- 1v1 lol mod menu working 2023 update<br />
31
- 1v1 lol mod menu installation guide and tips<br />
32
- 1v1 lol mod menu review and gameplay<br />
33
- 1v1 lol mod menu discord server and support<br />
34
- 1v1 lol mod menu pastebin and github links<br />
35
- 1v1 lol mod menu greasy fork and tampermonkey scripts<br />
36
- 1v1 lol mod menu firefox and chrome extensions<br />
37
- 1v1 lol mod menu youtube videos and channels<br />
38
- 1v1 lol mod menu reddit posts and comments<br />
39
- 1v1 lol mod menu features and options<br />
40
- 1v1 lol mod menu pros and cons<br />
41
- 1v1 lol mod menu vs vanilla game comparison<br />
42
- 1v1 lol mod menu custom skins and maps<br />
43
- 1v1 lol mod menu fun and funny moments<br />
44
- 1v1 lol mod menu glitches and bugs<br />
45
- 1v1 lol mod menu ban risk and safety<br />
46
- 1v1 lol mod menu alternatives and competitors<br />
47
- 1v1 lol mod menu download speed and size<br />
48
- 1v1 lol mod menu compatibility and requirements<br />
49
- 1v1 lol mod menu feedback and ratings<br />
50
- 1v1 lol mod menu developer and creator<br />
51
- How to uninstall 1v1 lol mod menu from your device<br />
52
- How to update 1v1 lol mod menu to the latest version<br />
53
- How to fix 1v1 lol mod menu errors and issues<br />
54
- How to customize 1v1 lol mod menu settings and preferences<br />
55
- How to use 1v</p>
56
- <h3>Some of the Features of 1v1 Lol Mod Menu</h3>
57
- <h4>God Mode, Infinite Ammo, Rapid Fire, and More</h4>
58
- <p>One of the features of 1v1 Lol mod menu is that it gives you god mode, which means you are invincible and cannot be killed by any weapon or damage. You can also have infinite ammo, which means you never run out of bullets or rockets. You can also have rapid fire, which means you can shoot faster and more frequently. These cheats can make you unstoppable and give you an unfair advantage over your enemies.</p>
59
- <h4>Free Fly, No Clip, No Recoil, and More</h4>
60
- <p>Another feature of 1v1 Lol mod menu is that it gives you free fly, which means you can fly around the map without any limitations. You can also have no clip, which means you can pass through walls and objects. You can also have no recoil, which means your aim is steady and accurate. These mods can make you more agile and flexible and give you more freedom and control over your movements.</p>
61
- <h2>How to Download and Install 1v1 Lol Mod Menu on Your Device</h2>
62
- <h3>The Requirements and Precautions for Using 1v1 Lol Mod Menu</h3>
63
- <p>Before you download and install 1v1 Lol mod menu on your device, there are some requirements and precautions that you need to know. First of all, you need to have a device that can run 1v1 Lol, such as a PC, a laptop, a tablet, or a smartphone. You also need to have a stable internet connection and a web browser that supports the game. Secondly, you need to have Cheat Engine installed on your device. Cheat Engine is a software that allows you to modify games and applications by changing their code. You can download Cheat Engine from its official website. Thirdly, you need to be aware of the risks and consequences of using 1v1 Lol mod menu. Using cheats and mods can be considered as cheating and hacking by the game developers and other players. You might get banned from the game or reported by other players if they notice your abnormal behavior. You might also ruin the fun and challenge of the game for yourself and others. Therefore, use 1v1 Lol mod menu at your own discretion and responsibility.</p>
64
- <h3>The Steps to Download and Install 1v1 Lol Mod Menu</h3>
65
- <h4>Download Cheat Engine and the Mod Menu Script</h4>
66
- <p>The first step to download and install 1v1 Lol mod menu is to download Cheat Engine and the mod menu script from their respective sources. You can download Cheat Engine from its official website or from any other trusted source. You can download the mod menu script from this link or from any other reliable source. Make sure to save them in a folder that you can easily access.</p>
67
- <h4>Run Cheat Engine and Select 1v1 Lol as the Process</h4>
68
- <p>The second step to download and install 1v1 Lol mod menu is to run Cheat Engine and select 1v1 Lol as the process that you want to modify. To do this, open Cheat Engine on your device and click on the computer icon on the top left corner. A window will pop up with a list of processes that are running on your device. Find and select the process that corresponds to 1v1 Lol (it might be named as "chrome.exe" or "firefox.exe" depending on your browser) and click on "Open".</p>
69
- <h4>Load the Mod Menu Script and Enable the Cheats You Want</h4>
70
- <p>The third step to download and install 1v1 Lol mod menu is to load the mod menu script and enable the cheats you want. To do this, click on the folder icon on the top left corner of Cheat Engine and browse to the folder where you saved the mod menu script. Select the script and click on "Open". A window will pop up with a list of cheats and mods that are available in the script. You can check or uncheck the boxes next to the cheats and mods that you want to enable or disable. You can also change the values of some of the cheats and mods by double-clicking on them and typing in the desired value. For example, you can change the speed of your character, the gravity of the map, or the size of your weapon. Once you are done, click on "OK".</p>
71
- <h2>Conclusion</h2>
72
- <p>1v1 Lol is a fun and fast-paced online shooter game that you can play with your friends or strangers in various modes and maps. However, if you want to have more fun and excitement, you can also download 1v1 Lol mod menu, a hack script that gives you access to cheats and mods that can enhance your gameplay. 1v1 Lol mod menu offers features such as god mode, infinite ammo, rapid fire, free fly, no clip, no recoil, and more. To download and install 1v1 Lol mod menu on your device, you need to have Cheat Engine and the mod menu script. You also need to run Cheat Engine and select 1v1 Lol as the process. Then, you need to load the mod menu script and enable the cheats you want. However, you also need to be aware of the risks and consequences of using 1v1 Lol mod menu. You might get banned from the game or reported by other players if they notice your abnormal behavior. You might also ruin the fun and challenge of the game for yourself and others. Therefore, use 1v1 Lol mod menu at your own discretion and responsibility.</p>
73
- <h2>FAQs</h2>
74
- <p>Here are some of the frequently asked questions about 1v1 Lol mod menu:</p>
75
- <ul>
76
- <li><b>Q: Is 1v1 Lol mod menu safe to use?</b></li>
77
- <li>A: 1v1 Lol mod menu is not an official or authorized product of 1v1 Lol or its developers. It is a hack script that modifies the game code and can be detected by anti-cheat systems or other players. Therefore, using 1v1 Lol mod menu is not safe and can result in getting banned from the game or reported by other players.</li>
78
- <li><b>Q: How can I update 1v1 Lol mod menu?</b></li>
79
- <li>A: 1v1 Lol mod menu is not a static product that works forever. It is a dynamic script that needs to be updated regularly to match the updates of 1v1 Lol and its anti-cheat systems. Therefore, you need to check for updates of 1v1 Lol mod menu from its source or from other reliable sources. You also need to download and install the latest version of Cheat Engine and the mod menu script.</li>
80
- <li><b>Q: Can I use 1v1 Lol mod menu on any device?</b></li>
81
- <li>A: 1v1 Lol mod menu is compatible with any device that can run 1v1 Lol, such as a PC, a laptop, a tablet, or a smartphone. However, you also need to have Cheat Engine installed on your device, which might not be available for some devices or operating systems. Therefore, you need to check if your device can support Cheat Engine before using 1v1 Lol mod menu.</li>
82
- <li><b>Q: Can I use 1v1 Lol mod menu on any mode or map?</b></li>
83
- <li>A: 1v1 Lol mod menu works on any mode or map that is available in 1v1 Lol, such as 1v1, 2v2, 4v4, Battle Royale, Box Fight, Party, and more. However, some of the cheats and mods might not work properly or have different effects depending on the mode or map. Therefore, you need to test and adjust the cheats and mods according to the mode or map that you are playing.</li>
84
- <li><b>Q: Can I use 1v1 Lol mod menu with my friends?</b></li>
85
- <li>A: 1v1 Lol mod menu can be used with your friends if they also have Cheat Engine and the mod menu script installed on their devices. You can join or create a room with your friends and play any mode or map you want with them. However, you also need to be careful not to get caught by other players or by the game developers if you use 1v1 Lol mod menu with your friends.</li>
86
- </ul></p> 197e85843d<br />
87
- <br />
88
- <br />
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
spaces/1pelhydcardo/ChatGPT-prompt-generator/assets/AetherSX2 Everything You Need to Know to Download and Play PS2 Games on Android.md DELETED
@@ -1,136 +0,0 @@
1
-
2
- <h1>Where to Download AetherSX2 Games</h1>
3
- <p>The Sony PlayStation 2 (PS2) is one of the most popular and nostalgic gaming consoles of all time. It has a huge library of games that span across various genres, from action and adventure to sports and racing. If you want to relive your childhood memories or discover new games that you missed out on, you can now play PS2 games on your Android device using the AetherSX2 emulator.</p>
4
- <p>AetherSX2 is the best PS2 emulator for Android by a country mile. It is based on the PCSX2 emulator for PC, which is a long-running, well-established program that can run most PS2 games smoothly. AetherSX2 has received the approval and support from the PCSX2 developers, unlike some other shady emulators that stole the code and violated the license agreement.</p>
5
- <h2>where to download aethersx2 games</h2><br /><p><b><b>Download</b> &harr; <a href="https://urlin.us/2uT2PN">https://urlin.us/2uT2PN</a></b></p><br /><br />
6
- <p>In this article, we will show you how to download AetherSX2 emulator, how to download games for AetherSX2, and how to install and play them on your Android device. We will also provide some tips and tricks to optimize your gaming experience and recommend some of the best games to play on AetherSX2.</p>
7
- <h2>How to download AetherSX2 emulator</h2>
8
- <p>The first step to play PS2 games on Android is to download the AetherSX2 emulator. There are two ways to get it: from the Google Play Store or from the official website.</p>
9
- <h3>How to get it from the Google Play Store</h3>
10
- <p>The easiest way to download AetherSX2 emulator is to get it from the Google Play Store. You can simply search for "AetherSX2" on the store or use this link: (https://play.google.com/store/apps/details?id=xyz.aethersx2.android). The app is free to download and use, so don't fall for any scams that ask you to pay for it.</p>
11
- <p>Once you have downloaded the app, you can open it and grant it the necessary permissions. You will also need to download a PS2 BIOS file, which is required for the emulator to run. You can get it from your own PS2 console or from other sources online. Just make sure you don't download any malware or viruses along with it.</p>
12
- <h3>How to get it from the official website</h3>
13
- <p>If you prefer to sideload the APK file of the emulator, you can also get it from the official website: (https://www.aethersx2.com/). You can find different versions of the app there, including stable releases and alpha builds. You can choose whichever one suits your needs, but keep in mind that alpha builds may have more bugs and issues than stable releases.</p>
14
- <p>To install the APK file, you will need to enable unknown sources on your device settings. You can do this by going to Settings > Security > Unknown sources and toggling it on. Then, you can tap on the downloaded APK file and follow the instructions to install it. You will also need a PS2 BIOS file, as mentioned above.</p>
15
- <p>How to play PS2 games on Android with AetherSX2<br />
16
- AetherSX2 emulator settings and performance tips<br />
17
- Best PS2 games to download for AetherSX2<br />
18
- AetherSX2 vs other PS2 emulators for Android<br />
19
- AetherSX2 compatibility list and game reviews<br />
20
- Where to find PS2 BIOS and ISO files for AetherSX2<br />
21
- How to use save states and cheats in AetherSX2<br />
22
- AetherSX2 controller support and configuration guide<br />
23
- How to install and update AetherSX2 on Android<br />
24
- AetherSX2 Vulkan vs OpenGL graphics comparison<br />
25
- AetherSX2 minimum requirements and recommended devices<br />
26
- How to fix common issues and errors in AetherSX2<br />
27
- AetherSX2 multiplayer and online features overview<br />
28
- How to stream PS2 games from AetherSX2 to PC or TV<br />
29
- AetherSX2 internal resolution scaling and quality settings<br />
30
- How to backup and restore your AetherSX2 data and games<br />
31
- How to mod PS2 games and use custom skins in AetherSX2<br />
32
- How to record and share your gameplay videos from AetherSX2<br />
33
- How to optimize your battery life and performance while using AetherSX2<br />
34
- How to get free PS2 games legally for AetherSX2<br />
35
- How to run PS1 and PSP games on AetherSX2<br />
36
- How to connect a PS4 or Xbox controller to AetherSX2<br />
37
- How to play PS2 games on Chromebook with AetherSX2<br />
38
- How to download and play GTA San Andreas on AetherSX2<br />
39
- How to download and play God of War on AetherSX2<br />
40
- How to download and play Kingdom Hearts on AetherSX2<br />
41
- How to download and play Final Fantasy X on AetherSX2<br />
42
- How to download and play Metal Gear Solid 3 on AetherSX2<br />
43
- How to download and play Shadow of the Colossus on AetherSX2<br />
44
- How to download and play Resident Evil 4 on AetherSX2<br />
45
- How to download and play Silent Hill 2 on AetherSX2<br />
46
- How to download and play Persona 4 on AetherSX2<br />
47
- How to download and play Dragon Ball Z Budokai Tenkaichi 3 on AetherSX2<br />
48
- How to download and play Naruto Shippuden Ultimate Ninja 5 on AetherSX2<br />
49
- How to download and play Tekken 5 on AetherSX2<br />
50
- How to download and play Mortal Kombat Deception on AetherSX2<br />
51
- How to download and play Need for Speed Most Wanted on AetherSX2<br />
52
- How to download and play Burnout 3 Takedown on AetherSX2<br />
53
- How to download and play Gran Turismo 4 on AetherSX2<br />
54
- How to download and play Ratchet & Clank on AetherSX2<br />
55
- How to download and play Jak & Daxter on AetherSX2<br />
56
- How to download and play Sly Cooper on AetherSX2<br />
57
- How to download and play Crash Bandicoot The Wrath of Cortex on AetherSX2<br />
58
- How to download and play Spyro Enter the Dragonfly on AetherSX2<br />
59
- How to download and play Lego Star Wars II The Original Trilogy on AetherSX2</p>
60
- <h2>How to download games for AetherSX2</h2>
61
- <p>Now that you have downloaded the AetherSX2 emulator, you will need some games to play on it. The emulator supports PS2 game ISOs or ROMs, which are digital copies of game discs. You can either rip them from your own PS2 discs using a PC or a modded console, or you can download them from legal sources online. However, we do not condone piracy or illegal downloading of games, so you should only download games that you own or have the right to use. You can find some legal sources of PS2 game ISOs or ROMs here: (https://www.emuparadise.me/Sony_Playstation_2_ISOs/41) (https://www.freeroms.com/ps2_roms.htm) (https://romsmania.cc/roms/playstation-2). Be careful of any fake or malicious links that may harm your device or compromise your privacy.</p>
62
- <h3>How to extract and transfer them to your device</h3>
63
- <p>Once you have downloaded the PS2 game ISOs or ROMs, you will need to extract them from their compressed formats, such as ZIP or RAR. You can use any file manager app that supports extraction, such as (https://play.google.com/store/apps/details?id=com.rarlab.rar) or (https://play.google.com/store/apps/details?id=com.estrongs.android.pop). You can also use a PC to extract them and then transfer them to your device via USB cable or cloud storage.</p>
64
- <p>After extracting the PS2 game ISOs or ROMs, you will need to transfer them to a folder on your device where the AetherSX2 emulator can access them. You can create a folder named "AetherSX2" on your internal storage or SD card and copy the game files there. Alternatively, you can use the default folder that the emulator creates when you first run it, which is "/storage/emulated/0/AetherSX2".</p>
65
- <h2>How to install and play games on AetherSX2</h2>
66
- <p>Now that you have the AetherSX2 emulator and the PS2 game ISOs or ROMs on your device, you are ready to install and play them. Here are the steps to follow:</p>
67
- <h3>How to load and run games on the emulator</h3>
68
- <p>To load and run games on the AetherSX2 emulator, you need to open the app and tap on the "Games" tab. You will see a list of games that are available in your device's storage. You can also browse for games by tapping on the "Browse" button and navigating to the folder where you stored them.</p>
69
- <p>Once you find the game that you want to play, tap on it and wait for it to load. The emulator will automatically detect the game's region and language settings and apply them accordingly. You will see a loading screen with some information about the game, such as its title, cover art, developer, publisher, genre, and release date.</p>
70
- <p>After the loading screen, the game will start running on the emulator. You will see a virtual controller overlay on the screen, which mimics the PS2 controller layout. You can use it to control the game as you would on a real PS2 console. You can also hide or show the controller overlay by tapping on the "Menu" button and selecting "Toggle On-screen Controls".</p>
71
- <h3>How to adjust settings and controls for optimal performance and experience</h3>
72
- <p>To adjust settings and controls for optimal performance and experience, you need to tap on the "Menu" button and select "Settings". You will see various options that you can tweak according to your preferences and device's capabilities. Here are some of the most important settings that you should pay attention to:</p>
73
- <ul>
74
- <li>Graphics: Here you can change the resolution, aspect ratio, frame rate, anti-aliasing, texture filtering, shaders, and other graphical enhancements of the emulator. You can also enable or disable cheats, speed hacks, skip frames, widescreen patches, and other features that may improve or worsen the game's appearance and performance.</li>
75
- <li>Audio: Here you can change the volume, latency, interpolation, reverb, sync mode, and other audio settings of the emulator. You can also enable or disable sound effects, music, voiceovers, and other sound components of the game.</li>
76
- <li>Input: Here you can change the layout, size, opacity, vibration, sensitivity, mapping, and other input settings of the emulator. You can also enable or disable touch input, motion sensor input, external controller input (such as Bluetooth or USB), and other input methods for the game.</li>
77
- <li>System: Here you can change the BIOS file, language, region, clock speed, memory card size, save state slot number, auto-save frequency, and other system settings of the emulator. You can also enable or disable fast boot, full boot, debug mode, logging, and other system features for the game.</li>
78
- </ul>
79
- <p>You can experiment with different settings and controls to find the best combination for your device and game. You can also save and load different profiles for different games, so you don't have to change the settings every time you switch games.</p>
80
- <h2>Conclusion</h2>
81
- <p>AetherSX2 is the best PS2 emulator for Android that lets you play PS2 games on your device with ease and convenience. You can download the emulator from the Google Play Store or the official website, and download games from legal sources online. You can also adjust settings and controls to optimize your gaming experience and enjoy the PS2 classics on your Android device.</p>
82
- <p>Some of the best games to play on AetherSX2 are:</p>
83
- <table>
84
- <tr>
85
- <th>Game</th>
86
- <th>Genre</th>
87
- <th>Description</th>
88
- </tr>
89
- <tr>
90
- <td>God of War</td>
91
- <td>Action-adventure</td>
92
- <td>A hack-and-slash game that follows the story of Kratos, a Spartan warrior who seeks revenge against the gods of Olympus.</td>
93
- </tr>
94
- <tr>
95
- <td>Shadow of the Colossus</td>
96
- <td>Action-adventure</td>
97
- <td>A unique game that involves exploring a vast land and defeating giant creatures called colossi to revive a girl named Mono.</td>
98
- </tr>
99
- <tr>
100
- <td>Grand Theft Auto: San Andreas</td>
101
- <td>Action-adventure</td>
102
- <td>A sandbox game that allows you to roam freely in a fictional state of San Andreas, where you can engage in various missions, activities, and crimes.</td>
103
- </tr>
104
- <tr>
105
- <td>Final Fantasy X</td>
106
- <td>Role-playing</td>
107
- <td>A turn-based game that follows the journey of Tidus, a young athlete who is transported to a world called Spira, where he joins a summoner named Yuna on her quest to defeat a monster called Sin.</td>
108
- </tr>
109
- <tr>
110
- <td>Metal Gear Solid 3: Snake Eater</td>
111
- <td>Stealth-action</td>
112
- <td>A stealth game that takes place in 1964, where you play as Naked Snake, a special agent who is sent to infiltrate a Soviet base and rescue a scientist.</td>
113
- </tr>
114
- </table>
115
- <h2>FAQs</h2>
116
- <h3>Q: Is AetherSX2 emulator legal?</h3>
117
- <p>A: Yes, AetherSX2 emulator is legal as long as you use it with games that you own or have the right to use. The emulator itself does not contain any copyrighted material or code from Sony or other parties.</p>
118
- <h3>Q: How much storage space do I need for AetherSX2 emulator and games?</h3>
119
- <p>A: The AetherSX2 emulator app itself is about 30 MB in size, but you will also need some additional space for the PS2 BIOS file and the game files. The PS2 BIOS file is about 4 MB in size, while the game files vary depending on the game. Some games are less than 1 GB in size, while others are more than 4 GB in size. You can check the file size of each game before downloading it.</p>
120
- <h3>Q: How powerful does my device need to be to run AetherSX2 emulator and games?</h3>
121
- <p>A: The AetherSX2 emulator and games require a decent amount of processing power and memory to run smoothly. The minimum requirements are:</p>
122
- <ul>
123
- <li>CPU: Quad-core 1.5 GHz or higher</li>
124
- <li>RAM: 2 GB or higher</li>
125
- <li>GPU: Adreno 320 or higher, Mali-400MP4 or higher, PowerVR SGX544MP or higher</li>
126
- <li>OS: Android 5.0 Lollipop or higher</li>
127
- <li>OpenGL ES: 3.0 or higher</li>
128
- <li>Vulkan: Supported (optional)</li>
129
- </ul>
130
- <h3>Q: Can I use cheats or mods with AetherSX2 emulator and games?</h3>
131
- <p>A: Yes, you can use cheats or mods with AetherSX2 emulator and games. The emulator supports cheat codes in various formats, such as RAW, PNACH, CB, ARMAX, etc. You can enter them manually or import them from files. You can also use mods that alter the game's graphics, sound, gameplay, etc. You can find them online or create them yourself.</p>
132
- <h3>Q: Can I play multiplayer games with AetherSX2 emulator?</h3>
133
- <p>A: Yes, you can play multiplayer games with AetherSX2 emulator. The emulator supports local multiplayer via split-screen mode or external controllers. You can also play online multiplayer via a network adapter or a VPN service. However, the online multiplayer feature is still experimental and may not work for all games or devices.</p>
134
- <p>I hope this article has helped you learn how to download AetherSX2 games and play them on your Android device. If you have any questions or feedback, feel free to leave a comment below. Happy gaming!</p> 197e85843d<br />
135
- <br />
136
- <br />
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
spaces/1phancelerku/anime-remove-background/Download and Play Real Drag Bike Racing Mod APK for Free.md DELETED
@@ -1,90 +0,0 @@
1
- <br />
2
- <h1>Link Real Drag Bike Racing Mod APK: A Guide for Thrill Seekers</h1>
3
- <p>If you are a fan of motorcycle racing, you might want to check out Link Real Drag Bike Racing Mod APK, a game that lets you experience the thrill of drag racing on your Android device. In this game, you can choose from a variety of drag bikes, customize them to your liking, and compete on different tracks and modes. You can also enjoy unlimited money and unlocked features with the modded version of the game. In this article, we will tell you more about Link Real Drag Bike Racing Mod APK, how to download and install it, how to play it, and some tips and tricks to help you win.</p>
4
- <h2>link real drag bike racing mod apk</h2><br /><p><b><b>Download File</b> &#10037; <a href="https://jinyurl.com/2uNR7W">https://jinyurl.com/2uNR7W</a></b></p><br /><br />
5
- <h2>What is Link Real Drag Bike Racing Mod APK?</h2>
6
- <p>Link Real Drag Bike Racing Mod APK is a modified version of Link Real Drag Bike Racing, a game developed by Get Mods Apk. The game is inspired by the real-life sport of drag racing, where two motorcycles race on a straight track for a short distance. The game features realistic graphics, sound effects, and physics, as well as a diverse selection of drag bikes for you to choose from. You can also customize your bike with different parts, colors, stickers, and accessories. The game offers various tracks and modes for you to challenge yourself, such as street racing, tournament racing, time trial racing, and online racing. You can also upgrade your skills and equipment as you progress in the game.</p>
7
- <p>The modded version of the game gives you some advantages over the original version, such as unlimited money and unlocked features. With unlimited money, you can buy any bike or part you want without worrying about the cost. You can also access all the tracks and modes without having to complete certain levels or tasks. The modded version also removes ads and other annoying features that might interrupt your gameplay.</p>
8
- <h2>Features and benefits of Link Real Drag Bike Racing Mod APK</h2>
9
- <p>Some of the features and benefits of Link Real Drag Bike Racing Mod APK are:</p>
10
- <p>Download real drag bike racing mod apk unlimited money<br />
11
- Real drag bike racing mod apk latest version free<br />
12
- How to install real drag bike racing mod apk on android<br />
13
- Real drag bike racing mod apk offline gameplay<br />
14
- Real drag bike racing mod apk v2.0 download link<br />
15
- Real drag bike racing mod apk hack cheats 2023<br />
16
- Real drag bike racing mod apk review and rating<br />
17
- Real drag bike racing mod apk features and tips<br />
18
- Real drag bike racing mod apk from uptodown.com<br />
19
- Real drag bike racing mod apk by marangi putro<br />
20
- Real drag bike racing mod apk for pc windows 10<br />
21
- Real drag bike racing mod apk no root required<br />
22
- Real drag bike racing mod apk update and news<br />
23
- Real drag bike racing mod apk best bikes and tracks<br />
24
- Real drag bike racing mod apk online multiplayer mode<br />
25
- Real drag bike racing mod apk vs real moto gp<br />
26
- Real drag bike racing mod apk dafunda download site<br />
27
- Real drag bike racing mod apk file size and requirements<br />
28
- Real drag bike racing mod apk support and feedback<br />
29
- Real drag bike racing mod apk alternatives and similar apps<br />
30
- Real drag bike racing mod apk with unlimited coins and gems<br />
31
- Real drag bike racing mod apk full unlocked and premium<br />
32
- Real drag bike racing mod apk bug fixes and improvements<br />
33
- Real drag bike racing mod apk fun and addictive game<br />
34
- Real drag bike racing mod apk realistic graphics and sound<br />
35
- Real drag bike racing mod apk easy and smooth controls<br />
36
- Real drag bike racing mod apk customise and upgrade bikes<br />
37
- Real drag bike racing mod apk challenge and compete with friends<br />
38
- Real drag bike racing mod apk new and exciting levels<br />
39
- Real drag bike racing mod apk for ios iphone and ipad</p>
40
- <ul>
41
- <li>Realistic graphics, sound effects, and physics that make you feel like you are on a real drag bike.</li>
42
- <li>A diverse selection of drag bikes for you to choose from, each with its own characteristics and performance.</li>
43
- <li>A variety of customization options for your bike, such as parts, colors, stickers, and accessories.</li>
44
- <li>Different tracks and modes for you to compete on, such as street racing, tournament racing, time trial racing, and online racing.</li>
45
- <li>Unlimited money and unlocked features that let you enjoy the game without any limitations or restrictions.</li>
46
- <li>No ads or other annoying features that might disrupt your gameplay.</li>
47
- </ul>
48
- <h2>How to download and install Link Real Drag Bike Racing Mod APK</h2>
49
- <p>To download and install Link Real Drag Bike Racing Mod APK on your Android device, follow these steps:</p>
50
- <ol>
51
- <li>Go to [this link](^1^) to download the modded version of the game.</li>
52
- <li>After downloading the file, go to your device settings and enable unknown sources. This will allow you to install apps from sources other than the Google Play Store.</li>
53
- <li>Locate the downloaded file in your device storage and tap on it to start the installation process.</li>
54
- <li>Follow the instructions on the screen to complete the installation.</li>
55
- <li>Once the installation is done, launch the game and enjoy the thrill of drag racing.</li>
56
- </ol>
57
- <h2>How to play Link Real Drag Bike Racing Mod APK</h2>
58
- <p>Link Real Drag Bike Racing Mod APK is easy to play, but hard to master. Here are some basic steps to help you get started:</p>
59
- <h3>Choose your drag bike and customize it</h3>
60
- <p>The first thing you need to do is to choose your drag bike from the garage. You can select from different categories, such as street bikes, sport bikes, or super bikes. Each bike has its own stats, such as power, torque, weight, and speed. You can also customize your bike with different parts, colors, stickers, and accessories. You can use the unlimited money from the modded version to buy any bike or part you want.</p>
61
- <h3>Compete on various tracks and modes</h3>
62
- <p>After choosing and customizing your bike, you can compete on various tracks and modes. You can choose from different locations, such as city streets, highways, deserts, or mountains. You can also choose from different modes, such as street racing, tournament racing, time trial racing, or online racing. In street racing, you can race against random opponents on different tracks. In tournament racing, you can participate in a series of races and earn trophies and rewards. In time trial racing, you can race against the clock and beat your own records. In online racing, you can race against other players from around the world and show off your skills.</p>
63
- <h3>Upgrade your skills and equipment</h3>
64
- <p>As you progress in the game, you can upgrade your skills and equipment to improve your performance. You can upgrade your skills, such as launch control, shifting control, nitrous control, and tuning control. You can also upgrade your equipment, such as engine, turbo, exhaust, transmission, tires, and brakes. You can use the unlimited money from the modded version to upgrade anything you want.</p>
65
- <h2>Tips and tricks for Link Real Drag Bike Racing Mod APK</h2>
66
- <p>Link Real Drag Bike Racing Mod APK is a game that requires skill and strategy to win. Here are some tips and tricks to help you become a better drag racer:</p>
67
- <h3>Master the launch and shifting</h3>
68
- <p>The launch and shifting are two of the most important aspects of drag racing. You need to launch your bike at the right time and shift gears at the right time to optimize your acceleration and speed. To launch your bike, you need to press the clutch button when the countdown starts and release it when the green light appears. To shift gears, you need to press the shift button when the needle reaches the green zone on the tachometer. If you launch or shift too early or too late, you will lose speed and time.</p>
69
- <h3>Use nitrous wisely</h3>
70
- <p>Nitrous is a powerful boost that can give you an edge over your opponents. However, you need to use it wisely, as it is limited and can run out quickly. You can activate nitrous by pressing the nitrous button on the screen. You should use nitrous when you need an extra burst of speed or when you are behind your opponent. You should avoid using nitrous when you are already at top speed or when you are about to shift gears.</p>
71
- <h3>Tune your bike according to the track conditions</h3>
72
- <p>Tuning your bike is a way of adjusting its performance according to the track conditions. You can tune your bike by changing its settings, such as gear ratio, tire pressure, suspension stiffness, and wheel alignment. You can access the tuning menu by tapping on the tuning button on the screen. You should tune your bike according to the track length, surface type, weather condition, and elevation. For example, if the track is long and straight, you should increase your gear ratio for higher top speed. If the track is short and curvy, you should decrease your gear ratio for faster acceleration. You should also adjust your tire pressure, suspension stiffness, and wheel alignment according to the surface type, weather condition, and elevation of the track.</p>
73
- <h2>Conclusion</h2>
74
- <p>Link Real Drag Bike Racing Mod APK is a game that lets you experience the thrill of drag racing on your Android device. You can choose from a variety of drag bikes, customize them to your liking, and compete on different tracks and modes. You can also enjoy unlimited money and unlocked features with the modded version of the game. The game is easy to play, but hard to master. You need to master the launch and shifting, use nitrous wisely, and tune your bike according to the track conditions. If you follow these tips and tricks, you will become a better drag racer and have more fun with the game.</p>
75
- <h2>FAQs</h2>
76
- <p>Here are some frequently asked questions about Link Real Drag Bike Racing Mod APK:</p>
77
- <ol>
78
- <li>Is Link Real Drag Bike Racing Mod APK safe to download and install?</li>
79
- <p>Yes, Link Real Drag Bike Racing Mod APK is safe to download and install, as long as you download it from a trusted source, such as [this link]. The modded version of the game does not contain any viruses or malware that might harm your device or data.</p>
80
- <li>Do I need to root my device to use Link Real Drag Bike Racing Mod APK?</li>
81
- <p>No, you do not need to root your device to use Link Real Drag Bike Racing Mod APK. The modded version of the game works on both rooted and non-rooted devices. However, you need to enable unknown sources in your device settings to install apps from sources other than the Google Play Store.</p>
82
- <li>Can I play Link Real Drag Bike Racing Mod APK offline?</li>
83
- <p>Yes, you can play Link Real Drag Bike Racing Mod APK offline, except for the online racing mode. The online racing mode requires an internet connection to connect with other players from around the world. The other modes, such as street racing, tournament racing, and time trial racing, can be played offline without any problem.</p>
84
- <li>Can I update Link Real Drag Bike Racing Mod APK?</li>
85
- <p>No, you cannot update Link Real Drag Bike Racing Mod APK from the Google Play Store or any other source. The modded version of the game is not compatible with the original version of the game. If you try to update it, you might lose your progress and data. You should only download and install the latest version of Link Real Drag Bike Racing Mod APK from [this link].</p>
86
- <li>How can I contact the developer of Link Real Drag Bike Racing Mod APK?</li>
87
- <p>You can contact the developer of Link Real Drag Bike Racing Mod APK by visiting their website at [this link]. You can also follow them on their social media accounts, such as Facebook, Twitter, Instagram, and YouTube. You can send them your feedback, suggestions, questions, or complaints about the game.</p>
88
- </ol></p> 401be4b1e0<br />
89
- <br />
90
- <br />
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
spaces/AB-TW/team-ai/agents/tools/smart_domain/domain_layer_code_tool.py DELETED
@@ -1,56 +0,0 @@
1
- from langchain import LLMChain, PromptTemplate
2
- from langchain.agents import tool
3
- from agents.tools.smart_domain.common import getPrefix
4
-
5
- from models import llm
6
- from agents.tools.smart_domain.entity import entity_architecture, entity_test_strategy, entity_tech_stack
7
- from agents.tools.smart_domain.association import association_architecture, association_test_strategy, association_teck_stack
8
-
9
-
10
-
11
-
12
- domain_task = """Your task is to generate the domain layer tests and product code."""
13
- domain_teck_stack = """Java17、reactor、lombok、Junit5、reactor test、Mockito"""
14
- domain_architecture = f"""the domain layer inclue 2 componets:
15
- * {entity_architecture}
16
- * {association_architecture}"""
17
-
18
- domain_test_strategy = f"""{entity_test_strategy}
19
- {association_test_strategy}"""
20
-
21
-
22
-
23
- DOMAIN_LAYER = getPrefix(domain_task, domain_teck_stack, domain_architecture, domain_test_strategy) + """
24
-
25
- Use the following format:
26
- request: the request that you need to fulfill
27
-
28
- Entity:
29
- ```
30
- the Entity code that you write to fulfill the request, follow TechStack and Architecture
31
- ```
32
-
33
- Association:
34
- ```
35
- the Association code that you write to fulfill the request, follow TechStack and Architecture
36
- ```
37
-
38
- Test:
39
- ```
40
- the test code that you write to fulfill the request, follow TechStack Architecture and TestStrategy
41
- ```
42
-
43
- request: {input}"""
44
-
45
-
46
-
47
- DOMAIN_LAYER_PROMPT = PromptTemplate(input_variables=["input"], template=DOMAIN_LAYER,)
48
-
49
- domainLayerChain = LLMChain(llm = llm(temperature=0.1), prompt=DOMAIN_LAYER_PROMPT)
50
-
51
-
52
- @tool("Generate Domain Layer Code", return_direct=True)
53
- def domainLayerCodeGenerator(input: str) -> str:
54
- '''useful for when you need to generate domain layer code'''
55
- response = domainLayerChain.run(input)
56
- return response
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
spaces/AIConsultant/MusicGen/audiocraft/data/audio.py DELETED
@@ -1,216 +0,0 @@
1
- # Copyright (c) Meta Platforms, Inc. and affiliates.
2
- # All rights reserved.
3
- #
4
- # This source code is licensed under the license found in the
5
- # LICENSE file in the root directory of this source tree.
6
-
7
- """
8
- Audio IO methods are defined in this module (info, read, write),
9
- We rely on av library for faster read when possible, otherwise on torchaudio.
10
- """
11
-
12
- from dataclasses import dataclass
13
- from pathlib import Path
14
- import logging
15
- import typing as tp
16
-
17
- import numpy as np
18
- import soundfile
19
- import torch
20
- from torch.nn import functional as F
21
- import torchaudio as ta
22
-
23
- import av
24
-
25
- from .audio_utils import f32_pcm, i16_pcm, normalize_audio
26
-
27
-
28
- _av_initialized = False
29
-
30
-
31
- def _init_av():
32
- global _av_initialized
33
- if _av_initialized:
34
- return
35
- logger = logging.getLogger('libav.mp3')
36
- logger.setLevel(logging.ERROR)
37
- _av_initialized = True
38
-
39
-
40
- @dataclass(frozen=True)
41
- class AudioFileInfo:
42
- sample_rate: int
43
- duration: float
44
- channels: int
45
-
46
-
47
- def _av_info(filepath: tp.Union[str, Path]) -> AudioFileInfo:
48
- _init_av()
49
- with av.open(str(filepath)) as af:
50
- stream = af.streams.audio[0]
51
- sample_rate = stream.codec_context.sample_rate
52
- duration = float(stream.duration * stream.time_base)
53
- channels = stream.channels
54
- return AudioFileInfo(sample_rate, duration, channels)
55
-
56
-
57
- def _soundfile_info(filepath: tp.Union[str, Path]) -> AudioFileInfo:
58
- info = soundfile.info(filepath)
59
- return AudioFileInfo(info.samplerate, info.duration, info.channels)
60
-
61
-
62
- def audio_info(filepath: tp.Union[str, Path]) -> AudioFileInfo:
63
- # torchaudio no longer returns useful duration informations for some formats like mp3s.
64
- filepath = Path(filepath)
65
- if filepath.suffix in ['.flac', '.ogg']: # TODO: Validate .ogg can be safely read with av_info
66
- # ffmpeg has some weird issue with flac.
67
- return _soundfile_info(filepath)
68
- else:
69
- return _av_info(filepath)
70
-
71
-
72
- def _av_read(filepath: tp.Union[str, Path], seek_time: float = 0, duration: float = -1.) -> tp.Tuple[torch.Tensor, int]:
73
- """FFMPEG-based audio file reading using PyAV bindings.
74
- Soundfile cannot read mp3 and av_read is more efficient than torchaudio.
75
-
76
- Args:
77
- filepath (str or Path): Path to audio file to read.
78
- seek_time (float): Time at which to start reading in the file.
79
- duration (float): Duration to read from the file. If set to -1, the whole file is read.
80
- Returns:
81
- tuple of torch.Tensor, int: Tuple containing audio data and sample rate
82
- """
83
- _init_av()
84
- with av.open(str(filepath)) as af:
85
- stream = af.streams.audio[0]
86
- sr = stream.codec_context.sample_rate
87
- num_frames = int(sr * duration) if duration >= 0 else -1
88
- frame_offset = int(sr * seek_time)
89
- # we need a small negative offset otherwise we get some edge artifact
90
- # from the mp3 decoder.
91
- af.seek(int(max(0, (seek_time - 0.1)) / stream.time_base), stream=stream)
92
- frames = []
93
- length = 0
94
- for frame in af.decode(streams=stream.index):
95
- current_offset = int(frame.rate * frame.pts * frame.time_base)
96
- strip = max(0, frame_offset - current_offset)
97
- buf = torch.from_numpy(frame.to_ndarray())
98
- if buf.shape[0] != stream.channels:
99
- buf = buf.view(-1, stream.channels).t()
100
- buf = buf[:, strip:]
101
- frames.append(buf)
102
- length += buf.shape[1]
103
- if num_frames > 0 and length >= num_frames:
104
- break
105
- assert frames
106
- # If the above assert fails, it is likely because we seeked past the end of file point,
107
- # in which case ffmpeg returns a single frame with only zeros, and a weird timestamp.
108
- # This will need proper debugging, in due time.
109
- wav = torch.cat(frames, dim=1)
110
- assert wav.shape[0] == stream.channels
111
- if num_frames > 0:
112
- wav = wav[:, :num_frames]
113
- return f32_pcm(wav), sr
114
-
115
-
116
- def audio_read(filepath: tp.Union[str, Path], seek_time: float = 0.,
117
- duration: float = -1., pad: bool = False) -> tp.Tuple[torch.Tensor, int]:
118
- """Read audio by picking the most appropriate backend tool based on the audio format.
119
-
120
- Args:
121
- filepath (str or Path): Path to audio file to read.
122
- seek_time (float): Time at which to start reading in the file.
123
- duration (float): Duration to read from the file. If set to -1, the whole file is read.
124
- pad (bool): Pad output audio if not reaching expected duration.
125
- Returns:
126
- tuple of torch.Tensor, int: Tuple containing audio data and sample rate.
127
- """
128
- fp = Path(filepath)
129
- if fp.suffix in ['.flac', '.ogg']: # TODO: check if we can safely use av_read for .ogg
130
- # There is some bug with ffmpeg and reading flac
131
- info = _soundfile_info(filepath)
132
- frames = -1 if duration <= 0 else int(duration * info.sample_rate)
133
- frame_offset = int(seek_time * info.sample_rate)
134
- wav, sr = soundfile.read(filepath, start=frame_offset, frames=frames, dtype=np.float32)
135
- assert info.sample_rate == sr, f"Mismatch of sample rates {info.sample_rate} {sr}"
136
- wav = torch.from_numpy(wav).t().contiguous()
137
- if len(wav.shape) == 1:
138
- wav = torch.unsqueeze(wav, 0)
139
- elif (
140
- fp.suffix in ['.wav', '.mp3'] and fp.suffix[1:] in ta.utils.sox_utils.list_read_formats()
141
- and duration <= 0 and seek_time == 0
142
- ):
143
- # Torchaudio is faster if we load an entire file at once.
144
- wav, sr = ta.load(fp)
145
- else:
146
- wav, sr = _av_read(filepath, seek_time, duration)
147
- if pad and duration > 0:
148
- expected_frames = int(duration * sr)
149
- wav = F.pad(wav, (0, expected_frames - wav.shape[-1]))
150
- return wav, sr
151
-
152
-
153
- def audio_write(stem_name: tp.Union[str, Path],
154
- wav: torch.Tensor, sample_rate: int,
155
- format: str = 'wav', mp3_rate: int = 320, normalize: bool = True,
156
- strategy: str = 'peak', peak_clip_headroom_db: float = 1,
157
- rms_headroom_db: float = 18, loudness_headroom_db: float = 14,
158
- loudness_compressor: bool = False,
159
- log_clipping: bool = True, make_parent_dir: bool = True,
160
- add_suffix: bool = True) -> Path:
161
- """Convenience function for saving audio to disk. Returns the filename the audio was written to.
162
-
163
- Args:
164
- stem_name (str or Path): Filename without extension which will be added automatically.
165
- format (str): Either "wav" or "mp3".
166
- mp3_rate (int): kbps when using mp3s.
167
- normalize (bool): if `True` (default), normalizes according to the prescribed
168
- strategy (see after). If `False`, the strategy is only used in case clipping
169
- would happen.
170
- strategy (str): Can be either 'clip', 'peak', or 'rms'. Default is 'peak',
171
- i.e. audio is normalized by its largest value. RMS normalizes by root-mean-square
172
- with extra headroom to avoid clipping. 'clip' just clips.
173
- peak_clip_headroom_db (float): Headroom in dB when doing 'peak' or 'clip' strategy.
174
- rms_headroom_db (float): Headroom in dB when doing 'rms' strategy. This must be much larger
175
- than the `peak_clip` one to avoid further clipping.
176
- loudness_headroom_db (float): Target loudness for loudness normalization.
177
- loudness_compressor (bool): Uses tanh for soft clipping when strategy is 'loudness'.
178
- when strategy is 'loudness' log_clipping (bool): If True, basic logging on stderr when clipping still
179
- occurs despite strategy (only for 'rms').
180
- make_parent_dir (bool): Make parent directory if it doesn't exist.
181
- Returns:
182
- Path: Path of the saved audio.
183
- """
184
- assert wav.dtype.is_floating_point, "wav is not floating point"
185
- if wav.dim() == 1:
186
- wav = wav[None]
187
- elif wav.dim() > 2:
188
- raise ValueError("Input wav should be at most 2 dimension.")
189
- assert wav.isfinite().all()
190
- wav = normalize_audio(wav, normalize, strategy, peak_clip_headroom_db,
191
- rms_headroom_db, loudness_headroom_db, loudness_compressor,
192
- log_clipping=log_clipping, sample_rate=sample_rate,
193
- stem_name=str(stem_name))
194
- kwargs: dict = {}
195
- if format == 'mp3':
196
- suffix = '.mp3'
197
- kwargs.update({"compression": mp3_rate})
198
- elif format == 'wav':
199
- wav = i16_pcm(wav)
200
- suffix = '.wav'
201
- kwargs.update({"encoding": "PCM_S", "bits_per_sample": 16})
202
- else:
203
- raise RuntimeError(f"Invalid format {format}. Only wav or mp3 are supported.")
204
- if not add_suffix:
205
- suffix = ''
206
- path = Path(str(stem_name) + suffix)
207
- if make_parent_dir:
208
- path.parent.mkdir(exist_ok=True, parents=True)
209
- try:
210
- ta.save(path, wav, sample_rate, **kwargs)
211
- except Exception:
212
- if path.exists():
213
- # we do not want to leave half written files around.
214
- path.unlink()
215
- raise
216
- return path
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
spaces/AIGC-Audio/AudioGPT/text_to_audio/Make_An_Audio/ldm/modules/diffusionmodules/util.py DELETED
@@ -1,267 +0,0 @@
1
- # adopted from
2
- # https://github.com/openai/improved-diffusion/blob/main/improved_diffusion/gaussian_diffusion.py
3
- # and
4
- # https://github.com/lucidrains/denoising-diffusion-pytorch/blob/7706bdfc6f527f58d33f84b7b522e61e6e3164b3/denoising_diffusion_pytorch/denoising_diffusion_pytorch.py
5
- # and
6
- # https://github.com/openai/guided-diffusion/blob/0ba878e517b276c45d1195eb29f6f5f72659a05b/guided_diffusion/nn.py
7
- #
8
- # thanks!
9
-
10
-
11
- import os
12
- import math
13
- import torch
14
- import torch.nn as nn
15
- import numpy as np
16
- from einops import repeat
17
-
18
- from ldm.util import instantiate_from_config
19
-
20
-
21
- def make_beta_schedule(schedule, n_timestep, linear_start=1e-4, linear_end=2e-2, cosine_s=8e-3):
22
- if schedule == "linear":
23
- betas = (
24
- torch.linspace(linear_start ** 0.5, linear_end ** 0.5, n_timestep, dtype=torch.float64) ** 2
25
- )
26
-
27
- elif schedule == "cosine":
28
- timesteps = (
29
- torch.arange(n_timestep + 1, dtype=torch.float64) / n_timestep + cosine_s
30
- )
31
- alphas = timesteps / (1 + cosine_s) * np.pi / 2
32
- alphas = torch.cos(alphas).pow(2)
33
- alphas = alphas / alphas[0]
34
- betas = 1 - alphas[1:] / alphas[:-1]
35
- betas = np.clip(betas, a_min=0, a_max=0.999)
36
-
37
- elif schedule == "sqrt_linear":
38
- betas = torch.linspace(linear_start, linear_end, n_timestep, dtype=torch.float64)
39
- elif schedule == "sqrt":
40
- betas = torch.linspace(linear_start, linear_end, n_timestep, dtype=torch.float64) ** 0.5
41
- else:
42
- raise ValueError(f"schedule '{schedule}' unknown.")
43
- return betas.numpy()
44
-
45
-
46
- def make_ddim_timesteps(ddim_discr_method, num_ddim_timesteps, num_ddpm_timesteps, verbose=True):
47
- if ddim_discr_method == 'uniform':
48
- c = num_ddpm_timesteps // num_ddim_timesteps
49
- ddim_timesteps = np.asarray(list(range(0, num_ddpm_timesteps, c)))
50
- elif ddim_discr_method == 'quad':
51
- ddim_timesteps = ((np.linspace(0, np.sqrt(num_ddpm_timesteps * .8), num_ddim_timesteps)) ** 2).astype(int)
52
- else:
53
- raise NotImplementedError(f'There is no ddim discretization method called "{ddim_discr_method}"')
54
-
55
- # assert ddim_timesteps.shape[0] == num_ddim_timesteps
56
- # add one to get the final alpha values right (the ones from first scale to data during sampling)
57
- steps_out = ddim_timesteps + 1
58
- if verbose:
59
- print(f'Selected timesteps for ddim sampler: {steps_out}')
60
- return steps_out
61
-
62
-
63
- def make_ddim_sampling_parameters(alphacums, ddim_timesteps, eta, verbose=True):
64
- # select alphas for computing the variance schedule
65
- alphas = alphacums[ddim_timesteps]
66
- alphas_prev = np.asarray([alphacums[0]] + alphacums[ddim_timesteps[:-1]].tolist())
67
-
68
- # according the the formula provided in https://arxiv.org/abs/2010.02502
69
- sigmas = eta * np.sqrt((1 - alphas_prev) / (1 - alphas) * (1 - alphas / alphas_prev))
70
- if verbose:
71
- print(f'Selected alphas for ddim sampler: a_t: {alphas}; a_(t-1): {alphas_prev}')
72
- print(f'For the chosen value of eta, which is {eta}, '
73
- f'this results in the following sigma_t schedule for ddim sampler {sigmas}')
74
- return sigmas, alphas, alphas_prev
75
-
76
-
77
- def betas_for_alpha_bar(num_diffusion_timesteps, alpha_bar, max_beta=0.999):
78
- """
79
- Create a beta schedule that discretizes the given alpha_t_bar function,
80
- which defines the cumulative product of (1-beta) over time from t = [0,1].
81
- :param num_diffusion_timesteps: the number of betas to produce.
82
- :param alpha_bar: a lambda that takes an argument t from 0 to 1 and
83
- produces the cumulative product of (1-beta) up to that
84
- part of the diffusion process.
85
- :param max_beta: the maximum beta to use; use values lower than 1 to
86
- prevent singularities.
87
- """
88
- betas = []
89
- for i in range(num_diffusion_timesteps):
90
- t1 = i / num_diffusion_timesteps
91
- t2 = (i + 1) / num_diffusion_timesteps
92
- betas.append(min(1 - alpha_bar(t2) / alpha_bar(t1), max_beta))
93
- return np.array(betas)
94
-
95
-
96
- def extract_into_tensor(a, t, x_shape):
97
- b, *_ = t.shape
98
- out = a.gather(-1, t)
99
- return out.reshape(b, *((1,) * (len(x_shape) - 1)))
100
-
101
-
102
- def checkpoint(func, inputs, params, flag):
103
- """
104
- Evaluate a function without caching intermediate activations, allowing for
105
- reduced memory at the expense of extra compute in the backward pass.
106
- :param func: the function to evaluate.
107
- :param inputs: the argument sequence to pass to `func`.
108
- :param params: a sequence of parameters `func` depends on but does not
109
- explicitly take as arguments.
110
- :param flag: if False, disable gradient checkpointing.
111
- """
112
- if flag:
113
- args = tuple(inputs) + tuple(params)
114
- return CheckpointFunction.apply(func, len(inputs), *args)
115
- else:
116
- return func(*inputs)
117
-
118
-
119
- class CheckpointFunction(torch.autograd.Function):
120
- @staticmethod
121
- def forward(ctx, run_function, length, *args):
122
- ctx.run_function = run_function
123
- ctx.input_tensors = list(args[:length])
124
- ctx.input_params = list(args[length:])
125
-
126
- with torch.no_grad():
127
- output_tensors = ctx.run_function(*ctx.input_tensors)
128
- return output_tensors
129
-
130
- @staticmethod
131
- def backward(ctx, *output_grads):
132
- ctx.input_tensors = [x.detach().requires_grad_(True) for x in ctx.input_tensors]
133
- with torch.enable_grad():
134
- # Fixes a bug where the first op in run_function modifies the
135
- # Tensor storage in place, which is not allowed for detach()'d
136
- # Tensors.
137
- shallow_copies = [x.view_as(x) for x in ctx.input_tensors]
138
- output_tensors = ctx.run_function(*shallow_copies)
139
- input_grads = torch.autograd.grad(
140
- output_tensors,
141
- ctx.input_tensors + ctx.input_params,
142
- output_grads,
143
- allow_unused=True,
144
- )
145
- del ctx.input_tensors
146
- del ctx.input_params
147
- del output_tensors
148
- return (None, None) + input_grads
149
-
150
-
151
- def timestep_embedding(timesteps, dim, max_period=10000, repeat_only=False):
152
- """
153
- Create sinusoidal timestep embeddings.
154
- :param timesteps: a 1-D Tensor of N indices, one per batch element.
155
- These may be fractional.
156
- :param dim: the dimension of the output.
157
- :param max_period: controls the minimum frequency of the embeddings.
158
- :return: an [N x dim] Tensor of positional embeddings.
159
- """
160
- if not repeat_only:
161
- half = dim // 2
162
- freqs = torch.exp(
163
- -math.log(max_period) * torch.arange(start=0, end=half, dtype=torch.float32) / half
164
- ).to(device=timesteps.device)
165
- args = timesteps[:, None].float() * freqs[None]
166
- embedding = torch.cat([torch.cos(args), torch.sin(args)], dim=-1)
167
- if dim % 2:
168
- embedding = torch.cat([embedding, torch.zeros_like(embedding[:, :1])], dim=-1)
169
- else:
170
- embedding = repeat(timesteps, 'b -> b d', d=dim)
171
- return embedding
172
-
173
-
174
- def zero_module(module):
175
- """
176
- Zero out the parameters of a module and return it.
177
- """
178
- for p in module.parameters():
179
- p.detach().zero_()
180
- return module
181
-
182
-
183
- def scale_module(module, scale):
184
- """
185
- Scale the parameters of a module and return it.
186
- """
187
- for p in module.parameters():
188
- p.detach().mul_(scale)
189
- return module
190
-
191
-
192
- def mean_flat(tensor):
193
- """
194
- Take the mean over all non-batch dimensions.
195
- """
196
- return tensor.mean(dim=list(range(1, len(tensor.shape))))
197
-
198
-
199
- def normalization(channels):
200
- """
201
- Make a standard normalization layer.
202
- :param channels: number of input channels.
203
- :return: an nn.Module for normalization.
204
- """
205
- return GroupNorm32(32, channels)
206
-
207
-
208
- # PyTorch 1.7 has SiLU, but we support PyTorch 1.5.
209
- class SiLU(nn.Module):
210
- def forward(self, x):
211
- return x * torch.sigmoid(x)
212
-
213
-
214
- class GroupNorm32(nn.GroupNorm):
215
- def forward(self, x):
216
- return super().forward(x.float()).type(x.dtype)
217
-
218
- def conv_nd(dims, *args, **kwargs):
219
- """
220
- Create a 1D, 2D, or 3D convolution module.
221
- """
222
- if dims == 1:
223
- return nn.Conv1d(*args, **kwargs)
224
- elif dims == 2:
225
- return nn.Conv2d(*args, **kwargs)
226
- elif dims == 3:
227
- return nn.Conv3d(*args, **kwargs)
228
- raise ValueError(f"unsupported dimensions: {dims}")
229
-
230
-
231
- def linear(*args, **kwargs):
232
- """
233
- Create a linear module.
234
- """
235
- return nn.Linear(*args, **kwargs)
236
-
237
-
238
- def avg_pool_nd(dims, *args, **kwargs):
239
- """
240
- Create a 1D, 2D, or 3D average pooling module.
241
- """
242
- if dims == 1:
243
- return nn.AvgPool1d(*args, **kwargs)
244
- elif dims == 2:
245
- return nn.AvgPool2d(*args, **kwargs)
246
- elif dims == 3:
247
- return nn.AvgPool3d(*args, **kwargs)
248
- raise ValueError(f"unsupported dimensions: {dims}")
249
-
250
-
251
- class HybridConditioner(nn.Module):
252
-
253
- def __init__(self, c_concat_config, c_crossattn_config):
254
- super().__init__()
255
- self.concat_conditioner = instantiate_from_config(c_concat_config)
256
- self.crossattn_conditioner = instantiate_from_config(c_crossattn_config)
257
-
258
- def forward(self, c_concat, c_crossattn):
259
- c_concat = self.concat_conditioner(c_concat)
260
- c_crossattn = self.crossattn_conditioner(c_crossattn)
261
- return {'c_concat': [c_concat], 'c_crossattn': [c_crossattn]}
262
-
263
-
264
- def noise_like(shape, device, repeat=False):
265
- repeat_noise = lambda: torch.randn((1, *shape[1:]), device=device).repeat(shape[0], *((1,) * (len(shape) - 1)))
266
- noise = lambda: torch.randn(shape, device=device)
267
- return repeat_noise() if repeat else noise()
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
spaces/Abhilashvj/planogram-compliance/utils/aws/mime.sh DELETED
@@ -1,26 +0,0 @@
1
- # AWS EC2 instance startup 'MIME' script https://aws.amazon.com/premiumsupport/knowledge-center/execute-user-data-ec2/
2
- # This script will run on every instance restart, not only on first start
3
- # --- DO NOT COPY ABOVE COMMENTS WHEN PASTING INTO USERDATA ---
4
-
5
- Content-Type: multipart/mixed; boundary="//"
6
- MIME-Version: 1.0
7
-
8
- --//
9
- Content-Type: text/cloud-config; charset="us-ascii"
10
- MIME-Version: 1.0
11
- Content-Transfer-Encoding: 7bit
12
- Content-Disposition: attachment; filename="cloud-config.txt"
13
-
14
- #cloud-config
15
- cloud_final_modules:
16
- - [scripts-user, always]
17
-
18
- --//
19
- Content-Type: text/x-shellscript; charset="us-ascii"
20
- MIME-Version: 1.0
21
- Content-Transfer-Encoding: 7bit
22
- Content-Disposition: attachment; filename="userdata.txt"
23
-
24
- #!/bin/bash
25
- # --- paste contents of userdata.sh here ---
26
- --//
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
spaces/Adapter/T2I-Adapter/ldm/modules/extra_condition/model_edge.py DELETED
@@ -1,653 +0,0 @@
1
- """
2
- Author: Zhuo Su, Wenzhe Liu
3
- Date: Feb 18, 2021
4
- """
5
-
6
- import math
7
-
8
- import cv2
9
- import numpy as np
10
- import torch
11
- import torch.nn as nn
12
- import torch.nn.functional as F
13
- from basicsr.utils import img2tensor
14
-
15
- nets = {
16
- 'baseline': {
17
- 'layer0': 'cv',
18
- 'layer1': 'cv',
19
- 'layer2': 'cv',
20
- 'layer3': 'cv',
21
- 'layer4': 'cv',
22
- 'layer5': 'cv',
23
- 'layer6': 'cv',
24
- 'layer7': 'cv',
25
- 'layer8': 'cv',
26
- 'layer9': 'cv',
27
- 'layer10': 'cv',
28
- 'layer11': 'cv',
29
- 'layer12': 'cv',
30
- 'layer13': 'cv',
31
- 'layer14': 'cv',
32
- 'layer15': 'cv',
33
- },
34
- 'c-v15': {
35
- 'layer0': 'cd',
36
- 'layer1': 'cv',
37
- 'layer2': 'cv',
38
- 'layer3': 'cv',
39
- 'layer4': 'cv',
40
- 'layer5': 'cv',
41
- 'layer6': 'cv',
42
- 'layer7': 'cv',
43
- 'layer8': 'cv',
44
- 'layer9': 'cv',
45
- 'layer10': 'cv',
46
- 'layer11': 'cv',
47
- 'layer12': 'cv',
48
- 'layer13': 'cv',
49
- 'layer14': 'cv',
50
- 'layer15': 'cv',
51
- },
52
- 'a-v15': {
53
- 'layer0': 'ad',
54
- 'layer1': 'cv',
55
- 'layer2': 'cv',
56
- 'layer3': 'cv',
57
- 'layer4': 'cv',
58
- 'layer5': 'cv',
59
- 'layer6': 'cv',
60
- 'layer7': 'cv',
61
- 'layer8': 'cv',
62
- 'layer9': 'cv',
63
- 'layer10': 'cv',
64
- 'layer11': 'cv',
65
- 'layer12': 'cv',
66
- 'layer13': 'cv',
67
- 'layer14': 'cv',
68
- 'layer15': 'cv',
69
- },
70
- 'r-v15': {
71
- 'layer0': 'rd',
72
- 'layer1': 'cv',
73
- 'layer2': 'cv',
74
- 'layer3': 'cv',
75
- 'layer4': 'cv',
76
- 'layer5': 'cv',
77
- 'layer6': 'cv',
78
- 'layer7': 'cv',
79
- 'layer8': 'cv',
80
- 'layer9': 'cv',
81
- 'layer10': 'cv',
82
- 'layer11': 'cv',
83
- 'layer12': 'cv',
84
- 'layer13': 'cv',
85
- 'layer14': 'cv',
86
- 'layer15': 'cv',
87
- },
88
- 'cvvv4': {
89
- 'layer0': 'cd',
90
- 'layer1': 'cv',
91
- 'layer2': 'cv',
92
- 'layer3': 'cv',
93
- 'layer4': 'cd',
94
- 'layer5': 'cv',
95
- 'layer6': 'cv',
96
- 'layer7': 'cv',
97
- 'layer8': 'cd',
98
- 'layer9': 'cv',
99
- 'layer10': 'cv',
100
- 'layer11': 'cv',
101
- 'layer12': 'cd',
102
- 'layer13': 'cv',
103
- 'layer14': 'cv',
104
- 'layer15': 'cv',
105
- },
106
- 'avvv4': {
107
- 'layer0': 'ad',
108
- 'layer1': 'cv',
109
- 'layer2': 'cv',
110
- 'layer3': 'cv',
111
- 'layer4': 'ad',
112
- 'layer5': 'cv',
113
- 'layer6': 'cv',
114
- 'layer7': 'cv',
115
- 'layer8': 'ad',
116
- 'layer9': 'cv',
117
- 'layer10': 'cv',
118
- 'layer11': 'cv',
119
- 'layer12': 'ad',
120
- 'layer13': 'cv',
121
- 'layer14': 'cv',
122
- 'layer15': 'cv',
123
- },
124
- 'rvvv4': {
125
- 'layer0': 'rd',
126
- 'layer1': 'cv',
127
- 'layer2': 'cv',
128
- 'layer3': 'cv',
129
- 'layer4': 'rd',
130
- 'layer5': 'cv',
131
- 'layer6': 'cv',
132
- 'layer7': 'cv',
133
- 'layer8': 'rd',
134
- 'layer9': 'cv',
135
- 'layer10': 'cv',
136
- 'layer11': 'cv',
137
- 'layer12': 'rd',
138
- 'layer13': 'cv',
139
- 'layer14': 'cv',
140
- 'layer15': 'cv',
141
- },
142
- 'cccv4': {
143
- 'layer0': 'cd',
144
- 'layer1': 'cd',
145
- 'layer2': 'cd',
146
- 'layer3': 'cv',
147
- 'layer4': 'cd',
148
- 'layer5': 'cd',
149
- 'layer6': 'cd',
150
- 'layer7': 'cv',
151
- 'layer8': 'cd',
152
- 'layer9': 'cd',
153
- 'layer10': 'cd',
154
- 'layer11': 'cv',
155
- 'layer12': 'cd',
156
- 'layer13': 'cd',
157
- 'layer14': 'cd',
158
- 'layer15': 'cv',
159
- },
160
- 'aaav4': {
161
- 'layer0': 'ad',
162
- 'layer1': 'ad',
163
- 'layer2': 'ad',
164
- 'layer3': 'cv',
165
- 'layer4': 'ad',
166
- 'layer5': 'ad',
167
- 'layer6': 'ad',
168
- 'layer7': 'cv',
169
- 'layer8': 'ad',
170
- 'layer9': 'ad',
171
- 'layer10': 'ad',
172
- 'layer11': 'cv',
173
- 'layer12': 'ad',
174
- 'layer13': 'ad',
175
- 'layer14': 'ad',
176
- 'layer15': 'cv',
177
- },
178
- 'rrrv4': {
179
- 'layer0': 'rd',
180
- 'layer1': 'rd',
181
- 'layer2': 'rd',
182
- 'layer3': 'cv',
183
- 'layer4': 'rd',
184
- 'layer5': 'rd',
185
- 'layer6': 'rd',
186
- 'layer7': 'cv',
187
- 'layer8': 'rd',
188
- 'layer9': 'rd',
189
- 'layer10': 'rd',
190
- 'layer11': 'cv',
191
- 'layer12': 'rd',
192
- 'layer13': 'rd',
193
- 'layer14': 'rd',
194
- 'layer15': 'cv',
195
- },
196
- 'c16': {
197
- 'layer0': 'cd',
198
- 'layer1': 'cd',
199
- 'layer2': 'cd',
200
- 'layer3': 'cd',
201
- 'layer4': 'cd',
202
- 'layer5': 'cd',
203
- 'layer6': 'cd',
204
- 'layer7': 'cd',
205
- 'layer8': 'cd',
206
- 'layer9': 'cd',
207
- 'layer10': 'cd',
208
- 'layer11': 'cd',
209
- 'layer12': 'cd',
210
- 'layer13': 'cd',
211
- 'layer14': 'cd',
212
- 'layer15': 'cd',
213
- },
214
- 'a16': {
215
- 'layer0': 'ad',
216
- 'layer1': 'ad',
217
- 'layer2': 'ad',
218
- 'layer3': 'ad',
219
- 'layer4': 'ad',
220
- 'layer5': 'ad',
221
- 'layer6': 'ad',
222
- 'layer7': 'ad',
223
- 'layer8': 'ad',
224
- 'layer9': 'ad',
225
- 'layer10': 'ad',
226
- 'layer11': 'ad',
227
- 'layer12': 'ad',
228
- 'layer13': 'ad',
229
- 'layer14': 'ad',
230
- 'layer15': 'ad',
231
- },
232
- 'r16': {
233
- 'layer0': 'rd',
234
- 'layer1': 'rd',
235
- 'layer2': 'rd',
236
- 'layer3': 'rd',
237
- 'layer4': 'rd',
238
- 'layer5': 'rd',
239
- 'layer6': 'rd',
240
- 'layer7': 'rd',
241
- 'layer8': 'rd',
242
- 'layer9': 'rd',
243
- 'layer10': 'rd',
244
- 'layer11': 'rd',
245
- 'layer12': 'rd',
246
- 'layer13': 'rd',
247
- 'layer14': 'rd',
248
- 'layer15': 'rd',
249
- },
250
- 'carv4': {
251
- 'layer0': 'cd',
252
- 'layer1': 'ad',
253
- 'layer2': 'rd',
254
- 'layer3': 'cv',
255
- 'layer4': 'cd',
256
- 'layer5': 'ad',
257
- 'layer6': 'rd',
258
- 'layer7': 'cv',
259
- 'layer8': 'cd',
260
- 'layer9': 'ad',
261
- 'layer10': 'rd',
262
- 'layer11': 'cv',
263
- 'layer12': 'cd',
264
- 'layer13': 'ad',
265
- 'layer14': 'rd',
266
- 'layer15': 'cv',
267
- },
268
- }
269
-
270
- def createConvFunc(op_type):
271
- assert op_type in ['cv', 'cd', 'ad', 'rd'], 'unknown op type: %s' % str(op_type)
272
- if op_type == 'cv':
273
- return F.conv2d
274
-
275
- if op_type == 'cd':
276
- def func(x, weights, bias=None, stride=1, padding=0, dilation=1, groups=1):
277
- assert dilation in [1, 2], 'dilation for cd_conv should be in 1 or 2'
278
- assert weights.size(2) == 3 and weights.size(3) == 3, 'kernel size for cd_conv should be 3x3'
279
- assert padding == dilation, 'padding for cd_conv set wrong'
280
-
281
- weights_c = weights.sum(dim=[2, 3], keepdim=True)
282
- yc = F.conv2d(x, weights_c, stride=stride, padding=0, groups=groups)
283
- y = F.conv2d(x, weights, bias, stride=stride, padding=padding, dilation=dilation, groups=groups)
284
- return y - yc
285
- return func
286
- elif op_type == 'ad':
287
- def func(x, weights, bias=None, stride=1, padding=0, dilation=1, groups=1):
288
- assert dilation in [1, 2], 'dilation for ad_conv should be in 1 or 2'
289
- assert weights.size(2) == 3 and weights.size(3) == 3, 'kernel size for ad_conv should be 3x3'
290
- assert padding == dilation, 'padding for ad_conv set wrong'
291
-
292
- shape = weights.shape
293
- weights = weights.view(shape[0], shape[1], -1)
294
- weights_conv = (weights - weights[:, :, [3, 0, 1, 6, 4, 2, 7, 8, 5]]).view(shape) # clock-wise
295
- y = F.conv2d(x, weights_conv, bias, stride=stride, padding=padding, dilation=dilation, groups=groups)
296
- return y
297
- return func
298
- elif op_type == 'rd':
299
- def func(x, weights, bias=None, stride=1, padding=0, dilation=1, groups=1):
300
- assert dilation in [1, 2], 'dilation for rd_conv should be in 1 or 2'
301
- assert weights.size(2) == 3 and weights.size(3) == 3, 'kernel size for rd_conv should be 3x3'
302
- padding = 2 * dilation
303
-
304
- shape = weights.shape
305
- if weights.is_cuda:
306
- buffer = torch.cuda.FloatTensor(shape[0], shape[1], 5 * 5).fill_(0)
307
- else:
308
- buffer = torch.zeros(shape[0], shape[1], 5 * 5)
309
- weights = weights.view(shape[0], shape[1], -1)
310
- buffer[:, :, [0, 2, 4, 10, 14, 20, 22, 24]] = weights[:, :, 1:]
311
- buffer[:, :, [6, 7, 8, 11, 13, 16, 17, 18]] = -weights[:, :, 1:]
312
- buffer[:, :, 12] = 0
313
- buffer = buffer.view(shape[0], shape[1], 5, 5)
314
- y = F.conv2d(x, buffer, bias, stride=stride, padding=padding, dilation=dilation, groups=groups)
315
- return y
316
- return func
317
- else:
318
- print('impossible to be here unless you force that')
319
- return None
320
-
321
- class Conv2d(nn.Module):
322
- def __init__(self, pdc, in_channels, out_channels, kernel_size, stride=1, padding=0, dilation=1, groups=1, bias=False):
323
- super(Conv2d, self).__init__()
324
- if in_channels % groups != 0:
325
- raise ValueError('in_channels must be divisible by groups')
326
- if out_channels % groups != 0:
327
- raise ValueError('out_channels must be divisible by groups')
328
- self.in_channels = in_channels
329
- self.out_channels = out_channels
330
- self.kernel_size = kernel_size
331
- self.stride = stride
332
- self.padding = padding
333
- self.dilation = dilation
334
- self.groups = groups
335
- self.weight = nn.Parameter(torch.Tensor(out_channels, in_channels // groups, kernel_size, kernel_size))
336
- if bias:
337
- self.bias = nn.Parameter(torch.Tensor(out_channels))
338
- else:
339
- self.register_parameter('bias', None)
340
- self.reset_parameters()
341
- self.pdc = pdc
342
-
343
- def reset_parameters(self):
344
- nn.init.kaiming_uniform_(self.weight, a=math.sqrt(5))
345
- if self.bias is not None:
346
- fan_in, _ = nn.init._calculate_fan_in_and_fan_out(self.weight)
347
- bound = 1 / math.sqrt(fan_in)
348
- nn.init.uniform_(self.bias, -bound, bound)
349
-
350
- def forward(self, input):
351
-
352
- return self.pdc(input, self.weight, self.bias, self.stride, self.padding, self.dilation, self.groups)
353
-
354
- class CSAM(nn.Module):
355
- """
356
- Compact Spatial Attention Module
357
- """
358
- def __init__(self, channels):
359
- super(CSAM, self).__init__()
360
-
361
- mid_channels = 4
362
- self.relu1 = nn.ReLU()
363
- self.conv1 = nn.Conv2d(channels, mid_channels, kernel_size=1, padding=0)
364
- self.conv2 = nn.Conv2d(mid_channels, 1, kernel_size=3, padding=1, bias=False)
365
- self.sigmoid = nn.Sigmoid()
366
- nn.init.constant_(self.conv1.bias, 0)
367
-
368
- def forward(self, x):
369
- y = self.relu1(x)
370
- y = self.conv1(y)
371
- y = self.conv2(y)
372
- y = self.sigmoid(y)
373
-
374
- return x * y
375
-
376
- class CDCM(nn.Module):
377
- """
378
- Compact Dilation Convolution based Module
379
- """
380
- def __init__(self, in_channels, out_channels):
381
- super(CDCM, self).__init__()
382
-
383
- self.relu1 = nn.ReLU()
384
- self.conv1 = nn.Conv2d(in_channels, out_channels, kernel_size=1, padding=0)
385
- self.conv2_1 = nn.Conv2d(out_channels, out_channels, kernel_size=3, dilation=5, padding=5, bias=False)
386
- self.conv2_2 = nn.Conv2d(out_channels, out_channels, kernel_size=3, dilation=7, padding=7, bias=False)
387
- self.conv2_3 = nn.Conv2d(out_channels, out_channels, kernel_size=3, dilation=9, padding=9, bias=False)
388
- self.conv2_4 = nn.Conv2d(out_channels, out_channels, kernel_size=3, dilation=11, padding=11, bias=False)
389
- nn.init.constant_(self.conv1.bias, 0)
390
-
391
- def forward(self, x):
392
- x = self.relu1(x)
393
- x = self.conv1(x)
394
- x1 = self.conv2_1(x)
395
- x2 = self.conv2_2(x)
396
- x3 = self.conv2_3(x)
397
- x4 = self.conv2_4(x)
398
- return x1 + x2 + x3 + x4
399
-
400
-
401
- class MapReduce(nn.Module):
402
- """
403
- Reduce feature maps into a single edge map
404
- """
405
- def __init__(self, channels):
406
- super(MapReduce, self).__init__()
407
- self.conv = nn.Conv2d(channels, 1, kernel_size=1, padding=0)
408
- nn.init.constant_(self.conv.bias, 0)
409
-
410
- def forward(self, x):
411
- return self.conv(x)
412
-
413
-
414
- class PDCBlock(nn.Module):
415
- def __init__(self, pdc, inplane, ouplane, stride=1):
416
- super(PDCBlock, self).__init__()
417
- self.stride=stride
418
-
419
- self.stride=stride
420
- if self.stride > 1:
421
- self.pool = nn.MaxPool2d(kernel_size=2, stride=2)
422
- self.shortcut = nn.Conv2d(inplane, ouplane, kernel_size=1, padding=0)
423
- self.conv1 = Conv2d(pdc, inplane, inplane, kernel_size=3, padding=1, groups=inplane, bias=False)
424
- self.relu2 = nn.ReLU()
425
- self.conv2 = nn.Conv2d(inplane, ouplane, kernel_size=1, padding=0, bias=False)
426
-
427
- def forward(self, x):
428
- if self.stride > 1:
429
- x = self.pool(x)
430
- y = self.conv1(x)
431
- y = self.relu2(y)
432
- y = self.conv2(y)
433
- if self.stride > 1:
434
- x = self.shortcut(x)
435
- y = y + x
436
- return y
437
-
438
- class PDCBlock_converted(nn.Module):
439
- """
440
- CPDC, APDC can be converted to vanilla 3x3 convolution
441
- RPDC can be converted to vanilla 5x5 convolution
442
- """
443
- def __init__(self, pdc, inplane, ouplane, stride=1):
444
- super(PDCBlock_converted, self).__init__()
445
- self.stride=stride
446
-
447
- if self.stride > 1:
448
- self.pool = nn.MaxPool2d(kernel_size=2, stride=2)
449
- self.shortcut = nn.Conv2d(inplane, ouplane, kernel_size=1, padding=0)
450
- if pdc == 'rd':
451
- self.conv1 = nn.Conv2d(inplane, inplane, kernel_size=5, padding=2, groups=inplane, bias=False)
452
- else:
453
- self.conv1 = nn.Conv2d(inplane, inplane, kernel_size=3, padding=1, groups=inplane, bias=False)
454
- self.relu2 = nn.ReLU()
455
- self.conv2 = nn.Conv2d(inplane, ouplane, kernel_size=1, padding=0, bias=False)
456
-
457
- def forward(self, x):
458
- if self.stride > 1:
459
- x = self.pool(x)
460
- y = self.conv1(x)
461
- y = self.relu2(y)
462
- y = self.conv2(y)
463
- if self.stride > 1:
464
- x = self.shortcut(x)
465
- y = y + x
466
- return y
467
-
468
- class PiDiNet(nn.Module):
469
- def __init__(self, inplane, pdcs, dil=None, sa=False, convert=False):
470
- super(PiDiNet, self).__init__()
471
- self.sa = sa
472
- if dil is not None:
473
- assert isinstance(dil, int), 'dil should be an int'
474
- self.dil = dil
475
-
476
- self.fuseplanes = []
477
-
478
- self.inplane = inplane
479
- if convert:
480
- if pdcs[0] == 'rd':
481
- init_kernel_size = 5
482
- init_padding = 2
483
- else:
484
- init_kernel_size = 3
485
- init_padding = 1
486
- self.init_block = nn.Conv2d(3, self.inplane,
487
- kernel_size=init_kernel_size, padding=init_padding, bias=False)
488
- block_class = PDCBlock_converted
489
- else:
490
- self.init_block = Conv2d(pdcs[0], 3, self.inplane, kernel_size=3, padding=1)
491
- block_class = PDCBlock
492
-
493
- self.block1_1 = block_class(pdcs[1], self.inplane, self.inplane)
494
- self.block1_2 = block_class(pdcs[2], self.inplane, self.inplane)
495
- self.block1_3 = block_class(pdcs[3], self.inplane, self.inplane)
496
- self.fuseplanes.append(self.inplane) # C
497
-
498
- inplane = self.inplane
499
- self.inplane = self.inplane * 2
500
- self.block2_1 = block_class(pdcs[4], inplane, self.inplane, stride=2)
501
- self.block2_2 = block_class(pdcs[5], self.inplane, self.inplane)
502
- self.block2_3 = block_class(pdcs[6], self.inplane, self.inplane)
503
- self.block2_4 = block_class(pdcs[7], self.inplane, self.inplane)
504
- self.fuseplanes.append(self.inplane) # 2C
505
-
506
- inplane = self.inplane
507
- self.inplane = self.inplane * 2
508
- self.block3_1 = block_class(pdcs[8], inplane, self.inplane, stride=2)
509
- self.block3_2 = block_class(pdcs[9], self.inplane, self.inplane)
510
- self.block3_3 = block_class(pdcs[10], self.inplane, self.inplane)
511
- self.block3_4 = block_class(pdcs[11], self.inplane, self.inplane)
512
- self.fuseplanes.append(self.inplane) # 4C
513
-
514
- self.block4_1 = block_class(pdcs[12], self.inplane, self.inplane, stride=2)
515
- self.block4_2 = block_class(pdcs[13], self.inplane, self.inplane)
516
- self.block4_3 = block_class(pdcs[14], self.inplane, self.inplane)
517
- self.block4_4 = block_class(pdcs[15], self.inplane, self.inplane)
518
- self.fuseplanes.append(self.inplane) # 4C
519
-
520
- self.conv_reduces = nn.ModuleList()
521
- if self.sa and self.dil is not None:
522
- self.attentions = nn.ModuleList()
523
- self.dilations = nn.ModuleList()
524
- for i in range(4):
525
- self.dilations.append(CDCM(self.fuseplanes[i], self.dil))
526
- self.attentions.append(CSAM(self.dil))
527
- self.conv_reduces.append(MapReduce(self.dil))
528
- elif self.sa:
529
- self.attentions = nn.ModuleList()
530
- for i in range(4):
531
- self.attentions.append(CSAM(self.fuseplanes[i]))
532
- self.conv_reduces.append(MapReduce(self.fuseplanes[i]))
533
- elif self.dil is not None:
534
- self.dilations = nn.ModuleList()
535
- for i in range(4):
536
- self.dilations.append(CDCM(self.fuseplanes[i], self.dil))
537
- self.conv_reduces.append(MapReduce(self.dil))
538
- else:
539
- for i in range(4):
540
- self.conv_reduces.append(MapReduce(self.fuseplanes[i]))
541
-
542
- self.classifier = nn.Conv2d(4, 1, kernel_size=1) # has bias
543
- nn.init.constant_(self.classifier.weight, 0.25)
544
- nn.init.constant_(self.classifier.bias, 0)
545
-
546
- # print('initialization done')
547
-
548
- def get_weights(self):
549
- conv_weights = []
550
- bn_weights = []
551
- relu_weights = []
552
- for pname, p in self.named_parameters():
553
- if 'bn' in pname:
554
- bn_weights.append(p)
555
- elif 'relu' in pname:
556
- relu_weights.append(p)
557
- else:
558
- conv_weights.append(p)
559
-
560
- return conv_weights, bn_weights, relu_weights
561
-
562
- def forward(self, x):
563
- H, W = x.size()[2:]
564
-
565
- x = self.init_block(x)
566
-
567
- x1 = self.block1_1(x)
568
- x1 = self.block1_2(x1)
569
- x1 = self.block1_3(x1)
570
-
571
- x2 = self.block2_1(x1)
572
- x2 = self.block2_2(x2)
573
- x2 = self.block2_3(x2)
574
- x2 = self.block2_4(x2)
575
-
576
- x3 = self.block3_1(x2)
577
- x3 = self.block3_2(x3)
578
- x3 = self.block3_3(x3)
579
- x3 = self.block3_4(x3)
580
-
581
- x4 = self.block4_1(x3)
582
- x4 = self.block4_2(x4)
583
- x4 = self.block4_3(x4)
584
- x4 = self.block4_4(x4)
585
-
586
- x_fuses = []
587
- if self.sa and self.dil is not None:
588
- for i, xi in enumerate([x1, x2, x3, x4]):
589
- x_fuses.append(self.attentions[i](self.dilations[i](xi)))
590
- elif self.sa:
591
- for i, xi in enumerate([x1, x2, x3, x4]):
592
- x_fuses.append(self.attentions[i](xi))
593
- elif self.dil is not None:
594
- for i, xi in enumerate([x1, x2, x3, x4]):
595
- x_fuses.append(self.dilations[i](xi))
596
- else:
597
- x_fuses = [x1, x2, x3, x4]
598
-
599
- e1 = self.conv_reduces[0](x_fuses[0])
600
- e1 = F.interpolate(e1, (H, W), mode="bilinear", align_corners=False)
601
-
602
- e2 = self.conv_reduces[1](x_fuses[1])
603
- e2 = F.interpolate(e2, (H, W), mode="bilinear", align_corners=False)
604
-
605
- e3 = self.conv_reduces[2](x_fuses[2])
606
- e3 = F.interpolate(e3, (H, W), mode="bilinear", align_corners=False)
607
-
608
- e4 = self.conv_reduces[3](x_fuses[3])
609
- e4 = F.interpolate(e4, (H, W), mode="bilinear", align_corners=False)
610
-
611
- outputs = [e1, e2, e3, e4]
612
-
613
- output = self.classifier(torch.cat(outputs, dim=1))
614
- #if not self.training:
615
- # return torch.sigmoid(output)
616
-
617
- outputs.append(output)
618
- outputs = [torch.sigmoid(r) for r in outputs]
619
- return outputs
620
-
621
- def config_model(model):
622
- model_options = list(nets.keys())
623
- assert model in model_options, \
624
- 'unrecognized model, please choose from %s' % str(model_options)
625
-
626
- # print(str(nets[model]))
627
-
628
- pdcs = []
629
- for i in range(16):
630
- layer_name = 'layer%d' % i
631
- op = nets[model][layer_name]
632
- pdcs.append(createConvFunc(op))
633
-
634
- return pdcs
635
-
636
- def pidinet():
637
- pdcs = config_model('carv4')
638
- dil = 24 #if args.dil else None
639
- return PiDiNet(60, pdcs, dil=dil, sa=True)
640
-
641
-
642
- if __name__ == '__main__':
643
- model = pidinet()
644
- ckp = torch.load('table5_pidinet.pth')['state_dict']
645
- model.load_state_dict({k.replace('module.',''):v for k, v in ckp.items()})
646
- im = cv2.imread('examples/test_my/cat_v4.png')
647
- im = img2tensor(im).unsqueeze(0)/255.
648
- res = model(im)[-1]
649
- res = res>0.5
650
- res = res.float()
651
- res = (res[0,0].cpu().data.numpy()*255.).astype(np.uint8)
652
- print(res.shape)
653
- cv2.imwrite('edge.png', res)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
spaces/AgentVerse/agentVerse/ui/src/phaser3-rex-plugins/templates/spinner/grid/Factory.js DELETED
@@ -1,13 +0,0 @@
1
- import Grid from './Grid.js';
2
- import ObjectFactory from '../ObjectFactory.js';
3
- import SetValue from '../../../plugins/utils/object/SetValue.js';
4
-
5
- ObjectFactory.register('grid', function (config) {
6
- var gameObject = new Grid(this.scene, config);
7
- this.scene.add.existing(gameObject);
8
- return gameObject;
9
- });
10
-
11
- SetValue(window, 'RexPlugins.Spinner.Grid', Grid);
12
-
13
- export default Grid;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
spaces/Al-Chan/Vits_League_of_Legends_Yuumi_TTS/cmd_inference.py DELETED
@@ -1,106 +0,0 @@
1
- """该模块用于生成VITS文件
2
- 使用方法
3
-
4
- python cmd_inference.py -m 模型路径 -c 配置文件路径 -o 输出文件路径 -l 输入的语言 -t 输入文本 -s 合成目标说话人名称
5
-
6
- 可选参数
7
- -ns 感情变化程度
8
- -nsw 音素发音长度
9
- -ls 整体语速
10
- -on 输出文件的名称
11
-
12
- """
13
-
14
- from pathlib import Path
15
- import utils
16
- from models import SynthesizerTrn
17
- import torch
18
- from torch import no_grad, LongTensor
19
- import librosa
20
- from text import text_to_sequence, _clean_text
21
- import commons
22
- import scipy.io.wavfile as wavf
23
- import os
24
-
25
- device = "cuda:0" if torch.cuda.is_available() else "cpu"
26
-
27
- language_marks = {
28
- "Japanese": "",
29
- "日本語": "[JA]",
30
- "简体中文": "[ZH]",
31
- "English": "[EN]",
32
- "Mix": "",
33
- }
34
-
35
-
36
- def get_text(text, hps, is_symbol):
37
- text_norm = text_to_sequence(text, hps.symbols, [] if is_symbol else hps.data.text_cleaners)
38
- if hps.data.add_blank:
39
- text_norm = commons.intersperse(text_norm, 0)
40
- text_norm = LongTensor(text_norm)
41
- return text_norm
42
-
43
-
44
-
45
- if __name__ == "__main__":
46
- import argparse
47
-
48
- parser = argparse.ArgumentParser(description='vits inference')
49
- #必须参数
50
- parser.add_argument('-m', '--model_path', type=str, default="logs/44k/G_0.pth", help='模型路径')
51
- parser.add_argument('-c', '--config_path', type=str, default="configs/config.json", help='配置文件路径')
52
- parser.add_argument('-o', '--output_path', type=str, default="output/vits", help='输出文件路径')
53
- parser.add_argument('-l', '--language', type=str, default="日本語", help='输入的语言')
54
- parser.add_argument('-t', '--text', type=str, help='输入文本')
55
- parser.add_argument('-s', '--spk', type=str, help='合成目标说话人名称')
56
- #可选参数
57
- parser.add_argument('-on', '--output_name', type=str, default="output", help='输出文件的名称')
58
- parser.add_argument('-ns', '--noise_scale', type=float,default= .667,help='感情变化程度')
59
- parser.add_argument('-nsw', '--noise_scale_w', type=float,default=0.6, help='音素发音长度')
60
- parser.add_argument('-ls', '--length_scale', type=float,default=1, help='整体语速')
61
-
62
- args = parser.parse_args()
63
-
64
- model_path = args.model_path
65
- config_path = args.config_path
66
- output_dir = Path(args.output_path)
67
- output_dir.mkdir(parents=True, exist_ok=True)
68
-
69
- language = args.language
70
- text = args.text
71
- spk = args.spk
72
- noise_scale = args.noise_scale
73
- noise_scale_w = args.noise_scale_w
74
- length = args.length_scale
75
- output_name = args.output_name
76
-
77
- hps = utils.get_hparams_from_file(config_path)
78
- net_g = SynthesizerTrn(
79
- len(hps.symbols),
80
- hps.data.filter_length // 2 + 1,
81
- hps.train.segment_size // hps.data.hop_length,
82
- n_speakers=hps.data.n_speakers,
83
- **hps.model).to(device)
84
- _ = net_g.eval()
85
- _ = utils.load_checkpoint(model_path, net_g, None)
86
-
87
- speaker_ids = hps.speakers
88
-
89
-
90
- if language is not None:
91
- text = language_marks[language] + text + language_marks[language]
92
- speaker_id = speaker_ids[spk]
93
- stn_tst = get_text(text, hps, False)
94
- with no_grad():
95
- x_tst = stn_tst.unsqueeze(0).to(device)
96
- x_tst_lengths = LongTensor([stn_tst.size(0)]).to(device)
97
- sid = LongTensor([speaker_id]).to(device)
98
- audio = net_g.infer(x_tst, x_tst_lengths, sid=sid, noise_scale=noise_scale, noise_scale_w=noise_scale_w,
99
- length_scale=1.0 / length)[0][0, 0].data.cpu().float().numpy()
100
- del stn_tst, x_tst, x_tst_lengths, sid
101
-
102
- wavf.write(str(output_dir)+"/"+output_name+".wav",hps.data.sampling_rate,audio)
103
-
104
-
105
-
106
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
spaces/AlhitawiMohammed22/HTD_HTR/README.md DELETED
@@ -1,20 +0,0 @@
1
- ---
2
- title: HTD HTR
3
- emoji: 📉
4
- colorFrom: pink
5
- colorTo: blue
6
- sdk: gradio
7
- sdk_version: 3.43.2
8
- app_file: app.py
9
- pinned: false
10
- license: apache-2.0
11
- ---
12
-
13
- reference:
14
-
15
- https://github.com/kforcodeai/doctr-trocr
16
-
17
- https://github.com/mindee/doctr/issues/1307
18
-
19
- https://github.com/mindee/doctr/discussions/606
20
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
spaces/Andy1621/uniformer_image_detection/configs/gfl/gfl_r50_fpn_1x_coco.py DELETED
@@ -1,57 +0,0 @@
1
- _base_ = [
2
- '../_base_/datasets/coco_detection.py',
3
- '../_base_/schedules/schedule_1x.py', '../_base_/default_runtime.py'
4
- ]
5
- model = dict(
6
- type='GFL',
7
- pretrained='torchvision://resnet50',
8
- backbone=dict(
9
- type='ResNet',
10
- depth=50,
11
- num_stages=4,
12
- out_indices=(0, 1, 2, 3),
13
- frozen_stages=1,
14
- norm_cfg=dict(type='BN', requires_grad=True),
15
- norm_eval=True,
16
- style='pytorch'),
17
- neck=dict(
18
- type='FPN',
19
- in_channels=[256, 512, 1024, 2048],
20
- out_channels=256,
21
- start_level=1,
22
- add_extra_convs='on_output',
23
- num_outs=5),
24
- bbox_head=dict(
25
- type='GFLHead',
26
- num_classes=80,
27
- in_channels=256,
28
- stacked_convs=4,
29
- feat_channels=256,
30
- anchor_generator=dict(
31
- type='AnchorGenerator',
32
- ratios=[1.0],
33
- octave_base_scale=8,
34
- scales_per_octave=1,
35
- strides=[8, 16, 32, 64, 128]),
36
- loss_cls=dict(
37
- type='QualityFocalLoss',
38
- use_sigmoid=True,
39
- beta=2.0,
40
- loss_weight=1.0),
41
- loss_dfl=dict(type='DistributionFocalLoss', loss_weight=0.25),
42
- reg_max=16,
43
- loss_bbox=dict(type='GIoULoss', loss_weight=2.0)),
44
- # training and testing settings
45
- train_cfg=dict(
46
- assigner=dict(type='ATSSAssigner', topk=9),
47
- allowed_border=-1,
48
- pos_weight=-1,
49
- debug=False),
50
- test_cfg=dict(
51
- nms_pre=1000,
52
- min_bbox_size=0,
53
- score_thr=0.05,
54
- nms=dict(type='nms', iou_threshold=0.6),
55
- max_per_img=100))
56
- # optimizer
57
- optimizer = dict(type='SGD', lr=0.01, momentum=0.9, weight_decay=0.0001)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
spaces/Andy1621/uniformer_image_detection/configs/regnet/retinanet_regnetx-1.6GF_fpn_1x_coco.py DELETED
@@ -1,16 +0,0 @@
1
- _base_ = './retinanet_regnetx-3.2GF_fpn_1x_coco.py'
2
- model = dict(
3
- pretrained='open-mmlab://regnetx_1.6gf',
4
- backbone=dict(
5
- type='RegNet',
6
- arch='regnetx_1.6gf',
7
- out_indices=(0, 1, 2, 3),
8
- frozen_stages=1,
9
- norm_cfg=dict(type='BN', requires_grad=True),
10
- norm_eval=True,
11
- style='pytorch'),
12
- neck=dict(
13
- type='FPN',
14
- in_channels=[72, 168, 408, 912],
15
- out_channels=256,
16
- num_outs=5))
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
spaces/Andy1621/uniformer_image_detection/configs/sabl/sabl_faster_rcnn_r50_fpn_1x_coco.py DELETED
@@ -1,34 +0,0 @@
1
- _base_ = [
2
- '../_base_/models/faster_rcnn_r50_fpn.py',
3
- '../_base_/datasets/coco_detection.py',
4
- '../_base_/schedules/schedule_1x.py', '../_base_/default_runtime.py'
5
- ]
6
- model = dict(
7
- roi_head=dict(
8
- bbox_head=dict(
9
- _delete_=True,
10
- type='SABLHead',
11
- num_classes=80,
12
- cls_in_channels=256,
13
- reg_in_channels=256,
14
- roi_feat_size=7,
15
- reg_feat_up_ratio=2,
16
- reg_pre_kernel=3,
17
- reg_post_kernel=3,
18
- reg_pre_num=2,
19
- reg_post_num=1,
20
- cls_out_channels=1024,
21
- reg_offset_out_channels=256,
22
- reg_cls_out_channels=256,
23
- num_cls_fcs=1,
24
- num_reg_fcs=0,
25
- reg_class_agnostic=True,
26
- norm_cfg=None,
27
- bbox_coder=dict(
28
- type='BucketingBBoxCoder', num_buckets=14, scale_factor=1.7),
29
- loss_cls=dict(
30
- type='CrossEntropyLoss', use_sigmoid=False, loss_weight=1.0),
31
- loss_bbox_cls=dict(
32
- type='CrossEntropyLoss', use_sigmoid=True, loss_weight=1.0),
33
- loss_bbox_reg=dict(type='SmoothL1Loss', beta=0.1,
34
- loss_weight=1.0))))
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
spaces/Andy1621/uniformer_image_segmentation/configs/pspnet/pspnet_r50-d8_512x1024_40k_cityscapes.py DELETED
@@ -1,4 +0,0 @@
1
- _base_ = [
2
- '../_base_/models/pspnet_r50-d8.py', '../_base_/datasets/cityscapes.py',
3
- '../_base_/default_runtime.py', '../_base_/schedules/schedule_40k.py'
4
- ]
 
 
 
 
 
spaces/Andy1621/uniformer_image_segmentation/configs/resnest/deeplabv3plus_s101-d8_512x512_160k_ade20k.py DELETED
@@ -1,9 +0,0 @@
1
- _base_ = '../deeplabv3plus/deeplabv3plus_r101-d8_512x512_160k_ade20k.py'
2
- model = dict(
3
- pretrained='open-mmlab://resnest101',
4
- backbone=dict(
5
- type='ResNeSt',
6
- stem_channels=128,
7
- radix=2,
8
- reduction_factor=4,
9
- avg_down_stride=True))
 
 
 
 
 
 
 
 
 
 
spaces/AnishKumbhar/ChatBot/app.py DELETED
@@ -1 +0,0 @@
1
- python /text-generation-webui/server.py --share --chat --wbits 4 --groupsize 128 --model_type llama
 
 
spaces/AnishKumbhar/ChatBot/text-generation-webui-main/docs/One-Click-Installers.md DELETED
@@ -1,72 +0,0 @@
1
- # Additional one-click installers info
2
-
3
- ## Installing nvcc
4
-
5
- If you have an NVIDIA GPU and ever need to compile something, like ExLlamav2 (that currently doesn't have pre-built wheels), you can install `nvcc` by running the `cmd_` script for your OS and entering this command:
6
-
7
- ```
8
- conda install cuda -c nvidia/label/cuda-11.7.1
9
- ```
10
-
11
- ## Using an AMD GPU in Linux
12
-
13
- Requires ROCm SDK 5.4.2 or 5.4.3 to be installed. Some systems may also
14
- need: sudo apt-get install libstdc++-12-dev
15
-
16
- Edit the "one_click.py" script using a text editor and un-comment and
17
- modify the lines near the top of the script according to your setup. In
18
- particular, modify the os.environ["ROCM_PATH"] = '/opt/rocm' line to
19
- point to your ROCm installation.
20
-
21
- ## WSL instructions
22
-
23
- If you do not have WSL installed, see here:
24
- https://learn.microsoft.com/en-us/windows/wsl/install
25
-
26
- If you want to install Linux to a drive other than C
27
- Open powershell and enter these commands:
28
-
29
- cd D:\Path\To\Linux
30
- $ProgressPreference = 'SilentlyContinue'
31
- Invoke-WebRequest -Uri <LinuxDistroURL> -OutFile Linux.appx -UseBasicParsing
32
- mv Linux.appx Linux.zip
33
-
34
- Then open Linux.zip and you should see several .appx files inside.
35
- The one with _x64.appx contains the exe installer that you need.
36
- Extract the contents of that _x64.appx file and run <distro>.exe to install.
37
-
38
- Linux Distro URLs:
39
- https://learn.microsoft.com/en-us/windows/wsl/install-manual#downloading-distributions
40
-
41
- ******************************************************************************
42
- *ENSURE THAT THE WSL LINUX DISTRO THAT YOU WISH TO USE IS SET AS THE DEFAULT!*
43
- ******************************************************************************
44
-
45
- Do this by using these commands:
46
- wsl -l
47
- wsl -s <DistroName>
48
-
49
- ### Web UI Installation
50
-
51
- Run the "start" script. By default it will install the web UI in WSL:
52
- /home/{username}/text-gen-install
53
-
54
- To launch the web UI in the future after it is already installed, run
55
- the same "start" script. Ensure that one_click.py and wsl.sh are next to it!
56
-
57
- ### Updating the web UI
58
-
59
- As an alternative to running the "update" script, you can also run "wsl.sh update" in WSL.
60
-
61
- ### Running an interactive shell
62
-
63
- As an alternative to running the "cmd" script, you can also run "wsl.sh cmd" in WSL.
64
-
65
- ### Changing the default install location
66
-
67
- To change this, you will need to edit the scripts as follows:
68
- wsl.sh: line ~22 INSTALL_DIR="/path/to/install/dir"
69
-
70
- Keep in mind that there is a long-standing bug in WSL that significantly
71
- slows drive read/write speeds when using a physical drive as opposed to
72
- the virtual one that Linux is installed in.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
spaces/Anonymous-123/ImageNet-Editing/object_removal/TFill/util/util.py DELETED
@@ -1,76 +0,0 @@
1
- """This module contains simple helper functions """
2
- from __future__ import print_function
3
- import torch
4
- import numpy as np
5
- import os
6
- import imageio
7
-
8
-
9
- def tensor2im(input_image, imtype=np.uint8):
10
- """"Converts a Tensor array into a numpy image array.
11
-
12
- Parameters:
13
- input_image (tensor) -- the input image tensor array
14
- imtype (type) -- the desired type of the converted numpy array
15
- """
16
- if not isinstance(input_image, np.ndarray):
17
- if isinstance(input_image, torch.Tensor): # get the data from a variable
18
- image_tensor = input_image.data
19
- else:
20
- return input_image
21
- image_numpy = image_tensor[0].cpu().float().numpy() # convert it into a numpy array
22
- if image_numpy.shape[0] == 1: # grayscale to RGB
23
- image_numpy = np.tile(image_numpy, (3, 1, 1))
24
- image_numpy = (np.transpose(image_numpy, (1, 2, 0)) + 1) / 2.0 * 255.0 # post-processing: tranpose and scaling
25
- else: # if it is a numpy array, do nothing
26
- image_numpy = input_image
27
- return image_numpy.astype(imtype)
28
-
29
-
30
- def tensor2array(value_tensor):
31
- """Converts a Tensor array into a numpy
32
- :param value_tensor:
33
- :return:
34
- """
35
- if value_tensor.dim() == 3:
36
- numpy = value_tensor.view(-1).cpu().float().numpy()
37
- else:
38
- numpy = value_tensor[0].view(-1).cpu().float().numpy()
39
- return numpy
40
-
41
-
42
- def save_image(image_numpy, image_path):
43
- """Save a numpy image to the disk
44
-
45
- Parameters:
46
- image_numpy (numpy array) -- input numpy array
47
- image_path (str) -- the path of the image
48
- """
49
-
50
- if image_numpy.shape[2] == 1:
51
- image_numpy = image_numpy.reshape(image_numpy.shape[0], image_numpy.shape[1])
52
-
53
- imageio.imwrite(image_path, image_numpy)
54
-
55
-
56
- def mkdirs(paths):
57
- """create empty directories if they don't exist
58
-
59
- Parameters:
60
- paths (str list) -- a list of directory paths
61
- """
62
- if isinstance(paths, list) and not isinstance(paths, str):
63
- for path in paths:
64
- mkdir(path)
65
- else:
66
- mkdir(paths)
67
-
68
-
69
- def mkdir(path):
70
- """create a single empty directory if it didn't exist
71
-
72
- Parameters:
73
- path (str) -- a single directory path
74
- """
75
- if not os.path.exists(path):
76
- os.makedirs(path)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
spaces/Anonymous-sub/Rerender/ControlNet/annotator/uniformer/mmcv/cnn/utils/__init__.py DELETED
@@ -1,19 +0,0 @@
1
- # Copyright (c) OpenMMLab. All rights reserved.
2
- from .flops_counter import get_model_complexity_info
3
- from .fuse_conv_bn import fuse_conv_bn
4
- from .sync_bn import revert_sync_batchnorm
5
- from .weight_init import (INITIALIZERS, Caffe2XavierInit, ConstantInit,
6
- KaimingInit, NormalInit, PretrainedInit,
7
- TruncNormalInit, UniformInit, XavierInit,
8
- bias_init_with_prob, caffe2_xavier_init,
9
- constant_init, initialize, kaiming_init, normal_init,
10
- trunc_normal_init, uniform_init, xavier_init)
11
-
12
- __all__ = [
13
- 'get_model_complexity_info', 'bias_init_with_prob', 'caffe2_xavier_init',
14
- 'constant_init', 'kaiming_init', 'normal_init', 'trunc_normal_init',
15
- 'uniform_init', 'xavier_init', 'fuse_conv_bn', 'initialize',
16
- 'INITIALIZERS', 'ConstantInit', 'XavierInit', 'NormalInit',
17
- 'TruncNormalInit', 'UniformInit', 'KaimingInit', 'PretrainedInit',
18
- 'Caffe2XavierInit', 'revert_sync_batchnorm'
19
- ]
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
spaces/Arnx/MusicGenXvAKN/audiocraft/utils/export.py DELETED
@@ -1,56 +0,0 @@
1
- # Copyright (c) Meta Platforms, Inc. and affiliates.
2
- # All rights reserved.
3
- #
4
- # This source code is licensed under the license found in the
5
- # LICENSE file in the root directory of this source tree.
6
-
7
- """
8
- Utility to export a training checkpoint to a lightweight release checkpoint.
9
- """
10
-
11
- from pathlib import Path
12
- import typing as tp
13
-
14
- from omegaconf import OmegaConf, DictConfig
15
- import torch
16
-
17
-
18
- def _clean_lm_cfg(cfg: DictConfig):
19
- OmegaConf.set_struct(cfg, False)
20
- # This used to be set automatically in the LM solver, need a more robust solution
21
- # for the future.
22
- cfg['transformer_lm']['card'] = 2048
23
- cfg['transformer_lm']['n_q'] = 4
24
- # Experimental params no longer supported.
25
- bad_params = ['spectral_norm_attn_iters', 'spectral_norm_ff_iters',
26
- 'residual_balancer_attn', 'residual_balancer_ff', 'layer_drop']
27
- for name in bad_params:
28
- del cfg['transformer_lm'][name]
29
- OmegaConf.set_struct(cfg, True)
30
- return cfg
31
-
32
-
33
- def export_encodec(checkpoint_path: tp.Union[Path, str], out_folder: tp.Union[Path, str]):
34
- sig = Path(checkpoint_path).parent.name
35
- assert len(sig) == 8, "Not a valid Dora signature"
36
- pkg = torch.load(checkpoint_path, 'cpu')
37
- new_pkg = {
38
- 'best_state': pkg['ema']['state']['model'],
39
- 'xp.cfg': OmegaConf.to_yaml(pkg['xp.cfg']),
40
- }
41
- out_file = Path(out_folder) / f'{sig}.th'
42
- torch.save(new_pkg, out_file)
43
- return out_file
44
-
45
-
46
- def export_lm(checkpoint_path: tp.Union[Path, str], out_folder: tp.Union[Path, str]):
47
- sig = Path(checkpoint_path).parent.name
48
- assert len(sig) == 8, "Not a valid Dora signature"
49
- pkg = torch.load(checkpoint_path, 'cpu')
50
- new_pkg = {
51
- 'best_state': pkg['fsdp_best_state']['model'],
52
- 'xp.cfg': OmegaConf.to_yaml(_clean_lm_cfg(pkg['xp.cfg']))
53
- }
54
- out_file = Path(out_folder) / f'{sig}.th'
55
- torch.save(new_pkg, out_file)
56
- return out_file
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
spaces/Ataturk-Chatbot/HuggingFaceChat/venv/lib/python3.11/site-packages/pip/_vendor/rich/console.py DELETED
The diff for this file is too large to render. See raw diff
 
spaces/Awiny/Image2Paragraph/models/grit_src/third_party/CenterNet2/detectron2/modeling/anchor_generator.py DELETED
@@ -1,382 +0,0 @@
1
- # Copyright (c) Facebook, Inc. and its affiliates.
2
- import collections
3
- import math
4
- from typing import List
5
- import torch
6
- from torch import nn
7
-
8
- from detectron2.config import configurable
9
- from detectron2.layers import ShapeSpec
10
- from detectron2.structures import Boxes, RotatedBoxes
11
- from detectron2.utils.registry import Registry
12
-
13
- ANCHOR_GENERATOR_REGISTRY = Registry("ANCHOR_GENERATOR")
14
- ANCHOR_GENERATOR_REGISTRY.__doc__ = """
15
- Registry for modules that creates object detection anchors for feature maps.
16
-
17
- The registered object will be called with `obj(cfg, input_shape)`.
18
- """
19
-
20
-
21
- class BufferList(nn.Module):
22
- """
23
- Similar to nn.ParameterList, but for buffers
24
- """
25
-
26
- def __init__(self, buffers):
27
- super().__init__()
28
- for i, buffer in enumerate(buffers):
29
- # Use non-persistent buffer so the values are not saved in checkpoint
30
- self.register_buffer(str(i), buffer, persistent=False)
31
-
32
- def __len__(self):
33
- return len(self._buffers)
34
-
35
- def __iter__(self):
36
- return iter(self._buffers.values())
37
-
38
-
39
- def _create_grid_offsets(size: List[int], stride: int, offset: float, device: torch.device):
40
- grid_height, grid_width = size
41
- shifts_x = torch.arange(
42
- offset * stride, grid_width * stride, step=stride, dtype=torch.float32, device=device
43
- )
44
- shifts_y = torch.arange(
45
- offset * stride, grid_height * stride, step=stride, dtype=torch.float32, device=device
46
- )
47
-
48
- shift_y, shift_x = torch.meshgrid(shifts_y, shifts_x)
49
- shift_x = shift_x.reshape(-1)
50
- shift_y = shift_y.reshape(-1)
51
- return shift_x, shift_y
52
-
53
-
54
- def _broadcast_params(params, num_features, name):
55
- """
56
- If one size (or aspect ratio) is specified and there are multiple feature
57
- maps, we "broadcast" anchors of that single size (or aspect ratio)
58
- over all feature maps.
59
-
60
- If params is list[float], or list[list[float]] with len(params) == 1, repeat
61
- it num_features time.
62
-
63
- Returns:
64
- list[list[float]]: param for each feature
65
- """
66
- assert isinstance(
67
- params, collections.abc.Sequence
68
- ), f"{name} in anchor generator has to be a list! Got {params}."
69
- assert len(params), f"{name} in anchor generator cannot be empty!"
70
- if not isinstance(params[0], collections.abc.Sequence): # params is list[float]
71
- return [params] * num_features
72
- if len(params) == 1:
73
- return list(params) * num_features
74
- assert len(params) == num_features, (
75
- f"Got {name} of length {len(params)} in anchor generator, "
76
- f"but the number of input features is {num_features}!"
77
- )
78
- return params
79
-
80
-
81
- @ANCHOR_GENERATOR_REGISTRY.register()
82
- class DefaultAnchorGenerator(nn.Module):
83
- """
84
- Compute anchors in the standard ways described in
85
- "Faster R-CNN: Towards Real-Time Object Detection with Region Proposal Networks".
86
- """
87
-
88
- box_dim: torch.jit.Final[int] = 4
89
- """
90
- the dimension of each anchor box.
91
- """
92
-
93
- @configurable
94
- def __init__(self, *, sizes, aspect_ratios, strides, offset=0.5):
95
- """
96
- This interface is experimental.
97
-
98
- Args:
99
- sizes (list[list[float]] or list[float]):
100
- If ``sizes`` is list[list[float]], ``sizes[i]`` is the list of anchor sizes
101
- (i.e. sqrt of anchor area) to use for the i-th feature map.
102
- If ``sizes`` is list[float], ``sizes`` is used for all feature maps.
103
- Anchor sizes are given in absolute lengths in units of
104
- the input image; they do not dynamically scale if the input image size changes.
105
- aspect_ratios (list[list[float]] or list[float]): list of aspect ratios
106
- (i.e. height / width) to use for anchors. Same "broadcast" rule for `sizes` applies.
107
- strides (list[int]): stride of each input feature.
108
- offset (float): Relative offset between the center of the first anchor and the top-left
109
- corner of the image. Value has to be in [0, 1).
110
- Recommend to use 0.5, which means half stride.
111
- """
112
- super().__init__()
113
-
114
- self.strides = strides
115
- self.num_features = len(self.strides)
116
- sizes = _broadcast_params(sizes, self.num_features, "sizes")
117
- aspect_ratios = _broadcast_params(aspect_ratios, self.num_features, "aspect_ratios")
118
- self.cell_anchors = self._calculate_anchors(sizes, aspect_ratios)
119
-
120
- self.offset = offset
121
- assert 0.0 <= self.offset < 1.0, self.offset
122
-
123
- @classmethod
124
- def from_config(cls, cfg, input_shape: List[ShapeSpec]):
125
- return {
126
- "sizes": cfg.MODEL.ANCHOR_GENERATOR.SIZES,
127
- "aspect_ratios": cfg.MODEL.ANCHOR_GENERATOR.ASPECT_RATIOS,
128
- "strides": [x.stride for x in input_shape],
129
- "offset": cfg.MODEL.ANCHOR_GENERATOR.OFFSET,
130
- }
131
-
132
- def _calculate_anchors(self, sizes, aspect_ratios):
133
- cell_anchors = [
134
- self.generate_cell_anchors(s, a).float() for s, a in zip(sizes, aspect_ratios)
135
- ]
136
- return BufferList(cell_anchors)
137
-
138
- @property
139
- @torch.jit.unused
140
- def num_cell_anchors(self):
141
- """
142
- Alias of `num_anchors`.
143
- """
144
- return self.num_anchors
145
-
146
- @property
147
- @torch.jit.unused
148
- def num_anchors(self):
149
- """
150
- Returns:
151
- list[int]: Each int is the number of anchors at every pixel
152
- location, on that feature map.
153
- For example, if at every pixel we use anchors of 3 aspect
154
- ratios and 5 sizes, the number of anchors is 15.
155
- (See also ANCHOR_GENERATOR.SIZES and ANCHOR_GENERATOR.ASPECT_RATIOS in config)
156
-
157
- In standard RPN models, `num_anchors` on every feature map is the same.
158
- """
159
- return [len(cell_anchors) for cell_anchors in self.cell_anchors]
160
-
161
- def _grid_anchors(self, grid_sizes: List[List[int]]):
162
- """
163
- Returns:
164
- list[Tensor]: #featuremap tensors, each is (#locations x #cell_anchors) x 4
165
- """
166
- anchors = []
167
- # buffers() not supported by torchscript. use named_buffers() instead
168
- buffers: List[torch.Tensor] = [x[1] for x in self.cell_anchors.named_buffers()]
169
- for size, stride, base_anchors in zip(grid_sizes, self.strides, buffers):
170
- shift_x, shift_y = _create_grid_offsets(size, stride, self.offset, base_anchors.device)
171
- shifts = torch.stack((shift_x, shift_y, shift_x, shift_y), dim=1)
172
-
173
- anchors.append((shifts.view(-1, 1, 4) + base_anchors.view(1, -1, 4)).reshape(-1, 4))
174
-
175
- return anchors
176
-
177
- def generate_cell_anchors(self, sizes=(32, 64, 128, 256, 512), aspect_ratios=(0.5, 1, 2)):
178
- """
179
- Generate a tensor storing canonical anchor boxes, which are all anchor
180
- boxes of different sizes and aspect_ratios centered at (0, 0).
181
- We can later build the set of anchors for a full feature map by
182
- shifting and tiling these tensors (see `meth:_grid_anchors`).
183
-
184
- Args:
185
- sizes (tuple[float]):
186
- aspect_ratios (tuple[float]]):
187
-
188
- Returns:
189
- Tensor of shape (len(sizes) * len(aspect_ratios), 4) storing anchor boxes
190
- in XYXY format.
191
- """
192
-
193
- # This is different from the anchor generator defined in the original Faster R-CNN
194
- # code or Detectron. They yield the same AP, however the old version defines cell
195
- # anchors in a less natural way with a shift relative to the feature grid and
196
- # quantization that results in slightly different sizes for different aspect ratios.
197
- # See also https://github.com/facebookresearch/Detectron/issues/227
198
-
199
- anchors = []
200
- for size in sizes:
201
- area = size ** 2.0
202
- for aspect_ratio in aspect_ratios:
203
- # s * s = w * h
204
- # a = h / w
205
- # ... some algebra ...
206
- # w = sqrt(s * s / a)
207
- # h = a * w
208
- w = math.sqrt(area / aspect_ratio)
209
- h = aspect_ratio * w
210
- x0, y0, x1, y1 = -w / 2.0, -h / 2.0, w / 2.0, h / 2.0
211
- anchors.append([x0, y0, x1, y1])
212
- return torch.tensor(anchors)
213
-
214
- def forward(self, features: List[torch.Tensor]):
215
- """
216
- Args:
217
- features (list[Tensor]): list of backbone feature maps on which to generate anchors.
218
-
219
- Returns:
220
- list[Boxes]: a list of Boxes containing all the anchors for each feature map
221
- (i.e. the cell anchors repeated over all locations in the feature map).
222
- The number of anchors of each feature map is Hi x Wi x num_cell_anchors,
223
- where Hi, Wi are resolution of the feature map divided by anchor stride.
224
- """
225
- grid_sizes = [feature_map.shape[-2:] for feature_map in features]
226
- anchors_over_all_feature_maps = self._grid_anchors(grid_sizes)
227
- return [Boxes(x) for x in anchors_over_all_feature_maps]
228
-
229
-
230
- @ANCHOR_GENERATOR_REGISTRY.register()
231
- class RotatedAnchorGenerator(nn.Module):
232
- """
233
- Compute rotated anchors used by Rotated RPN (RRPN), described in
234
- "Arbitrary-Oriented Scene Text Detection via Rotation Proposals".
235
- """
236
-
237
- box_dim: int = 5
238
- """
239
- the dimension of each anchor box.
240
- """
241
-
242
- @configurable
243
- def __init__(self, *, sizes, aspect_ratios, strides, angles, offset=0.5):
244
- """
245
- This interface is experimental.
246
-
247
- Args:
248
- sizes (list[list[float]] or list[float]):
249
- If sizes is list[list[float]], sizes[i] is the list of anchor sizes
250
- (i.e. sqrt of anchor area) to use for the i-th feature map.
251
- If sizes is list[float], the sizes are used for all feature maps.
252
- Anchor sizes are given in absolute lengths in units of
253
- the input image; they do not dynamically scale if the input image size changes.
254
- aspect_ratios (list[list[float]] or list[float]): list of aspect ratios
255
- (i.e. height / width) to use for anchors. Same "broadcast" rule for `sizes` applies.
256
- strides (list[int]): stride of each input feature.
257
- angles (list[list[float]] or list[float]): list of angles (in degrees CCW)
258
- to use for anchors. Same "broadcast" rule for `sizes` applies.
259
- offset (float): Relative offset between the center of the first anchor and the top-left
260
- corner of the image. Value has to be in [0, 1).
261
- Recommend to use 0.5, which means half stride.
262
- """
263
- super().__init__()
264
-
265
- self.strides = strides
266
- self.num_features = len(self.strides)
267
- sizes = _broadcast_params(sizes, self.num_features, "sizes")
268
- aspect_ratios = _broadcast_params(aspect_ratios, self.num_features, "aspect_ratios")
269
- angles = _broadcast_params(angles, self.num_features, "angles")
270
- self.cell_anchors = self._calculate_anchors(sizes, aspect_ratios, angles)
271
-
272
- self.offset = offset
273
- assert 0.0 <= self.offset < 1.0, self.offset
274
-
275
- @classmethod
276
- def from_config(cls, cfg, input_shape: List[ShapeSpec]):
277
- return {
278
- "sizes": cfg.MODEL.ANCHOR_GENERATOR.SIZES,
279
- "aspect_ratios": cfg.MODEL.ANCHOR_GENERATOR.ASPECT_RATIOS,
280
- "strides": [x.stride for x in input_shape],
281
- "offset": cfg.MODEL.ANCHOR_GENERATOR.OFFSET,
282
- "angles": cfg.MODEL.ANCHOR_GENERATOR.ANGLES,
283
- }
284
-
285
- def _calculate_anchors(self, sizes, aspect_ratios, angles):
286
- cell_anchors = [
287
- self.generate_cell_anchors(size, aspect_ratio, angle).float()
288
- for size, aspect_ratio, angle in zip(sizes, aspect_ratios, angles)
289
- ]
290
- return BufferList(cell_anchors)
291
-
292
- @property
293
- def num_cell_anchors(self):
294
- """
295
- Alias of `num_anchors`.
296
- """
297
- return self.num_anchors
298
-
299
- @property
300
- def num_anchors(self):
301
- """
302
- Returns:
303
- list[int]: Each int is the number of anchors at every pixel
304
- location, on that feature map.
305
- For example, if at every pixel we use anchors of 3 aspect
306
- ratios, 2 sizes and 5 angles, the number of anchors is 30.
307
- (See also ANCHOR_GENERATOR.SIZES, ANCHOR_GENERATOR.ASPECT_RATIOS
308
- and ANCHOR_GENERATOR.ANGLES in config)
309
-
310
- In standard RRPN models, `num_anchors` on every feature map is the same.
311
- """
312
- return [len(cell_anchors) for cell_anchors in self.cell_anchors]
313
-
314
- def _grid_anchors(self, grid_sizes):
315
- anchors = []
316
- for size, stride, base_anchors in zip(grid_sizes, self.strides, self.cell_anchors):
317
- shift_x, shift_y = _create_grid_offsets(size, stride, self.offset, base_anchors.device)
318
- zeros = torch.zeros_like(shift_x)
319
- shifts = torch.stack((shift_x, shift_y, zeros, zeros, zeros), dim=1)
320
-
321
- anchors.append((shifts.view(-1, 1, 5) + base_anchors.view(1, -1, 5)).reshape(-1, 5))
322
-
323
- return anchors
324
-
325
- def generate_cell_anchors(
326
- self,
327
- sizes=(32, 64, 128, 256, 512),
328
- aspect_ratios=(0.5, 1, 2),
329
- angles=(-90, -60, -30, 0, 30, 60, 90),
330
- ):
331
- """
332
- Generate a tensor storing canonical anchor boxes, which are all anchor
333
- boxes of different sizes, aspect_ratios, angles centered at (0, 0).
334
- We can later build the set of anchors for a full feature map by
335
- shifting and tiling these tensors (see `meth:_grid_anchors`).
336
-
337
- Args:
338
- sizes (tuple[float]):
339
- aspect_ratios (tuple[float]]):
340
- angles (tuple[float]]):
341
-
342
- Returns:
343
- Tensor of shape (len(sizes) * len(aspect_ratios) * len(angles), 5)
344
- storing anchor boxes in (x_ctr, y_ctr, w, h, angle) format.
345
- """
346
- anchors = []
347
- for size in sizes:
348
- area = size ** 2.0
349
- for aspect_ratio in aspect_ratios:
350
- # s * s = w * h
351
- # a = h / w
352
- # ... some algebra ...
353
- # w = sqrt(s * s / a)
354
- # h = a * w
355
- w = math.sqrt(area / aspect_ratio)
356
- h = aspect_ratio * w
357
- anchors.extend([0, 0, w, h, a] for a in angles)
358
-
359
- return torch.tensor(anchors)
360
-
361
- def forward(self, features):
362
- """
363
- Args:
364
- features (list[Tensor]): list of backbone feature maps on which to generate anchors.
365
-
366
- Returns:
367
- list[RotatedBoxes]: a list of Boxes containing all the anchors for each feature map
368
- (i.e. the cell anchors repeated over all locations in the feature map).
369
- The number of anchors of each feature map is Hi x Wi x num_cell_anchors,
370
- where Hi, Wi are resolution of the feature map divided by anchor stride.
371
- """
372
- grid_sizes = [feature_map.shape[-2:] for feature_map in features]
373
- anchors_over_all_feature_maps = self._grid_anchors(grid_sizes)
374
- return [RotatedBoxes(x) for x in anchors_over_all_feature_maps]
375
-
376
-
377
- def build_anchor_generator(cfg, input_shape):
378
- """
379
- Built an anchor generator from `cfg.MODEL.ANCHOR_GENERATOR.NAME`.
380
- """
381
- anchor_generator = cfg.MODEL.ANCHOR_GENERATOR.NAME
382
- return ANCHOR_GENERATOR_REGISTRY.get(anchor_generator)(cfg, input_shape)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
spaces/Awiny/Image2Paragraph/models/grit_src/third_party/CenterNet2/detectron2/structures/rotated_boxes.py DELETED
@@ -1,503 +0,0 @@
1
- # Copyright (c) Facebook, Inc. and its affiliates.
2
- import math
3
- from typing import List, Tuple
4
- import torch
5
-
6
- from detectron2.layers.rotated_boxes import pairwise_iou_rotated
7
-
8
- from .boxes import Boxes
9
-
10
-
11
- class RotatedBoxes(Boxes):
12
- """
13
- This structure stores a list of rotated boxes as a Nx5 torch.Tensor.
14
- It supports some common methods about boxes
15
- (`area`, `clip`, `nonempty`, etc),
16
- and also behaves like a Tensor
17
- (support indexing, `to(device)`, `.device`, and iteration over all boxes)
18
- """
19
-
20
- def __init__(self, tensor: torch.Tensor):
21
- """
22
- Args:
23
- tensor (Tensor[float]): a Nx5 matrix. Each row is
24
- (x_center, y_center, width, height, angle),
25
- in which angle is represented in degrees.
26
- While there's no strict range restriction for it,
27
- the recommended principal range is between [-180, 180) degrees.
28
-
29
- Assume we have a horizontal box B = (x_center, y_center, width, height),
30
- where width is along the x-axis and height is along the y-axis.
31
- The rotated box B_rot (x_center, y_center, width, height, angle)
32
- can be seen as:
33
-
34
- 1. When angle == 0:
35
- B_rot == B
36
- 2. When angle > 0:
37
- B_rot is obtained by rotating B w.r.t its center by :math:`|angle|` degrees CCW;
38
- 3. When angle < 0:
39
- B_rot is obtained by rotating B w.r.t its center by :math:`|angle|` degrees CW.
40
-
41
- Mathematically, since the right-handed coordinate system for image space
42
- is (y, x), where y is top->down and x is left->right, the 4 vertices of the
43
- rotated rectangle :math:`(yr_i, xr_i)` (i = 1, 2, 3, 4) can be obtained from
44
- the vertices of the horizontal rectangle :math:`(y_i, x_i)` (i = 1, 2, 3, 4)
45
- in the following way (:math:`\\theta = angle*\\pi/180` is the angle in radians,
46
- :math:`(y_c, x_c)` is the center of the rectangle):
47
-
48
- .. math::
49
-
50
- yr_i = \\cos(\\theta) (y_i - y_c) - \\sin(\\theta) (x_i - x_c) + y_c,
51
-
52
- xr_i = \\sin(\\theta) (y_i - y_c) + \\cos(\\theta) (x_i - x_c) + x_c,
53
-
54
- which is the standard rigid-body rotation transformation.
55
-
56
- Intuitively, the angle is
57
- (1) the rotation angle from y-axis in image space
58
- to the height vector (top->down in the box's local coordinate system)
59
- of the box in CCW, and
60
- (2) the rotation angle from x-axis in image space
61
- to the width vector (left->right in the box's local coordinate system)
62
- of the box in CCW.
63
-
64
- More intuitively, consider the following horizontal box ABCD represented
65
- in (x1, y1, x2, y2): (3, 2, 7, 4),
66
- covering the [3, 7] x [2, 4] region of the continuous coordinate system
67
- which looks like this:
68
-
69
- .. code:: none
70
-
71
- O--------> x
72
- |
73
- | A---B
74
- | | |
75
- | D---C
76
- |
77
- v y
78
-
79
- Note that each capital letter represents one 0-dimensional geometric point
80
- instead of a 'square pixel' here.
81
-
82
- In the example above, using (x, y) to represent a point we have:
83
-
84
- .. math::
85
-
86
- O = (0, 0), A = (3, 2), B = (7, 2), C = (7, 4), D = (3, 4)
87
-
88
- We name vector AB = vector DC as the width vector in box's local coordinate system, and
89
- vector AD = vector BC as the height vector in box's local coordinate system. Initially,
90
- when angle = 0 degree, they're aligned with the positive directions of x-axis and y-axis
91
- in the image space, respectively.
92
-
93
- For better illustration, we denote the center of the box as E,
94
-
95
- .. code:: none
96
-
97
- O--------> x
98
- |
99
- | A---B
100
- | | E |
101
- | D---C
102
- |
103
- v y
104
-
105
- where the center E = ((3+7)/2, (2+4)/2) = (5, 3).
106
-
107
- Also,
108
-
109
- .. math::
110
-
111
- width = |AB| = |CD| = 7 - 3 = 4,
112
- height = |AD| = |BC| = 4 - 2 = 2.
113
-
114
- Therefore, the corresponding representation for the same shape in rotated box in
115
- (x_center, y_center, width, height, angle) format is:
116
-
117
- (5, 3, 4, 2, 0),
118
-
119
- Now, let's consider (5, 3, 4, 2, 90), which is rotated by 90 degrees
120
- CCW (counter-clockwise) by definition. It looks like this:
121
-
122
- .. code:: none
123
-
124
- O--------> x
125
- | B-C
126
- | | |
127
- | |E|
128
- | | |
129
- | A-D
130
- v y
131
-
132
- The center E is still located at the same point (5, 3), while the vertices
133
- ABCD are rotated by 90 degrees CCW with regard to E:
134
- A = (4, 5), B = (4, 1), C = (6, 1), D = (6, 5)
135
-
136
- Here, 90 degrees can be seen as the CCW angle to rotate from y-axis to
137
- vector AD or vector BC (the top->down height vector in box's local coordinate system),
138
- or the CCW angle to rotate from x-axis to vector AB or vector DC (the left->right
139
- width vector in box's local coordinate system).
140
-
141
- .. math::
142
-
143
- width = |AB| = |CD| = 5 - 1 = 4,
144
- height = |AD| = |BC| = 6 - 4 = 2.
145
-
146
- Next, how about (5, 3, 4, 2, -90), which is rotated by 90 degrees CW (clockwise)
147
- by definition? It looks like this:
148
-
149
- .. code:: none
150
-
151
- O--------> x
152
- | D-A
153
- | | |
154
- | |E|
155
- | | |
156
- | C-B
157
- v y
158
-
159
- The center E is still located at the same point (5, 3), while the vertices
160
- ABCD are rotated by 90 degrees CW with regard to E:
161
- A = (6, 1), B = (6, 5), C = (4, 5), D = (4, 1)
162
-
163
- .. math::
164
-
165
- width = |AB| = |CD| = 5 - 1 = 4,
166
- height = |AD| = |BC| = 6 - 4 = 2.
167
-
168
- This covers exactly the same region as (5, 3, 4, 2, 90) does, and their IoU
169
- will be 1. However, these two will generate different RoI Pooling results and
170
- should not be treated as an identical box.
171
-
172
- On the other hand, it's easy to see that (X, Y, W, H, A) is identical to
173
- (X, Y, W, H, A+360N), for any integer N. For example (5, 3, 4, 2, 270) would be
174
- identical to (5, 3, 4, 2, -90), because rotating the shape 270 degrees CCW is
175
- equivalent to rotating the same shape 90 degrees CW.
176
-
177
- We could rotate further to get (5, 3, 4, 2, 180), or (5, 3, 4, 2, -180):
178
-
179
- .. code:: none
180
-
181
- O--------> x
182
- |
183
- | C---D
184
- | | E |
185
- | B---A
186
- |
187
- v y
188
-
189
- .. math::
190
-
191
- A = (7, 4), B = (3, 4), C = (3, 2), D = (7, 2),
192
-
193
- width = |AB| = |CD| = 7 - 3 = 4,
194
- height = |AD| = |BC| = 4 - 2 = 2.
195
-
196
- Finally, this is a very inaccurate (heavily quantized) illustration of
197
- how (5, 3, 4, 2, 60) looks like in case anyone wonders:
198
-
199
- .. code:: none
200
-
201
- O--------> x
202
- | B\
203
- | / C
204
- | /E /
205
- | A /
206
- | `D
207
- v y
208
-
209
- It's still a rectangle with center of (5, 3), width of 4 and height of 2,
210
- but its angle (and thus orientation) is somewhere between
211
- (5, 3, 4, 2, 0) and (5, 3, 4, 2, 90).
212
- """
213
- device = tensor.device if isinstance(tensor, torch.Tensor) else torch.device("cpu")
214
- tensor = torch.as_tensor(tensor, dtype=torch.float32, device=device)
215
- if tensor.numel() == 0:
216
- # Use reshape, so we don't end up creating a new tensor that does not depend on
217
- # the inputs (and consequently confuses jit)
218
- tensor = tensor.reshape((0, 5)).to(dtype=torch.float32, device=device)
219
- assert tensor.dim() == 2 and tensor.size(-1) == 5, tensor.size()
220
-
221
- self.tensor = tensor
222
-
223
- def clone(self) -> "RotatedBoxes":
224
- """
225
- Clone the RotatedBoxes.
226
-
227
- Returns:
228
- RotatedBoxes
229
- """
230
- return RotatedBoxes(self.tensor.clone())
231
-
232
- def to(self, device: torch.device):
233
- # Boxes are assumed float32 and does not support to(dtype)
234
- return RotatedBoxes(self.tensor.to(device=device))
235
-
236
- def area(self) -> torch.Tensor:
237
- """
238
- Computes the area of all the boxes.
239
-
240
- Returns:
241
- torch.Tensor: a vector with areas of each box.
242
- """
243
- box = self.tensor
244
- area = box[:, 2] * box[:, 3]
245
- return area
246
-
247
- def normalize_angles(self) -> None:
248
- """
249
- Restrict angles to the range of [-180, 180) degrees
250
- """
251
- self.tensor[:, 4] = (self.tensor[:, 4] + 180.0) % 360.0 - 180.0
252
-
253
- def clip(self, box_size: Tuple[int, int], clip_angle_threshold: float = 1.0) -> None:
254
- """
255
- Clip (in place) the boxes by limiting x coordinates to the range [0, width]
256
- and y coordinates to the range [0, height].
257
-
258
- For RRPN:
259
- Only clip boxes that are almost horizontal with a tolerance of
260
- clip_angle_threshold to maintain backward compatibility.
261
-
262
- Rotated boxes beyond this threshold are not clipped for two reasons:
263
-
264
- 1. There are potentially multiple ways to clip a rotated box to make it
265
- fit within the image.
266
- 2. It's tricky to make the entire rectangular box fit within the image
267
- and still be able to not leave out pixels of interest.
268
-
269
- Therefore we rely on ops like RoIAlignRotated to safely handle this.
270
-
271
- Args:
272
- box_size (height, width): The clipping box's size.
273
- clip_angle_threshold:
274
- Iff. abs(normalized(angle)) <= clip_angle_threshold (in degrees),
275
- we do the clipping as horizontal boxes.
276
- """
277
- h, w = box_size
278
-
279
- # normalize angles to be within (-180, 180] degrees
280
- self.normalize_angles()
281
-
282
- idx = torch.where(torch.abs(self.tensor[:, 4]) <= clip_angle_threshold)[0]
283
-
284
- # convert to (x1, y1, x2, y2)
285
- x1 = self.tensor[idx, 0] - self.tensor[idx, 2] / 2.0
286
- y1 = self.tensor[idx, 1] - self.tensor[idx, 3] / 2.0
287
- x2 = self.tensor[idx, 0] + self.tensor[idx, 2] / 2.0
288
- y2 = self.tensor[idx, 1] + self.tensor[idx, 3] / 2.0
289
-
290
- # clip
291
- x1.clamp_(min=0, max=w)
292
- y1.clamp_(min=0, max=h)
293
- x2.clamp_(min=0, max=w)
294
- y2.clamp_(min=0, max=h)
295
-
296
- # convert back to (xc, yc, w, h)
297
- self.tensor[idx, 0] = (x1 + x2) / 2.0
298
- self.tensor[idx, 1] = (y1 + y2) / 2.0
299
- # make sure widths and heights do not increase due to numerical errors
300
- self.tensor[idx, 2] = torch.min(self.tensor[idx, 2], x2 - x1)
301
- self.tensor[idx, 3] = torch.min(self.tensor[idx, 3], y2 - y1)
302
-
303
- def nonempty(self, threshold: float = 0.0) -> torch.Tensor:
304
- """
305
- Find boxes that are non-empty.
306
- A box is considered empty, if either of its side is no larger than threshold.
307
-
308
- Returns:
309
- Tensor: a binary vector which represents
310
- whether each box is empty (False) or non-empty (True).
311
- """
312
- box = self.tensor
313
- widths = box[:, 2]
314
- heights = box[:, 3]
315
- keep = (widths > threshold) & (heights > threshold)
316
- return keep
317
-
318
- def __getitem__(self, item) -> "RotatedBoxes":
319
- """
320
- Returns:
321
- RotatedBoxes: Create a new :class:`RotatedBoxes` by indexing.
322
-
323
- The following usage are allowed:
324
-
325
- 1. `new_boxes = boxes[3]`: return a `RotatedBoxes` which contains only one box.
326
- 2. `new_boxes = boxes[2:10]`: return a slice of boxes.
327
- 3. `new_boxes = boxes[vector]`, where vector is a torch.ByteTensor
328
- with `length = len(boxes)`. Nonzero elements in the vector will be selected.
329
-
330
- Note that the returned RotatedBoxes might share storage with this RotatedBoxes,
331
- subject to Pytorch's indexing semantics.
332
- """
333
- if isinstance(item, int):
334
- return RotatedBoxes(self.tensor[item].view(1, -1))
335
- b = self.tensor[item]
336
- assert b.dim() == 2, "Indexing on RotatedBoxes with {} failed to return a matrix!".format(
337
- item
338
- )
339
- return RotatedBoxes(b)
340
-
341
- def __len__(self) -> int:
342
- return self.tensor.shape[0]
343
-
344
- def __repr__(self) -> str:
345
- return "RotatedBoxes(" + str(self.tensor) + ")"
346
-
347
- def inside_box(self, box_size: Tuple[int, int], boundary_threshold: int = 0) -> torch.Tensor:
348
- """
349
- Args:
350
- box_size (height, width): Size of the reference box covering
351
- [0, width] x [0, height]
352
- boundary_threshold (int): Boxes that extend beyond the reference box
353
- boundary by more than boundary_threshold are considered "outside".
354
-
355
- For RRPN, it might not be necessary to call this function since it's common
356
- for rotated box to extend to outside of the image boundaries
357
- (the clip function only clips the near-horizontal boxes)
358
-
359
- Returns:
360
- a binary vector, indicating whether each box is inside the reference box.
361
- """
362
- height, width = box_size
363
-
364
- cnt_x = self.tensor[..., 0]
365
- cnt_y = self.tensor[..., 1]
366
- half_w = self.tensor[..., 2] / 2.0
367
- half_h = self.tensor[..., 3] / 2.0
368
- a = self.tensor[..., 4]
369
- c = torch.abs(torch.cos(a * math.pi / 180.0))
370
- s = torch.abs(torch.sin(a * math.pi / 180.0))
371
- # This basically computes the horizontal bounding rectangle of the rotated box
372
- max_rect_dx = c * half_w + s * half_h
373
- max_rect_dy = c * half_h + s * half_w
374
-
375
- inds_inside = (
376
- (cnt_x - max_rect_dx >= -boundary_threshold)
377
- & (cnt_y - max_rect_dy >= -boundary_threshold)
378
- & (cnt_x + max_rect_dx < width + boundary_threshold)
379
- & (cnt_y + max_rect_dy < height + boundary_threshold)
380
- )
381
-
382
- return inds_inside
383
-
384
- def get_centers(self) -> torch.Tensor:
385
- """
386
- Returns:
387
- The box centers in a Nx2 array of (x, y).
388
- """
389
- return self.tensor[:, :2]
390
-
391
- def scale(self, scale_x: float, scale_y: float) -> None:
392
- """
393
- Scale the rotated box with horizontal and vertical scaling factors
394
- Note: when scale_factor_x != scale_factor_y,
395
- the rotated box does not preserve the rectangular shape when the angle
396
- is not a multiple of 90 degrees under resize transformation.
397
- Instead, the shape is a parallelogram (that has skew)
398
- Here we make an approximation by fitting a rotated rectangle to the parallelogram.
399
- """
400
- self.tensor[:, 0] *= scale_x
401
- self.tensor[:, 1] *= scale_y
402
- theta = self.tensor[:, 4] * math.pi / 180.0
403
- c = torch.cos(theta)
404
- s = torch.sin(theta)
405
-
406
- # In image space, y is top->down and x is left->right
407
- # Consider the local coordintate system for the rotated box,
408
- # where the box center is located at (0, 0), and the four vertices ABCD are
409
- # A(-w / 2, -h / 2), B(w / 2, -h / 2), C(w / 2, h / 2), D(-w / 2, h / 2)
410
- # the midpoint of the left edge AD of the rotated box E is:
411
- # E = (A+D)/2 = (-w / 2, 0)
412
- # the midpoint of the top edge AB of the rotated box F is:
413
- # F(0, -h / 2)
414
- # To get the old coordinates in the global system, apply the rotation transformation
415
- # (Note: the right-handed coordinate system for image space is yOx):
416
- # (old_x, old_y) = (s * y + c * x, c * y - s * x)
417
- # E(old) = (s * 0 + c * (-w/2), c * 0 - s * (-w/2)) = (-c * w / 2, s * w / 2)
418
- # F(old) = (s * (-h / 2) + c * 0, c * (-h / 2) - s * 0) = (-s * h / 2, -c * h / 2)
419
- # After applying the scaling factor (sfx, sfy):
420
- # E(new) = (-sfx * c * w / 2, sfy * s * w / 2)
421
- # F(new) = (-sfx * s * h / 2, -sfy * c * h / 2)
422
- # The new width after scaling tranformation becomes:
423
-
424
- # w(new) = |E(new) - O| * 2
425
- # = sqrt[(sfx * c * w / 2)^2 + (sfy * s * w / 2)^2] * 2
426
- # = sqrt[(sfx * c)^2 + (sfy * s)^2] * w
427
- # i.e., scale_factor_w = sqrt[(sfx * c)^2 + (sfy * s)^2]
428
- #
429
- # For example,
430
- # when angle = 0 or 180, |c| = 1, s = 0, scale_factor_w == scale_factor_x;
431
- # when |angle| = 90, c = 0, |s| = 1, scale_factor_w == scale_factor_y
432
- self.tensor[:, 2] *= torch.sqrt((scale_x * c) ** 2 + (scale_y * s) ** 2)
433
-
434
- # h(new) = |F(new) - O| * 2
435
- # = sqrt[(sfx * s * h / 2)^2 + (sfy * c * h / 2)^2] * 2
436
- # = sqrt[(sfx * s)^2 + (sfy * c)^2] * h
437
- # i.e., scale_factor_h = sqrt[(sfx * s)^2 + (sfy * c)^2]
438
- #
439
- # For example,
440
- # when angle = 0 or 180, |c| = 1, s = 0, scale_factor_h == scale_factor_y;
441
- # when |angle| = 90, c = 0, |s| = 1, scale_factor_h == scale_factor_x
442
- self.tensor[:, 3] *= torch.sqrt((scale_x * s) ** 2 + (scale_y * c) ** 2)
443
-
444
- # The angle is the rotation angle from y-axis in image space to the height
445
- # vector (top->down in the box's local coordinate system) of the box in CCW.
446
- #
447
- # angle(new) = angle_yOx(O - F(new))
448
- # = angle_yOx( (sfx * s * h / 2, sfy * c * h / 2) )
449
- # = atan2(sfx * s * h / 2, sfy * c * h / 2)
450
- # = atan2(sfx * s, sfy * c)
451
- #
452
- # For example,
453
- # when sfx == sfy, angle(new) == atan2(s, c) == angle(old)
454
- self.tensor[:, 4] = torch.atan2(scale_x * s, scale_y * c) * 180 / math.pi
455
-
456
- @classmethod
457
- def cat(cls, boxes_list: List["RotatedBoxes"]) -> "RotatedBoxes":
458
- """
459
- Concatenates a list of RotatedBoxes into a single RotatedBoxes
460
-
461
- Arguments:
462
- boxes_list (list[RotatedBoxes])
463
-
464
- Returns:
465
- RotatedBoxes: the concatenated RotatedBoxes
466
- """
467
- assert isinstance(boxes_list, (list, tuple))
468
- if len(boxes_list) == 0:
469
- return cls(torch.empty(0))
470
- assert all([isinstance(box, RotatedBoxes) for box in boxes_list])
471
-
472
- # use torch.cat (v.s. layers.cat) so the returned boxes never share storage with input
473
- cat_boxes = cls(torch.cat([b.tensor for b in boxes_list], dim=0))
474
- return cat_boxes
475
-
476
- @property
477
- def device(self) -> torch.device:
478
- return self.tensor.device
479
-
480
- @torch.jit.unused
481
- def __iter__(self):
482
- """
483
- Yield a box as a Tensor of shape (5,) at a time.
484
- """
485
- yield from self.tensor
486
-
487
-
488
- def pairwise_iou(boxes1: RotatedBoxes, boxes2: RotatedBoxes) -> None:
489
- """
490
- Given two lists of rotated boxes of size N and M,
491
- compute the IoU (intersection over union)
492
- between **all** N x M pairs of boxes.
493
- The box order must be (x_center, y_center, width, height, angle).
494
-
495
- Args:
496
- boxes1, boxes2 (RotatedBoxes):
497
- two `RotatedBoxes`. Contains N & M rotated boxes, respectively.
498
-
499
- Returns:
500
- Tensor: IoU, sized [N,M].
501
- """
502
-
503
- return pairwise_iou_rotated(boxes1.tensor, boxes2.tensor)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
spaces/BartPoint/VoiceChange/infer_pack/models.py DELETED
@@ -1,1124 +0,0 @@
1
- import math, pdb, os
2
- from time import time as ttime
3
- import torch
4
- from torch import nn
5
- from torch.nn import functional as F
6
- from infer_pack import modules
7
- from infer_pack import attentions
8
- from infer_pack import commons
9
- from infer_pack.commons import init_weights, get_padding
10
- from torch.nn import Conv1d, ConvTranspose1d, AvgPool1d, Conv2d
11
- from torch.nn.utils import weight_norm, remove_weight_norm, spectral_norm
12
- from infer_pack.commons import init_weights
13
- import numpy as np
14
- from infer_pack import commons
15
-
16
-
17
- class TextEncoder256(nn.Module):
18
- def __init__(
19
- self,
20
- out_channels,
21
- hidden_channels,
22
- filter_channels,
23
- n_heads,
24
- n_layers,
25
- kernel_size,
26
- p_dropout,
27
- f0=True,
28
- ):
29
- super().__init__()
30
- self.out_channels = out_channels
31
- self.hidden_channels = hidden_channels
32
- self.filter_channels = filter_channels
33
- self.n_heads = n_heads
34
- self.n_layers = n_layers
35
- self.kernel_size = kernel_size
36
- self.p_dropout = p_dropout
37
- self.emb_phone = nn.Linear(256, hidden_channels)
38
- self.lrelu = nn.LeakyReLU(0.1, inplace=True)
39
- if f0 == True:
40
- self.emb_pitch = nn.Embedding(256, hidden_channels) # pitch 256
41
- self.encoder = attentions.Encoder(
42
- hidden_channels, filter_channels, n_heads, n_layers, kernel_size, p_dropout
43
- )
44
- self.proj = nn.Conv1d(hidden_channels, out_channels * 2, 1)
45
-
46
- def forward(self, phone, pitch, lengths):
47
- if pitch == None:
48
- x = self.emb_phone(phone)
49
- else:
50
- x = self.emb_phone(phone) + self.emb_pitch(pitch)
51
- x = x * math.sqrt(self.hidden_channels) # [b, t, h]
52
- x = self.lrelu(x)
53
- x = torch.transpose(x, 1, -1) # [b, h, t]
54
- x_mask = torch.unsqueeze(commons.sequence_mask(lengths, x.size(2)), 1).to(
55
- x.dtype
56
- )
57
- x = self.encoder(x * x_mask, x_mask)
58
- stats = self.proj(x) * x_mask
59
-
60
- m, logs = torch.split(stats, self.out_channels, dim=1)
61
- return m, logs, x_mask
62
-
63
-
64
- class TextEncoder768(nn.Module):
65
- def __init__(
66
- self,
67
- out_channels,
68
- hidden_channels,
69
- filter_channels,
70
- n_heads,
71
- n_layers,
72
- kernel_size,
73
- p_dropout,
74
- f0=True,
75
- ):
76
- super().__init__()
77
- self.out_channels = out_channels
78
- self.hidden_channels = hidden_channels
79
- self.filter_channels = filter_channels
80
- self.n_heads = n_heads
81
- self.n_layers = n_layers
82
- self.kernel_size = kernel_size
83
- self.p_dropout = p_dropout
84
- self.emb_phone = nn.Linear(768, hidden_channels)
85
- self.lrelu = nn.LeakyReLU(0.1, inplace=True)
86
- if f0 == True:
87
- self.emb_pitch = nn.Embedding(256, hidden_channels) # pitch 256
88
- self.encoder = attentions.Encoder(
89
- hidden_channels, filter_channels, n_heads, n_layers, kernel_size, p_dropout
90
- )
91
- self.proj = nn.Conv1d(hidden_channels, out_channels * 2, 1)
92
-
93
- def forward(self, phone, pitch, lengths):
94
- if pitch == None:
95
- x = self.emb_phone(phone)
96
- else:
97
- x = self.emb_phone(phone) + self.emb_pitch(pitch)
98
- x = x * math.sqrt(self.hidden_channels) # [b, t, h]
99
- x = self.lrelu(x)
100
- x = torch.transpose(x, 1, -1) # [b, h, t]
101
- x_mask = torch.unsqueeze(commons.sequence_mask(lengths, x.size(2)), 1).to(
102
- x.dtype
103
- )
104
- x = self.encoder(x * x_mask, x_mask)
105
- stats = self.proj(x) * x_mask
106
-
107
- m, logs = torch.split(stats, self.out_channels, dim=1)
108
- return m, logs, x_mask
109
-
110
-
111
- class ResidualCouplingBlock(nn.Module):
112
- def __init__(
113
- self,
114
- channels,
115
- hidden_channels,
116
- kernel_size,
117
- dilation_rate,
118
- n_layers,
119
- n_flows=4,
120
- gin_channels=0,
121
- ):
122
- super().__init__()
123
- self.channels = channels
124
- self.hidden_channels = hidden_channels
125
- self.kernel_size = kernel_size
126
- self.dilation_rate = dilation_rate
127
- self.n_layers = n_layers
128
- self.n_flows = n_flows
129
- self.gin_channels = gin_channels
130
-
131
- self.flows = nn.ModuleList()
132
- for i in range(n_flows):
133
- self.flows.append(
134
- modules.ResidualCouplingLayer(
135
- channels,
136
- hidden_channels,
137
- kernel_size,
138
- dilation_rate,
139
- n_layers,
140
- gin_channels=gin_channels,
141
- mean_only=True,
142
- )
143
- )
144
- self.flows.append(modules.Flip())
145
-
146
- def forward(self, x, x_mask, g=None, reverse=False):
147
- if not reverse:
148
- for flow in self.flows:
149
- x, _ = flow(x, x_mask, g=g, reverse=reverse)
150
- else:
151
- for flow in reversed(self.flows):
152
- x = flow(x, x_mask, g=g, reverse=reverse)
153
- return x
154
-
155
- def remove_weight_norm(self):
156
- for i in range(self.n_flows):
157
- self.flows[i * 2].remove_weight_norm()
158
-
159
-
160
- class PosteriorEncoder(nn.Module):
161
- def __init__(
162
- self,
163
- in_channels,
164
- out_channels,
165
- hidden_channels,
166
- kernel_size,
167
- dilation_rate,
168
- n_layers,
169
- gin_channels=0,
170
- ):
171
- super().__init__()
172
- self.in_channels = in_channels
173
- self.out_channels = out_channels
174
- self.hidden_channels = hidden_channels
175
- self.kernel_size = kernel_size
176
- self.dilation_rate = dilation_rate
177
- self.n_layers = n_layers
178
- self.gin_channels = gin_channels
179
-
180
- self.pre = nn.Conv1d(in_channels, hidden_channels, 1)
181
- self.enc = modules.WN(
182
- hidden_channels,
183
- kernel_size,
184
- dilation_rate,
185
- n_layers,
186
- gin_channels=gin_channels,
187
- )
188
- self.proj = nn.Conv1d(hidden_channels, out_channels * 2, 1)
189
-
190
- def forward(self, x, x_lengths, g=None):
191
- x_mask = torch.unsqueeze(commons.sequence_mask(x_lengths, x.size(2)), 1).to(
192
- x.dtype
193
- )
194
- x = self.pre(x) * x_mask
195
- x = self.enc(x, x_mask, g=g)
196
- stats = self.proj(x) * x_mask
197
- m, logs = torch.split(stats, self.out_channels, dim=1)
198
- z = (m + torch.randn_like(m) * torch.exp(logs)) * x_mask
199
- return z, m, logs, x_mask
200
-
201
- def remove_weight_norm(self):
202
- self.enc.remove_weight_norm()
203
-
204
-
205
- class Generator(torch.nn.Module):
206
- def __init__(
207
- self,
208
- initial_channel,
209
- resblock,
210
- resblock_kernel_sizes,
211
- resblock_dilation_sizes,
212
- upsample_rates,
213
- upsample_initial_channel,
214
- upsample_kernel_sizes,
215
- gin_channels=0,
216
- ):
217
- super(Generator, self).__init__()
218
- self.num_kernels = len(resblock_kernel_sizes)
219
- self.num_upsamples = len(upsample_rates)
220
- self.conv_pre = Conv1d(
221
- initial_channel, upsample_initial_channel, 7, 1, padding=3
222
- )
223
- resblock = modules.ResBlock1 if resblock == "1" else modules.ResBlock2
224
-
225
- self.ups = nn.ModuleList()
226
- for i, (u, k) in enumerate(zip(upsample_rates, upsample_kernel_sizes)):
227
- self.ups.append(
228
- weight_norm(
229
- ConvTranspose1d(
230
- upsample_initial_channel // (2**i),
231
- upsample_initial_channel // (2 ** (i + 1)),
232
- k,
233
- u,
234
- padding=(k - u) // 2,
235
- )
236
- )
237
- )
238
-
239
- self.resblocks = nn.ModuleList()
240
- for i in range(len(self.ups)):
241
- ch = upsample_initial_channel // (2 ** (i + 1))
242
- for j, (k, d) in enumerate(
243
- zip(resblock_kernel_sizes, resblock_dilation_sizes)
244
- ):
245
- self.resblocks.append(resblock(ch, k, d))
246
-
247
- self.conv_post = Conv1d(ch, 1, 7, 1, padding=3, bias=False)
248
- self.ups.apply(init_weights)
249
-
250
- if gin_channels != 0:
251
- self.cond = nn.Conv1d(gin_channels, upsample_initial_channel, 1)
252
-
253
- def forward(self, x, g=None):
254
- x = self.conv_pre(x)
255
- if g is not None:
256
- x = x + self.cond(g)
257
-
258
- for i in range(self.num_upsamples):
259
- x = F.leaky_relu(x, modules.LRELU_SLOPE)
260
- x = self.ups[i](x)
261
- xs = None
262
- for j in range(self.num_kernels):
263
- if xs is None:
264
- xs = self.resblocks[i * self.num_kernels + j](x)
265
- else:
266
- xs += self.resblocks[i * self.num_kernels + j](x)
267
- x = xs / self.num_kernels
268
- x = F.leaky_relu(x)
269
- x = self.conv_post(x)
270
- x = torch.tanh(x)
271
-
272
- return x
273
-
274
- def remove_weight_norm(self):
275
- for l in self.ups:
276
- remove_weight_norm(l)
277
- for l in self.resblocks:
278
- l.remove_weight_norm()
279
-
280
-
281
- class SineGen(torch.nn.Module):
282
- """Definition of sine generator
283
- SineGen(samp_rate, harmonic_num = 0,
284
- sine_amp = 0.1, noise_std = 0.003,
285
- voiced_threshold = 0,
286
- flag_for_pulse=False)
287
- samp_rate: sampling rate in Hz
288
- harmonic_num: number of harmonic overtones (default 0)
289
- sine_amp: amplitude of sine-wavefrom (default 0.1)
290
- noise_std: std of Gaussian noise (default 0.003)
291
- voiced_thoreshold: F0 threshold for U/V classification (default 0)
292
- flag_for_pulse: this SinGen is used inside PulseGen (default False)
293
- Note: when flag_for_pulse is True, the first time step of a voiced
294
- segment is always sin(np.pi) or cos(0)
295
- """
296
-
297
- def __init__(
298
- self,
299
- samp_rate,
300
- harmonic_num=0,
301
- sine_amp=0.1,
302
- noise_std=0.003,
303
- voiced_threshold=0,
304
- flag_for_pulse=False,
305
- ):
306
- super(SineGen, self).__init__()
307
- self.sine_amp = sine_amp
308
- self.noise_std = noise_std
309
- self.harmonic_num = harmonic_num
310
- self.dim = self.harmonic_num + 1
311
- self.sampling_rate = samp_rate
312
- self.voiced_threshold = voiced_threshold
313
-
314
- def _f02uv(self, f0):
315
- # generate uv signal
316
- uv = torch.ones_like(f0)
317
- uv = uv * (f0 > self.voiced_threshold)
318
- return uv
319
-
320
- def forward(self, f0, upp):
321
- """sine_tensor, uv = forward(f0)
322
- input F0: tensor(batchsize=1, length, dim=1)
323
- f0 for unvoiced steps should be 0
324
- output sine_tensor: tensor(batchsize=1, length, dim)
325
- output uv: tensor(batchsize=1, length, 1)
326
- """
327
- with torch.no_grad():
328
- f0 = f0[:, None].transpose(1, 2)
329
- f0_buf = torch.zeros(f0.shape[0], f0.shape[1], self.dim, device=f0.device)
330
- # fundamental component
331
- f0_buf[:, :, 0] = f0[:, :, 0]
332
- for idx in np.arange(self.harmonic_num):
333
- f0_buf[:, :, idx + 1] = f0_buf[:, :, 0] * (
334
- idx + 2
335
- ) # idx + 2: the (idx+1)-th overtone, (idx+2)-th harmonic
336
- rad_values = (f0_buf / self.sampling_rate) % 1 ###%1意味着n_har的乘积无法后处理优化
337
- rand_ini = torch.rand(
338
- f0_buf.shape[0], f0_buf.shape[2], device=f0_buf.device
339
- )
340
- rand_ini[:, 0] = 0
341
- rad_values[:, 0, :] = rad_values[:, 0, :] + rand_ini
342
- tmp_over_one = torch.cumsum(rad_values, 1) # % 1 #####%1意味着后面的cumsum无法再优化
343
- tmp_over_one *= upp
344
- tmp_over_one = F.interpolate(
345
- tmp_over_one.transpose(2, 1),
346
- scale_factor=upp,
347
- mode="linear",
348
- align_corners=True,
349
- ).transpose(2, 1)
350
- rad_values = F.interpolate(
351
- rad_values.transpose(2, 1), scale_factor=upp, mode="nearest"
352
- ).transpose(
353
- 2, 1
354
- ) #######
355
- tmp_over_one %= 1
356
- tmp_over_one_idx = (tmp_over_one[:, 1:, :] - tmp_over_one[:, :-1, :]) < 0
357
- cumsum_shift = torch.zeros_like(rad_values)
358
- cumsum_shift[:, 1:, :] = tmp_over_one_idx * -1.0
359
- sine_waves = torch.sin(
360
- torch.cumsum(rad_values + cumsum_shift, dim=1) * 2 * np.pi
361
- )
362
- sine_waves = sine_waves * self.sine_amp
363
- uv = self._f02uv(f0)
364
- uv = F.interpolate(
365
- uv.transpose(2, 1), scale_factor=upp, mode="nearest"
366
- ).transpose(2, 1)
367
- noise_amp = uv * self.noise_std + (1 - uv) * self.sine_amp / 3
368
- noise = noise_amp * torch.randn_like(sine_waves)
369
- sine_waves = sine_waves * uv + noise
370
- return sine_waves, uv, noise
371
-
372
-
373
- class SourceModuleHnNSF(torch.nn.Module):
374
- """SourceModule for hn-nsf
375
- SourceModule(sampling_rate, harmonic_num=0, sine_amp=0.1,
376
- add_noise_std=0.003, voiced_threshod=0)
377
- sampling_rate: sampling_rate in Hz
378
- harmonic_num: number of harmonic above F0 (default: 0)
379
- sine_amp: amplitude of sine source signal (default: 0.1)
380
- add_noise_std: std of additive Gaussian noise (default: 0.003)
381
- note that amplitude of noise in unvoiced is decided
382
- by sine_amp
383
- voiced_threshold: threhold to set U/V given F0 (default: 0)
384
- Sine_source, noise_source = SourceModuleHnNSF(F0_sampled)
385
- F0_sampled (batchsize, length, 1)
386
- Sine_source (batchsize, length, 1)
387
- noise_source (batchsize, length 1)
388
- uv (batchsize, length, 1)
389
- """
390
-
391
- def __init__(
392
- self,
393
- sampling_rate,
394
- harmonic_num=0,
395
- sine_amp=0.1,
396
- add_noise_std=0.003,
397
- voiced_threshod=0,
398
- is_half=True,
399
- ):
400
- super(SourceModuleHnNSF, self).__init__()
401
-
402
- self.sine_amp = sine_amp
403
- self.noise_std = add_noise_std
404
- self.is_half = is_half
405
- # to produce sine waveforms
406
- self.l_sin_gen = SineGen(
407
- sampling_rate, harmonic_num, sine_amp, add_noise_std, voiced_threshod
408
- )
409
-
410
- # to merge source harmonics into a single excitation
411
- self.l_linear = torch.nn.Linear(harmonic_num + 1, 1)
412
- self.l_tanh = torch.nn.Tanh()
413
-
414
- def forward(self, x, upp=None):
415
- sine_wavs, uv, _ = self.l_sin_gen(x, upp)
416
- if self.is_half:
417
- sine_wavs = sine_wavs.half()
418
- sine_merge = self.l_tanh(self.l_linear(sine_wavs))
419
- return sine_merge, None, None # noise, uv
420
-
421
-
422
- class GeneratorNSF(torch.nn.Module):
423
- def __init__(
424
- self,
425
- initial_channel,
426
- resblock,
427
- resblock_kernel_sizes,
428
- resblock_dilation_sizes,
429
- upsample_rates,
430
- upsample_initial_channel,
431
- upsample_kernel_sizes,
432
- gin_channels,
433
- sr,
434
- is_half=False,
435
- ):
436
- super(GeneratorNSF, self).__init__()
437
- self.num_kernels = len(resblock_kernel_sizes)
438
- self.num_upsamples = len(upsample_rates)
439
-
440
- self.f0_upsamp = torch.nn.Upsample(scale_factor=np.prod(upsample_rates))
441
- self.m_source = SourceModuleHnNSF(
442
- sampling_rate=sr, harmonic_num=0, is_half=is_half
443
- )
444
- self.noise_convs = nn.ModuleList()
445
- self.conv_pre = Conv1d(
446
- initial_channel, upsample_initial_channel, 7, 1, padding=3
447
- )
448
- resblock = modules.ResBlock1 if resblock == "1" else modules.ResBlock2
449
-
450
- self.ups = nn.ModuleList()
451
- for i, (u, k) in enumerate(zip(upsample_rates, upsample_kernel_sizes)):
452
- c_cur = upsample_initial_channel // (2 ** (i + 1))
453
- self.ups.append(
454
- weight_norm(
455
- ConvTranspose1d(
456
- upsample_initial_channel // (2**i),
457
- upsample_initial_channel // (2 ** (i + 1)),
458
- k,
459
- u,
460
- padding=(k - u) // 2,
461
- )
462
- )
463
- )
464
- if i + 1 < len(upsample_rates):
465
- stride_f0 = np.prod(upsample_rates[i + 1 :])
466
- self.noise_convs.append(
467
- Conv1d(
468
- 1,
469
- c_cur,
470
- kernel_size=stride_f0 * 2,
471
- stride=stride_f0,
472
- padding=stride_f0 // 2,
473
- )
474
- )
475
- else:
476
- self.noise_convs.append(Conv1d(1, c_cur, kernel_size=1))
477
-
478
- self.resblocks = nn.ModuleList()
479
- for i in range(len(self.ups)):
480
- ch = upsample_initial_channel // (2 ** (i + 1))
481
- for j, (k, d) in enumerate(
482
- zip(resblock_kernel_sizes, resblock_dilation_sizes)
483
- ):
484
- self.resblocks.append(resblock(ch, k, d))
485
-
486
- self.conv_post = Conv1d(ch, 1, 7, 1, padding=3, bias=False)
487
- self.ups.apply(init_weights)
488
-
489
- if gin_channels != 0:
490
- self.cond = nn.Conv1d(gin_channels, upsample_initial_channel, 1)
491
-
492
- self.upp = np.prod(upsample_rates)
493
-
494
- def forward(self, x, f0, g=None):
495
- har_source, noi_source, uv = self.m_source(f0, self.upp)
496
- har_source = har_source.transpose(1, 2)
497
- x = self.conv_pre(x)
498
- if g is not None:
499
- x = x + self.cond(g)
500
-
501
- for i in range(self.num_upsamples):
502
- x = F.leaky_relu(x, modules.LRELU_SLOPE)
503
- x = self.ups[i](x)
504
- x_source = self.noise_convs[i](har_source)
505
- x = x + x_source
506
- xs = None
507
- for j in range(self.num_kernels):
508
- if xs is None:
509
- xs = self.resblocks[i * self.num_kernels + j](x)
510
- else:
511
- xs += self.resblocks[i * self.num_kernels + j](x)
512
- x = xs / self.num_kernels
513
- x = F.leaky_relu(x)
514
- x = self.conv_post(x)
515
- x = torch.tanh(x)
516
- return x
517
-
518
- def remove_weight_norm(self):
519
- for l in self.ups:
520
- remove_weight_norm(l)
521
- for l in self.resblocks:
522
- l.remove_weight_norm()
523
-
524
-
525
- sr2sr = {
526
- "32k": 32000,
527
- "40k": 40000,
528
- "48k": 48000,
529
- }
530
-
531
-
532
- class SynthesizerTrnMs256NSFsid(nn.Module):
533
- def __init__(
534
- self,
535
- spec_channels,
536
- segment_size,
537
- inter_channels,
538
- hidden_channels,
539
- filter_channels,
540
- n_heads,
541
- n_layers,
542
- kernel_size,
543
- p_dropout,
544
- resblock,
545
- resblock_kernel_sizes,
546
- resblock_dilation_sizes,
547
- upsample_rates,
548
- upsample_initial_channel,
549
- upsample_kernel_sizes,
550
- spk_embed_dim,
551
- gin_channels,
552
- sr,
553
- **kwargs
554
- ):
555
- super().__init__()
556
- if type(sr) == type("strr"):
557
- sr = sr2sr[sr]
558
- self.spec_channels = spec_channels
559
- self.inter_channels = inter_channels
560
- self.hidden_channels = hidden_channels
561
- self.filter_channels = filter_channels
562
- self.n_heads = n_heads
563
- self.n_layers = n_layers
564
- self.kernel_size = kernel_size
565
- self.p_dropout = p_dropout
566
- self.resblock = resblock
567
- self.resblock_kernel_sizes = resblock_kernel_sizes
568
- self.resblock_dilation_sizes = resblock_dilation_sizes
569
- self.upsample_rates = upsample_rates
570
- self.upsample_initial_channel = upsample_initial_channel
571
- self.upsample_kernel_sizes = upsample_kernel_sizes
572
- self.segment_size = segment_size
573
- self.gin_channels = gin_channels
574
- # self.hop_length = hop_length#
575
- self.spk_embed_dim = spk_embed_dim
576
- self.enc_p = TextEncoder256(
577
- inter_channels,
578
- hidden_channels,
579
- filter_channels,
580
- n_heads,
581
- n_layers,
582
- kernel_size,
583
- p_dropout,
584
- )
585
- self.dec = GeneratorNSF(
586
- inter_channels,
587
- resblock,
588
- resblock_kernel_sizes,
589
- resblock_dilation_sizes,
590
- upsample_rates,
591
- upsample_initial_channel,
592
- upsample_kernel_sizes,
593
- gin_channels=gin_channels,
594
- sr=sr,
595
- is_half=kwargs["is_half"],
596
- )
597
- self.enc_q = PosteriorEncoder(
598
- spec_channels,
599
- inter_channels,
600
- hidden_channels,
601
- 5,
602
- 1,
603
- 16,
604
- gin_channels=gin_channels,
605
- )
606
- self.flow = ResidualCouplingBlock(
607
- inter_channels, hidden_channels, 5, 1, 3, gin_channels=gin_channels
608
- )
609
- self.emb_g = nn.Embedding(self.spk_embed_dim, gin_channels)
610
- print("gin_channels:", gin_channels, "self.spk_embed_dim:", self.spk_embed_dim)
611
-
612
- def remove_weight_norm(self):
613
- self.dec.remove_weight_norm()
614
- self.flow.remove_weight_norm()
615
- self.enc_q.remove_weight_norm()
616
-
617
- def forward(
618
- self, phone, phone_lengths, pitch, pitchf, y, y_lengths, ds
619
- ): # 这里ds是id,[bs,1]
620
- # print(1,pitch.shape)#[bs,t]
621
- g = self.emb_g(ds).unsqueeze(-1) # [b, 256, 1]##1是t,广播的
622
- m_p, logs_p, x_mask = self.enc_p(phone, pitch, phone_lengths)
623
- z, m_q, logs_q, y_mask = self.enc_q(y, y_lengths, g=g)
624
- z_p = self.flow(z, y_mask, g=g)
625
- z_slice, ids_slice = commons.rand_slice_segments(
626
- z, y_lengths, self.segment_size
627
- )
628
- # print(-1,pitchf.shape,ids_slice,self.segment_size,self.hop_length,self.segment_size//self.hop_length)
629
- pitchf = commons.slice_segments2(pitchf, ids_slice, self.segment_size)
630
- # print(-2,pitchf.shape,z_slice.shape)
631
- o = self.dec(z_slice, pitchf, g=g)
632
- return o, ids_slice, x_mask, y_mask, (z, z_p, m_p, logs_p, m_q, logs_q)
633
-
634
- def infer(self, phone, phone_lengths, pitch, nsff0, sid, max_len=None):
635
- g = self.emb_g(sid).unsqueeze(-1)
636
- m_p, logs_p, x_mask = self.enc_p(phone, pitch, phone_lengths)
637
- z_p = (m_p + torch.exp(logs_p) * torch.randn_like(m_p) * 0.66666) * x_mask
638
- z = self.flow(z_p, x_mask, g=g, reverse=True)
639
- o = self.dec((z * x_mask)[:, :, :max_len], nsff0, g=g)
640
- return o, x_mask, (z, z_p, m_p, logs_p)
641
-
642
-
643
- class SynthesizerTrnMs768NSFsid(nn.Module):
644
- def __init__(
645
- self,
646
- spec_channels,
647
- segment_size,
648
- inter_channels,
649
- hidden_channels,
650
- filter_channels,
651
- n_heads,
652
- n_layers,
653
- kernel_size,
654
- p_dropout,
655
- resblock,
656
- resblock_kernel_sizes,
657
- resblock_dilation_sizes,
658
- upsample_rates,
659
- upsample_initial_channel,
660
- upsample_kernel_sizes,
661
- spk_embed_dim,
662
- gin_channels,
663
- sr,
664
- **kwargs
665
- ):
666
- super().__init__()
667
- if type(sr) == type("strr"):
668
- sr = sr2sr[sr]
669
- self.spec_channels = spec_channels
670
- self.inter_channels = inter_channels
671
- self.hidden_channels = hidden_channels
672
- self.filter_channels = filter_channels
673
- self.n_heads = n_heads
674
- self.n_layers = n_layers
675
- self.kernel_size = kernel_size
676
- self.p_dropout = p_dropout
677
- self.resblock = resblock
678
- self.resblock_kernel_sizes = resblock_kernel_sizes
679
- self.resblock_dilation_sizes = resblock_dilation_sizes
680
- self.upsample_rates = upsample_rates
681
- self.upsample_initial_channel = upsample_initial_channel
682
- self.upsample_kernel_sizes = upsample_kernel_sizes
683
- self.segment_size = segment_size
684
- self.gin_channels = gin_channels
685
- # self.hop_length = hop_length#
686
- self.spk_embed_dim = spk_embed_dim
687
- self.enc_p = TextEncoder768(
688
- inter_channels,
689
- hidden_channels,
690
- filter_channels,
691
- n_heads,
692
- n_layers,
693
- kernel_size,
694
- p_dropout,
695
- )
696
- self.dec = GeneratorNSF(
697
- inter_channels,
698
- resblock,
699
- resblock_kernel_sizes,
700
- resblock_dilation_sizes,
701
- upsample_rates,
702
- upsample_initial_channel,
703
- upsample_kernel_sizes,
704
- gin_channels=gin_channels,
705
- sr=sr,
706
- is_half=kwargs["is_half"],
707
- )
708
- self.enc_q = PosteriorEncoder(
709
- spec_channels,
710
- inter_channels,
711
- hidden_channels,
712
- 5,
713
- 1,
714
- 16,
715
- gin_channels=gin_channels,
716
- )
717
- self.flow = ResidualCouplingBlock(
718
- inter_channels, hidden_channels, 5, 1, 3, gin_channels=gin_channels
719
- )
720
- self.emb_g = nn.Embedding(self.spk_embed_dim, gin_channels)
721
- print("gin_channels:", gin_channels, "self.spk_embed_dim:", self.spk_embed_dim)
722
-
723
- def remove_weight_norm(self):
724
- self.dec.remove_weight_norm()
725
- self.flow.remove_weight_norm()
726
- self.enc_q.remove_weight_norm()
727
-
728
- def forward(
729
- self, phone, phone_lengths, pitch, pitchf, y, y_lengths, ds
730
- ): # 这里ds是id,[bs,1]
731
- # print(1,pitch.shape)#[bs,t]
732
- g = self.emb_g(ds).unsqueeze(-1) # [b, 256, 1]##1是t,广播的
733
- m_p, logs_p, x_mask = self.enc_p(phone, pitch, phone_lengths)
734
- z, m_q, logs_q, y_mask = self.enc_q(y, y_lengths, g=g)
735
- z_p = self.flow(z, y_mask, g=g)
736
- z_slice, ids_slice = commons.rand_slice_segments(
737
- z, y_lengths, self.segment_size
738
- )
739
- # print(-1,pitchf.shape,ids_slice,self.segment_size,self.hop_length,self.segment_size//self.hop_length)
740
- pitchf = commons.slice_segments2(pitchf, ids_slice, self.segment_size)
741
- # print(-2,pitchf.shape,z_slice.shape)
742
- o = self.dec(z_slice, pitchf, g=g)
743
- return o, ids_slice, x_mask, y_mask, (z, z_p, m_p, logs_p, m_q, logs_q)
744
-
745
- def infer(self, phone, phone_lengths, pitch, nsff0, sid, max_len=None):
746
- g = self.emb_g(sid).unsqueeze(-1)
747
- m_p, logs_p, x_mask = self.enc_p(phone, pitch, phone_lengths)
748
- z_p = (m_p + torch.exp(logs_p) * torch.randn_like(m_p) * 0.66666) * x_mask
749
- z = self.flow(z_p, x_mask, g=g, reverse=True)
750
- o = self.dec((z * x_mask)[:, :, :max_len], nsff0, g=g)
751
- return o, x_mask, (z, z_p, m_p, logs_p)
752
-
753
-
754
- class SynthesizerTrnMs256NSFsid_nono(nn.Module):
755
- def __init__(
756
- self,
757
- spec_channels,
758
- segment_size,
759
- inter_channels,
760
- hidden_channels,
761
- filter_channels,
762
- n_heads,
763
- n_layers,
764
- kernel_size,
765
- p_dropout,
766
- resblock,
767
- resblock_kernel_sizes,
768
- resblock_dilation_sizes,
769
- upsample_rates,
770
- upsample_initial_channel,
771
- upsample_kernel_sizes,
772
- spk_embed_dim,
773
- gin_channels,
774
- sr=None,
775
- **kwargs
776
- ):
777
- super().__init__()
778
- self.spec_channels = spec_channels
779
- self.inter_channels = inter_channels
780
- self.hidden_channels = hidden_channels
781
- self.filter_channels = filter_channels
782
- self.n_heads = n_heads
783
- self.n_layers = n_layers
784
- self.kernel_size = kernel_size
785
- self.p_dropout = p_dropout
786
- self.resblock = resblock
787
- self.resblock_kernel_sizes = resblock_kernel_sizes
788
- self.resblock_dilation_sizes = resblock_dilation_sizes
789
- self.upsample_rates = upsample_rates
790
- self.upsample_initial_channel = upsample_initial_channel
791
- self.upsample_kernel_sizes = upsample_kernel_sizes
792
- self.segment_size = segment_size
793
- self.gin_channels = gin_channels
794
- # self.hop_length = hop_length#
795
- self.spk_embed_dim = spk_embed_dim
796
- self.enc_p = TextEncoder256(
797
- inter_channels,
798
- hidden_channels,
799
- filter_channels,
800
- n_heads,
801
- n_layers,
802
- kernel_size,
803
- p_dropout,
804
- f0=False,
805
- )
806
- self.dec = Generator(
807
- inter_channels,
808
- resblock,
809
- resblock_kernel_sizes,
810
- resblock_dilation_sizes,
811
- upsample_rates,
812
- upsample_initial_channel,
813
- upsample_kernel_sizes,
814
- gin_channels=gin_channels,
815
- )
816
- self.enc_q = PosteriorEncoder(
817
- spec_channels,
818
- inter_channels,
819
- hidden_channels,
820
- 5,
821
- 1,
822
- 16,
823
- gin_channels=gin_channels,
824
- )
825
- self.flow = ResidualCouplingBlock(
826
- inter_channels, hidden_channels, 5, 1, 3, gin_channels=gin_channels
827
- )
828
- self.emb_g = nn.Embedding(self.spk_embed_dim, gin_channels)
829
- print("gin_channels:", gin_channels, "self.spk_embed_dim:", self.spk_embed_dim)
830
-
831
- def remove_weight_norm(self):
832
- self.dec.remove_weight_norm()
833
- self.flow.remove_weight_norm()
834
- self.enc_q.remove_weight_norm()
835
-
836
- def forward(self, phone, phone_lengths, y, y_lengths, ds): # 这里ds是id,[bs,1]
837
- g = self.emb_g(ds).unsqueeze(-1) # [b, 256, 1]##1是t,广播的
838
- m_p, logs_p, x_mask = self.enc_p(phone, None, phone_lengths)
839
- z, m_q, logs_q, y_mask = self.enc_q(y, y_lengths, g=g)
840
- z_p = self.flow(z, y_mask, g=g)
841
- z_slice, ids_slice = commons.rand_slice_segments(
842
- z, y_lengths, self.segment_size
843
- )
844
- o = self.dec(z_slice, g=g)
845
- return o, ids_slice, x_mask, y_mask, (z, z_p, m_p, logs_p, m_q, logs_q)
846
-
847
- def infer(self, phone, phone_lengths, sid, max_len=None):
848
- g = self.emb_g(sid).unsqueeze(-1)
849
- m_p, logs_p, x_mask = self.enc_p(phone, None, phone_lengths)
850
- z_p = (m_p + torch.exp(logs_p) * torch.randn_like(m_p) * 0.66666) * x_mask
851
- z = self.flow(z_p, x_mask, g=g, reverse=True)
852
- o = self.dec((z * x_mask)[:, :, :max_len], g=g)
853
- return o, x_mask, (z, z_p, m_p, logs_p)
854
-
855
-
856
- class SynthesizerTrnMs768NSFsid_nono(nn.Module):
857
- def __init__(
858
- self,
859
- spec_channels,
860
- segment_size,
861
- inter_channels,
862
- hidden_channels,
863
- filter_channels,
864
- n_heads,
865
- n_layers,
866
- kernel_size,
867
- p_dropout,
868
- resblock,
869
- resblock_kernel_sizes,
870
- resblock_dilation_sizes,
871
- upsample_rates,
872
- upsample_initial_channel,
873
- upsample_kernel_sizes,
874
- spk_embed_dim,
875
- gin_channels,
876
- sr=None,
877
- **kwargs
878
- ):
879
- super().__init__()
880
- self.spec_channels = spec_channels
881
- self.inter_channels = inter_channels
882
- self.hidden_channels = hidden_channels
883
- self.filter_channels = filter_channels
884
- self.n_heads = n_heads
885
- self.n_layers = n_layers
886
- self.kernel_size = kernel_size
887
- self.p_dropout = p_dropout
888
- self.resblock = resblock
889
- self.resblock_kernel_sizes = resblock_kernel_sizes
890
- self.resblock_dilation_sizes = resblock_dilation_sizes
891
- self.upsample_rates = upsample_rates
892
- self.upsample_initial_channel = upsample_initial_channel
893
- self.upsample_kernel_sizes = upsample_kernel_sizes
894
- self.segment_size = segment_size
895
- self.gin_channels = gin_channels
896
- # self.hop_length = hop_length#
897
- self.spk_embed_dim = spk_embed_dim
898
- self.enc_p = TextEncoder768(
899
- inter_channels,
900
- hidden_channels,
901
- filter_channels,
902
- n_heads,
903
- n_layers,
904
- kernel_size,
905
- p_dropout,
906
- f0=False,
907
- )
908
- self.dec = Generator(
909
- inter_channels,
910
- resblock,
911
- resblock_kernel_sizes,
912
- resblock_dilation_sizes,
913
- upsample_rates,
914
- upsample_initial_channel,
915
- upsample_kernel_sizes,
916
- gin_channels=gin_channels,
917
- )
918
- self.enc_q = PosteriorEncoder(
919
- spec_channels,
920
- inter_channels,
921
- hidden_channels,
922
- 5,
923
- 1,
924
- 16,
925
- gin_channels=gin_channels,
926
- )
927
- self.flow = ResidualCouplingBlock(
928
- inter_channels, hidden_channels, 5, 1, 3, gin_channels=gin_channels
929
- )
930
- self.emb_g = nn.Embedding(self.spk_embed_dim, gin_channels)
931
- print("gin_channels:", gin_channels, "self.spk_embed_dim:", self.spk_embed_dim)
932
-
933
- def remove_weight_norm(self):
934
- self.dec.remove_weight_norm()
935
- self.flow.remove_weight_norm()
936
- self.enc_q.remove_weight_norm()
937
-
938
- def forward(self, phone, phone_lengths, y, y_lengths, ds): # 这里ds是id,[bs,1]
939
- g = self.emb_g(ds).unsqueeze(-1) # [b, 256, 1]##1是t,广播的
940
- m_p, logs_p, x_mask = self.enc_p(phone, None, phone_lengths)
941
- z, m_q, logs_q, y_mask = self.enc_q(y, y_lengths, g=g)
942
- z_p = self.flow(z, y_mask, g=g)
943
- z_slice, ids_slice = commons.rand_slice_segments(
944
- z, y_lengths, self.segment_size
945
- )
946
- o = self.dec(z_slice, g=g)
947
- return o, ids_slice, x_mask, y_mask, (z, z_p, m_p, logs_p, m_q, logs_q)
948
-
949
- def infer(self, phone, phone_lengths, sid, max_len=None):
950
- g = self.emb_g(sid).unsqueeze(-1)
951
- m_p, logs_p, x_mask = self.enc_p(phone, None, phone_lengths)
952
- z_p = (m_p + torch.exp(logs_p) * torch.randn_like(m_p) * 0.66666) * x_mask
953
- z = self.flow(z_p, x_mask, g=g, reverse=True)
954
- o = self.dec((z * x_mask)[:, :, :max_len], g=g)
955
- return o, x_mask, (z, z_p, m_p, logs_p)
956
-
957
-
958
- class MultiPeriodDiscriminator(torch.nn.Module):
959
- def __init__(self, use_spectral_norm=False):
960
- super(MultiPeriodDiscriminator, self).__init__()
961
- periods = [2, 3, 5, 7, 11, 17]
962
- # periods = [3, 5, 7, 11, 17, 23, 37]
963
-
964
- discs = [DiscriminatorS(use_spectral_norm=use_spectral_norm)]
965
- discs = discs + [
966
- DiscriminatorP(i, use_spectral_norm=use_spectral_norm) for i in periods
967
- ]
968
- self.discriminators = nn.ModuleList(discs)
969
-
970
- def forward(self, y, y_hat):
971
- y_d_rs = [] #
972
- y_d_gs = []
973
- fmap_rs = []
974
- fmap_gs = []
975
- for i, d in enumerate(self.discriminators):
976
- y_d_r, fmap_r = d(y)
977
- y_d_g, fmap_g = d(y_hat)
978
- # for j in range(len(fmap_r)):
979
- # print(i,j,y.shape,y_hat.shape,fmap_r[j].shape,fmap_g[j].shape)
980
- y_d_rs.append(y_d_r)
981
- y_d_gs.append(y_d_g)
982
- fmap_rs.append(fmap_r)
983
- fmap_gs.append(fmap_g)
984
-
985
- return y_d_rs, y_d_gs, fmap_rs, fmap_gs
986
-
987
-
988
- class MultiPeriodDiscriminatorV2(torch.nn.Module):
989
- def __init__(self, use_spectral_norm=False):
990
- super(MultiPeriodDiscriminatorV2, self).__init__()
991
- # periods = [2, 3, 5, 7, 11, 17]
992
- periods = [2, 3, 5, 7, 11, 17, 23, 37]
993
-
994
- discs = [DiscriminatorS(use_spectral_norm=use_spectral_norm)]
995
- discs = discs + [
996
- DiscriminatorP(i, use_spectral_norm=use_spectral_norm) for i in periods
997
- ]
998
- self.discriminators = nn.ModuleList(discs)
999
-
1000
- def forward(self, y, y_hat):
1001
- y_d_rs = [] #
1002
- y_d_gs = []
1003
- fmap_rs = []
1004
- fmap_gs = []
1005
- for i, d in enumerate(self.discriminators):
1006
- y_d_r, fmap_r = d(y)
1007
- y_d_g, fmap_g = d(y_hat)
1008
- # for j in range(len(fmap_r)):
1009
- # print(i,j,y.shape,y_hat.shape,fmap_r[j].shape,fmap_g[j].shape)
1010
- y_d_rs.append(y_d_r)
1011
- y_d_gs.append(y_d_g)
1012
- fmap_rs.append(fmap_r)
1013
- fmap_gs.append(fmap_g)
1014
-
1015
- return y_d_rs, y_d_gs, fmap_rs, fmap_gs
1016
-
1017
-
1018
- class DiscriminatorS(torch.nn.Module):
1019
- def __init__(self, use_spectral_norm=False):
1020
- super(DiscriminatorS, self).__init__()
1021
- norm_f = weight_norm if use_spectral_norm == False else spectral_norm
1022
- self.convs = nn.ModuleList(
1023
- [
1024
- norm_f(Conv1d(1, 16, 15, 1, padding=7)),
1025
- norm_f(Conv1d(16, 64, 41, 4, groups=4, padding=20)),
1026
- norm_f(Conv1d(64, 256, 41, 4, groups=16, padding=20)),
1027
- norm_f(Conv1d(256, 1024, 41, 4, groups=64, padding=20)),
1028
- norm_f(Conv1d(1024, 1024, 41, 4, groups=256, padding=20)),
1029
- norm_f(Conv1d(1024, 1024, 5, 1, padding=2)),
1030
- ]
1031
- )
1032
- self.conv_post = norm_f(Conv1d(1024, 1, 3, 1, padding=1))
1033
-
1034
- def forward(self, x):
1035
- fmap = []
1036
-
1037
- for l in self.convs:
1038
- x = l(x)
1039
- x = F.leaky_relu(x, modules.LRELU_SLOPE)
1040
- fmap.append(x)
1041
- x = self.conv_post(x)
1042
- fmap.append(x)
1043
- x = torch.flatten(x, 1, -1)
1044
-
1045
- return x, fmap
1046
-
1047
-
1048
- class DiscriminatorP(torch.nn.Module):
1049
- def __init__(self, period, kernel_size=5, stride=3, use_spectral_norm=False):
1050
- super(DiscriminatorP, self).__init__()
1051
- self.period = period
1052
- self.use_spectral_norm = use_spectral_norm
1053
- norm_f = weight_norm if use_spectral_norm == False else spectral_norm
1054
- self.convs = nn.ModuleList(
1055
- [
1056
- norm_f(
1057
- Conv2d(
1058
- 1,
1059
- 32,
1060
- (kernel_size, 1),
1061
- (stride, 1),
1062
- padding=(get_padding(kernel_size, 1), 0),
1063
- )
1064
- ),
1065
- norm_f(
1066
- Conv2d(
1067
- 32,
1068
- 128,
1069
- (kernel_size, 1),
1070
- (stride, 1),
1071
- padding=(get_padding(kernel_size, 1), 0),
1072
- )
1073
- ),
1074
- norm_f(
1075
- Conv2d(
1076
- 128,
1077
- 512,
1078
- (kernel_size, 1),
1079
- (stride, 1),
1080
- padding=(get_padding(kernel_size, 1), 0),
1081
- )
1082
- ),
1083
- norm_f(
1084
- Conv2d(
1085
- 512,
1086
- 1024,
1087
- (kernel_size, 1),
1088
- (stride, 1),
1089
- padding=(get_padding(kernel_size, 1), 0),
1090
- )
1091
- ),
1092
- norm_f(
1093
- Conv2d(
1094
- 1024,
1095
- 1024,
1096
- (kernel_size, 1),
1097
- 1,
1098
- padding=(get_padding(kernel_size, 1), 0),
1099
- )
1100
- ),
1101
- ]
1102
- )
1103
- self.conv_post = norm_f(Conv2d(1024, 1, (3, 1), 1, padding=(1, 0)))
1104
-
1105
- def forward(self, x):
1106
- fmap = []
1107
-
1108
- # 1d to 2d
1109
- b, c, t = x.shape
1110
- if t % self.period != 0: # pad first
1111
- n_pad = self.period - (t % self.period)
1112
- x = F.pad(x, (0, n_pad), "reflect")
1113
- t = t + n_pad
1114
- x = x.view(b, c, t // self.period, self.period)
1115
-
1116
- for l in self.convs:
1117
- x = l(x)
1118
- x = F.leaky_relu(x, modules.LRELU_SLOPE)
1119
- fmap.append(x)
1120
- x = self.conv_post(x)
1121
- fmap.append(x)
1122
- x = torch.flatten(x, 1, -1)
1123
-
1124
- return x, fmap
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
spaces/Benson/text-generation/Examples/Dani Among Us 3d Download.md DELETED
@@ -1,53 +0,0 @@
1
- <br />
2
- <h1>Dani entre nosotros Descargar 3D: Cómo jugar el juego viral en 3D</h1>
3
- <p>Si eres un fan de <strong>Among Us</strong>, el exitoso juego multijugador online de engaño y trabajo en equipo, es posible que hayas oído hablar de <strong>Dani</strong>, un desarrollador de juegos indie noruego y YouTuber que hizo una versión en 3D del juego. En este artículo, te diremos todo lo que necesitas saber sobre <strong>Dani Among Us 3D</strong>, incluyendo lo que es, cómo se hizo, y cómo descargarlo y jugarlo. </p>
4
- <h2>¿Qué hay entre nosotros? </h2>
5
- <p>Entre nosotros es un juego donde juegas como uno de los compañeros de equipo o impostores en una nave espacial. Los tripulantes tienen que trabajar juntos para completar las tareas y encontrar a los impostores, mientras que los impostores tienen que matar a los tripulantes o sabotear la nave. El juego se puede jugar en línea o a través de WiFi local con 4-15 jugadores. </p>
6
- <h2>dani among us 3d download</h2><br /><p><b><b>Download File</b> &#128504; <a href="https://bltlly.com/2v6JpF">https://bltlly.com/2v6JpF</a></b></p><br /><br />
7
- <h3>Un popular juego multijugador en línea de engaño y trabajo en equipo</h3>
8
- <p>Among Us fue lanzado en 2018 por Innersloth, un estudio de juegos estadounidense, pero se hizo viral en 2020 gracias a los streamers y YouTubers que lo jugaron con sus amigos y fans. El juego ha sido elogiado por su juego simple pero adictivo, su interacción social y comunicación, y su valor de repetición. A partir de junio de 2021, Among Us tiene más de 500 millones de descargas en Google Play Store y más de 18 millones de propietarios en Steam.</p>
9
- <h3>Diferentes mapas, modos y opciones de personalización</h3>
10
- <p>Among Us ofrece cuatro mapas diferentes para jugar: The Skeld, MIRA HQ, Polus y The Airship. Cada mapa tiene su propio diseño, tareas, rejillas de ventilación, cámaras y sabotajes. El juego también tiene diferentes modos para elegir, como Classic o Hide n Seek. Además, los jugadores pueden personalizar sus personajes con varios colores, sombreros, pieles, mascotas y trajes. </p>
11
- <h2>¿Quién es Dani? </h2>
12
- <p>Dani es el alias en línea de Daniel William Sooman, un desarrollador de juegos indie noruego y YouTuber. Es conocido por crear juegos en Unity usando lenguaje de programación en C# y publicar devlogs (registros de desarrollo) en su canal de YouTube. </p>
13
-
14
- <p>Dani comenzó a programar cuando tenía 15 años, usando Java como su primer lenguaje. Luego cambió a Unity y C# ya que quería hacer mejores juegos. Creó su canal de YouTube en octubre de 2018 y subió su primer video en noviembre de 2018. Desde entonces, ha ganado más de 6 millones de suscriptores y más de 600 millones de visitas en su canal. </p>
15
- <h3>Conocido por crear juegos en Unity y publicar devlogs</h3>
16
- <p>Los vídeos de YouTube de Dani consisten principalmente en él desarrollando juegos en Unity y mostrando el proceso, los desafíos y los resultados de sus proyectos. Algunos de sus juegos más populares incluyen: - <strong>Karlson</strong>: un juego de disparos parkour basado en la física donde juegas como Karlson, un agente adicto a la leche que tiene que escapar de una instalación llena de enemigos y trampas. - <strong>Muck</strong>: un juego roguelike de supervivencia donde tienes que reunir recursos, crear objetos, luchar contra monstruos, y sobrevivir tanto como puedas en una isla generada por procedimientos. - <strong>Mobile Suit</strong>: un juego de combate mech donde piloteas un robot gigante y luchas contra otros mechs en varios entornos. Dani también hace juegos basados en títulos o géneros populares, como Fall Guys, Minecraft, Doom, GTA y más. A menudo añade su propio toque o humor a estos juegos, haciéndolos únicos y entretenidos. </p>
17
- <h2>¿Cómo hizo Dani Among Us 3D? </h2>
18
- <p>Dani’s Among Us 3D es uno de sus juegos más virales, ya que se basa en el juego original de Among Us pero con una perspectiva y gráficos en 3D. Dani hizo este juego en Unity usando C# y agregó nuevas características y mecánicas al juego. </p>
19
- <h3>Inspirado por los comentarios sobre su video clonado de Fall Guys</h3>
20
- <p>Dani tuvo la idea de hacer Among Us 3D de los comentarios en su video donde hizo un clon de Fall Guys en Unity. Mucha gente sugirió que debería hacer una versión en 3D de Among Us, ya que ambos juegos son similares en su estilo colorido y de dibujos animados. Dani decidió asumir el reto y comenzó a trabajar en el proyecto. </p>
21
- <p></p>
22
-
23
- <p>Dani utilizó Unity como motor de juego y C# como lenguaje de programación para crear una versión en 3D de Among Us. Siguió el mismo juego y reglas que el juego original, pero con una perspectiva en 3D y gráficos. También usó Blender para modelar los personajes, elementos y entornos. Documentó su progreso y desafíos en sus videos de YouTube, donde mostró cómo implementó características como: - El sistema de lobby - La visión del impostor - Las animaciones de eliminación - El sistema de ventilación - El sistema de votación - El sistema de tareas - El sistema de chat - Los efectos de sonido - La música </p>
24
- <h3>Añadidas nuevas características y mecánicas al juego</h3>
25
- <p>Además de recrear el juego original en 3D, Dani también agregó algunas nuevas características y mecánicas para hacer su versión más divertida e interesante. Algunas de estas características incluyen: - Una opción de cámara en primera persona - Un sistema de física ragdoll - Un artículo de jetpack - Un artículo de gancho de agarre - Un elemento de cáscara de plátano - Una opción de chat de voz de proximidad - Un editor de mapas personalizado </p>
26
- <h2>¿Cómo descargar y jugar a Dani Among Us 3D? </h2>
27
- <p>Si estás interesado en jugar a Dani Among Us 3D, quizás te estés preguntando cómo descargarlo y jugarlo. Desafortunadamente, no hay enlace de descarga oficial disponible todavía, ya que Dani todavía está trabajando en el juego y no lo ha lanzado públicamente. Sin embargo, hay algunas formas posibles de acceder al juego. </p>
28
- <h3>Todavía no hay enlace oficial de descarga</h3>
29
- <p>Dani no ha lanzado su juego 3D Among Us al público todavía, ya que todavía está trabajando en mejorarlo y agregar más características. Solo ha compartido algunas claves beta con algunos de sus amigos y fans que han probado el juego y le han dado retroalimentación. También ha declarado que no quiere lanzar el juego sin el permiso de Innersloth, ya que respeta su trabajo y no quiere causar ningún problema. </p>
30
- <h3>Formas posibles de acceder al juego</h3>
31
-
32
- <p>La mejor manera de mantenerse actualizado en Dani Among Us 3D es suscribirse al canal de YouTube de Dani y activar las notificaciones. Dani publica regularmente vídeos sobre sus proyectos de desarrollo de juegos, incluyendo Among Us 3D. También a veces da claves beta o pistas sobre cómo conseguirlas en sus vídeos o descripciones. También puedes comentar sus vídeos y pedirle educadamente una clave beta o más información sobre el juego. </p>
33
- <h4>Únete al servidor Discord de Dani y pide una clave beta</h4>
34
- <p>Otra forma de acceder a Dani Among Us 3D es unirse al servidor de Discord de Dani y pedir una clave beta o más información sobre el juego. Dani’s Discord server es una comunidad de más de 200.000 miembros que son fans de sus juegos y videos. Puede unirse al servidor haciendo clic en el enlace de la descripción de su canal de YouTube o utilizando este código de invitación: https://discord.gg/DaniDev. Una vez que se une al servidor, puede chatear con otros miembros, compartir sus comentarios y sugerencias, y participar en eventos y regalos. También puedes pedirle a Dani o a sus moderadores una clave beta o más información sobre Among Us 3D en el canal #among-us-3d o enviándoles un mensaje directo. </p>
35
- <h4>Apoyo Dani en Patreon y obtener recompensas exclusivas</h4>
36
-
37
- <h2>Conclusión</h2>
38
- <p>Dani Among Us 3D es un giro divertido y creativo en el juego original de Among Us, donde puedes jugar el juego en 3D con nuevas características y mecánicas. Dani es un desarrollador de juegos talentoso y entretenido y YouTuber que hace juegos en Unity y publica devlogs en su canal. Si quieres descargar y jugar Dani Among Us 3D, puedes suscribirte a su canal de YouTube, unirte a su servidor Discord, o apoyarlo en Patreon y esperar actualizaciones o claves beta. Alternativamente, también puedes ver sus videos o transmisiones donde muestra el juego y lo juega con otras personas. </p>
39
- <p>Esperamos que hayas disfrutado de este artículo y hayas aprendido algo nuevo sobre Dani Among Us 3D. Si tiene alguna pregunta o comentario, no dude en dejarlos abajo. ¡Gracias por leer! </p>
40
- <h2>Preguntas frecuentes</h2>
41
- <p>Aquí hay algunas preguntas frecuentes sobre Dani Among Us 3D:</p>
42
- <h3>Q: ¿Es Dani Among Us 3D gratis? </h3>
43
- <p>A: Dani aún no ha anunciado el precio de su juego Among Us 3D, pero ha dicho que podría hacerlo gratis o muy barato, ya que no quiere beneficiarse del trabajo de Innersloth o causar problemas legales. </p>
44
- <h3>Q: ¿Está Dani Among Us 3D disponible para dispositivos móviles? </h3>
45
- <p>A: Dani no ha lanzado su juego 3D Among Us para dispositivos móviles todavía, pero ha dicho que podría hacer una versión móvil en el futuro, ya que sabe que muchas personas juegan entre nosotros en sus teléfonos o tabletas. </p>
46
- <h3>Q: ¿Está Dani entre nosotros multijugador 3D? </h3>
47
- <p>A: Sí, Dani Among Us 3D es multijugador, al igual que el juego original. Puedes jugar online o a través de WiFi local con hasta 15 jugadores. También puede utilizar el chat de voz o de texto para comunicarse con otros jugadores. </p>
48
- <h3>Q: ¿Puedo jugar Dani entre nosotros 3D con mods? </h3>
49
- <p>A: Dani aún no ha lanzado ningún mod oficial para su juego Among Us 3D, pero ha dicho que podría hacer algunos mods o permitir que otras personas hagan mods en el futuro, ya que le gustan los juegos de modding y cree que agrega más diversión y variedad al juego. </p>
50
-
51
- <p>A: Puedes contactar a Dani o darle retroalimentación dejando un comentario en sus videos de YouTube, enviándole un mensaje en su servidor Discord, tuiteándolo en Twitter (@DaniDevYT), o enviándole un correo electrónico a [email protected]. </p> 64aa2da5cf<br />
52
- <br />
53
- <br />
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
spaces/Big-Web/MMSD/env/Lib/site-packages/pip/_vendor/pygments/formatters/irc.py DELETED
@@ -1,154 +0,0 @@
1
- """
2
- pygments.formatters.irc
3
- ~~~~~~~~~~~~~~~~~~~~~~~
4
-
5
- Formatter for IRC output
6
-
7
- :copyright: Copyright 2006-2022 by the Pygments team, see AUTHORS.
8
- :license: BSD, see LICENSE for details.
9
- """
10
-
11
- from pip._vendor.pygments.formatter import Formatter
12
- from pip._vendor.pygments.token import Keyword, Name, Comment, String, Error, \
13
- Number, Operator, Generic, Token, Whitespace
14
- from pip._vendor.pygments.util import get_choice_opt
15
-
16
-
17
- __all__ = ['IRCFormatter']
18
-
19
-
20
- #: Map token types to a tuple of color values for light and dark
21
- #: backgrounds.
22
- IRC_COLORS = {
23
- Token: ('', ''),
24
-
25
- Whitespace: ('gray', 'brightblack'),
26
- Comment: ('gray', 'brightblack'),
27
- Comment.Preproc: ('cyan', 'brightcyan'),
28
- Keyword: ('blue', 'brightblue'),
29
- Keyword.Type: ('cyan', 'brightcyan'),
30
- Operator.Word: ('magenta', 'brightcyan'),
31
- Name.Builtin: ('cyan', 'brightcyan'),
32
- Name.Function: ('green', 'brightgreen'),
33
- Name.Namespace: ('_cyan_', '_brightcyan_'),
34
- Name.Class: ('_green_', '_brightgreen_'),
35
- Name.Exception: ('cyan', 'brightcyan'),
36
- Name.Decorator: ('brightblack', 'gray'),
37
- Name.Variable: ('red', 'brightred'),
38
- Name.Constant: ('red', 'brightred'),
39
- Name.Attribute: ('cyan', 'brightcyan'),
40
- Name.Tag: ('brightblue', 'brightblue'),
41
- String: ('yellow', 'yellow'),
42
- Number: ('blue', 'brightblue'),
43
-
44
- Generic.Deleted: ('brightred', 'brightred'),
45
- Generic.Inserted: ('green', 'brightgreen'),
46
- Generic.Heading: ('**', '**'),
47
- Generic.Subheading: ('*magenta*', '*brightmagenta*'),
48
- Generic.Error: ('brightred', 'brightred'),
49
-
50
- Error: ('_brightred_', '_brightred_'),
51
- }
52
-
53
-
54
- IRC_COLOR_MAP = {
55
- 'white': 0,
56
- 'black': 1,
57
- 'blue': 2,
58
- 'brightgreen': 3,
59
- 'brightred': 4,
60
- 'yellow': 5,
61
- 'magenta': 6,
62
- 'orange': 7,
63
- 'green': 7, #compat w/ ansi
64
- 'brightyellow': 8,
65
- 'lightgreen': 9,
66
- 'brightcyan': 9, # compat w/ ansi
67
- 'cyan': 10,
68
- 'lightblue': 11,
69
- 'red': 11, # compat w/ ansi
70
- 'brightblue': 12,
71
- 'brightmagenta': 13,
72
- 'brightblack': 14,
73
- 'gray': 15,
74
- }
75
-
76
- def ircformat(color, text):
77
- if len(color) < 1:
78
- return text
79
- add = sub = ''
80
- if '_' in color: # italic
81
- add += '\x1D'
82
- sub = '\x1D' + sub
83
- color = color.strip('_')
84
- if '*' in color: # bold
85
- add += '\x02'
86
- sub = '\x02' + sub
87
- color = color.strip('*')
88
- # underline (\x1F) not supported
89
- # backgrounds (\x03FF,BB) not supported
90
- if len(color) > 0: # actual color - may have issues with ircformat("red", "blah")+"10" type stuff
91
- add += '\x03' + str(IRC_COLOR_MAP[color]).zfill(2)
92
- sub = '\x03' + sub
93
- return add + text + sub
94
- return '<'+add+'>'+text+'</'+sub+'>'
95
-
96
-
97
- class IRCFormatter(Formatter):
98
- r"""
99
- Format tokens with IRC color sequences
100
-
101
- The `get_style_defs()` method doesn't do anything special since there is
102
- no support for common styles.
103
-
104
- Options accepted:
105
-
106
- `bg`
107
- Set to ``"light"`` or ``"dark"`` depending on the terminal's background
108
- (default: ``"light"``).
109
-
110
- `colorscheme`
111
- A dictionary mapping token types to (lightbg, darkbg) color names or
112
- ``None`` (default: ``None`` = use builtin colorscheme).
113
-
114
- `linenos`
115
- Set to ``True`` to have line numbers in the output as well
116
- (default: ``False`` = no line numbers).
117
- """
118
- name = 'IRC'
119
- aliases = ['irc', 'IRC']
120
- filenames = []
121
-
122
- def __init__(self, **options):
123
- Formatter.__init__(self, **options)
124
- self.darkbg = get_choice_opt(options, 'bg',
125
- ['light', 'dark'], 'light') == 'dark'
126
- self.colorscheme = options.get('colorscheme', None) or IRC_COLORS
127
- self.linenos = options.get('linenos', False)
128
- self._lineno = 0
129
-
130
- def _write_lineno(self, outfile):
131
- if self.linenos:
132
- self._lineno += 1
133
- outfile.write("%04d: " % self._lineno)
134
-
135
- def format_unencoded(self, tokensource, outfile):
136
- self._write_lineno(outfile)
137
-
138
- for ttype, value in tokensource:
139
- color = self.colorscheme.get(ttype)
140
- while color is None:
141
- ttype = ttype[:-1]
142
- color = self.colorscheme.get(ttype)
143
- if color:
144
- color = color[self.darkbg]
145
- spl = value.split('\n')
146
- for line in spl[:-1]:
147
- if line:
148
- outfile.write(ircformat(color, line))
149
- outfile.write('\n')
150
- self._write_lineno(outfile)
151
- if spl[-1]:
152
- outfile.write(ircformat(color, spl[-1]))
153
- else:
154
- outfile.write(value)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
spaces/Big-Web/MMSD/env/Lib/site-packages/setuptools/_distutils/archive_util.py DELETED
@@ -1,280 +0,0 @@
1
- """distutils.archive_util
2
-
3
- Utility functions for creating archive files (tarballs, zip files,
4
- that sort of thing)."""
5
-
6
- import os
7
- from warnings import warn
8
- import sys
9
-
10
- try:
11
- import zipfile
12
- except ImportError:
13
- zipfile = None
14
-
15
-
16
- from distutils.errors import DistutilsExecError
17
- from distutils.spawn import spawn
18
- from distutils.dir_util import mkpath
19
- from distutils import log
20
-
21
- try:
22
- from pwd import getpwnam
23
- except ImportError:
24
- getpwnam = None
25
-
26
- try:
27
- from grp import getgrnam
28
- except ImportError:
29
- getgrnam = None
30
-
31
-
32
- def _get_gid(name):
33
- """Returns a gid, given a group name."""
34
- if getgrnam is None or name is None:
35
- return None
36
- try:
37
- result = getgrnam(name)
38
- except KeyError:
39
- result = None
40
- if result is not None:
41
- return result[2]
42
- return None
43
-
44
-
45
- def _get_uid(name):
46
- """Returns an uid, given a user name."""
47
- if getpwnam is None or name is None:
48
- return None
49
- try:
50
- result = getpwnam(name)
51
- except KeyError:
52
- result = None
53
- if result is not None:
54
- return result[2]
55
- return None
56
-
57
-
58
- def make_tarball(
59
- base_name, base_dir, compress="gzip", verbose=0, dry_run=0, owner=None, group=None
60
- ):
61
- """Create a (possibly compressed) tar file from all the files under
62
- 'base_dir'.
63
-
64
- 'compress' must be "gzip" (the default), "bzip2", "xz", "compress", or
65
- None. ("compress" will be deprecated in Python 3.2)
66
-
67
- 'owner' and 'group' can be used to define an owner and a group for the
68
- archive that is being built. If not provided, the current owner and group
69
- will be used.
70
-
71
- The output tar file will be named 'base_dir' + ".tar", possibly plus
72
- the appropriate compression extension (".gz", ".bz2", ".xz" or ".Z").
73
-
74
- Returns the output filename.
75
- """
76
- tar_compression = {
77
- 'gzip': 'gz',
78
- 'bzip2': 'bz2',
79
- 'xz': 'xz',
80
- None: '',
81
- 'compress': '',
82
- }
83
- compress_ext = {'gzip': '.gz', 'bzip2': '.bz2', 'xz': '.xz', 'compress': '.Z'}
84
-
85
- # flags for compression program, each element of list will be an argument
86
- if compress is not None and compress not in compress_ext.keys():
87
- raise ValueError(
88
- "bad value for 'compress': must be None, 'gzip', 'bzip2', "
89
- "'xz' or 'compress'"
90
- )
91
-
92
- archive_name = base_name + '.tar'
93
- if compress != 'compress':
94
- archive_name += compress_ext.get(compress, '')
95
-
96
- mkpath(os.path.dirname(archive_name), dry_run=dry_run)
97
-
98
- # creating the tarball
99
- import tarfile # late import so Python build itself doesn't break
100
-
101
- log.info('Creating tar archive')
102
-
103
- uid = _get_uid(owner)
104
- gid = _get_gid(group)
105
-
106
- def _set_uid_gid(tarinfo):
107
- if gid is not None:
108
- tarinfo.gid = gid
109
- tarinfo.gname = group
110
- if uid is not None:
111
- tarinfo.uid = uid
112
- tarinfo.uname = owner
113
- return tarinfo
114
-
115
- if not dry_run:
116
- tar = tarfile.open(archive_name, 'w|%s' % tar_compression[compress])
117
- try:
118
- tar.add(base_dir, filter=_set_uid_gid)
119
- finally:
120
- tar.close()
121
-
122
- # compression using `compress`
123
- if compress == 'compress':
124
- warn("'compress' is deprecated.", DeprecationWarning)
125
- # the option varies depending on the platform
126
- compressed_name = archive_name + compress_ext[compress]
127
- if sys.platform == 'win32':
128
- cmd = [compress, archive_name, compressed_name]
129
- else:
130
- cmd = [compress, '-f', archive_name]
131
- spawn(cmd, dry_run=dry_run)
132
- return compressed_name
133
-
134
- return archive_name
135
-
136
-
137
- def make_zipfile(base_name, base_dir, verbose=0, dry_run=0): # noqa: C901
138
- """Create a zip file from all the files under 'base_dir'.
139
-
140
- The output zip file will be named 'base_name' + ".zip". Uses either the
141
- "zipfile" Python module (if available) or the InfoZIP "zip" utility
142
- (if installed and found on the default search path). If neither tool is
143
- available, raises DistutilsExecError. Returns the name of the output zip
144
- file.
145
- """
146
- zip_filename = base_name + ".zip"
147
- mkpath(os.path.dirname(zip_filename), dry_run=dry_run)
148
-
149
- # If zipfile module is not available, try spawning an external
150
- # 'zip' command.
151
- if zipfile is None:
152
- if verbose:
153
- zipoptions = "-r"
154
- else:
155
- zipoptions = "-rq"
156
-
157
- try:
158
- spawn(["zip", zipoptions, zip_filename, base_dir], dry_run=dry_run)
159
- except DistutilsExecError:
160
- # XXX really should distinguish between "couldn't find
161
- # external 'zip' command" and "zip failed".
162
- raise DistutilsExecError(
163
- (
164
- "unable to create zip file '%s': "
165
- "could neither import the 'zipfile' module nor "
166
- "find a standalone zip utility"
167
- )
168
- % zip_filename
169
- )
170
-
171
- else:
172
- log.info("creating '%s' and adding '%s' to it", zip_filename, base_dir)
173
-
174
- if not dry_run:
175
- try:
176
- zip = zipfile.ZipFile(
177
- zip_filename, "w", compression=zipfile.ZIP_DEFLATED
178
- )
179
- except RuntimeError:
180
- zip = zipfile.ZipFile(zip_filename, "w", compression=zipfile.ZIP_STORED)
181
-
182
- with zip:
183
- if base_dir != os.curdir:
184
- path = os.path.normpath(os.path.join(base_dir, ''))
185
- zip.write(path, path)
186
- log.info("adding '%s'", path)
187
- for dirpath, dirnames, filenames in os.walk(base_dir):
188
- for name in dirnames:
189
- path = os.path.normpath(os.path.join(dirpath, name, ''))
190
- zip.write(path, path)
191
- log.info("adding '%s'", path)
192
- for name in filenames:
193
- path = os.path.normpath(os.path.join(dirpath, name))
194
- if os.path.isfile(path):
195
- zip.write(path, path)
196
- log.info("adding '%s'", path)
197
-
198
- return zip_filename
199
-
200
-
201
- ARCHIVE_FORMATS = {
202
- 'gztar': (make_tarball, [('compress', 'gzip')], "gzip'ed tar-file"),
203
- 'bztar': (make_tarball, [('compress', 'bzip2')], "bzip2'ed tar-file"),
204
- 'xztar': (make_tarball, [('compress', 'xz')], "xz'ed tar-file"),
205
- 'ztar': (make_tarball, [('compress', 'compress')], "compressed tar file"),
206
- 'tar': (make_tarball, [('compress', None)], "uncompressed tar file"),
207
- 'zip': (make_zipfile, [], "ZIP file"),
208
- }
209
-
210
-
211
- def check_archive_formats(formats):
212
- """Returns the first format from the 'format' list that is unknown.
213
-
214
- If all formats are known, returns None
215
- """
216
- for format in formats:
217
- if format not in ARCHIVE_FORMATS:
218
- return format
219
- return None
220
-
221
-
222
- def make_archive(
223
- base_name,
224
- format,
225
- root_dir=None,
226
- base_dir=None,
227
- verbose=0,
228
- dry_run=0,
229
- owner=None,
230
- group=None,
231
- ):
232
- """Create an archive file (eg. zip or tar).
233
-
234
- 'base_name' is the name of the file to create, minus any format-specific
235
- extension; 'format' is the archive format: one of "zip", "tar", "gztar",
236
- "bztar", "xztar", or "ztar".
237
-
238
- 'root_dir' is a directory that will be the root directory of the
239
- archive; ie. we typically chdir into 'root_dir' before creating the
240
- archive. 'base_dir' is the directory where we start archiving from;
241
- ie. 'base_dir' will be the common prefix of all files and
242
- directories in the archive. 'root_dir' and 'base_dir' both default
243
- to the current directory. Returns the name of the archive file.
244
-
245
- 'owner' and 'group' are used when creating a tar archive. By default,
246
- uses the current owner and group.
247
- """
248
- save_cwd = os.getcwd()
249
- if root_dir is not None:
250
- log.debug("changing into '%s'", root_dir)
251
- base_name = os.path.abspath(base_name)
252
- if not dry_run:
253
- os.chdir(root_dir)
254
-
255
- if base_dir is None:
256
- base_dir = os.curdir
257
-
258
- kwargs = {'dry_run': dry_run}
259
-
260
- try:
261
- format_info = ARCHIVE_FORMATS[format]
262
- except KeyError:
263
- raise ValueError("unknown archive format '%s'" % format)
264
-
265
- func = format_info[0]
266
- for arg, val in format_info[1]:
267
- kwargs[arg] = val
268
-
269
- if format != 'zip':
270
- kwargs['owner'] = owner
271
- kwargs['group'] = group
272
-
273
- try:
274
- filename = func(base_name, base_dir, **kwargs)
275
- finally:
276
- if root_dir is not None:
277
- log.debug("changing back to '%s'", save_cwd)
278
- os.chdir(save_cwd)
279
-
280
- return filename
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
spaces/Big-Web/MMSD/env/Lib/site-packages/setuptools/_distutils/dist.py DELETED
@@ -1,1286 +0,0 @@
1
- """distutils.dist
2
-
3
- Provides the Distribution class, which represents the module distribution
4
- being built/installed/distributed.
5
- """
6
-
7
- import sys
8
- import os
9
- import re
10
- import pathlib
11
- import contextlib
12
- from email import message_from_file
13
-
14
- try:
15
- import warnings
16
- except ImportError:
17
- warnings = None
18
-
19
- from distutils.errors import (
20
- DistutilsOptionError,
21
- DistutilsModuleError,
22
- DistutilsArgError,
23
- DistutilsClassError,
24
- )
25
- from distutils.fancy_getopt import FancyGetopt, translate_longopt
26
- from distutils.util import check_environ, strtobool, rfc822_escape
27
- from distutils import log
28
- from distutils.debug import DEBUG
29
-
30
- # Regex to define acceptable Distutils command names. This is not *quite*
31
- # the same as a Python NAME -- I don't allow leading underscores. The fact
32
- # that they're very similar is no coincidence; the default naming scheme is
33
- # to look for a Python module named after the command.
34
- command_re = re.compile(r'^[a-zA-Z]([a-zA-Z0-9_]*)$')
35
-
36
-
37
- def _ensure_list(value, fieldname):
38
- if isinstance(value, str):
39
- # a string containing comma separated values is okay. It will
40
- # be converted to a list by Distribution.finalize_options().
41
- pass
42
- elif not isinstance(value, list):
43
- # passing a tuple or an iterator perhaps, warn and convert
44
- typename = type(value).__name__
45
- msg = "Warning: '{fieldname}' should be a list, got type '{typename}'"
46
- msg = msg.format(**locals())
47
- log.log(log.WARN, msg)
48
- value = list(value)
49
- return value
50
-
51
-
52
- class Distribution:
53
- """The core of the Distutils. Most of the work hiding behind 'setup'
54
- is really done within a Distribution instance, which farms the work out
55
- to the Distutils commands specified on the command line.
56
-
57
- Setup scripts will almost never instantiate Distribution directly,
58
- unless the 'setup()' function is totally inadequate to their needs.
59
- However, it is conceivable that a setup script might wish to subclass
60
- Distribution for some specialized purpose, and then pass the subclass
61
- to 'setup()' as the 'distclass' keyword argument. If so, it is
62
- necessary to respect the expectations that 'setup' has of Distribution.
63
- See the code for 'setup()', in core.py, for details.
64
- """
65
-
66
- # 'global_options' describes the command-line options that may be
67
- # supplied to the setup script prior to any actual commands.
68
- # Eg. "./setup.py -n" or "./setup.py --quiet" both take advantage of
69
- # these global options. This list should be kept to a bare minimum,
70
- # since every global option is also valid as a command option -- and we
71
- # don't want to pollute the commands with too many options that they
72
- # have minimal control over.
73
- # The fourth entry for verbose means that it can be repeated.
74
- global_options = [
75
- ('verbose', 'v', "run verbosely (default)", 1),
76
- ('quiet', 'q', "run quietly (turns verbosity off)"),
77
- ('dry-run', 'n', "don't actually do anything"),
78
- ('help', 'h', "show detailed help message"),
79
- ('no-user-cfg', None, 'ignore pydistutils.cfg in your home directory'),
80
- ]
81
-
82
- # 'common_usage' is a short (2-3 line) string describing the common
83
- # usage of the setup script.
84
- common_usage = """\
85
- Common commands: (see '--help-commands' for more)
86
-
87
- setup.py build will build the package underneath 'build/'
88
- setup.py install will install the package
89
- """
90
-
91
- # options that are not propagated to the commands
92
- display_options = [
93
- ('help-commands', None, "list all available commands"),
94
- ('name', None, "print package name"),
95
- ('version', 'V', "print package version"),
96
- ('fullname', None, "print <package name>-<version>"),
97
- ('author', None, "print the author's name"),
98
- ('author-email', None, "print the author's email address"),
99
- ('maintainer', None, "print the maintainer's name"),
100
- ('maintainer-email', None, "print the maintainer's email address"),
101
- ('contact', None, "print the maintainer's name if known, else the author's"),
102
- (
103
- 'contact-email',
104
- None,
105
- "print the maintainer's email address if known, else the author's",
106
- ),
107
- ('url', None, "print the URL for this package"),
108
- ('license', None, "print the license of the package"),
109
- ('licence', None, "alias for --license"),
110
- ('description', None, "print the package description"),
111
- ('long-description', None, "print the long package description"),
112
- ('platforms', None, "print the list of platforms"),
113
- ('classifiers', None, "print the list of classifiers"),
114
- ('keywords', None, "print the list of keywords"),
115
- ('provides', None, "print the list of packages/modules provided"),
116
- ('requires', None, "print the list of packages/modules required"),
117
- ('obsoletes', None, "print the list of packages/modules made obsolete"),
118
- ]
119
- display_option_names = [translate_longopt(x[0]) for x in display_options]
120
-
121
- # negative options are options that exclude other options
122
- negative_opt = {'quiet': 'verbose'}
123
-
124
- # -- Creation/initialization methods -------------------------------
125
-
126
- def __init__(self, attrs=None): # noqa: C901
127
- """Construct a new Distribution instance: initialize all the
128
- attributes of a Distribution, and then use 'attrs' (a dictionary
129
- mapping attribute names to values) to assign some of those
130
- attributes their "real" values. (Any attributes not mentioned in
131
- 'attrs' will be assigned to some null value: 0, None, an empty list
132
- or dictionary, etc.) Most importantly, initialize the
133
- 'command_obj' attribute to the empty dictionary; this will be
134
- filled in with real command objects by 'parse_command_line()'.
135
- """
136
-
137
- # Default values for our command-line options
138
- self.verbose = 1
139
- self.dry_run = 0
140
- self.help = 0
141
- for attr in self.display_option_names:
142
- setattr(self, attr, 0)
143
-
144
- # Store the distribution meta-data (name, version, author, and so
145
- # forth) in a separate object -- we're getting to have enough
146
- # information here (and enough command-line options) that it's
147
- # worth it. Also delegate 'get_XXX()' methods to the 'metadata'
148
- # object in a sneaky and underhanded (but efficient!) way.
149
- self.metadata = DistributionMetadata()
150
- for basename in self.metadata._METHOD_BASENAMES:
151
- method_name = "get_" + basename
152
- setattr(self, method_name, getattr(self.metadata, method_name))
153
-
154
- # 'cmdclass' maps command names to class objects, so we
155
- # can 1) quickly figure out which class to instantiate when
156
- # we need to create a new command object, and 2) have a way
157
- # for the setup script to override command classes
158
- self.cmdclass = {}
159
-
160
- # 'command_packages' is a list of packages in which commands
161
- # are searched for. The factory for command 'foo' is expected
162
- # to be named 'foo' in the module 'foo' in one of the packages
163
- # named here. This list is searched from the left; an error
164
- # is raised if no named package provides the command being
165
- # searched for. (Always access using get_command_packages().)
166
- self.command_packages = None
167
-
168
- # 'script_name' and 'script_args' are usually set to sys.argv[0]
169
- # and sys.argv[1:], but they can be overridden when the caller is
170
- # not necessarily a setup script run from the command-line.
171
- self.script_name = None
172
- self.script_args = None
173
-
174
- # 'command_options' is where we store command options between
175
- # parsing them (from config files, the command-line, etc.) and when
176
- # they are actually needed -- ie. when the command in question is
177
- # instantiated. It is a dictionary of dictionaries of 2-tuples:
178
- # command_options = { command_name : { option : (source, value) } }
179
- self.command_options = {}
180
-
181
- # 'dist_files' is the list of (command, pyversion, file) that
182
- # have been created by any dist commands run so far. This is
183
- # filled regardless of whether the run is dry or not. pyversion
184
- # gives sysconfig.get_python_version() if the dist file is
185
- # specific to a Python version, 'any' if it is good for all
186
- # Python versions on the target platform, and '' for a source
187
- # file. pyversion should not be used to specify minimum or
188
- # maximum required Python versions; use the metainfo for that
189
- # instead.
190
- self.dist_files = []
191
-
192
- # These options are really the business of various commands, rather
193
- # than of the Distribution itself. We provide aliases for them in
194
- # Distribution as a convenience to the developer.
195
- self.packages = None
196
- self.package_data = {}
197
- self.package_dir = None
198
- self.py_modules = None
199
- self.libraries = None
200
- self.headers = None
201
- self.ext_modules = None
202
- self.ext_package = None
203
- self.include_dirs = None
204
- self.extra_path = None
205
- self.scripts = None
206
- self.data_files = None
207
- self.password = ''
208
-
209
- # And now initialize bookkeeping stuff that can't be supplied by
210
- # the caller at all. 'command_obj' maps command names to
211
- # Command instances -- that's how we enforce that every command
212
- # class is a singleton.
213
- self.command_obj = {}
214
-
215
- # 'have_run' maps command names to boolean values; it keeps track
216
- # of whether we have actually run a particular command, to make it
217
- # cheap to "run" a command whenever we think we might need to -- if
218
- # it's already been done, no need for expensive filesystem
219
- # operations, we just check the 'have_run' dictionary and carry on.
220
- # It's only safe to query 'have_run' for a command class that has
221
- # been instantiated -- a false value will be inserted when the
222
- # command object is created, and replaced with a true value when
223
- # the command is successfully run. Thus it's probably best to use
224
- # '.get()' rather than a straight lookup.
225
- self.have_run = {}
226
-
227
- # Now we'll use the attrs dictionary (ultimately, keyword args from
228
- # the setup script) to possibly override any or all of these
229
- # distribution options.
230
-
231
- if attrs:
232
- # Pull out the set of command options and work on them
233
- # specifically. Note that this order guarantees that aliased
234
- # command options will override any supplied redundantly
235
- # through the general options dictionary.
236
- options = attrs.get('options')
237
- if options is not None:
238
- del attrs['options']
239
- for (command, cmd_options) in options.items():
240
- opt_dict = self.get_option_dict(command)
241
- for (opt, val) in cmd_options.items():
242
- opt_dict[opt] = ("setup script", val)
243
-
244
- if 'licence' in attrs:
245
- attrs['license'] = attrs['licence']
246
- del attrs['licence']
247
- msg = "'licence' distribution option is deprecated; use 'license'"
248
- if warnings is not None:
249
- warnings.warn(msg)
250
- else:
251
- sys.stderr.write(msg + "\n")
252
-
253
- # Now work on the rest of the attributes. Any attribute that's
254
- # not already defined is invalid!
255
- for (key, val) in attrs.items():
256
- if hasattr(self.metadata, "set_" + key):
257
- getattr(self.metadata, "set_" + key)(val)
258
- elif hasattr(self.metadata, key):
259
- setattr(self.metadata, key, val)
260
- elif hasattr(self, key):
261
- setattr(self, key, val)
262
- else:
263
- msg = "Unknown distribution option: %s" % repr(key)
264
- warnings.warn(msg)
265
-
266
- # no-user-cfg is handled before other command line args
267
- # because other args override the config files, and this
268
- # one is needed before we can load the config files.
269
- # If attrs['script_args'] wasn't passed, assume false.
270
- #
271
- # This also make sure we just look at the global options
272
- self.want_user_cfg = True
273
-
274
- if self.script_args is not None:
275
- for arg in self.script_args:
276
- if not arg.startswith('-'):
277
- break
278
- if arg == '--no-user-cfg':
279
- self.want_user_cfg = False
280
- break
281
-
282
- self.finalize_options()
283
-
284
- def get_option_dict(self, command):
285
- """Get the option dictionary for a given command. If that
286
- command's option dictionary hasn't been created yet, then create it
287
- and return the new dictionary; otherwise, return the existing
288
- option dictionary.
289
- """
290
- dict = self.command_options.get(command)
291
- if dict is None:
292
- dict = self.command_options[command] = {}
293
- return dict
294
-
295
- def dump_option_dicts(self, header=None, commands=None, indent=""):
296
- from pprint import pformat
297
-
298
- if commands is None: # dump all command option dicts
299
- commands = sorted(self.command_options.keys())
300
-
301
- if header is not None:
302
- self.announce(indent + header)
303
- indent = indent + " "
304
-
305
- if not commands:
306
- self.announce(indent + "no commands known yet")
307
- return
308
-
309
- for cmd_name in commands:
310
- opt_dict = self.command_options.get(cmd_name)
311
- if opt_dict is None:
312
- self.announce(indent + "no option dict for '%s' command" % cmd_name)
313
- else:
314
- self.announce(indent + "option dict for '%s' command:" % cmd_name)
315
- out = pformat(opt_dict)
316
- for line in out.split('\n'):
317
- self.announce(indent + " " + line)
318
-
319
- # -- Config file finding/parsing methods ---------------------------
320
-
321
- def find_config_files(self):
322
- """Find as many configuration files as should be processed for this
323
- platform, and return a list of filenames in the order in which they
324
- should be parsed. The filenames returned are guaranteed to exist
325
- (modulo nasty race conditions).
326
-
327
- There are multiple possible config files:
328
- - distutils.cfg in the Distutils installation directory (i.e.
329
- where the top-level Distutils __inst__.py file lives)
330
- - a file in the user's home directory named .pydistutils.cfg
331
- on Unix and pydistutils.cfg on Windows/Mac; may be disabled
332
- with the ``--no-user-cfg`` option
333
- - setup.cfg in the current directory
334
- - a file named by an environment variable
335
- """
336
- check_environ()
337
- files = [str(path) for path in self._gen_paths() if os.path.isfile(path)]
338
-
339
- if DEBUG:
340
- self.announce("using config files: %s" % ', '.join(files))
341
-
342
- return files
343
-
344
- def _gen_paths(self):
345
- # The system-wide Distutils config file
346
- sys_dir = pathlib.Path(sys.modules['distutils'].__file__).parent
347
- yield sys_dir / "distutils.cfg"
348
-
349
- # The per-user config file
350
- prefix = '.' * (os.name == 'posix')
351
- filename = prefix + 'pydistutils.cfg'
352
- if self.want_user_cfg:
353
- yield pathlib.Path('~').expanduser() / filename
354
-
355
- # All platforms support local setup.cfg
356
- yield pathlib.Path('setup.cfg')
357
-
358
- # Additional config indicated in the environment
359
- with contextlib.suppress(TypeError):
360
- yield pathlib.Path(os.getenv("DIST_EXTRA_CONFIG"))
361
-
362
- def parse_config_files(self, filenames=None): # noqa: C901
363
- from configparser import ConfigParser
364
-
365
- # Ignore install directory options if we have a venv
366
- if sys.prefix != sys.base_prefix:
367
- ignore_options = [
368
- 'install-base',
369
- 'install-platbase',
370
- 'install-lib',
371
- 'install-platlib',
372
- 'install-purelib',
373
- 'install-headers',
374
- 'install-scripts',
375
- 'install-data',
376
- 'prefix',
377
- 'exec-prefix',
378
- 'home',
379
- 'user',
380
- 'root',
381
- ]
382
- else:
383
- ignore_options = []
384
-
385
- ignore_options = frozenset(ignore_options)
386
-
387
- if filenames is None:
388
- filenames = self.find_config_files()
389
-
390
- if DEBUG:
391
- self.announce("Distribution.parse_config_files():")
392
-
393
- parser = ConfigParser()
394
- for filename in filenames:
395
- if DEBUG:
396
- self.announce(" reading %s" % filename)
397
- parser.read(filename)
398
- for section in parser.sections():
399
- options = parser.options(section)
400
- opt_dict = self.get_option_dict(section)
401
-
402
- for opt in options:
403
- if opt != '__name__' and opt not in ignore_options:
404
- val = parser.get(section, opt)
405
- opt = opt.replace('-', '_')
406
- opt_dict[opt] = (filename, val)
407
-
408
- # Make the ConfigParser forget everything (so we retain
409
- # the original filenames that options come from)
410
- parser.__init__()
411
-
412
- # If there was a "global" section in the config file, use it
413
- # to set Distribution options.
414
-
415
- if 'global' in self.command_options:
416
- for (opt, (src, val)) in self.command_options['global'].items():
417
- alias = self.negative_opt.get(opt)
418
- try:
419
- if alias:
420
- setattr(self, alias, not strtobool(val))
421
- elif opt in ('verbose', 'dry_run'): # ugh!
422
- setattr(self, opt, strtobool(val))
423
- else:
424
- setattr(self, opt, val)
425
- except ValueError as msg:
426
- raise DistutilsOptionError(msg)
427
-
428
- # -- Command-line parsing methods ----------------------------------
429
-
430
- def parse_command_line(self):
431
- """Parse the setup script's command line, taken from the
432
- 'script_args' instance attribute (which defaults to 'sys.argv[1:]'
433
- -- see 'setup()' in core.py). This list is first processed for
434
- "global options" -- options that set attributes of the Distribution
435
- instance. Then, it is alternately scanned for Distutils commands
436
- and options for that command. Each new command terminates the
437
- options for the previous command. The allowed options for a
438
- command are determined by the 'user_options' attribute of the
439
- command class -- thus, we have to be able to load command classes
440
- in order to parse the command line. Any error in that 'options'
441
- attribute raises DistutilsGetoptError; any error on the
442
- command-line raises DistutilsArgError. If no Distutils commands
443
- were found on the command line, raises DistutilsArgError. Return
444
- true if command-line was successfully parsed and we should carry
445
- on with executing commands; false if no errors but we shouldn't
446
- execute commands (currently, this only happens if user asks for
447
- help).
448
- """
449
- #
450
- # We now have enough information to show the Macintosh dialog
451
- # that allows the user to interactively specify the "command line".
452
- #
453
- toplevel_options = self._get_toplevel_options()
454
-
455
- # We have to parse the command line a bit at a time -- global
456
- # options, then the first command, then its options, and so on --
457
- # because each command will be handled by a different class, and
458
- # the options that are valid for a particular class aren't known
459
- # until we have loaded the command class, which doesn't happen
460
- # until we know what the command is.
461
-
462
- self.commands = []
463
- parser = FancyGetopt(toplevel_options + self.display_options)
464
- parser.set_negative_aliases(self.negative_opt)
465
- parser.set_aliases({'licence': 'license'})
466
- args = parser.getopt(args=self.script_args, object=self)
467
- option_order = parser.get_option_order()
468
- log.set_verbosity(self.verbose)
469
-
470
- # for display options we return immediately
471
- if self.handle_display_options(option_order):
472
- return
473
- while args:
474
- args = self._parse_command_opts(parser, args)
475
- if args is None: # user asked for help (and got it)
476
- return
477
-
478
- # Handle the cases of --help as a "global" option, ie.
479
- # "setup.py --help" and "setup.py --help command ...". For the
480
- # former, we show global options (--verbose, --dry-run, etc.)
481
- # and display-only options (--name, --version, etc.); for the
482
- # latter, we omit the display-only options and show help for
483
- # each command listed on the command line.
484
- if self.help:
485
- self._show_help(
486
- parser, display_options=len(self.commands) == 0, commands=self.commands
487
- )
488
- return
489
-
490
- # Oops, no commands found -- an end-user error
491
- if not self.commands:
492
- raise DistutilsArgError("no commands supplied")
493
-
494
- # All is well: return true
495
- return True
496
-
497
- def _get_toplevel_options(self):
498
- """Return the non-display options recognized at the top level.
499
-
500
- This includes options that are recognized *only* at the top
501
- level as well as options recognized for commands.
502
- """
503
- return self.global_options + [
504
- (
505
- "command-packages=",
506
- None,
507
- "list of packages that provide distutils commands",
508
- ),
509
- ]
510
-
511
- def _parse_command_opts(self, parser, args): # noqa: C901
512
- """Parse the command-line options for a single command.
513
- 'parser' must be a FancyGetopt instance; 'args' must be the list
514
- of arguments, starting with the current command (whose options
515
- we are about to parse). Returns a new version of 'args' with
516
- the next command at the front of the list; will be the empty
517
- list if there are no more commands on the command line. Returns
518
- None if the user asked for help on this command.
519
- """
520
- # late import because of mutual dependence between these modules
521
- from distutils.cmd import Command
522
-
523
- # Pull the current command from the head of the command line
524
- command = args[0]
525
- if not command_re.match(command):
526
- raise SystemExit("invalid command name '%s'" % command)
527
- self.commands.append(command)
528
-
529
- # Dig up the command class that implements this command, so we
530
- # 1) know that it's a valid command, and 2) know which options
531
- # it takes.
532
- try:
533
- cmd_class = self.get_command_class(command)
534
- except DistutilsModuleError as msg:
535
- raise DistutilsArgError(msg)
536
-
537
- # Require that the command class be derived from Command -- want
538
- # to be sure that the basic "command" interface is implemented.
539
- if not issubclass(cmd_class, Command):
540
- raise DistutilsClassError(
541
- "command class %s must subclass Command" % cmd_class
542
- )
543
-
544
- # Also make sure that the command object provides a list of its
545
- # known options.
546
- if not (
547
- hasattr(cmd_class, 'user_options')
548
- and isinstance(cmd_class.user_options, list)
549
- ):
550
- msg = (
551
- "command class %s must provide "
552
- "'user_options' attribute (a list of tuples)"
553
- )
554
- raise DistutilsClassError(msg % cmd_class)
555
-
556
- # If the command class has a list of negative alias options,
557
- # merge it in with the global negative aliases.
558
- negative_opt = self.negative_opt
559
- if hasattr(cmd_class, 'negative_opt'):
560
- negative_opt = negative_opt.copy()
561
- negative_opt.update(cmd_class.negative_opt)
562
-
563
- # Check for help_options in command class. They have a different
564
- # format (tuple of four) so we need to preprocess them here.
565
- if hasattr(cmd_class, 'help_options') and isinstance(
566
- cmd_class.help_options, list
567
- ):
568
- help_options = fix_help_options(cmd_class.help_options)
569
- else:
570
- help_options = []
571
-
572
- # All commands support the global options too, just by adding
573
- # in 'global_options'.
574
- parser.set_option_table(
575
- self.global_options + cmd_class.user_options + help_options
576
- )
577
- parser.set_negative_aliases(negative_opt)
578
- (args, opts) = parser.getopt(args[1:])
579
- if hasattr(opts, 'help') and opts.help:
580
- self._show_help(parser, display_options=0, commands=[cmd_class])
581
- return
582
-
583
- if hasattr(cmd_class, 'help_options') and isinstance(
584
- cmd_class.help_options, list
585
- ):
586
- help_option_found = 0
587
- for (help_option, short, desc, func) in cmd_class.help_options:
588
- if hasattr(opts, parser.get_attr_name(help_option)):
589
- help_option_found = 1
590
- if callable(func):
591
- func()
592
- else:
593
- raise DistutilsClassError(
594
- "invalid help function %r for help option '%s': "
595
- "must be a callable object (function, etc.)"
596
- % (func, help_option)
597
- )
598
-
599
- if help_option_found:
600
- return
601
-
602
- # Put the options from the command-line into their official
603
- # holding pen, the 'command_options' dictionary.
604
- opt_dict = self.get_option_dict(command)
605
- for (name, value) in vars(opts).items():
606
- opt_dict[name] = ("command line", value)
607
-
608
- return args
609
-
610
- def finalize_options(self):
611
- """Set final values for all the options on the Distribution
612
- instance, analogous to the .finalize_options() method of Command
613
- objects.
614
- """
615
- for attr in ('keywords', 'platforms'):
616
- value = getattr(self.metadata, attr)
617
- if value is None:
618
- continue
619
- if isinstance(value, str):
620
- value = [elm.strip() for elm in value.split(',')]
621
- setattr(self.metadata, attr, value)
622
-
623
- def _show_help(self, parser, global_options=1, display_options=1, commands=[]):
624
- """Show help for the setup script command-line in the form of
625
- several lists of command-line options. 'parser' should be a
626
- FancyGetopt instance; do not expect it to be returned in the
627
- same state, as its option table will be reset to make it
628
- generate the correct help text.
629
-
630
- If 'global_options' is true, lists the global options:
631
- --verbose, --dry-run, etc. If 'display_options' is true, lists
632
- the "display-only" options: --name, --version, etc. Finally,
633
- lists per-command help for every command name or command class
634
- in 'commands'.
635
- """
636
- # late import because of mutual dependence between these modules
637
- from distutils.core import gen_usage
638
- from distutils.cmd import Command
639
-
640
- if global_options:
641
- if display_options:
642
- options = self._get_toplevel_options()
643
- else:
644
- options = self.global_options
645
- parser.set_option_table(options)
646
- parser.print_help(self.common_usage + "\nGlobal options:")
647
- print('')
648
-
649
- if display_options:
650
- parser.set_option_table(self.display_options)
651
- parser.print_help(
652
- "Information display options (just display "
653
- + "information, ignore any commands)"
654
- )
655
- print('')
656
-
657
- for command in self.commands:
658
- if isinstance(command, type) and issubclass(command, Command):
659
- klass = command
660
- else:
661
- klass = self.get_command_class(command)
662
- if hasattr(klass, 'help_options') and isinstance(klass.help_options, list):
663
- parser.set_option_table(
664
- klass.user_options + fix_help_options(klass.help_options)
665
- )
666
- else:
667
- parser.set_option_table(klass.user_options)
668
- parser.print_help("Options for '%s' command:" % klass.__name__)
669
- print('')
670
-
671
- print(gen_usage(self.script_name))
672
-
673
- def handle_display_options(self, option_order):
674
- """If there were any non-global "display-only" options
675
- (--help-commands or the metadata display options) on the command
676
- line, display the requested info and return true; else return
677
- false.
678
- """
679
- from distutils.core import gen_usage
680
-
681
- # User just wants a list of commands -- we'll print it out and stop
682
- # processing now (ie. if they ran "setup --help-commands foo bar",
683
- # we ignore "foo bar").
684
- if self.help_commands:
685
- self.print_commands()
686
- print('')
687
- print(gen_usage(self.script_name))
688
- return 1
689
-
690
- # If user supplied any of the "display metadata" options, then
691
- # display that metadata in the order in which the user supplied the
692
- # metadata options.
693
- any_display_options = 0
694
- is_display_option = {}
695
- for option in self.display_options:
696
- is_display_option[option[0]] = 1
697
-
698
- for (opt, val) in option_order:
699
- if val and is_display_option.get(opt):
700
- opt = translate_longopt(opt)
701
- value = getattr(self.metadata, "get_" + opt)()
702
- if opt in ['keywords', 'platforms']:
703
- print(','.join(value))
704
- elif opt in ('classifiers', 'provides', 'requires', 'obsoletes'):
705
- print('\n'.join(value))
706
- else:
707
- print(value)
708
- any_display_options = 1
709
-
710
- return any_display_options
711
-
712
- def print_command_list(self, commands, header, max_length):
713
- """Print a subset of the list of all commands -- used by
714
- 'print_commands()'.
715
- """
716
- print(header + ":")
717
-
718
- for cmd in commands:
719
- klass = self.cmdclass.get(cmd)
720
- if not klass:
721
- klass = self.get_command_class(cmd)
722
- try:
723
- description = klass.description
724
- except AttributeError:
725
- description = "(no description available)"
726
-
727
- print(" %-*s %s" % (max_length, cmd, description))
728
-
729
- def print_commands(self):
730
- """Print out a help message listing all available commands with a
731
- description of each. The list is divided into "standard commands"
732
- (listed in distutils.command.__all__) and "extra commands"
733
- (mentioned in self.cmdclass, but not a standard command). The
734
- descriptions come from the command class attribute
735
- 'description'.
736
- """
737
- import distutils.command
738
-
739
- std_commands = distutils.command.__all__
740
- is_std = {}
741
- for cmd in std_commands:
742
- is_std[cmd] = 1
743
-
744
- extra_commands = []
745
- for cmd in self.cmdclass.keys():
746
- if not is_std.get(cmd):
747
- extra_commands.append(cmd)
748
-
749
- max_length = 0
750
- for cmd in std_commands + extra_commands:
751
- if len(cmd) > max_length:
752
- max_length = len(cmd)
753
-
754
- self.print_command_list(std_commands, "Standard commands", max_length)
755
- if extra_commands:
756
- print()
757
- self.print_command_list(extra_commands, "Extra commands", max_length)
758
-
759
- def get_command_list(self):
760
- """Get a list of (command, description) tuples.
761
- The list is divided into "standard commands" (listed in
762
- distutils.command.__all__) and "extra commands" (mentioned in
763
- self.cmdclass, but not a standard command). The descriptions come
764
- from the command class attribute 'description'.
765
- """
766
- # Currently this is only used on Mac OS, for the Mac-only GUI
767
- # Distutils interface (by Jack Jansen)
768
- import distutils.command
769
-
770
- std_commands = distutils.command.__all__
771
- is_std = {}
772
- for cmd in std_commands:
773
- is_std[cmd] = 1
774
-
775
- extra_commands = []
776
- for cmd in self.cmdclass.keys():
777
- if not is_std.get(cmd):
778
- extra_commands.append(cmd)
779
-
780
- rv = []
781
- for cmd in std_commands + extra_commands:
782
- klass = self.cmdclass.get(cmd)
783
- if not klass:
784
- klass = self.get_command_class(cmd)
785
- try:
786
- description = klass.description
787
- except AttributeError:
788
- description = "(no description available)"
789
- rv.append((cmd, description))
790
- return rv
791
-
792
- # -- Command class/object methods ----------------------------------
793
-
794
- def get_command_packages(self):
795
- """Return a list of packages from which commands are loaded."""
796
- pkgs = self.command_packages
797
- if not isinstance(pkgs, list):
798
- if pkgs is None:
799
- pkgs = ''
800
- pkgs = [pkg.strip() for pkg in pkgs.split(',') if pkg != '']
801
- if "distutils.command" not in pkgs:
802
- pkgs.insert(0, "distutils.command")
803
- self.command_packages = pkgs
804
- return pkgs
805
-
806
- def get_command_class(self, command):
807
- """Return the class that implements the Distutils command named by
808
- 'command'. First we check the 'cmdclass' dictionary; if the
809
- command is mentioned there, we fetch the class object from the
810
- dictionary and return it. Otherwise we load the command module
811
- ("distutils.command." + command) and fetch the command class from
812
- the module. The loaded class is also stored in 'cmdclass'
813
- to speed future calls to 'get_command_class()'.
814
-
815
- Raises DistutilsModuleError if the expected module could not be
816
- found, or if that module does not define the expected class.
817
- """
818
- klass = self.cmdclass.get(command)
819
- if klass:
820
- return klass
821
-
822
- for pkgname in self.get_command_packages():
823
- module_name = "{}.{}".format(pkgname, command)
824
- klass_name = command
825
-
826
- try:
827
- __import__(module_name)
828
- module = sys.modules[module_name]
829
- except ImportError:
830
- continue
831
-
832
- try:
833
- klass = getattr(module, klass_name)
834
- except AttributeError:
835
- raise DistutilsModuleError(
836
- "invalid command '%s' (no class '%s' in module '%s')"
837
- % (command, klass_name, module_name)
838
- )
839
-
840
- self.cmdclass[command] = klass
841
- return klass
842
-
843
- raise DistutilsModuleError("invalid command '%s'" % command)
844
-
845
- def get_command_obj(self, command, create=1):
846
- """Return the command object for 'command'. Normally this object
847
- is cached on a previous call to 'get_command_obj()'; if no command
848
- object for 'command' is in the cache, then we either create and
849
- return it (if 'create' is true) or return None.
850
- """
851
- cmd_obj = self.command_obj.get(command)
852
- if not cmd_obj and create:
853
- if DEBUG:
854
- self.announce(
855
- "Distribution.get_command_obj(): "
856
- "creating '%s' command object" % command
857
- )
858
-
859
- klass = self.get_command_class(command)
860
- cmd_obj = self.command_obj[command] = klass(self)
861
- self.have_run[command] = 0
862
-
863
- # Set any options that were supplied in config files
864
- # or on the command line. (NB. support for error
865
- # reporting is lame here: any errors aren't reported
866
- # until 'finalize_options()' is called, which means
867
- # we won't report the source of the error.)
868
- options = self.command_options.get(command)
869
- if options:
870
- self._set_command_options(cmd_obj, options)
871
-
872
- return cmd_obj
873
-
874
- def _set_command_options(self, command_obj, option_dict=None): # noqa: C901
875
- """Set the options for 'command_obj' from 'option_dict'. Basically
876
- this means copying elements of a dictionary ('option_dict') to
877
- attributes of an instance ('command').
878
-
879
- 'command_obj' must be a Command instance. If 'option_dict' is not
880
- supplied, uses the standard option dictionary for this command
881
- (from 'self.command_options').
882
- """
883
- command_name = command_obj.get_command_name()
884
- if option_dict is None:
885
- option_dict = self.get_option_dict(command_name)
886
-
887
- if DEBUG:
888
- self.announce(" setting options for '%s' command:" % command_name)
889
- for (option, (source, value)) in option_dict.items():
890
- if DEBUG:
891
- self.announce(" {} = {} (from {})".format(option, value, source))
892
- try:
893
- bool_opts = [translate_longopt(o) for o in command_obj.boolean_options]
894
- except AttributeError:
895
- bool_opts = []
896
- try:
897
- neg_opt = command_obj.negative_opt
898
- except AttributeError:
899
- neg_opt = {}
900
-
901
- try:
902
- is_string = isinstance(value, str)
903
- if option in neg_opt and is_string:
904
- setattr(command_obj, neg_opt[option], not strtobool(value))
905
- elif option in bool_opts and is_string:
906
- setattr(command_obj, option, strtobool(value))
907
- elif hasattr(command_obj, option):
908
- setattr(command_obj, option, value)
909
- else:
910
- raise DistutilsOptionError(
911
- "error in %s: command '%s' has no such option '%s'"
912
- % (source, command_name, option)
913
- )
914
- except ValueError as msg:
915
- raise DistutilsOptionError(msg)
916
-
917
- def reinitialize_command(self, command, reinit_subcommands=0):
918
- """Reinitializes a command to the state it was in when first
919
- returned by 'get_command_obj()': ie., initialized but not yet
920
- finalized. This provides the opportunity to sneak option
921
- values in programmatically, overriding or supplementing
922
- user-supplied values from the config files and command line.
923
- You'll have to re-finalize the command object (by calling
924
- 'finalize_options()' or 'ensure_finalized()') before using it for
925
- real.
926
-
927
- 'command' should be a command name (string) or command object. If
928
- 'reinit_subcommands' is true, also reinitializes the command's
929
- sub-commands, as declared by the 'sub_commands' class attribute (if
930
- it has one). See the "install" command for an example. Only
931
- reinitializes the sub-commands that actually matter, ie. those
932
- whose test predicates return true.
933
-
934
- Returns the reinitialized command object.
935
- """
936
- from distutils.cmd import Command
937
-
938
- if not isinstance(command, Command):
939
- command_name = command
940
- command = self.get_command_obj(command_name)
941
- else:
942
- command_name = command.get_command_name()
943
-
944
- if not command.finalized:
945
- return command
946
- command.initialize_options()
947
- command.finalized = 0
948
- self.have_run[command_name] = 0
949
- self._set_command_options(command)
950
-
951
- if reinit_subcommands:
952
- for sub in command.get_sub_commands():
953
- self.reinitialize_command(sub, reinit_subcommands)
954
-
955
- return command
956
-
957
- # -- Methods that operate on the Distribution ----------------------
958
-
959
- def announce(self, msg, level=log.INFO):
960
- log.log(level, msg)
961
-
962
- def run_commands(self):
963
- """Run each command that was seen on the setup script command line.
964
- Uses the list of commands found and cache of command objects
965
- created by 'get_command_obj()'.
966
- """
967
- for cmd in self.commands:
968
- self.run_command(cmd)
969
-
970
- # -- Methods that operate on its Commands --------------------------
971
-
972
- def run_command(self, command):
973
- """Do whatever it takes to run a command (including nothing at all,
974
- if the command has already been run). Specifically: if we have
975
- already created and run the command named by 'command', return
976
- silently without doing anything. If the command named by 'command'
977
- doesn't even have a command object yet, create one. Then invoke
978
- 'run()' on that command object (or an existing one).
979
- """
980
- # Already been here, done that? then return silently.
981
- if self.have_run.get(command):
982
- return
983
-
984
- log.info("running %s", command)
985
- cmd_obj = self.get_command_obj(command)
986
- cmd_obj.ensure_finalized()
987
- cmd_obj.run()
988
- self.have_run[command] = 1
989
-
990
- # -- Distribution query methods ------------------------------------
991
-
992
- def has_pure_modules(self):
993
- return len(self.packages or self.py_modules or []) > 0
994
-
995
- def has_ext_modules(self):
996
- return self.ext_modules and len(self.ext_modules) > 0
997
-
998
- def has_c_libraries(self):
999
- return self.libraries and len(self.libraries) > 0
1000
-
1001
- def has_modules(self):
1002
- return self.has_pure_modules() or self.has_ext_modules()
1003
-
1004
- def has_headers(self):
1005
- return self.headers and len(self.headers) > 0
1006
-
1007
- def has_scripts(self):
1008
- return self.scripts and len(self.scripts) > 0
1009
-
1010
- def has_data_files(self):
1011
- return self.data_files and len(self.data_files) > 0
1012
-
1013
- def is_pure(self):
1014
- return (
1015
- self.has_pure_modules()
1016
- and not self.has_ext_modules()
1017
- and not self.has_c_libraries()
1018
- )
1019
-
1020
- # -- Metadata query methods ----------------------------------------
1021
-
1022
- # If you're looking for 'get_name()', 'get_version()', and so forth,
1023
- # they are defined in a sneaky way: the constructor binds self.get_XXX
1024
- # to self.metadata.get_XXX. The actual code is in the
1025
- # DistributionMetadata class, below.
1026
-
1027
-
1028
- class DistributionMetadata:
1029
- """Dummy class to hold the distribution meta-data: name, version,
1030
- author, and so forth.
1031
- """
1032
-
1033
- _METHOD_BASENAMES = (
1034
- "name",
1035
- "version",
1036
- "author",
1037
- "author_email",
1038
- "maintainer",
1039
- "maintainer_email",
1040
- "url",
1041
- "license",
1042
- "description",
1043
- "long_description",
1044
- "keywords",
1045
- "platforms",
1046
- "fullname",
1047
- "contact",
1048
- "contact_email",
1049
- "classifiers",
1050
- "download_url",
1051
- # PEP 314
1052
- "provides",
1053
- "requires",
1054
- "obsoletes",
1055
- )
1056
-
1057
- def __init__(self, path=None):
1058
- if path is not None:
1059
- self.read_pkg_file(open(path))
1060
- else:
1061
- self.name = None
1062
- self.version = None
1063
- self.author = None
1064
- self.author_email = None
1065
- self.maintainer = None
1066
- self.maintainer_email = None
1067
- self.url = None
1068
- self.license = None
1069
- self.description = None
1070
- self.long_description = None
1071
- self.keywords = None
1072
- self.platforms = None
1073
- self.classifiers = None
1074
- self.download_url = None
1075
- # PEP 314
1076
- self.provides = None
1077
- self.requires = None
1078
- self.obsoletes = None
1079
-
1080
- def read_pkg_file(self, file):
1081
- """Reads the metadata values from a file object."""
1082
- msg = message_from_file(file)
1083
-
1084
- def _read_field(name):
1085
- value = msg[name]
1086
- if value and value != "UNKNOWN":
1087
- return value
1088
-
1089
- def _read_list(name):
1090
- values = msg.get_all(name, None)
1091
- if values == []:
1092
- return None
1093
- return values
1094
-
1095
- metadata_version = msg['metadata-version']
1096
- self.name = _read_field('name')
1097
- self.version = _read_field('version')
1098
- self.description = _read_field('summary')
1099
- # we are filling author only.
1100
- self.author = _read_field('author')
1101
- self.maintainer = None
1102
- self.author_email = _read_field('author-email')
1103
- self.maintainer_email = None
1104
- self.url = _read_field('home-page')
1105
- self.license = _read_field('license')
1106
-
1107
- if 'download-url' in msg:
1108
- self.download_url = _read_field('download-url')
1109
- else:
1110
- self.download_url = None
1111
-
1112
- self.long_description = _read_field('description')
1113
- self.description = _read_field('summary')
1114
-
1115
- if 'keywords' in msg:
1116
- self.keywords = _read_field('keywords').split(',')
1117
-
1118
- self.platforms = _read_list('platform')
1119
- self.classifiers = _read_list('classifier')
1120
-
1121
- # PEP 314 - these fields only exist in 1.1
1122
- if metadata_version == '1.1':
1123
- self.requires = _read_list('requires')
1124
- self.provides = _read_list('provides')
1125
- self.obsoletes = _read_list('obsoletes')
1126
- else:
1127
- self.requires = None
1128
- self.provides = None
1129
- self.obsoletes = None
1130
-
1131
- def write_pkg_info(self, base_dir):
1132
- """Write the PKG-INFO file into the release tree."""
1133
- with open(
1134
- os.path.join(base_dir, 'PKG-INFO'), 'w', encoding='UTF-8'
1135
- ) as pkg_info:
1136
- self.write_pkg_file(pkg_info)
1137
-
1138
- def write_pkg_file(self, file):
1139
- """Write the PKG-INFO format data to a file object."""
1140
- version = '1.0'
1141
- if (
1142
- self.provides
1143
- or self.requires
1144
- or self.obsoletes
1145
- or self.classifiers
1146
- or self.download_url
1147
- ):
1148
- version = '1.1'
1149
-
1150
- # required fields
1151
- file.write('Metadata-Version: %s\n' % version)
1152
- file.write('Name: %s\n' % self.get_name())
1153
- file.write('Version: %s\n' % self.get_version())
1154
-
1155
- def maybe_write(header, val):
1156
- if val:
1157
- file.write(f"{header}: {val}\n")
1158
-
1159
- # optional fields
1160
- maybe_write("Summary", self.get_description())
1161
- maybe_write("Home-page", self.get_url())
1162
- maybe_write("Author", self.get_contact())
1163
- maybe_write("Author-email", self.get_contact_email())
1164
- maybe_write("License", self.get_license())
1165
- maybe_write("Download-URL", self.download_url)
1166
- maybe_write("Description", rfc822_escape(self.get_long_description() or ""))
1167
- maybe_write("Keywords", ",".join(self.get_keywords()))
1168
-
1169
- self._write_list(file, 'Platform', self.get_platforms())
1170
- self._write_list(file, 'Classifier', self.get_classifiers())
1171
-
1172
- # PEP 314
1173
- self._write_list(file, 'Requires', self.get_requires())
1174
- self._write_list(file, 'Provides', self.get_provides())
1175
- self._write_list(file, 'Obsoletes', self.get_obsoletes())
1176
-
1177
- def _write_list(self, file, name, values):
1178
- values = values or []
1179
- for value in values:
1180
- file.write('{}: {}\n'.format(name, value))
1181
-
1182
- # -- Metadata query methods ----------------------------------------
1183
-
1184
- def get_name(self):
1185
- return self.name or "UNKNOWN"
1186
-
1187
- def get_version(self):
1188
- return self.version or "0.0.0"
1189
-
1190
- def get_fullname(self):
1191
- return "{}-{}".format(self.get_name(), self.get_version())
1192
-
1193
- def get_author(self):
1194
- return self.author
1195
-
1196
- def get_author_email(self):
1197
- return self.author_email
1198
-
1199
- def get_maintainer(self):
1200
- return self.maintainer
1201
-
1202
- def get_maintainer_email(self):
1203
- return self.maintainer_email
1204
-
1205
- def get_contact(self):
1206
- return self.maintainer or self.author
1207
-
1208
- def get_contact_email(self):
1209
- return self.maintainer_email or self.author_email
1210
-
1211
- def get_url(self):
1212
- return self.url
1213
-
1214
- def get_license(self):
1215
- return self.license
1216
-
1217
- get_licence = get_license
1218
-
1219
- def get_description(self):
1220
- return self.description
1221
-
1222
- def get_long_description(self):
1223
- return self.long_description
1224
-
1225
- def get_keywords(self):
1226
- return self.keywords or []
1227
-
1228
- def set_keywords(self, value):
1229
- self.keywords = _ensure_list(value, 'keywords')
1230
-
1231
- def get_platforms(self):
1232
- return self.platforms
1233
-
1234
- def set_platforms(self, value):
1235
- self.platforms = _ensure_list(value, 'platforms')
1236
-
1237
- def get_classifiers(self):
1238
- return self.classifiers or []
1239
-
1240
- def set_classifiers(self, value):
1241
- self.classifiers = _ensure_list(value, 'classifiers')
1242
-
1243
- def get_download_url(self):
1244
- return self.download_url
1245
-
1246
- # PEP 314
1247
- def get_requires(self):
1248
- return self.requires or []
1249
-
1250
- def set_requires(self, value):
1251
- import distutils.versionpredicate
1252
-
1253
- for v in value:
1254
- distutils.versionpredicate.VersionPredicate(v)
1255
- self.requires = list(value)
1256
-
1257
- def get_provides(self):
1258
- return self.provides or []
1259
-
1260
- def set_provides(self, value):
1261
- value = [v.strip() for v in value]
1262
- for v in value:
1263
- import distutils.versionpredicate
1264
-
1265
- distutils.versionpredicate.split_provision(v)
1266
- self.provides = value
1267
-
1268
- def get_obsoletes(self):
1269
- return self.obsoletes or []
1270
-
1271
- def set_obsoletes(self, value):
1272
- import distutils.versionpredicate
1273
-
1274
- for v in value:
1275
- distutils.versionpredicate.VersionPredicate(v)
1276
- self.obsoletes = list(value)
1277
-
1278
-
1279
- def fix_help_options(options):
1280
- """Convert a 4-tuple 'help_options' list as found in various command
1281
- classes to the 3-tuple form required by FancyGetopt.
1282
- """
1283
- new_options = []
1284
- for help_tuple in options:
1285
- new_options.append(help_tuple[0:3])
1286
- return new_options
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
spaces/Boranbruh/ehartford-WizardLM-7B-Uncensored/app.py DELETED
@@ -1,3 +0,0 @@
1
- import gradio as gr
2
-
3
- gr.Interface.load("models/ehartford/WizardLM-7B-Uncensored").launch()
 
 
 
 
spaces/CVPR/LIVE/thrust/examples/cpp_integration/device.h DELETED
@@ -1,7 +0,0 @@
1
- #pragma once
2
-
3
- #include <thrust/host_vector.h>
4
-
5
- // function prototype
6
- void sort_on_device(thrust::host_vector<int>& V);
7
-
 
 
 
 
 
 
 
 
spaces/CVPR/LIVE/thrust/thrust/iterator/detail/is_iterator_category.h DELETED
@@ -1,60 +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
- #include <thrust/detail/config.h>
20
- #include <thrust/iterator/iterator_categories.h>
21
- #include <thrust/detail/type_traits.h>
22
-
23
- namespace thrust
24
- {
25
-
26
- namespace detail
27
- {
28
-
29
- template <typename T>
30
- struct is_host_iterator_category
31
- : thrust::detail::or_<
32
- thrust::detail::is_convertible<T, thrust::input_host_iterator_tag>,
33
- thrust::detail::is_convertible<T, thrust::output_host_iterator_tag>
34
- >
35
- {
36
- }; // end is_host_iterator_category
37
-
38
- template <typename T>
39
- struct is_device_iterator_category
40
- : thrust::detail::or_<
41
- thrust::detail::is_convertible<T, thrust::input_device_iterator_tag>,
42
- thrust::detail::is_convertible<T, thrust::output_device_iterator_tag>
43
- >
44
- {
45
- }; // end is_device_iterator_category
46
-
47
-
48
- template <typename T>
49
- struct is_iterator_category
50
- : thrust::detail::or_<
51
- is_host_iterator_category<T>,
52
- is_device_iterator_category<T>
53
- >
54
- {
55
- }; // end is_iterator_category
56
-
57
- } // end detail
58
-
59
- } // end thrust
60
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
spaces/CVPR/lama-example/bin/report_from_tb.py DELETED
@@ -1,83 +0,0 @@
1
- #!/usr/bin/env python3
2
-
3
- import glob
4
- import os
5
- import re
6
-
7
- import tensorflow as tf
8
- from torch.utils.tensorboard import SummaryWriter
9
-
10
-
11
- GROUPING_RULES = [
12
- re.compile(r'^(?P<group>train|test|val|extra_val_.*?(256|512))_(?P<title>.*)', re.I)
13
- ]
14
-
15
-
16
- DROP_RULES = [
17
- re.compile(r'_std$', re.I)
18
- ]
19
-
20
-
21
- def need_drop(tag):
22
- for rule in DROP_RULES:
23
- if rule.search(tag):
24
- return True
25
- return False
26
-
27
-
28
- def get_group_and_title(tag):
29
- for rule in GROUPING_RULES:
30
- match = rule.search(tag)
31
- if match is None:
32
- continue
33
- return match.group('group'), match.group('title')
34
- return None, None
35
-
36
-
37
- def main(args):
38
- os.makedirs(args.outdir, exist_ok=True)
39
-
40
- ignored_events = set()
41
-
42
- for orig_fname in glob.glob(args.inglob):
43
- cur_dirpath = os.path.dirname(orig_fname) # remove filename, this should point to "version_0" directory
44
- subdirname = os.path.basename(cur_dirpath) # == "version_0" most of time
45
- exp_root_path = os.path.dirname(cur_dirpath) # remove "version_0"
46
- exp_name = os.path.basename(exp_root_path)
47
-
48
- writers_by_group = {}
49
-
50
- for e in tf.compat.v1.train.summary_iterator(orig_fname):
51
- for v in e.summary.value:
52
- if need_drop(v.tag):
53
- continue
54
-
55
- cur_group, cur_title = get_group_and_title(v.tag)
56
- if cur_group is None:
57
- if v.tag not in ignored_events:
58
- print(f'WARNING: Could not detect group for {v.tag}, ignoring it')
59
- ignored_events.add(v.tag)
60
- continue
61
-
62
- cur_writer = writers_by_group.get(cur_group, None)
63
- if cur_writer is None:
64
- if args.include_version:
65
- cur_outdir = os.path.join(args.outdir, exp_name, f'{subdirname}_{cur_group}')
66
- else:
67
- cur_outdir = os.path.join(args.outdir, exp_name, cur_group)
68
- cur_writer = SummaryWriter(cur_outdir)
69
- writers_by_group[cur_group] = cur_writer
70
-
71
- cur_writer.add_scalar(cur_title, v.simple_value, global_step=e.step, walltime=e.wall_time)
72
-
73
-
74
- if __name__ == '__main__':
75
- import argparse
76
-
77
- aparser = argparse.ArgumentParser()
78
- aparser.add_argument('inglob', type=str)
79
- aparser.add_argument('outdir', type=str)
80
- aparser.add_argument('--include-version', action='store_true',
81
- help='Include subdirectory name e.g. "version_0" into output path')
82
-
83
- main(aparser.parse_args())
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
spaces/ChallengeHub/Chinese-LangChain/assets/custom.js DELETED
@@ -1 +0,0 @@
1
- // custom javascript here
 
 
spaces/ChrisCaviar/ControlNet-v1-1/app_scribble_interactive.py DELETED
@@ -1,112 +0,0 @@
1
- #!/usr/bin/env python
2
-
3
- import gradio as gr
4
- import numpy as np
5
-
6
- from utils import randomize_seed_fn
7
-
8
-
9
- def create_canvas(w, h):
10
- return np.zeros(shape=(h, w, 3), dtype=np.uint8) + 255
11
-
12
-
13
- def create_demo(process, max_images=12, default_num_images=3):
14
- with gr.Blocks() as demo:
15
- with gr.Row():
16
- with gr.Column():
17
- canvas_width = gr.Slider(label='Canvas width',
18
- minimum=256,
19
- maximum=512,
20
- value=512,
21
- step=1)
22
- canvas_height = gr.Slider(label='Canvas height',
23
- minimum=256,
24
- maximum=512,
25
- value=512,
26
- step=1)
27
- create_button = gr.Button('Open drawing canvas!')
28
- image = gr.Image(tool='sketch', brush_radius=10)
29
- prompt = gr.Textbox(label='Prompt')
30
- run_button = gr.Button('Run')
31
- with gr.Accordion('Advanced options', open=False):
32
- num_samples = gr.Slider(label='Number of images',
33
- minimum=1,
34
- maximum=max_images,
35
- value=default_num_images,
36
- step=1)
37
- image_resolution = gr.Slider(label='Image resolution',
38
- minimum=256,
39
- maximum=512,
40
- value=512,
41
- step=256)
42
- num_steps = gr.Slider(label='Number of steps',
43
- minimum=1,
44
- maximum=100,
45
- value=20,
46
- step=1)
47
- guidance_scale = gr.Slider(label='Guidance scale',
48
- minimum=0.1,
49
- maximum=30.0,
50
- value=9.0,
51
- step=0.1)
52
- seed = gr.Slider(label='Seed',
53
- minimum=0,
54
- maximum=1000000,
55
- step=1,
56
- value=0,
57
- randomize=True)
58
- randomize_seed = gr.Checkbox(label='Randomize seed',
59
- value=True)
60
- a_prompt = gr.Textbox(
61
- label='Additional prompt',
62
- value='best quality, extremely detailed')
63
- n_prompt = gr.Textbox(
64
- label='Negative prompt',
65
- value=
66
- 'longbody, lowres, bad anatomy, bad hands, missing fingers, extra digit, fewer digits, cropped, worst quality, low quality'
67
- )
68
- with gr.Column():
69
- result = gr.Gallery(label='Output', show_label=False).style(
70
- columns=2, object_fit='scale-down')
71
-
72
- create_button.click(fn=create_canvas,
73
- inputs=[canvas_width, canvas_height],
74
- outputs=image,
75
- queue=False)
76
- inputs = [
77
- image,
78
- prompt,
79
- a_prompt,
80
- n_prompt,
81
- num_samples,
82
- image_resolution,
83
- num_steps,
84
- guidance_scale,
85
- seed,
86
- ]
87
- prompt.submit(
88
- fn=randomize_seed_fn,
89
- inputs=[seed, randomize_seed],
90
- outputs=seed,
91
- ).then(
92
- fn=process,
93
- inputs=inputs,
94
- outputs=result,
95
- )
96
- run_button.click(
97
- fn=randomize_seed_fn,
98
- inputs=[seed, randomize_seed],
99
- outputs=seed,
100
- ).then(
101
- fn=process,
102
- inputs=inputs,
103
- outputs=result,
104
- )
105
- return demo
106
-
107
-
108
- if __name__ == '__main__':
109
- from model import Model
110
- model = Model(task_name='scribble')
111
- demo = create_demo(model.process_scribble_interactive)
112
- demo.queue().launch()
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
spaces/CikeyQI/Yunzai/Yunzai/plugins/ws-plugin/apps/request/request.js DELETED
@@ -1,65 +0,0 @@
1
- import { sendSocketList, Config, Version } from '../../components/index.js'
2
-
3
- Bot.on('request', async e => {
4
- if (sendSocketList.length == 0) return false
5
- let other = {}
6
- switch (e.request_type) {
7
- case 'friend':
8
- other.request_type = 'friend'
9
- switch (e.sub_type) {
10
- case 'add':
11
- if (!Config.friendAdd) return false
12
- break;
13
- default:
14
- return false
15
- }
16
- break;
17
- case 'group':
18
- other.request_type = 'group'
19
- other.group_id = e.group_id
20
- switch (e.sub_type) {
21
- case 'invite':
22
- if (!Config.groupInvite) return false
23
- other.sub_type = 'invite'
24
- break;
25
- case 'add':
26
- if (!Config.groupAdd) return false
27
- other.sub_type = 'add'
28
- break;
29
-
30
- default:
31
- return false;
32
- }
33
- break;
34
-
35
- default:
36
- return false;
37
- }
38
-
39
- let msg = {
40
- time: e.time,
41
- self_id: e.self_id,
42
- post_type: 'request',
43
- flag: e.flag,
44
- user_id: e.user_id,
45
- comment: e.comment,
46
- ...other
47
- }
48
- msg = JSON.stringify(msg)
49
- sendSocketList.forEach(i => {
50
- if (i.status == 1) {
51
- switch (Number(i.type)) {
52
- case 1:
53
- case 2:
54
- if (Version.isTrss) {
55
- if (i.uin != e.self_id) return
56
- if (!Version.protocol.some(i => i == e.bot?.version?.name)) return
57
- }
58
- i.ws.send(msg)
59
- break;
60
- default:
61
- break;
62
- }
63
- }
64
- })
65
- })
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
spaces/CofAI/tv/README.md DELETED
@@ -1,44 +0,0 @@
1
- ---
2
- title: CofTV
3
- emoji: 📺☕📺
4
- colorFrom: green
5
- colorTo: green
6
- sdk: docker
7
- pinned: false
8
- app_port: 7860
9
- duplicated_from: TNR-5/AI-WebTV
10
- ---
11
-
12
- A generative AI WebTV, powered by Zeroscope and Hugging Face.
13
-
14
- This is just the frontend part, you will need the media-server (also open source) to make it work.
15
-
16
- Warning: this is an experimental, proof-of-concept project made in a few days.
17
-
18
- It is not ready for production use by other people! Also, this use models that should only be used for research purposes (no commercial usage).
19
-
20
- Note: because the stream uses FLV, it doesn't work on iPhone. There is however a [Twitch mirror here](https://www.twitch.tv/ai_webtv).
21
-
22
- The main code of the webtv is located inside the [media-server](https://huggingface.co/spaces/jbilcke-hf/media-server/tree/main) :
23
-
24
- manual steps:
25
- - human input to write a short paragraph describing a multi-shot video sequence
26
- - manual submit it to GPT-4 to generate a list of video captions for each shot (the system instructions are extracts from a stable diffusion guide)
27
- - commit the captions to the [playlist database](https://huggingface.co/spaces/jbilcke-hf/media-server/raw/main/database.json)
28
-
29
- Inside the `media-server` space (generation process running in the background):
30
- - for each prompt in the database
31
- - generate a silent 3 seconds video clip with Zeroscope V2 576w (hosted on Hugging Face Spaces)
32
- - upscale the clip with Zeroscope V2 XL (also a HF Space)
33
- - perform frame interpolation with FILM (also a HF Space)
34
- - storage in the Persistent Storage of the media-server Space
35
-
36
- Inside the `media-server` space (streaming process running in the foreground):
37
- - for each video file in the persistent storage folder
38
- - add it to a new FFmpeg playlist (it's just a .txt file)
39
- - broadcast it over the RTMP protocol using FFmpeg (in FLV format)
40
- - diffusion of the stream using node-media-server
41
-
42
- Inside the `AI-WebTV` space:
43
- - display the stream using `mpegts.js`
44
- - this doesn't work on iPhone, but now there is also a Twitch mirror
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
spaces/Dagfinn1962/stablediffusion-models/appworks.py DELETED
@@ -1,80 +0,0 @@
1
- import gradio as gr
2
- import os
3
- import sys
4
- from pathlib import Path
5
-
6
- models = [
7
- {"name": "Stable Diffusion 1.4","url": "CompVis/stable-diffusion-v1-4"},
8
- {"name": "Stable Diffusion 1.5","url": "runwayml/stable-diffusion-v1-5"},
9
- ]
10
-
11
- current_model = models[0]
12
-
13
- text_gen = gr.Interface.load("spaces/daspartho/prompt-extend")
14
-
15
- models2 = []
16
- for model in models:
17
- model_url = f"models/{model['url']}"
18
- loaded_model = gr.Interface.load(model_url, live=True, preprocess=True)
19
- models2.append(loaded_model)
20
-
21
-
22
- def text_it(inputs, text_gen=text_gen):
23
- return text_gen(inputs)
24
-
25
-
26
- def set_model(current_model_index):
27
- global current_model
28
- current_model = models[current_model_index]
29
- return gr.update(value=f"{current_model['name']}")
30
-
31
-
32
- def send_it(inputs, model_choice):
33
- proc = models2[model_choice]
34
- return proc(inputs)
35
-
36
-
37
- with gr.Blocks() as myface:
38
- gr.HTML("""
39
- <head> <style> with global {width: 500px; position; absolute; background-color: #000000; height: 100%; margin-left:2px; margin-right: 2px; font-weight:800; font-size: 24px; margin-right: 10px; padding: 10px;} </style> </head>"""
40
-
41
- )
42
- with gr.Row():
43
- input_text = gr.Textbox(label=" ",placeholder="PROMPT HERE ",lines=4)
44
- # Model selection dropdown
45
- model_name1 = gr.Dropdown(
46
- label=" ",
47
- choices=[m["name"] for m in models],
48
- type="index",
49
- value=current_model["name"],
50
- interactive=True,
51
-
52
-
53
- )
54
- with gr.Row():
55
- see_prompts = gr.Button("Generate Prompts")
56
- run = gr.Button("Generate Images", varant="primery")
57
-
58
- with gr.Row():
59
- output1 = gr.Image(label="")
60
- output2 = gr.Image(label="")
61
- output3 = gr.Image(label="")
62
- with gr.Row():
63
- magic1 = gr.Textbox(label="Generated Prompt", lines=2)
64
- magic2 = gr.Textbox(label="Generated Prompt", lines=2)
65
- magic3 = gr.Textbox(label="Generated Prompt", lines=2)
66
-
67
- model_name1.change(set_model, inputs=model_name1, outputs=[output1, output2, output3,])
68
-
69
- run.click(send_it, inputs=[magic1, model_name1], outputs=[output1])
70
- run.click(send_it, inputs=[magic2, model_name1], outputs=[output2])
71
- run.click(send_it, inputs=[magic3, model_name1], outputs=[output3])
72
-
73
-
74
- see_prompts.click(text_it, inputs=[input_text], outputs=[magic1])
75
- see_prompts.click(text_it, inputs=[input_text], outputs=[magic2])
76
- see_prompts.click(text_it, inputs=[input_text], outputs=[magic3])
77
-
78
-
79
- myface.queue(concurrency_count=200)
80
- myface.launch(inline=True, show_api=False, max_threads=400)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
spaces/Detomo/Depth_estimation/layers.py DELETED
@@ -1,55 +0,0 @@
1
- from tensorflow.keras.layers import Layer, InputSpec
2
- import keras.utils.conv_utils as conv_utils
3
- import tensorflow as tf
4
- import tensorflow.keras.backend as K
5
-
6
-
7
- def normalize_data_format(value):
8
- if value is None:
9
- value = K.image_data_format()
10
- data_format = value.lower()
11
- if data_format not in {'channels_first', 'channels_last'}:
12
- raise ValueError('The `data_format` argument must be one of '
13
- '"channels_first", "channels_last". Received: ' +
14
- str(value))
15
- return data_format
16
-
17
-
18
- class BilinearUpSampling2D(Layer):
19
- def __init__(self, size=(2, 2), data_format=None, **kwargs):
20
- super(BilinearUpSampling2D, self).__init__(**kwargs)
21
- self.data_format = normalize_data_format(data_format)
22
- self.size = conv_utils.normalize_tuple(size, 2, 'size')
23
- self.input_spec = InputSpec(ndim=4)
24
-
25
- def compute_output_shape(self, input_shape):
26
- if self.data_format == 'channels_first':
27
- height = self.size[0] * input_shape[2] if input_shape[2] is not None else None
28
- width = self.size[1] * input_shape[3] if input_shape[3] is not None else None
29
- return (input_shape[0],
30
- input_shape[1],
31
- height,
32
- width)
33
- elif self.data_format == 'channels_last':
34
- height = self.size[0] * input_shape[1] if input_shape[1] is not None else None
35
- width = self.size[1] * input_shape[2] if input_shape[2] is not None else None
36
- return (input_shape[0],
37
- height,
38
- width,
39
- input_shape[3])
40
-
41
- def call(self, inputs):
42
- input_shape = K.shape(inputs)
43
- if self.data_format == 'channels_first':
44
- height = self.size[0] * input_shape[2] if input_shape[2] is not None else None
45
- width = self.size[1] * input_shape[3] if input_shape[3] is not None else None
46
- elif self.data_format == 'channels_last':
47
- height = self.size[0] * input_shape[1] if input_shape[1] is not None else None
48
- width = self.size[1] * input_shape[2] if input_shape[2] is not None else None
49
-
50
- return tf.image.resize(inputs, [height, width], method=tf.image.ResizeMethod.BILINEAR)
51
-
52
- def get_config(self):
53
- config = {'size': self.size, 'data_format': self.data_format}
54
- base_config = super(BilinearUpSampling2D, self).get_config()
55
- return dict(list(base_config.items()) + list(config.items()))
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
spaces/Dinoking/Garbage-Classifier-V4/app.py DELETED
@@ -1,31 +0,0 @@
1
- import gradio as gr
2
- import tensorflow as tf
3
- import numpy as np
4
- from PIL import Image
5
- import tensorflow.keras as keras
6
- import keras.applications.vgg16 as vgg16
7
-
8
- from tensorflow.keras.models import load_model
9
-
10
- # load model
11
- model = load_model('model6904.h5')
12
-
13
- classnames = ['battery','cardboard','clothes','food','glass','medical','metal','paper','plastic','shoes']
14
-
15
-
16
-
17
- def predict_image(img):
18
- img_4d=img.reshape(-1,224, 224,3)
19
- prediction=model.predict(img_4d)[0]
20
- return {classnames[i]: float(prediction[i]) for i in range(10)}
21
-
22
-
23
-
24
- image = gr.inputs.Image(shape=(224, 224))
25
- label = gr.outputs.Label(num_top_classes=3)
26
- article="<p style='text-align: center'>Made by Aditya Narendra with 🖤</p>"
27
-
28
-
29
-
30
- gr.Interface(fn=predict_image, inputs=image, title="Garbage Classifier V4-VGG16+SVM",
31
- description="This is a Garbage Classification Model Trained using VGG16+SVM(20 Epochs).Deployed to Hugging Faces using Gradio.",outputs=label,article=article,enable_queue=True,interpretation='default').launch(share="True")
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
spaces/DragGan/DragGan/stylegan_human/dnnlib/tflib/custom_ops.py DELETED
@@ -1,171 +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
- """TensorFlow custom ops builder.
10
- """
11
-
12
- import os
13
- import re
14
- import uuid
15
- import hashlib
16
- import tempfile
17
- import shutil
18
- import tensorflow as tf
19
- from tensorflow.python.client import device_lib # pylint: disable=no-name-in-module
20
-
21
- #----------------------------------------------------------------------------
22
- # Global options.
23
-
24
- cuda_cache_path = os.path.join(os.path.dirname(__file__), '_cudacache')
25
- cuda_cache_version_tag = 'v1'
26
- do_not_hash_included_headers = False # Speed up compilation by assuming that headers included by the CUDA code never change. Unsafe!
27
- verbose = True # Print status messages to stdout.
28
-
29
- compiler_bindir_search_path = [
30
- 'C:/Program Files (x86)/Microsoft Visual Studio/2017/Community/VC/Tools/MSVC/14.14.26428/bin/Hostx64/x64',
31
- 'C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/VC/Tools/MSVC/14.23.28105/bin/Hostx64/x64',
32
- 'C:/Program Files (x86)/Microsoft Visual Studio 14.0/vc/bin',
33
- ]
34
-
35
- #----------------------------------------------------------------------------
36
- # Internal helper funcs.
37
-
38
- def _find_compiler_bindir():
39
- for compiler_path in compiler_bindir_search_path:
40
- if os.path.isdir(compiler_path):
41
- return compiler_path
42
- return None
43
-
44
- def _get_compute_cap(device):
45
- caps_str = device.physical_device_desc
46
- m = re.search('compute capability: (\\d+).(\\d+)', caps_str)
47
- major = m.group(1)
48
- minor = m.group(2)
49
- return (major, minor)
50
-
51
- def _get_cuda_gpu_arch_string():
52
- gpus = [x for x in device_lib.list_local_devices() if x.device_type == 'GPU']
53
- if len(gpus) == 0:
54
- raise RuntimeError('No GPU devices found')
55
- (major, minor) = _get_compute_cap(gpus[0])
56
- return 'sm_%s%s' % (major, minor)
57
-
58
- def _run_cmd(cmd):
59
- with os.popen(cmd) as pipe:
60
- output = pipe.read()
61
- status = pipe.close()
62
- if status is not None:
63
- raise RuntimeError('NVCC returned an error. See below for full command line and output log:\n\n%s\n\n%s' % (cmd, output))
64
-
65
- def _prepare_nvcc_cli(opts):
66
- cmd = 'nvcc ' + opts.strip()
67
- cmd += ' --disable-warnings'
68
- cmd += ' --include-path "%s"' % tf.sysconfig.get_include()
69
- cmd += ' --include-path "%s"' % os.path.join(tf.sysconfig.get_include(), 'external', 'protobuf_archive', 'src')
70
- cmd += ' --include-path "%s"' % os.path.join(tf.sysconfig.get_include(), 'external', 'com_google_absl')
71
- cmd += ' --include-path "%s"' % os.path.join(tf.sysconfig.get_include(), 'external', 'eigen_archive')
72
-
73
- compiler_bindir = _find_compiler_bindir()
74
- if compiler_bindir is None:
75
- # Require that _find_compiler_bindir succeeds on Windows. Allow
76
- # nvcc to use whatever is the default on Linux.
77
- if os.name == 'nt':
78
- raise RuntimeError('Could not find MSVC/GCC/CLANG installation on this computer. Check compiler_bindir_search_path list in "%s".' % __file__)
79
- else:
80
- cmd += ' --compiler-bindir "%s"' % compiler_bindir
81
- cmd += ' 2>&1'
82
- return cmd
83
-
84
- #----------------------------------------------------------------------------
85
- # Main entry point.
86
-
87
- _plugin_cache = dict()
88
-
89
- def get_plugin(cuda_file):
90
- cuda_file_base = os.path.basename(cuda_file)
91
- cuda_file_name, cuda_file_ext = os.path.splitext(cuda_file_base)
92
-
93
- # Already in cache?
94
- if cuda_file in _plugin_cache:
95
- return _plugin_cache[cuda_file]
96
-
97
- # Setup plugin.
98
- if verbose:
99
- print('Setting up TensorFlow plugin "%s": ' % cuda_file_base, end='', flush=True)
100
- try:
101
- # Hash CUDA source.
102
- md5 = hashlib.md5()
103
- with open(cuda_file, 'rb') as f:
104
- md5.update(f.read())
105
- md5.update(b'\n')
106
-
107
- # Hash headers included by the CUDA code by running it through the preprocessor.
108
- if not do_not_hash_included_headers:
109
- if verbose:
110
- print('Preprocessing... ', end='', flush=True)
111
- with tempfile.TemporaryDirectory() as tmp_dir:
112
- tmp_file = os.path.join(tmp_dir, cuda_file_name + '_tmp' + cuda_file_ext)
113
- _run_cmd(_prepare_nvcc_cli('"%s" --preprocess -o "%s" --keep --keep-dir "%s"' % (cuda_file, tmp_file, tmp_dir)))
114
- with open(tmp_file, 'rb') as f:
115
- bad_file_str = ('"' + cuda_file.replace('\\', '/') + '"').encode('utf-8') # __FILE__ in error check macros
116
- good_file_str = ('"' + cuda_file_base + '"').encode('utf-8')
117
- for ln in f:
118
- if not ln.startswith(b'# ') and not ln.startswith(b'#line '): # ignore line number pragmas
119
- ln = ln.replace(bad_file_str, good_file_str)
120
- md5.update(ln)
121
- md5.update(b'\n')
122
-
123
- # Select compiler options.
124
- compile_opts = ''
125
- if os.name == 'nt':
126
- compile_opts += '"%s"' % os.path.join(tf.sysconfig.get_lib(), 'python', '_pywrap_tensorflow_internal.lib')
127
- elif os.name == 'posix':
128
- compile_opts += '"%s"' % os.path.join(tf.sysconfig.get_lib(), 'python', '_pywrap_tensorflow_internal.so')
129
- compile_opts += ' --compiler-options \'-fPIC -D_GLIBCXX_USE_CXX11_ABI=0\''
130
- else:
131
- assert False # not Windows or Linux, w00t?
132
- compile_opts += ' --gpu-architecture=%s' % _get_cuda_gpu_arch_string()
133
- compile_opts += ' --use_fast_math'
134
- nvcc_cmd = _prepare_nvcc_cli(compile_opts)
135
-
136
- # Hash build configuration.
137
- md5.update(('nvcc_cmd: ' + nvcc_cmd).encode('utf-8') + b'\n')
138
- md5.update(('tf.VERSION: ' + tf.VERSION).encode('utf-8') + b'\n')
139
- md5.update(('cuda_cache_version_tag: ' + cuda_cache_version_tag).encode('utf-8') + b'\n')
140
-
141
- # Compile if not already compiled.
142
- bin_file_ext = '.dll' if os.name == 'nt' else '.so'
143
- bin_file = os.path.join(cuda_cache_path, cuda_file_name + '_' + md5.hexdigest() + bin_file_ext)
144
- if not os.path.isfile(bin_file):
145
- if verbose:
146
- print('Compiling... ', end='', flush=True)
147
- with tempfile.TemporaryDirectory() as tmp_dir:
148
- tmp_file = os.path.join(tmp_dir, cuda_file_name + '_tmp' + bin_file_ext)
149
- _run_cmd(nvcc_cmd + ' "%s" --shared -o "%s" --keep --keep-dir "%s"' % (cuda_file, tmp_file, tmp_dir))
150
- os.makedirs(cuda_cache_path, exist_ok=True)
151
- intermediate_file = os.path.join(cuda_cache_path, cuda_file_name + '_' + uuid.uuid4().hex + '_tmp' + bin_file_ext)
152
- shutil.copyfile(tmp_file, intermediate_file)
153
- os.rename(intermediate_file, bin_file) # atomic
154
-
155
- # Load.
156
- if verbose:
157
- print('Loading... ', end='', flush=True)
158
- plugin = tf.load_op_library(bin_file)
159
-
160
- # Add to cache.
161
- _plugin_cache[cuda_file] = plugin
162
- if verbose:
163
- print('Done.', flush=True)
164
- return plugin
165
-
166
- except:
167
- if verbose:
168
- print('Failed!', flush=True)
169
- raise
170
-
171
- #----------------------------------------------------------------------------
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
spaces/ECCV2022/storydalle/dalle/models/stage1/layers.py DELETED
@@ -1,373 +0,0 @@
1
- # ------------------------------------------------------------------------------------
2
- # Modified from VQGAN (https://github.com/CompVis/taming-transformers)
3
- # Copyright (c) 2020 Patrick Esser and Robin Rombach and Björn Ommer. All Rights Reserved.
4
- # ------------------------------------------------------------------------------------
5
-
6
- import torch
7
- import torch.nn as nn
8
- from typing import Tuple, Optional
9
-
10
-
11
- def nonlinearity(x):
12
- # swish
13
- return x*torch.sigmoid(x)
14
-
15
-
16
- def Normalize(in_channels):
17
- return torch.nn.GroupNorm(num_groups=32,
18
- num_channels=in_channels,
19
- eps=1e-6,
20
- affine=True)
21
-
22
-
23
- class Upsample(nn.Module):
24
- def __init__(self, in_channels, with_conv):
25
- super().__init__()
26
- self.with_conv = with_conv
27
- if self.with_conv:
28
- self.conv = torch.nn.Conv2d(in_channels,
29
- in_channels,
30
- kernel_size=3,
31
- stride=1,
32
- padding=1)
33
-
34
- def forward(self, x):
35
- x = torch.nn.functional.interpolate(x, scale_factor=2.0, mode="nearest")
36
- if self.with_conv:
37
- x = self.conv(x)
38
- return x
39
-
40
-
41
- class Downsample(nn.Module):
42
- def __init__(self, in_channels, with_conv):
43
- super().__init__()
44
- self.with_conv = with_conv
45
- if self.with_conv:
46
- # no asymmetric padding in torch conv, must do it ourselves
47
- self.conv = torch.nn.Conv2d(in_channels,
48
- in_channels,
49
- kernel_size=3,
50
- stride=2,
51
- padding=0)
52
-
53
- def forward(self, x):
54
- if self.with_conv:
55
- pad = (0, 1, 0, 1)
56
- x = torch.nn.functional.pad(x, pad, mode="constant", value=0)
57
- x = self.conv(x)
58
- else:
59
- x = torch.nn.functional.avg_pool2d(x, kernel_size=2, stride=2)
60
- return x
61
-
62
-
63
- class ResnetBlock(nn.Module):
64
- def __init__(self, *, in_channels, out_channels=None, conv_shortcut=False,
65
- dropout, temb_channels=512):
66
- assert temb_channels == 0
67
- super().__init__()
68
- self.in_channels = in_channels
69
- out_channels = in_channels if out_channels is None else out_channels
70
- self.out_channels = out_channels
71
- self.use_conv_shortcut = conv_shortcut
72
-
73
- self.norm1 = Normalize(in_channels)
74
- self.conv1 = torch.nn.Conv2d(in_channels,
75
- out_channels,
76
- kernel_size=3,
77
- stride=1,
78
- padding=1)
79
- self.norm2 = Normalize(out_channels)
80
- self.dropout = torch.nn.Dropout(dropout)
81
- self.conv2 = torch.nn.Conv2d(out_channels,
82
- out_channels,
83
- kernel_size=3,
84
- stride=1,
85
- padding=1)
86
- if self.in_channels != self.out_channels:
87
- if self.use_conv_shortcut:
88
- self.conv_shortcut = torch.nn.Conv2d(in_channels,
89
- out_channels,
90
- kernel_size=3,
91
- stride=1,
92
- padding=1)
93
- else:
94
- self.nin_shortcut = torch.nn.Conv2d(in_channels,
95
- out_channels,
96
- kernel_size=1,
97
- stride=1,
98
- padding=0)
99
-
100
- def forward(self, x, temb=None):
101
- assert temb is None
102
-
103
- h = x
104
- h = self.norm1(h)
105
- h = nonlinearity(h)
106
- h = self.conv1(h)
107
-
108
- h = self.norm2(h)
109
- h = nonlinearity(h)
110
- h = self.dropout(h)
111
- h = self.conv2(h)
112
-
113
- if self.in_channels != self.out_channels:
114
- if self.use_conv_shortcut:
115
- x = self.conv_shortcut(x)
116
- else:
117
- x = self.nin_shortcut(x)
118
- return x+h
119
-
120
-
121
- class AttnBlock(nn.Module):
122
- def __init__(self, in_channels):
123
- super().__init__()
124
- self.in_channels = in_channels
125
-
126
- self.norm = Normalize(in_channels)
127
- self.q = torch.nn.Conv2d(in_channels,
128
- in_channels,
129
- kernel_size=1,
130
- stride=1,
131
- padding=0)
132
- self.k = torch.nn.Conv2d(in_channels,
133
- in_channels,
134
- kernel_size=1,
135
- stride=1,
136
- padding=0)
137
- self.v = torch.nn.Conv2d(in_channels,
138
- in_channels,
139
- kernel_size=1,
140
- stride=1,
141
- padding=0)
142
- self.proj_out = torch.nn.Conv2d(in_channels,
143
- in_channels,
144
- kernel_size=1,
145
- stride=1,
146
- padding=0)
147
-
148
- def forward(self, x):
149
- h_ = x
150
- h_ = self.norm(h_)
151
- q = self.q(h_)
152
- k = self.k(h_)
153
- v = self.v(h_)
154
-
155
- # compute attention
156
- b, c, h, w = q.shape
157
- q = q.reshape(b, c, h*w)
158
- q = q.permute(0, 2, 1) # b,hw,c
159
- k = k.reshape(b, c, h*w) # b,c,hw
160
- w_ = torch.bmm(q, k) # b,hw,hw w[b,i,j]=sum_c q[b,i,c]k[b,c,j]
161
- w_ = w_ * (int(c)**(-0.5))
162
- w_ = torch.nn.functional.softmax(w_, dim=2)
163
-
164
- # attend to values
165
- v = v.reshape(b, c, h*w)
166
- w_ = w_.permute(0, 2, 1) # b,hw,hw (first hw of k, second of q)
167
- h_ = torch.bmm(v, w_) # b, c,hw (hw of q) h_[b,c,j] = sum_i v[b,c,i] w_[b,i,j]
168
- h_ = h_.reshape(b, c, h, w)
169
-
170
- h_ = self.proj_out(h_)
171
- return x+h_
172
-
173
-
174
- class Encoder(nn.Module):
175
- def __init__(self,
176
- *, # forced to use named arguments
177
- ch: int,
178
- out_ch: int,
179
- ch_mult: Tuple[int] = (1, 2, 4, 8),
180
- num_res_blocks: int,
181
- attn_resolutions: Tuple[int],
182
- pdrop: float = 0.0,
183
- resamp_with_conv: bool = True,
184
- in_channels: int,
185
- resolution: int,
186
- z_channels: int,
187
- double_z: Optional[bool] = None) -> None:
188
- super().__init__()
189
- self.ch = ch
190
- self.temb_ch = 0
191
- self.num_resolutions = len(ch_mult)
192
- self.num_res_blocks = num_res_blocks
193
- self.resolution = resolution
194
- self.in_channels = in_channels
195
-
196
- # downsampling
197
- self.conv_in = torch.nn.Conv2d(in_channels,
198
- self.ch,
199
- kernel_size=3,
200
- stride=1,
201
- padding=1)
202
-
203
- curr_res = resolution
204
- in_ch_mult = (1,)+tuple(ch_mult)
205
- self.down = nn.ModuleList()
206
- for i_level in range(self.num_resolutions):
207
- block = nn.ModuleList()
208
- attn = nn.ModuleList()
209
- block_in = ch*in_ch_mult[i_level]
210
- block_out = ch*ch_mult[i_level]
211
- for i_block in range(self.num_res_blocks):
212
- block.append(ResnetBlock(in_channels=block_in,
213
- out_channels=block_out,
214
- temb_channels=self.temb_ch,
215
- dropout=pdrop))
216
- block_in = block_out
217
- if curr_res in attn_resolutions:
218
- attn.append(AttnBlock(block_in))
219
- down = nn.Module()
220
- down.block = block
221
- down.attn = attn
222
- if i_level != self.num_resolutions-1:
223
- down.downsample = Downsample(block_in, resamp_with_conv)
224
- curr_res = curr_res // 2
225
- self.down.append(down)
226
-
227
- # middle
228
- self.mid = nn.Module()
229
- self.mid.block_1 = ResnetBlock(in_channels=block_in,
230
- out_channels=block_in,
231
- temb_channels=self.temb_ch,
232
- dropout=pdrop)
233
- self.mid.attn_1 = AttnBlock(block_in)
234
- self.mid.block_2 = ResnetBlock(in_channels=block_in,
235
- out_channels=block_in,
236
- temb_channels=self.temb_ch,
237
- dropout=pdrop)
238
-
239
- # end
240
- self.norm_out = Normalize(block_in)
241
- self.conv_out = torch.nn.Conv2d(block_in,
242
- 2*z_channels if double_z else z_channels,
243
- kernel_size=3,
244
- stride=1,
245
- padding=1)
246
-
247
- def forward(self, x):
248
- assert x.shape[2] == x.shape[3] == self.resolution, \
249
- "{}, {}".format(x.shape, self.resolution)
250
-
251
- # downsampling
252
- h = self.conv_in(x)
253
- for i_level in range(self.num_resolutions):
254
- for i_block in range(self.num_res_blocks):
255
- h = self.down[i_level].block[i_block](h)
256
- if len(self.down[i_level].attn) > 0:
257
- h = self.down[i_level].attn[i_block](h)
258
- if i_level != self.num_resolutions-1:
259
- h = self.down[i_level].downsample(h)
260
-
261
- # middle
262
- h = self.mid.block_1(h)
263
- h = self.mid.attn_1(h)
264
- h = self.mid.block_2(h)
265
-
266
- # end
267
- h = self.norm_out(h)
268
- h = nonlinearity(h)
269
- h = self.conv_out(h)
270
- return h
271
-
272
-
273
- class Decoder(nn.Module):
274
- def __init__(self,
275
- *, # forced to use named arguments
276
- ch: int,
277
- out_ch: int,
278
- ch_mult: Tuple[int] = (1, 2, 4, 8),
279
- num_res_blocks: int,
280
- attn_resolutions: Tuple[int],
281
- pdrop: float = 0.0,
282
- resamp_with_conv: bool = True,
283
- in_channels: int,
284
- resolution: int,
285
- z_channels: int,
286
- double_z: bool) -> None:
287
- super().__init__()
288
- self.ch = ch
289
- self.temb_ch = 0
290
- self.num_resolutions = len(ch_mult)
291
- self.num_res_blocks = num_res_blocks
292
- self.resolution = resolution
293
- self.in_channels = in_channels
294
-
295
- # compute in_ch_mult, block_in and curr_res at lowest res
296
- block_in = ch*ch_mult[self.num_resolutions-1]
297
- curr_res = resolution // 2**(self.num_resolutions-1)
298
- self.z_shape = (1, z_channels, curr_res, curr_res)
299
-
300
- # z to block_in
301
- self.conv_in = torch.nn.Conv2d(z_channels,
302
- block_in,
303
- kernel_size=3,
304
- stride=1,
305
- padding=1)
306
-
307
- # middle
308
- self.mid = nn.Module()
309
- self.mid.block_1 = ResnetBlock(in_channels=block_in,
310
- out_channels=block_in,
311
- temb_channels=self.temb_ch,
312
- dropout=pdrop)
313
- self.mid.attn_1 = AttnBlock(block_in)
314
- self.mid.block_2 = ResnetBlock(in_channels=block_in,
315
- out_channels=block_in,
316
- temb_channels=self.temb_ch,
317
- dropout=pdrop)
318
-
319
- # upsampling
320
- self.up = nn.ModuleList()
321
- for i_level in reversed(range(self.num_resolutions)):
322
- block = nn.ModuleList()
323
- attn = nn.ModuleList()
324
- block_out = ch*ch_mult[i_level]
325
- for i_block in range(self.num_res_blocks+1):
326
- block.append(ResnetBlock(in_channels=block_in,
327
- out_channels=block_out,
328
- temb_channels=self.temb_ch,
329
- dropout=pdrop))
330
- block_in = block_out
331
- if curr_res in attn_resolutions:
332
- attn.append(AttnBlock(block_in))
333
- up = nn.Module()
334
- up.block = block
335
- up.attn = attn
336
- if i_level != 0:
337
- up.upsample = Upsample(block_in, resamp_with_conv)
338
- curr_res = curr_res * 2
339
- self.up.insert(0, up) # prepend to get consistent order
340
-
341
- # end
342
- self.norm_out = Normalize(block_in)
343
- self.conv_out = torch.nn.Conv2d(block_in,
344
- out_ch,
345
- kernel_size=3,
346
- stride=1,
347
- padding=1)
348
-
349
- def forward(self, z):
350
- assert z.shape[1:] == self.z_shape[1:]
351
- self.last_z_shape = z.shape
352
-
353
- # z to block_in
354
- h = self.conv_in(z)
355
-
356
- # middle
357
- h = self.mid.block_1(h)
358
- h = self.mid.attn_1(h)
359
- h = self.mid.block_2(h)
360
-
361
- # upsampling
362
- for i_level in reversed(range(self.num_resolutions)):
363
- for i_block in range(self.num_res_blocks+1):
364
- h = self.up[i_level].block[i_block](h)
365
- if len(self.up[i_level].attn) > 0:
366
- h = self.up[i_level].attn[i_block](h)
367
- if i_level != 0:
368
- h = self.up[i_level].upsample(h)
369
-
370
- h = self.norm_out(h)
371
- h = nonlinearity(h)
372
- h = self.conv_out(h)
373
- return h
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
spaces/Eduger/webui/app.py DELETED
@@ -1,72 +0,0 @@
1
- import os
2
- from subprocess import getoutput
3
-
4
- gpu_info = getoutput('nvidia-smi')
5
- if("A10G" in gpu_info):
6
- os.system(f"pip install -q https://github.com/camenduru/stable-diffusion-webui-colab/releases/download/0.0.15/xformers-0.0.15.dev0+4c06c79.d20221205-cp38-cp38-linux_x86_64.whl")
7
- elif("T4" in gpu_info):
8
- os.system(f"pip install -q https://github.com/camenduru/stable-diffusion-webui-colab/releases/download/0.0.15/xformers-0.0.15.dev0+1515f77.d20221130-cp38-cp38-linux_x86_64.whl")
9
-
10
- os.system(f"git clone -b v1.5 https://github.com/camenduru/stable-diffusion-webui /home/user/app/stable-diffusion-webui")
11
- os.chdir("/home/user/app/stable-diffusion-webui")
12
-
13
- os.system(f"wget -q https://github.com/camenduru/webui/raw/main/env_patch.py -O /home/user/app/env_patch.py")
14
- os.system(f"sed -i -e '/import image_from_url_text/r /home/user/app/env_patch.py' /home/user/app/stable-diffusion-webui/modules/ui.py")
15
- os.system(f"sed -i -e '/(modelmerger_interface, \"Checkpoint Merger\", \"modelmerger\"),/d' /home/user/app/stable-diffusion-webui/modules/ui.py")
16
- os.system(f"sed -i -e '/(train_interface, \"Train\", \"ti\"),/d' /home/user/app/stable-diffusion-webui/modules/ui.py")
17
- os.system(f"sed -i -e '/extensions_interface, \"Extensions\", \"extensions\"/d' /home/user/app/stable-diffusion-webui/modules/ui.py")
18
- os.system(f"sed -i -e '/settings_interface, \"Settings\", \"settings\"/d' /home/user/app/stable-diffusion-webui/modules/ui.py")
19
- os.system(f'''sed -i -e "s/document.getElementsByTagName('gradio-app')\[0\].shadowRoot/!!document.getElementsByTagName('gradio-app')[0].shadowRoot ? document.getElementsByTagName('gradio-app')[0].shadowRoot : document/g" /home/user/app/stable-diffusion-webui/script.js''')
20
- os.system(f"sed -i -e 's/ show_progress=False,/ show_progress=True,/g' /home/user/app/stable-diffusion-webui/modules/ui.py")
21
- os.system(f"sed -i -e 's/shared.demo.launch/shared.demo.queue().launch/g' /home/user/app/stable-diffusion-webui/webui.py")
22
- os.system(f"sed -i -e 's/ outputs=\[/queue=False, &/g' /home/user/app/stable-diffusion-webui/modules/ui.py")
23
- os.system(f"sed -i -e 's/ queue=False, / /g' /home/user/app/stable-diffusion-webui/modules/ui.py")
24
-
25
- # ----------------------------Please duplicate this space and delete this block if you don't want to see the extra header----------------------------
26
- os.system(f"wget -q https://github.com/camenduru/webui/raw/main/header_patch.py -O /home/user/app/header_patch.py")
27
- os.system(f"sed -i -e '/demo:/r /home/user/app/header_patch.py' /home/user/app/stable-diffusion-webui/modules/ui.py")
28
- # ---------------------------------------------------------------------------------------------------------------------------------------------------
29
-
30
- if "IS_SHARED_UI" in os.environ:
31
- os.system(f"rm -rfv /home/user/app/stable-diffusion-webui/scripts/")
32
-
33
- os.system(f"wget -q https://github.com/camenduru/webui/raw/main/shared-config.json -O /home/user/app/shared-config.json")
34
- os.system(f"wget -q https://github.com/camenduru/webui/raw/main/shared-ui-config.json -O /home/user/app/shared-ui-config.json")
35
-
36
- os.system(f"wget -q {os.getenv('MODEL_LINK')} -O /home/user/app/stable-diffusion-webui/models/Stable-diffusion/{os.getenv('MODEL_NAME')}")
37
- os.system(f"wget -q {os.getenv('VAE_LINK')} -O /home/user/app/stable-diffusion-webui/models/Stable-diffusion/{os.getenv('VAE_NAME')}")
38
- os.system(f"wget -q {os.getenv('YAML_LINK')} -O /home/user/app/stable-diffusion-webui/models/Stable-diffusion/{os.getenv('YAML_NAME')}")
39
-
40
- os.system(f"python launch.py --force-enable-xformers --disable-console-progressbars --enable-console-prompts --ui-config-file /home/user/app/shared-ui-config.json --ui-settings-file /home/user/app/shared-config.json --cors-allow-origins huggingface.co,hf.space --no-progressbar-hiding")
41
- else:
42
- # Please duplicate this space and delete # character in front of the custom script you want to use or add here more custom scripts with same structure os.system(f"wget -q https://CUSTOM_SCRIPT_URL -O /home/user/app/stable-diffusion-webui/scripts/CUSTOM_SCRIPT_NAME.py")
43
- os.system(f"wget -q https://gist.github.com/camenduru/9ec5f8141db9902e375967e93250860f/raw/d0bcf01786f20107c329c03f8968584ee67be12a/run_n_times.py -O /home/user/app/stable-diffusion-webui/scripts/run_n_times.py")
44
-
45
- # Please duplicate this space and delete # character in front of the extension you want to use or add here more extensions with same structure os.system(f"git clone https://EXTENSION_GIT_URL /home/user/app/stable-diffusion-webui/extensions/EXTENSION_NAME")
46
- #os.system(f"git clone https://github.com/camenduru/stable-diffusion-webui-artists-to-study /home/user/app/stable-diffusion-webui/extensions/stable-diffusion-webui-artists-to-study")
47
- os.system(f"git clone https://github.com/yfszzx/stable-diffusion-webui-images-browser /home/user/app/stable-diffusion-webui/extensions/stable-diffusion-webui-images-browser")
48
- os.system(f"git clone https://github.com/deforum-art/deforum-for-automatic1111-webui /home/user/app/stable-diffusion-webui/extensions/deforum-for-automatic1111-webui")
49
-
50
- # Please duplicate this space and delete # character in front of the model you want to use or add here more ckpts with same structure os.system(f"wget -q https://CKPT_URL -O /home/user/app/stable-diffusion-webui/models/Stable-diffusion/CKPT_NAME.ckpt")
51
- #os.system(f"wget -q https://huggingface.co/nitrosocke/Arcane-Diffusion/resolve/main/arcane-diffusion-v3.ckpt -O /home/user/app/stable-diffusion-webui/models/Stable-diffusion/arcane-diffusion-v3.ckpt")
52
- os.system(f"wget -q https://huggingface.co/DGSpitzer/Cyberpunk-Anime-Diffusion/resolve/main/Cyberpunk-Anime-Diffusion.ckpt -O /home/user/app/stable-diffusion-webui/models/Stable-diffusion/Cyberpunk-Anime-Diffusion.ckpt")
53
- os.system(f"wget -q https://huggingface.co/prompthero/midjourney-v4-diffusion/resolve/main/mdjrny-v4.ckpt -O /home/user/app/stable-diffusion-webui/models/Stable-diffusion/mdjrny-v4.ckpt")
54
- #os.system(f"wget -q https://huggingface.co/nitrosocke/mo-di-diffusion/resolve/main/moDi-v1-pruned.ckpt -O /home/user/app/stable-diffusion-webui/models/Stable-diffusion/moDi-v1-pruned.ckpt")
55
- #os.system(f"wget -q https://huggingface.co/Fictiverse/Stable_Diffusion_PaperCut_Model/resolve/main/PaperCut_v1.ckpt -O /home/user/app/stable-diffusion-webui/models/Stable-diffusion/PaperCut_v1.ckpt")
56
- #os.system(f"wget -q https://huggingface.co/lilpotat/sa/resolve/main/samdoesarts_style.ckpt -O /home/user/app/stable-diffusion-webui/models/Stable-diffusion/samdoesarts_style.ckpt")
57
- #os.system(f"wget -q https://huggingface.co/hakurei/waifu-diffusion-v1-3/resolve/main/wd-v1-3-float32.ckpt -O /home/user/app/stable-diffusion-webui/models/Stable-diffusion/wd-v1-3-float32.ckpt")
58
- #os.system(f"wget -q https://huggingface.co/CompVis/stable-diffusion-v-1-4-original/resolve/main/sd-v1-4.ckpt -O /home/user/app/stable-diffusion-webui/models/Stable-diffusion/sd-v1-4.ckpt")
59
- os.system(f"wget -q https://huggingface.co/runwayml/stable-diffusion-v1-5/resolve/main/v1-5-pruned-emaonly.ckpt -O /home/user/app/stable-diffusion-webui/models/Stable-diffusion/v1-5-pruned-emaonly.ckpt")
60
- #os.system(f"wget -q https://huggingface.co/runwayml/stable-diffusion-inpainting/resolve/main/sd-v1-5-inpainting.ckpt -O /home/user/app/stable-diffusion-webui/models/Stable-diffusion/sd-v1-5-inpainting.ckpt")
61
-
62
- #os.system(f"wget -q https://huggingface.co/Linaqruf/anything-v3.0/resolve/main/Anything-V3.0-pruned.ckpt -O /home/user/app/stable-diffusion-webui/models/Stable-diffusion/Anything-V3.0-pruned.ckpt")
63
- #os.system(f"wget -q https://huggingface.co/Linaqruf/anything-v3.0/resolve/main/Anything-V3.0.vae.pt -O /home/user/app/stable-diffusion-webui/models/Stable-diffusion/Anything-V3.0-pruned.vae.pt")
64
-
65
- #os.system(f"wget -q https://huggingface.co/stabilityai/stable-diffusion-2/resolve/main/768-v-ema.ckpt -O /home/user/app/stable-diffusion-webui/models/Stable-diffusion/768-v-ema.ckpt")
66
- #os.system(f"wget -q https://raw.githubusercontent.com/Stability-AI/stablediffusion/main/configs/stable-diffusion/v2-inference-v.yaml -O /home/user/app/stable-diffusion-webui/models/Stable-diffusion/768-v-ema.yaml")
67
-
68
- os.system(f"wget -q https://huggingface.co/stabilityai/stable-diffusion-2-1/resolve/main/v2-1_768-ema-pruned.ckpt -O /home/user/app/stable-diffusion-webui/models/Stable-diffusion/v2-1_768-ema-pruned.ckpt")
69
- os.system(f"wget -q https://raw.githubusercontent.com/Stability-AI/stablediffusion/main/configs/stable-diffusion/v2-inference-v.yaml -O /home/user/app/stable-diffusion-webui/models/Stable-diffusion/v2-1_768-ema-pruned.yaml")
70
-
71
- os.system(f"python launch.py --force-enable-xformers --ui-config-file /home/user/app/ui-config.json --ui-settings-file /home/user/app/config.json --disable-console-progressbars --enable-console-prompts --cors-allow-origins huggingface.co,hf.space --no-progressbar-hiding --api --skip-torch-cuda-test")
72
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
spaces/ElainaFanBoy/IRONY-Real-ESRGAN/FAQ.md DELETED
@@ -1,9 +0,0 @@
1
- # FAQ
2
-
3
- 1. **What is the difference of `--netscale` and `outscale`?**
4
-
5
- A: TODO.
6
-
7
- 1. **How to select models?**
8
-
9
- A: TODO.
 
 
 
 
 
 
 
 
 
 
spaces/EuroPython2022/mmocr-demo/configs/_base_/recog_pipelines/satrn_pipeline.py DELETED
@@ -1,44 +0,0 @@
1
- img_norm_cfg = dict(mean=[0.485, 0.456, 0.406], std=[0.229, 0.224, 0.225])
2
- train_pipeline = [
3
- dict(type='LoadImageFromFile'),
4
- dict(
5
- type='ResizeOCR',
6
- height=32,
7
- min_width=100,
8
- max_width=100,
9
- keep_aspect_ratio=False,
10
- width_downsample_ratio=0.25),
11
- dict(type='ToTensorOCR'),
12
- dict(type='NormalizeOCR', **img_norm_cfg),
13
- dict(
14
- type='Collect',
15
- keys=['img'],
16
- meta_keys=[
17
- 'filename', 'ori_shape', 'img_shape', 'text', 'valid_ratio',
18
- 'resize_shape'
19
- ]),
20
- ]
21
- test_pipeline = [
22
- dict(type='LoadImageFromFile'),
23
- dict(
24
- type='MultiRotateAugOCR',
25
- rotate_degrees=[0, 90, 270],
26
- transforms=[
27
- dict(
28
- type='ResizeOCR',
29
- height=32,
30
- min_width=100,
31
- max_width=100,
32
- keep_aspect_ratio=False,
33
- width_downsample_ratio=0.25),
34
- dict(type='ToTensorOCR'),
35
- dict(type='NormalizeOCR', **img_norm_cfg),
36
- dict(
37
- type='Collect',
38
- keys=['img'],
39
- meta_keys=[
40
- 'filename', 'ori_shape', 'img_shape', 'valid_ratio',
41
- 'resize_shape', 'img_norm_cfg', 'ori_filename'
42
- ]),
43
- ])
44
- ]