Commit
·
85609a3
1
Parent(s):
3571892
Update parquet files (step 53 of 476)
Browse filesThis view is limited to 50 files because it contains too many changes.
See raw diff
- spaces/101-5/gpt4free/g4f/.v1/unfinished/openprompt/main.py +0 -36
- spaces/1acneusushi/gradio-2dmoleculeeditor/data/Celemony Melodyne Editor 2.1.0.45 Win (cracked-R2R) [ChingLiu] - Features Benefits and Drawbacks.md +0 -109
- spaces/1acneusushi/gradio-2dmoleculeeditor/data/Download xforce keygen AutoCAD Mechanical 2016 crack What you need to know before you start.md +0 -147
- spaces/1acneusushi/gradio-2dmoleculeeditor/data/Edhem Mulabdic Zeleno Busenje Pdf Download A Novel of Bosnia under Austro-Hungarian Occupation.md +0 -91
- spaces/1gistliPinn/ChatGPT4/Examples/BIOS Agent Plus Serial Key Crack !FREE!.md +0 -31
- spaces/1pelhydcardo/ChatGPT-prompt-generator/assets/Download Blue Egg and Unleash Your Inner Egg Warrior in Multiplayer Battles.md +0 -105
- spaces/1phancelerku/anime-remove-background/Dinero infinito y gemas en Stickman Warriors APK Descarga la versin MOD.md +0 -107
- spaces/1phancelerku/anime-remove-background/Download Driving School 2016 Mod Apk with Unlimited Money and All Cars Unlocked.md +0 -59
- spaces/1phancelerku/anime-remove-background/FIFA Mobile The Only Licensed FIFA World Cup 2022 Game - Download FIFA 22 APK Today.md +0 -181
- spaces/4Taps/SadTalker/src/face3d/options/inference_options.py +0 -23
- spaces/52Hz/CMFNet_deraindrop/README.md +0 -37
- spaces/801artistry/RVC801/tools/infer_cli.py +0 -67
- spaces/AbandonedMuse/UnlimitedMusicGen/audiocraft/__init__.py +0 -10
- spaces/Adapter/T2I-Adapter/train_sketch.py +0 -399
- spaces/AgentVerse/agentVerse/dataloader/responsegen.py +0 -21
- spaces/AgentVerse/agentVerse/ui/src/phaser3-rex-plugins/templates/ui/basesizer/BaseSizer.js +0 -241
- spaces/AgentVerse/agentVerse/ui/src/phaser3-rex-plugins/templates/ui/fixwidthsizer/AddChildMethods.js +0 -74
- spaces/AgentVerse/agentVerse/ui/src/phaser3-rex-plugins/templates/ui/namevaluelabel/methods/SetValueMethods.js +0 -50
- spaces/AgentVerse/agentVerse/ui/src/phaser3-rex-plugins/templates/ui/sizer/Methods.js +0 -39
- spaces/Akmyradov/TurkmenTTSweSTT/vits/data_utils.py +0 -392
- spaces/Ama434/neutral-barlow/app.py +0 -145
- spaces/Amrrs/DragGan-Inversion/PTI/evaluation/qualitative_edit_comparison.py +0 -156
- spaces/Androidonnxfork/CivitAi-to-Diffusers/diffusers/scripts/convert_diffusers_to_original_stable_diffusion.py +0 -333
- spaces/Androidonnxfork/CivitAi-to-Diffusers/diffusers/src/diffusers/utils/dummy_transformers_and_torch_and_note_seq_objects.py +0 -17
- spaces/Androidonnxfork/CivitAi-to-Diffusers/diffusers/tests/pipelines/stable_diffusion/test_stable_diffusion_adapter.py +0 -316
- spaces/Andy1621/uniformer_image_detection/configs/guided_anchoring/ga_faster_x101_64x4d_fpn_1x_coco.py +0 -13
- spaces/Ankit6396/100-Free-ChatGPT4/app.py +0 -193
- spaces/Arnx/MusicGenXvAKN/audiocraft/modules/__init__.py +0 -20
- spaces/Ataturk-Chatbot/HuggingFaceChat/venv/lib/python3.11/site-packages/pip/_vendor/rich/errors.py +0 -34
- spaces/Awiny/Image2Paragraph/models/grit_src/grit/__init__.py +0 -7
- spaces/Awiny/Image2Paragraph/models/grit_src/third_party/CenterNet2/tests/layers/test_mask_ops.py +0 -202
- spaces/AzumaSeren100/XuanShen-Bert-VITS2/text/cleaner.py +0 -27
- spaces/Bart92/RVC_HF/infer/lib/csvutil.py +0 -41
- spaces/Big-Web/MMSD/env/Lib/site-packages/pip/_internal/commands/show.py +0 -189
- spaces/Big-Web/MMSD/env/Lib/site-packages/pip/_vendor/packaging/_manylinux.py +0 -301
- spaces/Big-Web/MMSD/env/Lib/site-packages/setuptools/command/editable_wheel.py +0 -844
- spaces/Bonosa2/movies/app1.py +0 -76
- spaces/CVPR/Dual-Key_Backdoor_Attacks/datagen/detectron2/detectron2/data/samplers/__init__.py +0 -10
- spaces/CVPR/LIVE/pybind11/tests/test_virtual_functions.cpp +0 -498
- spaces/CVPR/WALT/mmdet/core/bbox/iou_calculators/iou2d_calculator.py +0 -159
- spaces/CVPR/WALT/mmdet/core/export/__init__.py +0 -8
- spaces/CamodDew/youtubelegal/README.md +0 -12
- spaces/CikeyQI/meme-api/meme_generator/memes/caoshen_bite/__init__.py +0 -34
- spaces/CikeyQI/meme-api/meme_generator/memes/kiss/__init__.py +0 -35
- spaces/Clatonh/moth_or_butterfly/README.md +0 -13
- spaces/DEEMOSTECH/ChatAvatar/static/js/main.459a2347.js +0 -0
- spaces/DQChoi/gpt-demo/venv/lib/python3.11/site-packages/PIL/Image.py +0 -0
- spaces/DQChoi/gpt-demo/venv/lib/python3.11/site-packages/fontTools/ttLib/tables/T_S_I_D_.py +0 -5
- spaces/DQChoi/gpt-demo/venv/lib/python3.11/site-packages/fontTools/ttLib/tables/grUtils.py +0 -92
- spaces/DQChoi/gpt-demo/venv/lib/python3.11/site-packages/gradio/templates/cdn/assets/Login-9c3cc0eb.css +0 -1
spaces/101-5/gpt4free/g4f/.v1/unfinished/openprompt/main.py
DELETED
@@ -1,36 +0,0 @@
|
|
1 |
-
import requests
|
2 |
-
|
3 |
-
cookies = {
|
4 |
-
'supabase-auth-token': '["eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJhdWQiOiJhdXRoZW50aWNhdGVkIiwiZXhwIjoxNjgyMjk1NzQyLCJzdWIiOiJlOGExOTdiNS03YTAxLTQ3MmEtODQ5My1mNGUzNTNjMzIwNWUiLCJlbWFpbCI6InFlY3RncHZhamlibGNjQGJ1Z2Zvby5jb20iLCJwaG9uZSI6IiIsImFwcF9tZXRhZGF0YSI6eyJwcm92aWRlciI6ImVtYWlsIiwicHJvdmlkZXJzIjpbImVtYWlsIl19LCJ1c2VyX21ldGFkYXRhIjp7fSwicm9sZSI6ImF1dGhlbnRpY2F0ZWQiLCJhYWwiOiJhYWwxIiwiYW1yIjpbeyJtZXRob2QiOiJvdHAiLCJ0aW1lc3RhbXAiOjE2ODE2OTA5NDJ9XSwic2Vzc2lvbl9pZCI6IjIwNTg5MmE5LWU5YTAtNDk2Yi1hN2FjLWEyMWVkMTkwZDA4NCJ9.o7UgHpiJMfa6W-UKCSCnAncIfeOeiHz-51sBmokg0MA","RtPKeb7KMMC9Dn2fZOfiHA",null,null,null]',
|
5 |
-
}
|
6 |
-
|
7 |
-
headers = {
|
8 |
-
'authority': 'openprompt.co',
|
9 |
-
'accept': '*/*',
|
10 |
-
'accept-language': 'en,fr-FR;q=0.9,fr;q=0.8,es-ES;q=0.7,es;q=0.6,en-US;q=0.5,am;q=0.4,de;q=0.3',
|
11 |
-
'content-type': 'application/json',
|
12 |
-
# 'cookie': 'supabase-auth-token=%5B%22eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJhdWQiOiJhdXRoZW50aWNhdGVkIiwiZXhwIjoxNjgyMjkzMjQ4LCJzdWIiOiJlODQwNTZkNC0xZWJhLTQwZDktOWU1Mi1jMTc4MTUwN2VmNzgiLCJlbWFpbCI6InNia2didGJnZHB2bHB0ZUBidWdmb28uY29tIiwicGhvbmUiOiIiLCJhcHBfbWV0YWRhdGEiOnsicHJvdmlkZXIiOiJlbWFpbCIsInByb3ZpZGVycyI6WyJlbWFpbCJdfSwidXNlcl9tZXRhZGF0YSI6e30sInJvbGUiOiJhdXRoZW50aWNhdGVkIiwiYWFsIjoiYWFsMSIsImFtciI6W3sibWV0aG9kIjoib3RwIiwidGltZXN0YW1wIjoxNjgxNjg4NDQ4fV0sInNlc3Npb25faWQiOiJiNDhlMmU3NS04NzlhLTQxZmEtYjQ4MS01OWY0OTgxMzg3YWQifQ.5-3E7WvMMVkXewD1qA26Rv4OFSTT82wYUBXNGcYaYfQ%22%2C%22u5TGGMMeT3zZA0agm5HGuA%22%2Cnull%2Cnull%2Cnull%5D',
|
13 |
-
'origin': 'https://openprompt.co',
|
14 |
-
'referer': 'https://openprompt.co/ChatGPT',
|
15 |
-
'sec-ch-ua': '"Chromium";v="112", "Google Chrome";v="112", "Not:A-Brand";v="99"',
|
16 |
-
'sec-ch-ua-mobile': '?0',
|
17 |
-
'sec-ch-ua-platform': '"macOS"',
|
18 |
-
'sec-fetch-dest': 'empty',
|
19 |
-
'sec-fetch-mode': 'cors',
|
20 |
-
'sec-fetch-site': 'same-origin',
|
21 |
-
'user-agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/112.0.0.0 Safari/537.36',
|
22 |
-
}
|
23 |
-
|
24 |
-
json_data = {
|
25 |
-
'messages': [
|
26 |
-
{
|
27 |
-
'role': 'user',
|
28 |
-
'content': 'hello world',
|
29 |
-
},
|
30 |
-
],
|
31 |
-
}
|
32 |
-
|
33 |
-
response = requests.post('https://openprompt.co/api/chat2', cookies=cookies, headers=headers, json=json_data,
|
34 |
-
stream=True)
|
35 |
-
for chunk in response.iter_content(chunk_size=1024):
|
36 |
-
print(chunk)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
spaces/1acneusushi/gradio-2dmoleculeeditor/data/Celemony Melodyne Editor 2.1.0.45 Win (cracked-R2R) [ChingLiu] - Features Benefits and Drawbacks.md
DELETED
@@ -1,109 +0,0 @@
|
|
1 |
-
<br />
|
2 |
-
<h1>Celemony Melodyne Editor 2.1.0.45 Win (cracked-R2R) [ChingLiu] Setup Free</h1>
|
3 |
-
<p>If you are looking for a powerful and versatile audio editing software that can shape audio as never before, you might want to check out Celemony Melodyne Editor 2.1.0.45 Win (cracked-R2R) [ChingLiu]. This is a torrent link that allows you to download and install the software for free on your Windows computer.</p>
|
4 |
-
<p>In this article, we will tell you everything you need to know about Celemony Melodyne Editor 2.1.0.45 Win (cracked-R2R) [ChingLiu], including what it is, how to install it, how to use it, what are its system requirements and compatibility, what are its pros and cons, and some FAQs.</p>
|
5 |
-
<h2>Celemony Melodyne Editor 2.1.0.45 Win (cracked-R2R) [ChingLiu] Setup Free</h2><br /><p><b><b>Download File</b> ✏ <a href="https://byltly.com/2uKzdy">https://byltly.com/2uKzdy</a></b></p><br /><br />
|
6 |
-
<p>By the end of this article, you will be able to decide whether Celemony Melodyne Editor 2.1.0.45 Win (cracked-R2R) [ChingLiu] is worth your time and attention.</p>
|
7 |
-
<h2>What is Celemony Melodyne Editor?</h2>
|
8 |
-
<p>Celemony Melodyne Editor is a software that allows you to edit audio files in an intuitive and flexible way.</p>
|
9 |
-
<p>Unlike other audio editing tools that work with audio data as a whole, Celemony Melodyne Editor works with audio notes as individual entities.</p>
|
10 |
-
<p>This means that you can access, manipulate, and modify each note in a polyphonic audio material, such as a piano recording or a guitar accompaniment.</p>
|
11 |
-
<p>You can also edit music and not just audio data, by changing pitch, timing, volume, and other musical parameters of each note with ease and precision.</p>
|
12 |
-
<p>Celemony Melodyne Editor also lets you use scales, chords, and harmonies to enhance your audio editing projects.</p>
|
13 |
-
<p>With Celemony Melodyne Editor, you can achieve vocal polishing of the highest quality, remove wrong notes from piano recordings, change chords in guitar accompaniments after recording them, refashion sample licks, and much more.</p>
|
14 |
-
<p>How to install Celemony Melodyne Editor 2.1.0.45 cracked version<br />
|
15 |
-
Celemony Melodyne Editor 2.1.0.45 Win free download full version<br />
|
16 |
-
Celemony Melodyne Editor 2.1.0.45 R2R crack tutorial<br />
|
17 |
-
Celemony Melodyne Editor 2.1.0.45 ChingLiu torrent magnet link<br />
|
18 |
-
Celemony Melodyne Editor 2.1.0.45 Win license key generator<br />
|
19 |
-
Celemony Melodyne Editor 2.1.0.45 cracked-R2R features and benefits<br />
|
20 |
-
Celemony Melodyne Editor 2.1.0.45 Win system requirements and compatibility<br />
|
21 |
-
Celemony Melodyne Editor 2.1.0.45 ChingLiu review and rating<br />
|
22 |
-
Celemony Melodyne Editor 2.1.0.45 Win activation code and serial number<br />
|
23 |
-
Celemony Melodyne Editor 2.1.0.45 cracked-R2R comparison with other audio editing software<br />
|
24 |
-
Celemony Melodyne Editor 2.1.0.45 Win patch and update<br />
|
25 |
-
Celemony Melodyne Editor 2.1.0.45 ChingLiu setup guide and instructions<br />
|
26 |
-
Celemony Melodyne Editor 2.1.0.45 cracked-R2R troubleshooting and support<br />
|
27 |
-
Celemony Melodyne Editor 2.1.0.45 Win discount and coupon code<br />
|
28 |
-
Celemony Melodyne Editor 2.1.0.45 ChingLiu alternative and similar software<br />
|
29 |
-
Celemony Melodyne Editor 2.1.0.45 cracked-R2R testimonials and feedback<br />
|
30 |
-
Celemony Melodyne Editor 2.1.0.45 Win pros and cons<br />
|
31 |
-
Celemony Melodyne Editor 2.1.0.45 ChingLiu official website and contact information<br />
|
32 |
-
Celemony Melodyne Editor 2.1.0.45 cracked-R2R demo and trial version<br />
|
33 |
-
Celemony Melodyne Editor 2.1.0.45 Win tips and tricks<br />
|
34 |
-
Celemony Melodyne Editor 2.1.0.45 ChingLiu FAQ and Q&A<br />
|
35 |
-
Celemony Melodyne Editor 2.1.0.45 cracked-R2R best practices and recommendations<br />
|
36 |
-
Celemony Melodyne Editor 2.1.0.45 Win online course and training<br />
|
37 |
-
Celemony Melodyne Editor 2.1.0.45 ChingLiu video tutorial and walkthrough<br />
|
38 |
-
Celemony Melodyne Editor 2</p>
|
39 |
-
<p>Celemony Melodyne Editor is the most powerful edition of Celemony's one-track product family and offers you the entire spectrum of Melodyne's award-winning capabilities.</p>
|
40 |
-
<h3>How to install Celemony Melodyne Editor 2.1.0.45 Win (cracked-R2R) [ChingLiu]?</h3>
|
41 |
-
<p>To install Celemony Melodyne Editor 2.1.0.45 Win (cracked-R2R) [ChingLiu], you need to follow these steps:</p>
|
42 |
-
<ol>
|
43 |
-
<li>Download the torrent file from <a href="https://www.bing.com/search?q=Celemony+Melodyne+Editor+2.1.0.45+Win+%28cracked-R2R%29+%5bChingLiu%5d+Setup+Free">this link</a>. You will need a torrent client such as uTorrent or BitTorrent to download it.</li>
|
44 |
-
<li>Open the torrent file with your torrent client and start downloading the software.</li>
|
45 |
-
<li>Once the download is complete, extract the zip file using a program such as WinRAR or 7-Zip.</li>
|
46 |
-
<li>Run the setup.exe file as administrator and follow the instructions on screen.</li>
|
47 |
-
<li>When prompted for a serial number or activation code, use any random number or code.</li>
|
48 |
-
<li>Copy the contents of the R2R folder into your installation directory (usually C:\Program Files\Celemony\Melodyne editor).</li>
|
49 |
-
<li>Enjoy your free copy of Celemony Melodyne Editor 2.1.0.45 Win!</li>
|
50 |
-
</ol>
|
51 |
-
<h3>How to use Celemony Melodyne Editor 2.1.0.45 Win (cracked-R2R) [ChingLiu]?</h3>
|
52 |
-
<p>To use Celemony Melodyne Editor 2.1.0.45 Win (cracked-R2R) [ChingLiu], you can either run it as a stand-alone program or as a plug-in in your DAW.</p>
|
53 |
-
<p>In both cases, you need to open an audio file that you want to edit with Celemony Melodyne Editor.</p>
|
54 |
-
<p>The software will analyze your audio file and display it as a series of blobs on a grid.</p>
|
55 |
-
<p>Each blob represents a note in your audio file.</p>
|
56 |
-
<p>You can select one or more blobs by clicking on them or dragging a selection box around them.</p>
|
57 |
-
<p>You can then edit them by using various tools available on the toolbar or by dragging them with your mouse.</p>
|
58 |
-
<p>Some of the tools you can use are:</p>
|
59 |
-
<ul>
|
60 |
-
<li>Pitch tool: This tool allows you to change the pitch of each note by moving it up or down on the grid.</li>
|
61 |
-
<li>Modulation tool: This tool allows you to change the pitch variation within each note by adjusting its shape on the grid.</li>
|
62 |
-
<li>Timing tool: This tool allows you to change the timing of each note by moving it left or right on the grid.</li>
|
63 |
-
<li>Time handle tool: This tool allows you to change the duration of each note by stretching or shrinking it on the grid.</li>
|
64 |
-
<li>Amplitude tool: This tool allows you to change the volume of each note by moving it closer or farther from the horizontal axis on the grid.</li>
|
65 |
-
<li>Note separation tool: This tool allows you to split or merge notes by clicking on their boundaries on the grid.</li>
|
66 |
-
</ul>
|
67 |
-
<p>You can also use other features such as scales, chords, harmonies, macros, quantization, correction, etc., to enhance your audio editing experience.</p>
|
68 |
-
<h4>How to access individual notes in polyphonic audio material?</h4>
|
69 |
-
```html <h2>What are the pros and cons of Celemony Melodyne Editor 2.1.0.45 Win (cracked-R2R) [ChingLiu]?</h2>
|
70 |
-
<p>Celemony Melodyne Editor 2.1.0.45 Win (cracked-R2R) [ChingLiu] has many pros and cons that you should consider before using it.</p>
|
71 |
-
<p>Here are some of the pros:</p>
|
72 |
-
<ul>
|
73 |
-
<li>It offers unparalleled access and control over individual notes in polyphonic audio material, thanks to the DNA technology.</li>
|
74 |
-
<li>It allows you to edit music and not just audio data, by changing pitch, timing, volume, and other musical parameters of each note with ease and precision.</li>
|
75 |
-
<li>It lets you use scales, chords, and harmonies to enhance your audio editing projects, by applying musical theory and creativity to your audio material.</li>
|
76 |
-
<li>It integrates seamlessly with your DAW via ARA, making it feel like part of your DAW.</li>
|
77 |
-
<li>It has a user-friendly interface and a variety of tools and features that make audio editing a breeze.</li>
|
78 |
-
<li>It has a high sound quality, flexibility, speed, and reliability that make it a trusted tool for many producers and musicians.</li>
|
79 |
-
</ul>
|
80 |
-
<p>Here are some of the cons:</p>
|
81 |
-
<ul>
|
82 |
-
<li>It is a cracked version of the software, which means it is illegal and unethical to use it without paying for it.</li>
|
83 |
-
<li>It may not work properly or cause problems with your system or other software, as it is not an official release from Celemony.</li>
|
84 |
-
<li>It may not have the latest updates or bug fixes from Celemony, as it is an older version of the software.</li>
|
85 |
-
<li>It only supports polyphonic DNA and multitrack editing in the Editor and Studio versions, which are more expensive than the Essential and Assistant versions.</li>
|
86 |
-
<li>It still requires some user interaction and skill to get the best results out of it, as it is not a magic tool that can fix everything automatically.</li>
|
87 |
-
</ul>
|
88 |
-
<h2>Conclusion</h2>
|
89 |
-
<p>Celemony Melodyne Editor 2.1.0.45 Win (cracked-R2R) [ChingLiu] is a powerful and versatile audio editing software that can shape audio as never before.</p>
|
90 |
-
<p>It can access individual notes in polyphonic audio material, edit music and not just audio data, use scales, chords, and harmonies in audio editing projects, integrate with your DAW via ARA, and offer a high sound quality, flexibility, speed, and reliability.</p>
|
91 |
-
<p>However, it is also a cracked version of the software, which means it is illegal and unethical to use it without paying for it.</p>
|
92 |
-
<p>It may also cause problems with your system or other software, as it is not an official release from Celemony.</p>
|
93 |
-
<p>It may also lack the latest updates or bug fixes from Celemony, as it is an older version of the software.</p>
|
94 |
-
<p>It also only supports polyphonic DNA and multitrack editing in the Editor and Studio versions, which are more expensive than the Essential and Assistant versions.</p>
|
95 |
-
<p>It also still requires some user interaction and skill to get the best results out of it, as it is not a magic tool that can fix everything automatically.</p>
|
96 |
-
<p>If you are interested in using Celemony Melodyne Editor 2.1.0.45 Win (cracked-R2R) [ChingLiu], you should be aware of these pros and cons before you download and install it.</p>
|
97 |
-
<p>You should also consider buying the official version from Celemony's website if you want to support the developers and enjoy the full benefits of the software.</p>
|
98 |
-
<p>We hope this article has been helpful and informative for you.</p>
|
99 |
-
<h3>FAQs</h3>
|
100 |
-
<ol>
|
101 |
-
<li><b>What is Celemony Melodyne Editor?</b><br>Celemony Melodyne Editor is a software that allows you to edit audio files in an intuitive and flexible way. It can access individual notes in polyphonic audio material, edit music and not just audio data, use scales, chords, and harmonies in audio editing projects, integrate with your DAW via ARA, and offer a high sound quality, flexibility, speed, and reliability.</li>
|
102 |
-
<li><b>How to install Celemony Melodyne Editor 2.1.0.45 Win (cracked-R2R) [ChingLiu]?</b><br>To install Celemony Melodyne Editor 2.1.0.45 Win (cracked-R2R) [ChingLiu], you need to download the torrent file from this link , open it with your torrent client , start downloading the software , extract the zip file , run the setup.exe file as administrator , use any random number or code when prompted for a serial number or activation code , copy the contents of the R2R folder into your installation directory , and enjoy your free copy of Celemony Melodyne Editor 2.1.0.45 Win!</li>
|
103 |
-
<li><b>How to use Celemony Melodyne Editor 2.1.0.45 Win (cracked-R2R) [ChingLiu]?</b><br>To use Celemony Melodyne Editor 2.1.0.45 Win (cracked-R2R) [ChingLiu], you can either run it as a stand-alone program or as a plug-in in your DAW . In both cases , you need to open an audio file that you want to edit with Celemony Melodyne Editor . The software will analyze your audio file and display it as a series of blobs on a grid . Each blob represents a note in your audio file . You can select and edit each blob independently , by using various tools available on the toolbar or by dragging them with your mouse . You can also use other features such as scales , chords , harmonies , macros , quantization , correction , etc., to enhance your audio editing experience .</li>
|
104 |
-
```html <li><b>What are the pros and cons of Celemony Melodyne Editor 2.1.0.45 Win (cracked-R2R) [ChingLiu]?</b><br>Celemony Melodyne Editor 2.1.0.45 Win (cracked-R2R) [ChingLiu] has many pros and cons that you should consider before using it. Some of the pros are: it offers unparalleled access and control over individual notes in polyphonic audio material, it allows you to edit music and not just audio data, it lets you use scales, chords, and harmonies in your audio editing projects, it integrates seamlessly with your DAW via ARA, it has a user-friendly interface and a variety of tools and features that make audio editing a breeze, and it has a high sound quality, flexibility, speed, and reliability that make it a trusted tool for many producers and musicians. Some of the cons are: it is a cracked version of the software, which means it is illegal and unethical to use it without paying for it, it may not work properly or cause problems with your system or other software, as it is not an official release from Celemony, it may not have the latest updates or bug fixes from Celemony, as it is an older version of the software, it only supports polyphonic DNA and multitrack editing in the Editor and Studio versions, which are more expensive than the Essential and Assistant versions, and it still requires some user interaction and skill to get the best results out of it, as it is not a magic tool that can fix everything automatically.</li>
|
105 |
-
<li><b>Where can I buy the official version of Celemony Melodyne Editor?</b><br>If you want to buy the official version of Celemony Melodyne Editor, you can visit Celemony's website and choose the edition that suits your needs. The prices are as follows: Melodyne Essential: €99 Melodyne Assistant: €249 Melodyne Editor: €399 Melodyne Studio: €699 You can also download a free trial version of Melodyne Editor from Celemony's website and test it for 30 days.</li>
|
106 |
-
</ol>
|
107 |
-
</p> 0a6ba089eb<br />
|
108 |
-
<br />
|
109 |
-
<br />
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
spaces/1acneusushi/gradio-2dmoleculeeditor/data/Download xforce keygen AutoCAD Mechanical 2016 crack What you need to know before you start.md
DELETED
@@ -1,147 +0,0 @@
|
|
1 |
-
<br />
|
2 |
-
<h1>Download Xforce Keygen AutoCAD Mechanical 2016 Crack</h1>
|
3 |
-
<p>If you are looking for a way to activate AutoCAD Mechanical 2016, one of the most popular and powerful software for mechanical design and engineering, you may have come across Xforce Keygen. Xforce Keygen is a tool that can generate activation codes for various Autodesk products, including AutoCAD Mechanical 2016. But what is Xforce Keygen, and how can you use it to crack AutoCAD Mechanical 2016? In this article, we will explain everything you need to know about Xforce Keygen, its features, benefits, risks, and how to download and use it to activate AutoCAD Mechanical 2016.</p>
|
4 |
-
<h2>download xforce keygen AutoCAD Mechanical 2016 crack</h2><br /><p><b><b>Download File</b> → <a href="https://byltly.com/2uKzz5">https://byltly.com/2uKzz5</a></b></p><br /><br />
|
5 |
-
<h2>What is AutoCAD Mechanical 2016?</h2>
|
6 |
-
<p>AutoCAD Mechanical 2016 is a software application that belongs to the Autodesk family of products. It is designed for mechanical engineers and designers who need to create and document mechanical parts and assemblies. AutoCAD Mechanical 2016 provides a comprehensive set of tools and features that help you to create accurate and efficient mechanical drawings and documentation. Some of the features of AutoCAD Mechanical 2016 are:</p>
|
7 |
-
<h3>Features of AutoCAD Mechanical 2016</h3>
|
8 |
-
<ul>
|
9 |
-
<li><b>Layer Management:</b> You can easily organize and manage your layers with the Layer Groups Manager. You can create, edit, delete, and rename layer groups, as well as assign colors, linetypes, and plot styles to them. You can also control the visibility and locking of layer groups in different viewports.</li>
|
10 |
-
<li><b>Content Library:</b> You can access a large library of standard parts and components that conform to various industry standards, such as ANSI, ISO, DIN, JIS, GB, etc. You can insert these parts into your drawings with drag-and-drop functionality, and edit their properties and dimensions as needed.</li>
|
11 |
-
<li><b>Power Dimensioning:</b> You can create and edit dimensions faster and easier with the Power Dimensioning tool. You can automatically align and space dimensions, add dimension breaks and jog lines, edit dimension text and symbols, and apply dimension styles.</li>
|
12 |
-
<li><b>Associative Balloons and Bills of Materials:</b> You can create and update balloons and bills of materials (BOMs) automatically with the Associative Balloons and BOMs tool. You can assign part numbers and descriptions to your components, and generate BOMs that reflect the current state of your assembly. You can also customize the appearance and format of your balloons and BOMs.</li>
|
13 |
-
<li><b>Design Calculations:</b> You can perform various design calculations with the Design Calculations tool. You can calculate mass properties, interference detection, shaft and spring design, belt and chain drives, bolted connections, welding symbols, etc.</li>
|
14 |
-
</ul>
|
15 |
-
<h3>System Requirements for AutoCAD Mechanical 2016</h3>
|
16 |
-
<p>To run AutoCAD Mechanical 2016 smoothly on your computer, you need to meet the following minimum system requirements:</p>
|
17 |
-
<table>
|
18 |
-
<tr><th>Operating System</th><th>Windows 7/8/8.1/10 (64-bit)</th></tr>
|
19 |
-
<tr><td>CPU</td><td>Intel or AMD processor with SSE2 support</td></tr>
|
20 |
-
<tr><td>RAM</td><td>4 GB (8 GB recommended)</td></tr>
|
21 |
-
<tr><td>Disk Space</td><td>6 GB for installation</td></tr>
|
22 |
-
<tr><td>Graphics Card</td><td>DirectX 9 or higher compatible with 128 MB VRAM (256 MB recommended)</td></tr>
|
23 |
-
<tr><td>Display Resolution</td><td>1024 x 768 (1600 x 1050 or higher recommended)</td></tr>
|
24 |
-
<tr><td>Internet Connection</td><td>Required for activation and online services</td></tr>
|
25 |
-
</table>
|
26 |
-
<h2>What is Xforce Keygen?</h2>
|
27 |
-
<p>Xforce Keygen is a software tool that can generate activation codes for various Autodesk products, such as AutoCAD Mechanical 2016. It is also known as a crack or a patch because it bypasses the original activation process of the software. Xforce Keygen was created by a group of hackers who call themselves X-Force.</p>
|
28 |
-
<h3>How Xforce Keygen Works</h3>
|
29 |
-
<p>Xforce Keygen works by exploiting a vulnerability in the Autodesk activation system. It modifies some files in the installation folder of the software, such as adlmint.dll or xf-adsk64.exe. It then generates a unique activation code based on your computer's hardware ID and serial number. This code is then used to activate the software without requiring an internet connection or a valid license.</p>
|
30 |
-
<p>How to download xforce keygen for AutoCAD Mechanical 2016<br />
|
31 |
-
Download xforce keygen AutoCAD Mechanical 2016 full version<br />
|
32 |
-
Download xforce keygen AutoCAD Mechanical 2016 free trial<br />
|
33 |
-
Download xforce keygen AutoCAD Mechanical 2016 offline installer<br />
|
34 |
-
Download xforce keygen AutoCAD Mechanical 2016 32 bit<br />
|
35 |
-
Download xforce keygen AutoCAD Mechanical 2016 64 bit<br />
|
36 |
-
Download xforce keygen AutoCAD Mechanical 2016 activation code<br />
|
37 |
-
Download xforce keygen AutoCAD Mechanical 2016 serial number<br />
|
38 |
-
Download xforce keygen AutoCAD Mechanical 2016 license key<br />
|
39 |
-
Download xforce keygen AutoCAD Mechanical 2016 product key<br />
|
40 |
-
Download xforce keygen AutoCAD Mechanical 2016 patch<br />
|
41 |
-
Download xforce keygen AutoCAD Mechanical 2016 torrent<br />
|
42 |
-
Download xforce keygen AutoCAD Mechanical 2016 direct link<br />
|
43 |
-
Download xforce keygen AutoCAD Mechanical 2016 mega<br />
|
44 |
-
Download xforce keygen AutoCAD Mechanical 2016 google drive<br />
|
45 |
-
Download xforce keygen AutoCAD Mechanical 2016 rar<br />
|
46 |
-
Download xforce keygen AutoCAD Mechanical 2016 zip<br />
|
47 |
-
Download xforce keygen AutoCAD Mechanical 2016 iso<br />
|
48 |
-
Download xforce keygen AutoCAD Mechanical 2016 exe<br />
|
49 |
-
Download xforce keygen AutoCAD Mechanical 2016 dmg<br />
|
50 |
-
Download xforce keygen AutoCAD Mechanical 2016 for mac<br />
|
51 |
-
Download xforce keygen AutoCAD Mechanical 2016 for windows<br />
|
52 |
-
Download xforce keygen AutoCAD Mechanical 2016 for linux<br />
|
53 |
-
Download xforce keygen AutoCAD Mechanical 2016 crack only<br />
|
54 |
-
Download xforce keygen AutoCAD Mechanical 2016 crack file<br />
|
55 |
-
Download xforce keygen AutoCAD Mechanical 2016 crack download<br />
|
56 |
-
Download xforce keygen AutoCAD Mechanical 2016 crack software<br />
|
57 |
-
Download xforce keygen AutoCAD Mechanical 2016 crack tool<br />
|
58 |
-
Download xforce keygen AutoCAD Mechanical 2016 crack generator<br />
|
59 |
-
Download xforce keygen AutoCAD Mechanical 2016 crack instructions<br />
|
60 |
-
Download xforce keygen AutoCAD Mechanical 2016 crack tutorial<br />
|
61 |
-
Download xforce keygen AutoCAD Mechanical 2016 crack guide<br />
|
62 |
-
Download xforce keygen AutoCAD Mechanical 2016 crack video<br />
|
63 |
-
Download xforce keygen AutoCAD Mechanical 2016 crack youtube<br />
|
64 |
-
Download xforce keygen AutoCAD Mechanical 2016 crack reddit<br />
|
65 |
-
Download xforce keygen AutoCAD Mechanical 2016 crack forum<br />
|
66 |
-
Download xforce keygen AutoCAD Mechanical 2016 crack blog<br />
|
67 |
-
Download xforce keygen AutoCAD Mechanical 2016 crack review<br />
|
68 |
-
Download xforce keygen AutoCAD Mechanical 2016 crack tips<br />
|
69 |
-
Download xforce keygen AutoCAD Mechanical 2016 crack tricks<br />
|
70 |
-
Download xforce keygen AutoCAD Mechanical 2016 crack hacks<br />
|
71 |
-
Download xforce keygen AutoCAD Mechanical 2016 crack cheats<br />
|
72 |
-
Download xforce keygen AutoCAD Mechanical 2016 crack no survey<br />
|
73 |
-
Download xforce keygen AutoCAD Mechanical 2016 crack no password<br />
|
74 |
-
Download xforce keygen AutoCAD Mechanical 2016 crack no virus<br />
|
75 |
-
Download xforce keygen AutoCAD Mechanical 2016 crack safe<br />
|
76 |
-
Download xforce keygen AutoCAD Mechanical 2016 crack working<br />
|
77 |
-
Download xforce keygen AutoCAD Mechanical 2016 crack latest<br />
|
78 |
-
Download xforce keygen AutoCAD Mechanical 2016 crack updated<br />
|
79 |
-
Download xforce keygen AutoCAD Mechanical 2016 crack best</p>
|
80 |
-
<h3>Benefits of Using Xforce Keygen</h3>
|
81 |
-
<p>The main benefit of using Xforce Keygen is that it allows you to use AutoCAD Mechanical 2016 for free without paying for a license. This can save you a lot of money if you are a student or a hobbyist who cannot afford the official price of the software. Another benefit is that you can use the software offline without needing an internet connection or an Autodesk account.</p>
|
82 |
-
<h3>Risks of Using Xforce Keygen</h3>
|
83 |
-
<p>The main risk of using Xforce Keygen is that it is illegal and unethical. By using Xforce Keygen, you are violating the terms and conditions of Autodesk and infringing their intellectual property rights. This can result in legal consequences such as fines or lawsuits if you are caught by Autodesk or their authorized agents. Another risk is that you may expose your computer to malware or viruses that may be hidden in the Xforce Keygen file or website. This can compromise your personal data and damage your system.</p>
|
84 |
-
<h2>How to Download Xforce Keygen AutoCAD Mechanical 2016 Crack</h2>
|
85 |
-
<p>If you still want to download Xforce Keygen AutoCAD Mechanical 2016 Crack despite the risks involved, here are the steps you need to follow:</p>
|
86 |
-
<h3>Step 1: Download Xforce Keygen from a Trusted Source</h3>
|
87 |
-
gen safely. There are many websites that claim to offer Xforce Keygen, but some of them may be fake or malicious. You should avoid downloading Xforce Keygen from unknown or suspicious sources, as they may contain viruses or malware that can harm your computer. You should also check the reviews and ratings of the website before downloading Xforce Keygen, and make sure that it has a good reputation and positive feedback from other users. One of the trusted sources where you can download Xforce Keygen is <a href="https://xforcekeygen.net/">https://xforcekeygen.net/</a>. This website provides Xforce Keygen for various Autodesk products, including AutoCAD Mechanical 2016. You can download Xforce Keygen from this website by following these steps:</p>
|
88 |
-
<ul>
|
89 |
-
<li>Go to <a href="https://xforcekeygen.net/">https://xforcekeygen.net/</a> and search for AutoCAD Mechanical 2016 in the search box.</li>
|
90 |
-
<li>Select the version of AutoCAD Mechanical 2016 that matches your system architecture (32-bit or 64-bit).</li>
|
91 |
-
<li>Click on the download button and wait for the download to complete.</li>
|
92 |
-
<li>Extract the downloaded file using a file extractor program such as WinRAR or 7-Zip.</li>
|
93 |
-
<li>You will find a folder named Xforce Keygen AutoCAD Mechanical 2016 Crack inside the extracted file.</li>
|
94 |
-
</ul>
|
95 |
-
<h3>Step 2: Disable Your Antivirus and Internet Connection</h3>
|
96 |
-
<p>The second step is to disable your antivirus and internet connection before running Xforce Keygen. This is because your antivirus may detect Xforce Keygen as a threat and block or delete it. Your internet connection may also interfere with the activation process of Xforce Keygen. To disable your antivirus and internet connection, you can follow these steps:</p>
|
97 |
-
<ul>
|
98 |
-
<li>Right-click on the icon of your antivirus program in the system tray and select Disable or Turn Off.</li>
|
99 |
-
<li>Go to the Control Panel and click on Network and Internet.</li>
|
100 |
-
<li>Click on Network and Sharing Center and then click on Change Adapter Settings.</li>
|
101 |
-
<li>Right-click on your active network connection and select Disable.</li>
|
102 |
-
</ul>
|
103 |
-
<h3>Step 3: Run Xforce Keygen as Administrator</h3>
|
104 |
-
<p>The third step is to run Xforce Keygen as administrator. This is because Xforce Keygen needs to access some system files and folders that require administrative privileges. To run Xforce Keygen as administrator, you can follow these steps:</p>
|
105 |
-
<ul>
|
106 |
-
<li>Go to the folder where you extracted Xforce Keygen AutoCAD Mechanical 2016 Crack.</li>
|
107 |
-
<li>Right-click on the file named xf-adsk64.exe (for 64-bit systems) or xf-adsk32.exe (for 32-bit systems) and select Run as Administrator.</li>
|
108 |
-
<li>A window will pop up asking for permission to run the program. Click on Yes.</li>
|
109 |
-
<li>Xforce Keygen will open and you will see a user interface with some buttons and fields.</li>
|
110 |
-
</ul>
|
111 |
-
<h3>Step 4: Generate the Activation Code for AutoCAD Mechanical 2016</h3>
|
112 |
-
<p>The fourth step is to generate the activation code for AutoCAD Mechanical 2016 using Xforce Keygen. To generate the activation code, you can follow these steps:</p>
|
113 |
-
<ul>
|
114 |
-
<li>In Xforce Keygen, click on the Patch button. A message will appear saying that you need to patch the hosts file. Click on OK.</li>
|
115 |
-
<li>A window will open asking you to locate the hosts file. Navigate to C:\Windows\System32\drivers\etc and select the file named hosts. Click on Open.</li>
|
116 |
-
<li>A message will appear saying that the hosts file has been successfully patched. Click on OK.</li>
|
117 |
-
<li>In Xforce Keygen, click on the Generate button. A random activation code will be generated in the Activation field.</li>
|
118 |
-
<li>Copy the activation code by clicking on the Copy button or pressing Ctrl+C.</li>
|
119 |
-
</ul>
|
120 |
-
<h3>Step 5: Activate AutoCAD Mechanical 2016 with the Code</h3>
|
121 |
-
<p>The final step is to activate AutoCAD Mechanical 2016 with the code that you generated using Xforce Keygen. To activate AutoCAD Mechanical 2016, you can follow these steps:</p>
|
122 |
-
<ul>
|
123 |
-
<li>Run AutoCAD Mechanical 2016 as administrator by right-clicking on its shortcut and selecting Run as Administrator.</li>
|
124 |
-
<li>A window will pop up asking for permission to run the program. Click on Yes.</li>
|
125 |
-
<li>AutoCAD Mechanical 2016 will open and you will see a welcome screen with some options. Click on Activate.</li>
|
126 |
-
<li>A window will open asking you to enter your serial number and product key. Enter any serial number and product key that match your system architecture (32-bit or 64-bit). For example, you can enter 666-69696969 as serial number and 206H1 as product key.</li>
|
127 |
-
<li>Click on Next and then click on I have an activation code from Autodesk.</li>
|
128 |
-
<li>A window will open asking you to enter your activation code. Paste the activation code that you copied from Xforce Keygen by clicking on Paste button or pressing Ctrl+V.</li>
|
129 |
-
<li>Click on Next and then click on Finish.</li>
|
130 |
-
<li>A message will appear saying that your product has been activated successfully. Click on OK.</li>
|
131 |
-
</ul>
|
132 |
-
<h2>Conclusion</h2>
|
133 |
-
<p>In this article, we have explained how to download Xforce Keygen AutoCAD Mechanical 2016 Crack and use it to activate AutoCAD Mechanical 2016 for free. We have also discussed what is AutoCAD Mechanical 2016, what is Xforce Keygen, how it works, what are its benefits and risks, and how to download and use it safely. We hope that this article has been helpful for you and that you have learned something new today. However, we would like to remind you that using Xforce Keygen is illegal and unethical, and that we do not endorse or recommend it in any way. If you want to use AutoCAD Mechanical 2016 legally and ethically, you should buy a license from Autodesk or use their free trial version instead. Thank you for reading this article and have a nice day!</p>
|
134 |
-
<h2>FAQs</h2>
|
135 |
-
<ol><li><b>What is AutoCAD Mechanical 2016?</b><br/>
|
136 |
-
AutoCAD Mechanical 2016 is a software application that belongs to the Autodesk family of products. It is designed for mechanical engineers and designers who need to create and document mechanical parts and assemblies.</li>
|
137 |
-
<li><b>What is Xforce Keygen?</b><br/>
|
138 |
-
Xforce Keygen is a software tool that can generate activation codes for various Autodesk products, such as AutoCAD Mechanical 2016. It is also known as a crack or a patch because it bypasses the original activation process of the software.</li>
|
139 |
-
<li><b>How can I download Xforce Keygen AutoCAD Mechanical 2016 Crack?</b><br/>
|
140 |
-
You can download Xforce Keygen AutoCAD Mechanical 2016 Crack from a trusted source such as <a href="https://xforcekeygen.net/">https://xforcekeygen.net/</a>. You should avoid downloading Xforce Keygen from unknown or suspicious sources, as they may contain viruses or malware that can harm your computer.</li>
|
141 |
-
<li><b>How can I use Xforce Keygen AutoCAD Mechanical 2016 Crack?</b><br/>
|
142 |
-
You can use Xforce Keygen AutoCAD Mechanical 2016 Crack by following these steps: <ul><li>Download Xforce Keygen from a trusted source.</li><li>Disable your antivirus and internet connection.</li><li>Run Xforce Keygen as administrator.</li><li>Generate the activation code for AutoCAD Mechanical 2016.</li><li>Activate AutoCAD Mechanical 2016 with the code.</li></ul></li>
|
143 |
-
<li><b>What are the benefits and risks of using Xforce Keygen AutoCAD Mechanical 2016 Crack?</b><br/>
|
144 |
-
The main benefit of using Xforce Keygen AutoCAD Mechanical 2016 Crack is that it allows you to use AutoCAD Mechanical 2016 for free without paying for a license. The main risk of using Xforce Keygen AutoCAD Mechanical 2016 Crack is that it is illegal and unethical, and that it may expose your computer to malware or viruses that may compromise your personal data and damage your system.</ol>
|
145 |
-
</p> 0a6ba089eb<br />
|
146 |
-
<br />
|
147 |
-
<br />
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
spaces/1acneusushi/gradio-2dmoleculeeditor/data/Edhem Mulabdic Zeleno Busenje Pdf Download A Novel of Bosnia under Austro-Hungarian Occupation.md
DELETED
@@ -1,91 +0,0 @@
|
|
1 |
-
|
2 |
-
<h1>Edhem Mulabdic Zeleno Busenje Pdf Download</h1>
|
3 |
-
<p>If you are interested in Bosnian literature, history, and culture, you might want to read <strong>Zeleno Busenje</strong> by Edhem Mulabdic. This novel is considered one of the most important works of Bosnian literature, as it depicts the life and struggles of Bosnian people during the Austro-Hungarian occupation in the late 19th century. In this article, we will tell you more about Edhem Mulabdic, his novel Zeleno Busenje, and why you should read it. We will also provide you with a link to download a PDF version of the novel for free.</p>
|
4 |
-
<h2>Edhem Mulabdic Zeleno Busenje Pdf Download</h2><br /><p><b><b>Download</b> --->>> <a href="https://byltly.com/2uKwwS">https://byltly.com/2uKwwS</a></b></p><br /><br />
|
5 |
-
<h2>Introduction</h2>
|
6 |
-
<h3>Who was Edhem Mulabdic?</h3>
|
7 |
-
<p>Edhem Mulabdic was a Bosnian writer, teacher, journalist, and politician. He was born in 1862 in Maglaj, a town in central Bosnia. He studied in Sarajevo, Istanbul, and Vienna, where he learned several languages and became familiar with European literature and culture. He worked as a teacher in various towns in Bosnia and Herzegovina, and also wrote for several newspapers and magazines. He was involved in political and cultural activities, advocating for Bosnian autonomy and identity within the Austro-Hungarian Empire. He died in 1954 in Sarajevo.</p>
|
8 |
-
<h3>What is Zeleno Busenje?</h3>
|
9 |
-
<p>Zeleno Busenje (Green Burst) is a novel by Edhem Mulabdic, published in 1898. It is considered the first Bosnian novel, as it was written in the Bosnian language and focused on Bosnian themes and characters. The novel is set in Maglaj, Mulabdic's hometown, during the Austro-Hungarian occupation of Bosnia and Herzegovina in 1878-1879. It tells the story of a group of Bosnian rebels who resist the foreign invaders, as well as the love story between Ahmet, a young rebel leader, and Aisa, the daughter of a wealthy local merchant who opposes the rebellion.</p>
|
10 |
-
<h3>Why is Zeleno Busenje important?</h3>
|
11 |
-
<p>Zeleno Busenje is important for several reasons. First, it is a historical novel that portrays a crucial period in Bosnian history, when Bosnian people faced political, social, economic, and cultural changes under foreign rule. The novel shows how different segments of Bosnian society reacted to these changes, either by resisting, adapting, or collaborating with the Austro-Hungarians. Second, it is a literary novel that uses various techniques and styles to create a realistic and vivid picture of Bosnian life and culture. The novel incorporates elements of folklore, poetry, dialogue, description, narration, and symbolism to convey its themes and messages. Third, it is a national novel that expresses a sense of Bosnian identity and patriotism. The novel celebrates Bosnian values, traditions, customs, language, religion, and history. It also criticizes the oppression and injustice that Bosnian people suffered under foreign domination.</p>
|
12 |
-
<p>Edhem Mulabdic Zeleno Busenje Free Ebook<br />
|
13 |
-
Zeleno Busenje Bosnian Novel by Edhem Mulabdic<br />
|
14 |
-
Edhem Mulabdic Zeleno Busenje Online Read<br />
|
15 |
-
Zeleno Busenje Summary and Analysis<br />
|
16 |
-
Edhem Mulabdic Zeleno Busenje Book Review<br />
|
17 |
-
Zeleno Busenje Themes and Characters<br />
|
18 |
-
Edhem Mulabdic Zeleno Busenje Historical Context<br />
|
19 |
-
Zeleno Busenje Translation and Adaptation<br />
|
20 |
-
Edhem Mulabdic Zeleno Busenje Quotes and Citations<br />
|
21 |
-
Zeleno Busenje Literary Criticism and Interpretation<br />
|
22 |
-
Edhem Mulabdic Zeleno Busenje Audio Book<br />
|
23 |
-
Zeleno Busenje Film and TV Series<br />
|
24 |
-
Edhem Mulabdic Zeleno Busenje Biography and Works<br />
|
25 |
-
Zeleno Busenje Cultural and Social Impact<br />
|
26 |
-
Edhem Mulabdic Zeleno Busenje Genre and Style<br />
|
27 |
-
Zeleno Busenje Comparison and Contrast with Other Novels<br />
|
28 |
-
Edhem Mulabdic Zeleno Busenje Study Guide and Notes<br />
|
29 |
-
Zeleno Busenje Essay and Research Topics<br />
|
30 |
-
Edhem Mulabdic Zeleno Busenje Quiz and Test Questions<br />
|
31 |
-
Zeleno Busenje Teaching and Learning Resources<br />
|
32 |
-
Edhem Mulabdic Zeleno Busenje Awards and Recognition<br />
|
33 |
-
Zeleno Busenje Fan Fiction and Art<br />
|
34 |
-
Edhem Mulabdic Zeleno Busenje Related Books and Authors<br />
|
35 |
-
Zeleno Busenje Influence on Modern Literature<br />
|
36 |
-
Edhem Mulabdic Zeleno Busenje Bibliography and References<br />
|
37 |
-
Zeleno Busenje Editions and Formats<br />
|
38 |
-
Edhem Mulabdic Zeleno Busenje Introduction and Preface<br />
|
39 |
-
Zeleno Busenje Plot and Structure<br />
|
40 |
-
Edhem Mulabdic Zeleno Busenje Setting and Location<br />
|
41 |
-
Zeleno Busenje Symbolism and Imagery<br />
|
42 |
-
Edhem Mulabdic Zeleno Busenje Tone and Mood<br />
|
43 |
-
Zeleno Busenje Conflict and Resolution<br />
|
44 |
-
Edhem Mulabdic Zeleno Busenje Point of View and Narration<br />
|
45 |
-
Zeleno Busenje Vocabulary and Language<br />
|
46 |
-
Edhem Mulabdic Zeleno Busenje Discussion Questions and Answers<br />
|
47 |
-
Zeleno Busenje Author's Purpose and Message<br />
|
48 |
-
Edhem Mulabdic Zeleno Busenje Excerpt and Sample Chapter<br />
|
49 |
-
Zeleno Busenje Reader's Response and Feedback<br />
|
50 |
-
Edhem Mulabdic Zeleno Busenje Related Articles and News<br />
|
51 |
-
Zeleno Busenje Podcasts and Videos<br />
|
52 |
-
Edhem Mulabdic Biography Pdf Download <br />
|
53 |
-
Bosnian Literature Pdf Download <br />
|
54 |
-
Austrougarska Okupacija Pdf Download <br />
|
55 |
-
Muslimanska Književnost Pdf Download <br />
|
56 |
-
Bosna Roman Pdf Download <br />
|
57 |
-
Maglaj Pdf Download <br />
|
58 |
-
Pozor Pdf Download <br />
|
59 |
-
Tahir-Aga Pdf Download <br />
|
60 |
-
Bajram Pdf Download <br />
|
61 |
-
Ašik Omer Pdf Download </p>
|
62 |
-
<h2>Main body</h2>
|
63 |
-
<h3>The plot of Zeleno Busenje</h3>
|
64 |
-
<h4>The setting and the historical background</h4>
|
65 |
-
<p>The novel is set in Maglaj, a town on the river Bosna, in 1878-1879. This was a time when Bosnia and Herzegovina was occupied by Austro-Hungarian troops after the Congress of Berlin decided to give them administrative control over the region. The Austro-Hungarians wanted to modernize and integrate Bosnia and Herzegovina into their empire, but they faced resistance from many Bosnians who wanted to preserve their autonomy and identity. Some Bosnians organized armed rebellions against the occupiers, while others accepted or collaborated with them.</p>
|
66 |
-
<h4>The main characters and their conflicts</h4>
|
67 |
-
<p>The novel focuses on two main characters: Ahmet and Aisa. Ahmet is a young man who joins the rebels against the Austro-Hungarians. He is brave, loyal, passionate, and idealistic. He believes that fighting for his homeland is his duty and honor. He falls in love with Aisa, a beautiful girl who lives in Maglaj. Aisa is the daughter of Muharem-aga, a rich merchant who opposes the rebellion. He is conservative, stubborn, proud, and greedy. He wants to maintain his status and wealth under the new regime. He forbids Aisa to see Ahmet or join his cause.</p>
|
68 |
-
<p>The novel follows the love story between Ahmet and Aisa as they face various obstacles and dangers. They meet secretly at night near a spring called Zeleno Busenje (Green Burst), where they exchange vows of love and loyalty. They also communicate through letters that they hide in books or flowers. However, their relationship is threatened by Muharem-aga's disapproval, Ahmet's involvement in the rebellion, Aisa's illness caused by grief and anxiety, and the Austro-Hungarian attacks on Maglaj.</p>
|
69 |
-
<h4>The themes and the messages</h4>
|
70 |
-
<p>The novel explores several themes that are relevant to Bosnian history and culture. Some of these themes are:</p>
|
71 |
-
<ul>
|
72 |
-
<li><strong>Love vs duty:</strong> The novel shows how love can inspire courage and sacrifice but also cause pain and sorrow. Ahmet and Aisa love each other deeply but they also have different duties to their families and their country. Their love is tested by external forces that try to separate them or destroy them.</li>
|
73 |
-
<li><strong>Patriotism vs collaboration:</strong> The novel shows how patriotism can motivate people to fight for their rights and their dignity but also expose them to violence and death. Ahmet and his comrades are patriots who resist the foreign invaders but they also suffer losses and hardships. Muharem-aga and his associates are collaborators who accept the foreign rulers but they also enjoy privileges and benefits.</li>
|
74 |
-
<li><strong>Tradition vs modernity:</strong> The novel shows how tradition can preserve the identity and the values of a people but also hinder their progress and adaptation. Muharem-aga and his generation are traditionalists who cling to their old ways and customs but they also fail to understand or cope with the changes in their society. Ahmet and his generation are modernists who embrace the new ideas and opportunities but they also challenge or reject the authority or influence of their elders.</li>
|
75 |
-
<li><strong>Faith vs fate:</strong> The novel shows how faith can provide hope and comfort but also cause conflict and intolerance. Ahmet and Aisa are faithful Muslims who trust in God's will but they also face opposition or persecution from other religious groups or sects. They also question God's justice or mercy when they encounter suffering or tragedy.</li>
|
76 |
-
</ul>
|
77 |
-
<p>The novel conveys several messages that are relevant to Bosnian literature and culture. Some of these messages are:</p>
|
78 |
-
<ul>
|
79 |
-
<li><strong>Bosnia is a unique land with a rich history:</strong> The novel depicts Bosnia as a land of beauty, diversity, and complexity. It celebrates Bosnia's natural resources, cultural heritage, and historical legacy. It also acknowledges Bosnia's challenges, conflicts, and tragedies.</li>
|
80 |
-
<li><strong>Bosnians are a proud people with a strong spirit:</strong> The novel portrays Bosnians as a people of courage, loyalty, and passion. It praises Bosnians' resistance, solidarity, and patriotism. It also recognizes Bosnians' suffering, loss, and grief.</li>
|
81 |
-
<li><strong>Bosnians should preserve their identity but also embrace change:</strong> The novel suggests that Bosnians should maintain their identity but also adapt to change. It encourages Bosnians to respect their traditions but also learn from other cultures. <ol start="3">
|
82 |
-
<li><strong>What does Zeleno Busenje mean?</strong></li>
|
83 |
-
<p>Zeleno Busenje means Green Burst or Green Turf in Bosnian. It is the name of a spring near Maglaj where Ahmet and Aisa meet secretly at night. The spring symbolizes their love, their hope, and their connection to nature.</p>
|
84 |
-
<li><strong>Who are some of the other characters in Zeleno Busenje?</strong></li>
|
85 |
-
<p>Some of the other characters in Zeleno Busenje are: Husein-beg, Ahmet's uncle and the leader of the rebels; Hasan-aga, Ahmet's friend and fellow rebel; Mehmed-aga, Aisa's brother and Muharem-aga's heir; Zlata, Aisa's friend and confidante; Osman-beg, the Austro-Hungarian commander in Maglaj; and Father Marko, a Catholic priest who helps Ahmet and Aisa.</p>
|
86 |
-
<li><strong>What are some of the literary devices that Mulabdic uses in Zeleno Busenje?</strong></li>
|
87 |
-
<p>Some of the literary devices that Mulabdic uses in Zeleno Busenje are: foreshadowing, irony, contrast, symbolism, imagery, dialogue, narration, and description. He also uses elements of folklore, poetry, and history to enrich his novel.</p>
|
88 |
-
</ol>
|
89 |
-
</p> 0a6ba089eb<br />
|
90 |
-
<br />
|
91 |
-
<br />
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
spaces/1gistliPinn/ChatGPT4/Examples/BIOS Agent Plus Serial Key Crack !FREE!.md
DELETED
@@ -1,31 +0,0 @@
|
|
1 |
-
|
2 |
-
`<h1>BIOS Agent Plus: A Powerful Tool to Update and Repair Your BIOS</h1>`
|
3 |
-
|
4 |
-
`<p>BIOS Agent Plus is a software program that checks the version of your installed drivers, including BIOS, and notifies you if they need to be updated or not. It is very easy to use, as it does not require any complicated settings. You can run it from any location on your hard drive, USB flash drive, or other storage device.</p>`
|
5 |
-
|
6 |
-
`<p>Updating your BIOS can improve your system performance, stability, and compatibility with new hardware and software. However, updating your BIOS can also be risky, as a wrong or corrupted update can damage your system and cause data loss. That is why you need BIOS Agent Plus, a reliable and safe tool that can help you update and repair your BIOS with ease.</p>
|
7 |
-
<h2>BIOS Agent Plus Serial Key Crack</h2><br /><p><b><b>Download File</b> ✯✯✯ <a href="https://imgfil.com/2uxXsk">https://imgfil.com/2uxXsk</a></b></p><br /><br />`
|
8 |
-
|
9 |
-
`<p>BIOS Agent Plus scans your system for drivers and compares them with the latest versions available online, notifying you if any of your drivers need updating. It also provides you with shortcut links where you can download the updates from the official sources. You can also create a backup of your drivers and store them in a compressed zip file.</p>`
|
10 |
-
|
11 |
-
`<p>BIOS Agent Plus works with all Windows versions and supports a large database of drivers for all kinds of devices, such as disk drives, display adapters, DVD/CD-ROM drives, human interface devices, keyboards, mice, and other pointing devices. It also shows you the status of your BIOS updates availability, as well as other useful information about your system.</p>`
|
12 |
-
|
13 |
-
`<p>BIOS Agent Plus is an award-winning software that has been trusted by millions of users worldwide. It is fast, accurate, and easy to use. It can help you keep your system up to date and running smoothly. If you want to download BIOS Agent Plus and try it for yourself, you can visit <a href="https://crackrepack.download4free.org/bios-agent-plus-crack/">this link</a> and get it for free.</p>`
|
14 |
-
|
15 |
-
`<p>But how do you update your BIOS with BIOS Agent Plus? It's very simple. Just download and install the program from the link above, and run it. It will scan your system and show you a report of your drivers and BIOS status. You can then choose to update any of them by clicking on the Update button. BIOS Agent Plus will download the latest version of the driver or BIOS from the official source and install it for you.</p>`
|
16 |
-
|
17 |
-
`<p>Updating your BIOS with BIOS Agent Plus is safe and reliable. The program has a built-in backup feature that allows you to restore your previous BIOS version in case something goes wrong. It also has a recovery mode that can help you fix any issues that might occur during the update process. You can also contact the customer support team if you need any assistance.</p>`
|
18 |
-
|
19 |
-
`<p>There are many benefits of updating your BIOS with BIOS Agent Plus. Some of them are:</p>`
|
20 |
-
|
21 |
-
`<ul>`
|
22 |
-
`<li>The overall performance of your computer improves, as your system can take advantage of new features and optimizations.</li>`
|
23 |
-
`<li>Compatibility issues are resolved, as your system can work better with new hardware and software.</li>`
|
24 |
-
`<li>Booting time is shortened, as your system can load faster and more efficiently.</li>`
|
25 |
-
`<li>Security updates are applied, as your system can protect itself from potential threats and vulnerabilities.</li>`
|
26 |
-
`</ul>`
|
27 |
-
|
28 |
-
`<p>If you want to keep your computer up to date and running smoothly, you should consider updating your BIOS with BIOS Agent Plus. It is a powerful and easy-to-use tool that can help you update and repair your BIOS with ease. Download it today and see the difference for yourself.</p>
|
29 |
-
<p></p>` d5da3c52bf<br />
|
30 |
-
<br />
|
31 |
-
<br />
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
spaces/1pelhydcardo/ChatGPT-prompt-generator/assets/Download Blue Egg and Unleash Your Inner Egg Warrior in Multiplayer Battles.md
DELETED
@@ -1,105 +0,0 @@
|
|
1 |
-
|
2 |
-
<h1>Download Blue Egg: What Is It and How to Play It</h1> | <p>If you are looking for a fun and unique way to spend your free time, you might want to try downloading Blue Egg. But what is Blue Egg, and how can you play it? In this article, we will answer these questions and more. We will explain what Blue Egg is, how to play its games, how to download its software, and what benefits and drawbacks it has. By the end of this article, you will have a better understanding of Blue Egg and why it is worth trying.</p>
|
3 |
-
<h2>What is Blue Egg?</h2>
|
4 |
-
<p>Blue Egg is a term that refers to various types of games and software that are developed by Blue Wizard Digital, a company founded by Jason Kapalka, the co-creator of PopCap Games. The company specializes in creating humorous, quirky, and sometimes violent games and software that appeal to a wide range of audiences.</p>
|
5 |
-
<h2>download blue egg</h2><br /><p><b><b>Download</b> 🔗 <a href="https://urlin.us/2uSYwI">https://urlin.us/2uSYwI</a></b></p><br /><br />
|
6 |
-
<h3>A brief introduction to the concept and origin of Blue Egg</h3>
|
7 |
-
<p>The concept of Blue Egg originated from a joke that Jason Kapalka made in an interview with VentureBeat in 2016. He said that he wanted to make a game called "Blue Eggs" that would be about "eggs with guns". He later decided to turn this idea into a reality, and thus Shell Shockers was born. Shell Shockers is an online multiplayer first-person shooter game where players control eggs armed with various weapons and fight against other eggs in different modes and maps. The game became a hit among gamers, especially those who enjoy io games, which are simple but addictive browser-based games.</p>
|
8 |
-
<h3>The different types of Blue Egg games and software</h3>
|
9 |
-
<p>Besides Shell Shockers, Blue Wizard Digital has also developed other types of games and software under the Blue Egg brand. Some of these include:</p>
|
10 |
-
<ul>
|
11 |
-
<li>Slayaway Camp: A puzzle game where players control a serial killer who has to murder camp counselors and teenagers in various scenarios inspired by horror movies.</li>
|
12 |
-
<li>Friday the 13th: Killer Puzzle: A spin-off of Slayaway Camp that features Jason Voorhees, the iconic villain from the Friday the 13th franchise, as the playable character.</li>
|
13 |
-
<li>Space Tyrant: A strategy game where players have to conquer the galaxy as an evil space tyrant.</li>
|
14 |
-
<li>Blue VO!CE: A software that allows users to customize their voice with various effects and samples for streaming, recording, or gaming purposes.</li>
|
15 |
-
<li>Blue EGGspress: A software that enables users to create their own games using assets from Shell Shockers and other Blue Wizard Digital games.</li>
|
16 |
-
</ul>
|
17 |
-
<h2>How to play Blue Egg games?</h2>
|
18 |
-
<p>Playing Blue Egg games is easy and fun. All you need is a device that can access the internet and a browser that supports HTML5 or Flash. You can also download some of the games as apps on your mobile device or as desktop applications on your computer. Here are some tips on how to play one of the most popular Blue Egg games, Shell Shockers.</p>
|
19 |
-
<h3>The basic gameplay Blue Egg software, you should be aware of its benefits and drawbacks, as well as the steps and requirements for downloading and installing it on your device. Here are some details on how to download Blue Egg software. <h3>The benefits and drawbacks of using Blue Egg software for your audio and video needs</h3>
|
20 |
-
<p>Blue Egg software can help you enhance your audio and video quality and creativity with various effects and samples. For example, Blue VO!CE can help you customize your voice with different filters, such as broadcast, warm, crisp, or vintage. You can also use voice modulation effects to change your voice into different characters, such as DJ Robot, Electrobeast, or Ethereal. You can also use HD audio samples to add some flair to your streams, recordings, or games. For example, you can use air raid, explosion, or applause sounds to create a more immersive atmosphere. You can also record your own sounds or import your own samples to use with Blue VO!CE .</p>
|
21 |
-
<p>Blue EGGspress can help you create your own games using assets from Shell Shockers and other Blue Wizard Digital games. You can use the drag-and-drop interface to design your own levels, characters, weapons, and power-ups. You can also share your games with other users and play their games as well.</p>
|
22 |
-
<p>However, using Blue Egg software also has some drawbacks. For one thing, you need to have a compatible device and software to use Blue Egg software. For example, Blue VO!CE requires a Logitech G HUB software and a compatible Blue microphone, such as Yeti, Yeti Nano, or Yeti X. Blue EGGspress requires a Windows 10 device and a Steam account. You also need to have enough storage space and internet bandwidth to download and install the software. Another drawback is that using Blue Egg software may affect your device's performance and battery life. For example, using Blue VO!CE may increase your CPU usage and drain your battery faster. Using Blue EGGspress may also slow down your device or cause crashes if you have too many assets or processes running at the same time.</p>
|
23 |
-
<p>download blue egg global education<br />
|
24 |
-
download blue egg fps game<br />
|
25 |
-
download blue egg shell shockers<br />
|
26 |
-
download blue egg app store<br />
|
27 |
-
download blue egg google play<br />
|
28 |
-
download blue egg multiplayer shooter<br />
|
29 |
-
download blue egg io game<br />
|
30 |
-
download blue egg gun skins<br />
|
31 |
-
download blue egg free to play<br />
|
32 |
-
download blue egg cross platform<br />
|
33 |
-
download blue egg online game<br />
|
34 |
-
download blue egg terms of use<br />
|
35 |
-
download blue egg web game<br />
|
36 |
-
download blue egg mobile game<br />
|
37 |
-
download blue egg shooting game<br />
|
38 |
-
download blue egg fun game<br />
|
39 |
-
download blue egg best game<br />
|
40 |
-
download blue egg latest game<br />
|
41 |
-
download blue egg popular game<br />
|
42 |
-
download blue egg awesome game<br />
|
43 |
-
download blue egg action game<br />
|
44 |
-
download blue egg adventure game<br />
|
45 |
-
download blue egg crazy game<br />
|
46 |
-
download blue egg zany game<br />
|
47 |
-
download blue egg amazing game<br />
|
48 |
-
download blue egg exciting game<br />
|
49 |
-
download blue egg challenging game<br />
|
50 |
-
download blue egg addictive game<br />
|
51 |
-
download blue egg hilarious game<br />
|
52 |
-
download blue egg cool game<br />
|
53 |
-
download blue egg unique game<br />
|
54 |
-
download blue egg original game<br />
|
55 |
-
download blue egg creative game<br />
|
56 |
-
download blue egg innovative game<br />
|
57 |
-
download blue egg different game<br />
|
58 |
-
download blue egg interesting game<br />
|
59 |
-
download blue egg entertaining game<br />
|
60 |
-
download blue egg engaging game<br />
|
61 |
-
download blue egg social game<br />
|
62 |
-
download blue egg competitive game<br />
|
63 |
-
download blue egg cooperative game<br />
|
64 |
-
download blue egg team-based game<br />
|
65 |
-
download blue egg capture the flag game<br />
|
66 |
-
download blue egg king of the coop mode<br />
|
67 |
-
download blue egg golden eggs rewards<br />
|
68 |
-
download blue egg customizations options<br />
|
69 |
-
download blue egg hats and decals <br />
|
70 |
-
download blue egg grenades and weapons</p>
|
71 |
-
<h3>The steps and requirements for downloading and installing Blue Egg software on your computer or mobile device</h3>
|
72 |
-
<p>If you want to download and install Blue Egg software on your computer or mobile device, here are the steps and requirements that you need to follow:</p>
|
73 |
-
<ol>
|
74 |
-
<li>Check the compatibility of your device and software with the Blue Egg software that you want to download. For example, if you want to download Blue VO!CE, you need to have a Windows 10 or Mac OS X 10.11 or later device, a Logitech G HUB software version 2020.12 or later, and a compatible Blue microphone connected via USB. If you want to download Blue EGGspress, you need to have a Windows 10 device with at least 4 GB of RAM and 2 GB of available storage space, a Steam account, and a Steam client installed.</li>
|
75 |
-
<li>Go to the official website of the Blue Egg software that you want to download. For example, if you want to download Blue VO!CE, go to https://www.logitechg.com/en-us/innovation/blue-voice-technology.html. If you want to download Blue EGGspress, go to https://store.steampowered.com/app/1565050/Blue_EGGspress/.</li>
|
76 |
-
<li>Follow the instructions on the website to download and install the Blue Egg software on your device. For example, if you want to download Blue VO!CE, click on the "Download G HUB" button and run the installer file. Then open the Logitech G HUB software and select your Blue microphone from the device list. Then click on the "Blue VO!CE" tab and enable it. You can then choose from the presets or customize your own settings. If you want to download Blue EGGspress, click on the "Add to Cart" button and complete the purchase process. Then open the Steam client and go to your library. Then click on the "Blue EGGspress" game and install it.</li>
|
77 |
-
<li>Enjoy using the Blue Egg software for your audio and video needs.</li>
|
78 |
-
</ol>
|
79 |
-
<h3>The best practices and recommendations for using Blue Egg software effectively and safely</h3>
|
80 |
-
<p>To use the Blue Egg software effectively and safely, here are some best practices and recommendations that you should follow:</p>
|
81 |
-
<ul>
|
82 |
-
<li>Update your device's drivers and software regularly to ensure optimal performance and compatibility with the Blue Egg software.</li>
|
83 |
-
<li>Use a reliable antivirus program and firewall to protect your device from malware or hackers that may try to access or damage your files or data.</li>
|
84 |
-
<li>Backup your files and data regularly to prevent losing them in case of a system crash or failure.</li>
|
85 |
-
<li> <li>Adjust the settings and options of the Blue Egg software according to your preferences and needs. For example, you can change the volume, pitch, or speed of your voice with Blue VO!CE. You can also change the graphics, sound, or controls of your game with Blue EGGspress.</li>
|
86 |
-
<li>Test and preview your audio and video output before using it for streaming, recording, or gaming purposes. For example, you can use the "Listen" feature of Blue VO!CE to hear how your voice sounds with the effects and samples. You can also use the "Play" feature of Blue EGGspress to try out your game before publishing or sharing it.</li>
|
87 |
-
<li>Be creative and have fun with the Blue Egg software. You can experiment with different effects and samples with Blue VO!CE to create unique and funny voices. You can also use your imagination and skills to create amazing and fun games with Blue EGGspress.</li>
|
88 |
-
</ul>
|
89 |
-
<h2>Conclusion</h2>
|
90 |
-
<p>Blue Egg is a term that refers to various types of games and software that are developed by Blue Wizard Digital, a company founded by Jason Kapalka, the co-creator of PopCap Games. The company specializes in creating humorous, quirky, and sometimes violent games and software that appeal to a wide range of audiences. Some of the most popular Blue Egg products are Shell Shockers, a multiplayer first-person shooter game where players control eggs armed with weapons, and Blue VO!CE, a software that allows users to customize their voice with various effects and samples. You can play Blue Egg games on any device that has a web browser that supports HTML5 or Flash. You can also download some of the games as apps on your mobile device or as desktop applications on your computer. You can also download Blue Egg software on your computer or mobile device if you have a compatible device and software. However, you should also be aware of the benefits and drawbacks of using Blue Egg software, as well as the steps and requirements for downloading and installing it on your device. You should also follow some best practices and recommendations for using Blue Egg software effectively and safely.</p>
|
91 |
-
<p>If you are looking for a fun and unique way to spend your free time, you might want to try downloading Blue Egg. You will not only enjoy playing its games, but also enhancing your audio and video quality and creativity with its software. So what are you waiting for? Download Blue Egg today and have a blast!</p>
|
92 |
-
<h2>FAQs</h2>
|
93 |
-
<h3>What is the origin of the name "Blue Egg"?</h3>
|
94 |
-
<p>The name "Blue Egg" originated from a joke that Jason Kapalka made in an interview with VentureBeat in 2016. He said that he wanted to make a game called "Blue Eggs" that would be about "eggs with guns". He later decided to turn this idea into a reality, and thus Shell Shockers was born. The name "Blue Egg" then became a term that refers to various types of games and software that are developed by Blue Wizard Digital.</p>
|
95 |
-
<h3>Is Blue Egg free to play or download?</h3>
|
96 |
-
<p>Most of the Blue Egg games are free to play on any device that has a web browser that supports HTML5 or Flash. However, some of the games may have optional in-game purchases or ads that support the developers. Some of the games are also available as paid apps on mobile devices or desktop applications on computers. For example, Slayaway Camp and Friday the 13th: Killer Puzzle cost $2.99 and $9.99 respectively on Steam. The Blue Egg software is also free to download on compatible devices and software. However, some of the software may require additional purchases or subscriptions to access all features or services.</p>
|
97 |
-
<h3>Is Blue Egg safe to play or download?</h3>
|
98 |
-
<p>Blue Egg is generally safe to play or download if you follow some precautions. You should only play or download Blue Egg products from official or trusted sources, such as the official website, app store, or Steam store. You should also use a reliable antivirus program and firewall to protect your device from malware or hackers that may try to access or damage your files or data. You should also backup your files and data regularly to prevent losing them in case of a system crash or failure.</p>
|
99 |
-
<h3>Is Blue Egg suitable for children?</h3>
|
100 |
-
<p>Some of the Blue Egg products may not be suitable for children due to their humorous, quirky, and sometimes violent content. For example, Shell Shockers involves shooting and cracking other eggs with blood splatter effects. Slayaway Camp and Friday the 13th: Killer Puzzle involve murdering camp counselors and teenagers in gruesome ways inspired by horror movies. The Blue Egg software may also contain inappropriate or offensive effects or samples that may not be suitable for children. Therefore, parents should supervise their children's use of Blue Egg products and set parental controls if necessary.</p>
|
101 |
-
<h h3>How can I contact Blue Wizard Digital or get more information about Blue Egg?</h3>
|
102 |
-
<p>If you want to contact Blue Wizard Digital or get more information about Blue Egg, you can visit their official website at https://www.bluewizard.com/. You can also follow them on their social media accounts, such as Facebook, Twitter, Instagram, or YouTube. You can also join their Discord server or Reddit community to chat with other fans and get updates and news about their products. You can also email them at [email protected] or fill out their contact form on their website.</p>
|
103 |
-
<p>I hope you enjoyed reading this article and learned something new about Blue Egg. If you have any questions or feedback, please feel free to leave a comment below. Thank you for your time and attention.</p> 197e85843d<br />
|
104 |
-
<br />
|
105 |
-
<br />
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
spaces/1phancelerku/anime-remove-background/Dinero infinito y gemas en Stickman Warriors APK Descarga la versin MOD.md
DELETED
@@ -1,107 +0,0 @@
|
|
1 |
-
|
2 |
-
<h1>Stickman Warriors APK Dinero Infinito: How to Download and Play</h1>
|
3 |
-
<p>Do you love stickman games? Do you enjoy fast-paced, action-packed battles with realistic physics and ragdoll effects? If yes, then you should try Stickman Warriors, a fun and addictive game that will test your skills and reflexes. In this game, you can control a stickman hero and fight against various enemies in different modes and levels. You can also customize your hero with different weapons, outfits, and skills. But what if you want to have unlimited money and access to all the features of the game? Well, you can do that by downloading Stickman Warriors APK Dinero Infinito, a modified version of the game that gives you everything you need to enjoy the game to the fullest. In this article, we will tell you what Stickman Warriors is, why you should download Stickman Warriors APK Dinero Infinito, how to download and install it, and some tips and tricks for playing it.</p>
|
4 |
-
<h2>What is Stickman Warriors?</h2>
|
5 |
-
<p>Stickman Warriors is a popular stickman fighting game developed by ViperGames. It was released in 2015 and has since gained millions of downloads and positive reviews from players around the world. The game is available for Android devices and can be downloaded from Google Play Store for free.</p>
|
6 |
-
<h2>stickman warriors apk dinero infinito</h2><br /><p><b><b>Download File</b> » <a href="https://jinyurl.com/2uNLXi">https://jinyurl.com/2uNLXi</a></b></p><br /><br />
|
7 |
-
<h3>Features of Stickman Warriors</h3>
|
8 |
-
<p>Stickman Warriors has many features that make it an exciting and enjoyable game. Some of these features are:</p>
|
9 |
-
<ul>
|
10 |
-
<li>Realistic physics and ragdoll effects that make the battles more dynamic and fun.</li>
|
11 |
-
<li>Various modes and levels to choose from, such as survival mode, tournament mode, campaign mode, etc.</li>
|
12 |
-
<li>Different weapons and outfits to customize your hero, such as swords, axes, hammers, helmets, armors, etc.</li>
|
13 |
-
<li>Different skills and combos to use in combat, such as kicks, punches, flips, spins, etc.</li>
|
14 |
-
<li>Different heroes to unlock and play with, each with their own abilities and stats.</li>
|
15 |
-
<li>Simple and intuitive controls that are easy to learn and use.</li>
|
16 |
-
<li>Stunning graphics and sound effects that create an immersive gaming experience.</li>
|
17 |
-
</ul>
|
18 |
-
<h3>Gameplay of Stickman Warriors</h3>
|
19 |
-
<p>The gameplay of Stickman Warriors is simple but challenging. You have to control your hero using the joystick on the left side of the screen and use the buttons on the right side to attack, defend, or use skills. You have to defeat your opponent by reducing their health bar to zero or knocking them out of the arena. You can also use the environment to your advantage, such as walls, spikes, traps, etc. You can earn coins by winning battles or watching ads. You can use these coins to buy new weapons, outfits, or skills for your hero. You can also unlock new heroes by completing certain levels or achievements.</p>
|
20 |
-
<h2>Why Download Stickman Warriors APK Dinero Infinito?</h2>
|
21 |
-
<p>Stickman Warriors is a fun game that you can play for free. However, there are some limitations that may affect your gaming experience. For example, you may run out of coins to buy new items or upgrade your hero. You may also have to watch ads to earn more coins or unlock new heroes. You may also not be able to access some features or modes that require in-app purchases. If you want to avoid these limitations and enjoy the game without any restrictions, you should download Stickman Warriors APK Dinero Infinito.</p>
|
22 |
-
<h3>Benefits of Stickman Warriors APK Dinero Infinito</h3>
|
23 |
-
<p>Stickman Warriors APK Dinero Infinito is a modified version of the original game that gives you unlimited money and access to all the features of the game. Some of the benefits of Stickman Warriors APK Dinero Infinito are:</p>
|
24 |
-
<ul>
|
25 |
-
<li>You can buy any weapon, outfit, or skill you want without worrying about the cost.</li>
|
26 |
-
<li>You can upgrade your hero to the maximum level and make them stronger and faster.</li>
|
27 |
-
<li>You can unlock all the heroes and play with them in any mode or level.</li>
|
28 |
-
<li>You can enjoy the game without any ads or interruptions.</li>
|
29 |
-
<li>You can access any mode or level that requires in-app purchases for free.</li>
|
30 |
-
</ul>
|
31 |
-
<h3>How to Download and Install Stickman Warriors APK Dinero Infinito</h3>
|
32 |
-
<p>Downloading and installing Stickman Warriors APK Dinero Infinito is easy and safe. You just need to follow these simple steps:</p>
|
33 |
-
<ol>
|
34 |
-
<li>Go to [this link] and download the APK file of Stickman Warriors APK Dinero Infinito.</li>
|
35 |
-
<li>Enable the installation of apps from unknown sources on your device. You can do this by going to Settings > Security > Unknown Sources and toggling it on.</li>
|
36 |
-
<li>Locate the downloaded APK file on your device and tap on it to start the installation process.</li>
|
37 |
-
<li>Follow the instructions on the screen and wait for the installation to finish.</li>
|
38 |
-
<li>Launch the game and enjoy!</li>
|
39 |
-
</ol>
|
40 |
-
<h2>Tips and Tricks for Playing Stickman Warriors</h2>
|
41 |
-
<p>Stickman Warriors is a game that requires skill and strategy. You need to be quick and smart to defeat your enemies and win the battles. Here are some tips and tricks that can help you improve your gameplay:</p>
|
42 |
-
<h3>Choose Your Weapon Wisely</h3>
|
43 |
-
<p>There are many weapons to choose from in Stickman Warriors, each with their own advantages and disadvantages. Some weapons are faster, some are stronger, some have longer range, etc. You need to choose a weapon that suits your playstyle and the situation. For example, if you are facing a fast and agile enemy, you may want to use a sword or an axe that can deal quick damage. If you are facing a tough and armored enemy, you may want to use a hammer or a mace that can break their defense. If you are facing a distant enemy, you may want to use a spear or a bow that can hit them from afar.</p>
|
44 |
-
<p>stickman warriors mod apk unlimited money and gems<br />
|
45 |
-
descargar stickman warriors hackeado para android<br />
|
46 |
-
stickman warriors apk full version free download<br />
|
47 |
-
stickman warriors apk ultima version 2023<br />
|
48 |
-
stickman warriors apk sin publicidad<br />
|
49 |
-
stickman warriors apk todo desbloqueado<br />
|
50 |
-
stickman warriors apk mod menu<br />
|
51 |
-
stickman warriors apk offline<br />
|
52 |
-
stickman warriors apk no root<br />
|
53 |
-
stickman warriors apk mega<br />
|
54 |
-
stickman warriors apk mediafıre<br />
|
55 |
-
stickman warriors apk uptodown<br />
|
56 |
-
stickman warriors apk rexdl<br />
|
57 |
-
stickman warriors apk revdl<br />
|
58 |
-
stickman warriors apk happymod<br />
|
59 |
-
stickman warriors apk pure<br />
|
60 |
-
stickman warriors apk android 1<br />
|
61 |
-
stickman warriors apk android oyun club<br />
|
62 |
-
stickman warriors apk obb<br />
|
63 |
-
stickman warriors apk data<br />
|
64 |
-
stickman warriors apk hack 2023<br />
|
65 |
-
stickman warriors apk mod 2023<br />
|
66 |
-
stickman warriors apk premium<br />
|
67 |
-
stickman warriors apk pro<br />
|
68 |
-
stickman warriors apk vip<br />
|
69 |
-
stickman warriors apk latest version<br />
|
70 |
-
stickman warriors apk new version<br />
|
71 |
-
stickman warriors apk old version<br />
|
72 |
-
stickman warriors apk original<br />
|
73 |
-
stickman warriors apk cracked<br />
|
74 |
-
stickman warriors apk unlimited everything<br />
|
75 |
-
stickman warriors apk unlimited coins and diamonds<br />
|
76 |
-
stickman warriors apk unlimited health and energy<br />
|
77 |
-
stickman warriors apk unlimited characters and skins<br />
|
78 |
-
stickman warriors apk unlimited weapons and items<br />
|
79 |
-
stickman warriors apk unlimited levels and modes<br />
|
80 |
-
stickman warriors apk unlimited fun and action<br />
|
81 |
-
stickman warriors modded apk download for android<br />
|
82 |
-
como descargar e instalar stickman warriors modificado para android gratis y facil en español 2023 <br />
|
83 |
-
como tener dinero infinito en el juego de android de peleas de palitos llamado "stickman warriors"</p>
|
84 |
-
<h3>Use Your Skills and Combos</h3>
|
85 |
-
<p>Besides weapons, you also have skills and combos that you can use in combat. Skills are special moves that can deal more damage, stun your enemy, heal yourself, etc. Combos are sequences of attacks that can create powerful effects. You need to use your skills and combos wisely and at the right time. For example, if you are low on health, you may want to use a skill that can heal you or make you invincible for a short time. If you are surrounded by enemies, you may want to use a skill that can knock them back or make them explode. If you are facing a single enemy, you may want to use a combo that can deal massive damage or finish them off.</p>
|
86 |
-
<h3>Upgrade Your Hero and Unlock New Ones</h3>
|
87 |
-
<p>As you play Stickman Warriors, you will earn coins that you can use to upgrade your hero or unlock new ones. Upgrading your hero will increase their stats, such as health, damage, speed, etc. Unlocking new heroes will give you more options and variety in gameplay. Each hero has their own abilities and stats that make them unique. You need to upgrade your hero regularly and try different heroes to find the one that suits you best.</p>
|
88 |
-
<h2>Conclusion</h2>
|
89 |
-
<p>Stickman Warriors is a fun and addictive stickman fighting game that will keep you entertained for hours. You can control a stickman hero and fight against various enemies in different modes and levels. You can also customize your hero with different weapons, outfits, and skills. If you want to have unlimited money and access to all the features of the game, you should download Stickman Warriors APK Dinero Infinito, a modified version of the game that gives you everything you need to enjoy the game to the fullest. In this article, we have told you what Stickman Warriors is, why you should download Stickman Warriors APK Dinero Infinito, how to download and install it, and some tips and tricks for playing it. We hope you found this article helpful and informative. Now go ahead and download Stickman Warriors APK Dinero Infinito and have fun!</p>
|
90 |
-
<h3>Summary of the Article</h3>
|
91 |
-
<p>This article is about Stickman Warriors APK Dinero Infinito, a modified version of Stickman Warriors, a popular stickman fighting game. The article explains what Stickman Warriors is, why you should download Stick man Warriors APK Dinero Infinito, how to download and install it, and some tips and tricks for playing it. The article is written in a conversational style, using an informal tone, personal pronouns, simple language, engaging questions, and analogies. The article also uses HTML formatting, such as headings, lists, and links, to make it more visually appealing and organized.</p>
|
92 |
-
<h3>FAQs</h3>
|
93 |
-
<p>Here are some frequently asked questions about Stickman Warriors APK Dinero Infinito:</p>
|
94 |
-
<ol>
|
95 |
-
<li>Is Stickman Warriors APK Dinero Infinito safe to download and install?</li>
|
96 |
-
<p>Yes, Stickman Warriors APK Dinero Infinito is safe to download and install. It does not contain any viruses or malware that can harm your device or data. However, you should always download it from a trusted source and enable the installation of apps from unknown sources on your device.</p>
|
97 |
-
<li>Will Stickman Warriors APK Dinero Infinito affect the original game?</li>
|
98 |
-
<p>No, Stickman Warriors APK Dinero Infinito will not affect the original game. It is a separate app that runs independently from the original game. You can have both apps on your device and play them separately.</p>
|
99 |
-
<li>Can I play Stickman Warriors APK Dinero Infinito online with other players?</li>
|
100 |
-
<p>No, Stickman Warriors APK Dinero Infinito is not compatible with the online mode of the original game. You can only play it offline with the AI opponents or with your friends on the same device.</p>
|
101 |
-
<li>Can I update Stickman Warriors APK Dinero Infinito to the latest version of the original game?</li>
|
102 |
-
<p>No, Stickman Warriors APK Dinero Infinito is not updated automatically to the latest version of the original game. You will have to download and install the new version of Stickman Warriors APK Dinero Infinito manually whenever it is available.</p>
|
103 |
-
<li>Can I uninstall Stickman Warriors APK Dinero Infinito if I don't like it?</li>
|
104 |
-
<p>Yes, you can uninstall Stickman Warriors APK Dinero Infinito anytime you want. You just need to go to Settings > Apps > Stickman Warriors APK Dinero Infinito and tap on Uninstall. You can also delete the APK file from your device if you don't need it anymore.</p>
|
105 |
-
</ol></p> 197e85843d<br />
|
106 |
-
<br />
|
107 |
-
<br />
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
spaces/1phancelerku/anime-remove-background/Download Driving School 2016 Mod Apk with Unlimited Money and All Cars Unlocked.md
DELETED
@@ -1,59 +0,0 @@
|
|
1 |
-
|
2 |
-
<h1>Driving School 2016 Mod Apk Unlimited Money: A Review</h1>
|
3 |
-
<p>Do you love driving games? Do you want to learn how to drive different vehicles in various environments and situations? Do you wish you had unlimited money and unlocked cars to enjoy the game more? If you answered yes to any of these questions, then you should try <strong>Driving School 2016 mod apk</strong>.</p>
|
4 |
-
<h2>driving school 2016 mod apk unlimited money</h2><br /><p><b><b>Download File</b> ……… <a href="https://jinyurl.com/2uNTBI">https://jinyurl.com/2uNTBI</a></b></p><br /><br />
|
5 |
-
<p>Driving School 2016 is a popular driving simulation game that lets you drive over 50 vehicles across multiple locations and modes. You can learn how to drive a car, a bus, a truck, a bike, and even a tractor. You can also test your skills in career mode, free ride mode, multiplayer mode, and more. You can also customize your vehicles with different colors, stickers, and accessories.</p>
|
6 |
-
<p>However, if you want to have more fun and freedom in the game, you might want to try the mod apk version. This is a modified version of the game that gives you unlimited money and unlocked cars. This way, you can buy any vehicle you want without having to earn it through gameplay. You can also upgrade your vehicles with better engines, brakes, tires, and more. You can also enjoy the game without any ads or interruptions.</p>
|
7 |
-
<p>In this article, we will review the features of Driving School 2016 mod apk, how to download and install it, its pros and cons, and some frequently asked questions. Let's get started!</p>
|
8 |
-
<h2>Features of Driving School 2016 Mod Apk</h2>
|
9 |
-
<p>Driving School 2016 mod apk has many features that make it more enjoyable than the original game. Here are some of them:</p>
|
10 |
-
<h3>Unlocked Cars</h3>
|
11 |
-
<p>One of the best features of Driving School 2016 mod apk is that it gives you access to all vehicles in the game without having to unlock them through gameplay. You can choose from over 50 vehicles, including cars, buses, trucks, bikes, tractors, and more. You can also switch between vehicles anytime you want.</p>
|
12 |
-
<h3>Unlimited Money</h3>
|
13 |
-
<p>Another great feature of Driving School 2016 mod apk is that it gives you unlimited money in the game. You can use this money to buy upgrades and new vehicles. You can also use it to customize your vehicles with various colors, stickers, and accessories. You don't have to worry about running out of money or spending real money on in-app purchases.</p>
|
14 |
-
<h3>Real <h3>Realistic Driving</h3>
|
15 |
-
<p>Driving School 2016 mod apk also offers realistic driving physics and scenarios. You can feel the difference between driving a car and a bus, for example. You can also encounter different traffic situations, such as traffic lights, pedestrians, signs, and more. You can also drive in different weather conditions, such as rain, snow, fog, and more. You can also choose from different camera angles, such as first-person, third-person, or dashboard.</p>
|
16 |
-
<h3>Multiple Modes</h3>
|
17 |
-
<p>Driving School 2016 mod apk also has multiple modes to suit your preferences and goals. You can choose from career mode, free ride mode, multiplayer mode, and more. In career mode, you can complete various missions and challenges to earn money and unlock new vehicles. In free ride mode, you can explore the map and drive wherever you want. In multiplayer mode, you can compete with other players online and show off your driving skills.</p>
|
18 |
-
<h3>Customization</h3>
|
19 |
-
<p>Driving School 2016 mod apk also allows you to customize your vehicles with different colors, stickers, and accessories. You can change the appearance of your vehicles to match your style and personality. You can also upgrade your vehicles with better engines, brakes, tires, and more. You can make your vehicles faster, smoother, and more efficient.</p>
|
20 |
-
<p></p>
|
21 |
-
<h2>How to Download and Install Driving School 2016 Mod Apk</h2>
|
22 |
-
<p>If you want to try Driving School 2016 mod apk, you need to download and install it on your device. Here are the steps to do so:</p>
|
23 |
-
<ol>
|
24 |
-
<li>Download the mod apk file from a trusted source. You can search for Driving School 2016 mod apk on Google or use the link below. Make sure you download the latest version of the mod apk file.</li>
|
25 |
-
<li>Enable unknown sources on your device settings. To do this, go to Settings > Security > Unknown Sources and toggle it on. This will allow you to install apps from sources other than the Google Play Store.</li>
|
26 |
-
<li>Install the mod apk file and launch the game. Locate the downloaded mod apk file on your device and tap on it to install it. Follow the instructions on the screen and wait for the installation to finish. Then, launch the game and enjoy!</li>
|
27 |
-
</ol>
|
28 |
-
<h2>Pros and Cons of Driving School 2016 Mod Apk</h2>
|
29 |
-
<p>Driving School 2016 mod apk has many advantages, but it also has some disadvantages. Here are some of them:</p>
|
30 |
-
<h3>Pros</h3>
|
31 |
-
<ul>
|
32 |
-
<li>Fun: Driving School 2016 mod apk is a fun and addictive game that will keep you entertained for hours. You can drive various vehicles in different environments and modes.</li>
|
33 |
-
<li>Educational: Driving School 2016 mod apk is also an educational game that will teach you how to drive different vehicles in various situations. You can learn the rules of the road, the traffic signs, and the driving etiquette.</li>
|
34 |
-
<li>Free: Driving School 2016 mod apk is free to download and play. You don't have to spend any real money on in-app purchases or ads.</li>
|
35 |
-
</ul>
|
36 |
-
<h3>Cons</h3>
|
37 |
-
<ul>
|
38 |
-
<li>Bugs: Driving School 2016 mod apk may contain some bugs, glitches, or errors that may affect the gameplay or performance of the game. For example, some vehicles may not work properly or some features may not function correctly.</li>
|
39 |
-
<li>Viruses: Driving School 2016 mod apk may also contain some viruses or malware that may harm your device or data. For example, some mod apk files may steal your personal information or infect your device with unwanted ads or pop-ups.</li>
|
40 |
-
<li>Incompatibility: Driving School 2016 mod apk may not be compatible with some devices or operating systems. For example, some devices may not support the graphics or sound of the game or some operating systems may not allow the installation of the mod apk file.</li>
|
41 |
-
<li>Violation: Driving School 2016 mod apk may also violate the terms of service of the original game or the Google Play Store. For example, some mod apk files may modify or hack the original game or bypass the security measures of the Google Play Store.</li>
|
42 |
-
</ul> <h2>Conclusion</h2>
|
43 |
-
<p>Driving School 2016 mod apk is a modified version of the original driving simulation game that gives you unlimited money and unlocked cars. You can enjoy driving over 50 vehicles across multiple locations and modes. You can also customize your vehicles with different colors, stickers, and accessories. You can also experience realistic driving physics and scenarios.</p>
|
44 |
-
<p>However, Driving School 2016 mod apk also has some drawbacks, such as bugs, viruses, incompatibility, and violation. You should be careful when downloading and installing the mod apk file from unknown sources. You should also respect the rights of the original game developers and the Google Play Store.</p>
|
45 |
-
<p>If you love driving games and want to have more freedom and fun, you should try Driving School 2016 mod apk. It is a fun, addictive, and educational game that will teach you how to drive different vehicles in various situations. You can download it from the link below and enjoy!</p>
|
46 |
-
<h2>FAQs</h2>
|
47 |
-
<p>Here are some frequently asked questions about Driving School 2016 mod apk:</p>
|
48 |
-
<h3>Q1: Is Driving School 2016 mod apk safe to use?</h3>
|
49 |
-
<p>A1: Driving School 2016 mod apk is not completely safe to use, as it may contain some bugs, glitches, viruses, or malware that may harm your device or data. You should always scan the mod apk file with an antivirus or malware detector before installing it. You should also backup your data and device before using the mod apk file.</p>
|
50 |
-
<h3>Q2: How can I update Driving School 2016 mod apk?</h3>
|
51 |
-
<p>A2: Driving School 2016 mod apk may not be updated automatically, as it is not available on the Google Play Store. You may need to download and install the latest version of the mod apk file manually from a trusted source. You should also check for updates regularly to avoid missing out on new features or bug fixes.</p>
|
52 |
-
<h3>Q3: Can I play Driving School 2016 mod apk offline?</h3>
|
53 |
-
<p>A3: Yes, you can play Driving School 2016 mod apk offline, as it does not require an internet connection to run. However, you may not be able to access some features or modes that require online connectivity, such as multiplayer mode or leaderboards.</p>
|
54 |
-
<h3>Q4: What are the best cars to use in Driving School 2016 mod apk?</h3>
|
55 |
-
<p>A4: The best cars to use in Driving School 2016 mod apk depend on your personal preference and goal. You can choose from over 50 vehicles, including cars, buses, trucks, bikes, tractors, and more. You can also customize your vehicles with different colors, stickers, and accessories. Some of the most popular cars in the game are Ferrari, Lamborghini, Bugatti, BMW, Audi, and more.</p>
|
56 |
-
<h3>Q5: How can I contact the developers of Driving School 2016 mod apk?</h3>
|
57 |
-
<p>A5: You can contact the developers of Driving School 2016 mod apk by visiting their official website or social media pages. You can also email them at [email protected] or call them at +1-800-123-4567. You can also leave a comment or review on their website or app store page.</p> 197e85843d<br />
|
58 |
-
<br />
|
59 |
-
<br />
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
spaces/1phancelerku/anime-remove-background/FIFA Mobile The Only Licensed FIFA World Cup 2022 Game - Download FIFA 22 APK Today.md
DELETED
@@ -1,181 +0,0 @@
|
|
1 |
-
|
2 |
-
<h1>FIFA 22 APK Download: Everything You Need to Know</h1>
|
3 |
-
<p>FIFA 22 is the latest installment of the popular soccer simulation game series from EA Sports. It features groundbreaking new HyperMotion technology that enhances the realism and fluidity of the gameplay, as well as new modes, features, and improvements across the board. If you are a fan of soccer and want to experience FIFA 22 on your Android device, you might be wondering how to download and install the FIFA 22 APK file. In this article, we will answer all your questions and provide you with a step-by-step guide on how to get FIFA 22 on your Android device.</p>
|
4 |
-
<h2>What is FIFA 22?</h2>
|
5 |
-
<p>FIFA 22 is a soccer video game that lets you build your ultimate team of soccer stars from over 15,000 authentic players, including world-class talent like Kylian Mbappé, Christian Pulisic, Vinicius Jr and Son Heung-min. You can also relive the world‘s greatest soccer tournament with the official FIFA World Cup 2022™ mode, where you can play with any of the 32 qualified nations in authentic stadiums and kits. FIFA 22 also offers a variety of modes and options to suit your playstyle and preferences, such as Career Mode, Volta Football, Ultimate Team, Pro Clubs, and more.</p>
|
6 |
-
<h2>fifa apk download 22</h2><br /><p><b><b>Download File</b> ——— <a href="https://jinyurl.com/2uNJfL">https://jinyurl.com/2uNJfL</a></b></p><br /><br />
|
7 |
-
<h3>Features and gameplay</h3>
|
8 |
-
<p>FIFA 22 boasts a number of new features and gameplay improvements that make it the most realistic and immersive soccer game ever. Some of the highlights include:</p>
|
9 |
-
<ul>
|
10 |
-
<li><b>HyperMotion Technology:</b> This is a new gameplay technology that uses real-world data and machine learning to create more natural and responsive animations for every player on the pitch. It also enables new team tactics and behaviors that reflect the real-life strategies and styles of different teams.</li>
|
11 |
-
<li><b>Goalkeeper Rewrite:</b> This is a brand new goalkeeper system that brings a new level of intelligence and reliability to the last line of defense. Goalkeepers have more personality and variety in their positioning, reactions, saves, and decision-making.</li>
|
12 |
-
<li><b>True Ball Physics:</b> This is a new ball physics system that makes every touch, pass, shot, volley, dribble, and deflection look and feel more realistic than ever. The ball physics are based on real-world data and tuned parameters such as speed, swerve, air drag, air resistance, ground friction, and rolling friction.</li>
|
13 |
-
<li><b>Explosive Sprint:</b> This is a new gameplay mechanic that gives you more control over acceleration when dribbling or defending. You can lure opponents in and choose when to unleash your full speed to get past them or catch up with them.</li>
|
14 |
-
<li><b>New Attacking Tactics:</b> This is a new feature that lets you set up your team with different styles in each half of the pitch. You can choose from different attacking tactics such as fast build up, direct passing, or long ball.</li>
|
15 |
-
</ul>
|
16 |
-
<h3>System requirements and compatibility</h3>
|
17 |
-
<p>FIFA 22 is compatible with Android devices that meet the following minimum system requirements:</p>
|
18 |
-
<ul>
|
19 |
-
<li>OS: Android 6.0 or higher</li>
|
20 |
-
<li>Processor: Quad-core 1.8 GHz or equivalent</li>
|
21 |
-
<li>Memory: 2 GB RAM</li>
|
22 |
-
<li>Graphics: Ad reno 530 or equivalent</li>
|
23 |
-
<li>Storage: 4 GB available space</li>
|
24 |
-
<li>Internet: Broadband connection</li>
|
25 |
-
</ul>
|
26 |
-
<p>You can check if your device is compatible with FIFA 22 by visiting the Google Play Store and searching for the game. If you see the "Install" button, it means your device can run the game. If you see the "This app is incompatible with your device" message, it means your device does not meet the minimum requirements.</p>
|
27 |
-
<h2>How to download FIFA 22 APK for Android devices?</h2>
|
28 |
-
<p>If you want to download FIFA 22 APK for your Android device, you have two options: you can either download it from the official Google Play Store or from a third-party website. Here are the pros and cons of each option:</p>
|
29 |
-
<table>
|
30 |
-
<tr>
|
31 |
-
<th>Option</th>
|
32 |
-
<th>Pros</th>
|
33 |
-
<th>Cons</th>
|
34 |
-
</tr>
|
35 |
-
<tr>
|
36 |
-
<td>Google Play Store</td>
|
37 |
-
<td>- Safe and secure<br>- Automatic updates<br>- Easy installation</td>
|
38 |
-
<td>- Requires Google account<br>- May not be available in some regions<br>- May take up more storage space</td>
|
39 |
-
</tr>
|
40 |
-
<tr>
|
41 |
-
<td>Third-party website</td>
|
42 |
-
<td>- No Google account needed<br>- May be available in more regions<br>- May take up less storage space</td>
|
43 |
-
<td>- Risky and unreliable<br>- No automatic updates<br>- Complicated installation</td>
|
44 |
-
</tr>
|
45 |
-
</table>
|
46 |
-
<h3>Steps to follow</h3>
|
47 |
-
<p>The steps to download FIFA 22 APK from the Google Play Store are as follows:</p>
|
48 |
-
<ol>
|
49 |
-
<li>Open the Google Play Store app on your Android device.</li>
|
50 |
-
<li>Search for "FIFA 22" in the search bar.</li>
|
51 |
-
<li>Select the game from the list of results and tap on "Install".</li>
|
52 |
-
<li>Wait for the download and installation to complete.</li>
|
53 |
-
<li>Launch the game and enjoy!</li>
|
54 |
-
</ol>
|
55 |
-
<p>The steps to download FIFA 22 APK from a third-party website are as follows:</p>
|
56 |
-
<p>fifa mobile apk 22<br />
|
57 |
-
fifa soccer apk 22<br />
|
58 |
-
fifa world cup 2022 apk<br />
|
59 |
-
fifa 22 android apk<br />
|
60 |
-
fifa 22 mod apk download<br />
|
61 |
-
fifa 22 apk obb<br />
|
62 |
-
fifa 22 apk data<br />
|
63 |
-
fifa 22 apk offline<br />
|
64 |
-
fifa 22 apk free download<br />
|
65 |
-
fifa 22 apk latest version<br />
|
66 |
-
fifa 22 ultimate team apk<br />
|
67 |
-
fifa 22 manager mode apk<br />
|
68 |
-
fifa 22 icons and heroes apk<br />
|
69 |
-
fifa 22 hypermotion apk<br />
|
70 |
-
fifa 22 powered by football apk<br />
|
71 |
-
fifa 22 ea sports apk<br />
|
72 |
-
fifa 22 play store apk<br />
|
73 |
-
fifa 22 google play apk<br />
|
74 |
-
fifa 22 beta apk download<br />
|
75 |
-
fifa 22 pre order apk<br />
|
76 |
-
fifa 22 release date apk<br />
|
77 |
-
fifa 22 gameplay apk<br />
|
78 |
-
fifa 22 trailer apk<br />
|
79 |
-
fifa 22 demo apk download<br />
|
80 |
-
fifa 22 full game apk<br />
|
81 |
-
fifa 22 hack apk download<br />
|
82 |
-
fifa 22 coins generator apk<br />
|
83 |
-
fifa 22 points hack apk<br />
|
84 |
-
fifa 22 cheats apk download<br />
|
85 |
-
fifa 22 unlimited money apk<br />
|
86 |
-
fifa 22 career mode apk download<br />
|
87 |
-
fifa 22 volta football apk download<br />
|
88 |
-
fifa 22 pro clubs apk download<br />
|
89 |
-
fifa 22 co op seasons apk download<br />
|
90 |
-
fifa 22 online seasons apk download<br />
|
91 |
-
fifa 22 head to head apk download<br />
|
92 |
-
fifa 22 vs attack apk download<br />
|
93 |
-
fifa 22 tournament mode apk download<br />
|
94 |
-
fifa 22 champions league apk download<br />
|
95 |
-
fifa 22 europa league apk download<br />
|
96 |
-
fifa 22 super cup apk download<br />
|
97 |
-
fifa 22 world cup qualifiers apk download<br />
|
98 |
-
fifa 22 next level soccer simulation apk download<br />
|
99 |
-
fifa 22 realistic stadium sfx and commentary apk download <br />
|
100 |
-
fifa 22 kylian mbappe cover star apk download <br />
|
101 |
-
fifa 22 christian pulisic featured player apk download <br />
|
102 |
-
fifa 22 vinicius jr breakthrough talent apk download <br />
|
103 |
-
fifa 22 son heung-min fan favorite player apk download <br />
|
104 |
-
fifa 22 paolo maldini soccer icon apk download <br />
|
105 |
-
fifa 22 ronaldinho soccer legend apk download</p>
|
106 |
-
<ol>
|
107 |
-
<li>Find a reputable and trustworthy website that offers FIFA 22 APK download. You can use a search engine or ask for recommendations from other users.</li>
|
108 |
-
<li>Visit the website and look for the download link or button. Make sure it is the latest version of the game and compatible with your device.</li>
|
109 |
-
<li>Tap on the download link or button and wait for the file to be downloaded to your device.</li>
|
110 |
-
<li>Locate the downloaded file in your device's file manager and tap on it to open it.</li>
|
111 |
-
<li>You may need to enable "Unknown sources" in your device's settings to allow the installation of apps from outside the Google Play Store.</li>
|
112 |
-
<li>Follow the on-screen instructions to install the game.</li>
|
113 |
-
<li>Launch the game and enjoy!</li>
|
114 |
-
</ol>
|
115 |
-
<h3>Tips and tricks</h3>
|
116 |
-
<p>Here are some tips and tricks to help you download FIFA 22 APK successfully and safely:</p>
|
117 |
-
<ul>
|
118 |
-
<li>Make sure you have enough storage space on your device before downloading the game. You may need to delete some unwanted files or apps to free up some space.</li>
|
119 |
-
<li>Make sure you have a stable and fast internet connection before downloading the game. You may want to use Wi-Fi instead of mobile data to avoid extra charges or interruptions.</li>
|
120 |
-
<li>Make sure you have a compatible device that meets the minimum system requirements before downloading the game. You can check your device's specifications in your device's settings or online.</li>
|
121 |
-
<li>Make sure you download the game from a reliable and trusted source, whether it is the Google Play Store or a third-party website. You can check the reviews, ratings, comments, and feedback from other users to verify the quality and safety of the source.</li <li>Make sure you scan the downloaded file for viruses or malware before installing it. You can use a reputable antivirus app or online scanner to do this.</li>
|
122 |
-
<li>Make sure you backup your data and settings before installing the game. You can use a cloud service or an external storage device to do this.</li>
|
123 |
-
</ul>
|
124 |
-
<h2>How to install FIFA 22 APK on Android devices?</h2>
|
125 |
-
<p>Once you have downloaded the FIFA 22 APK file, you need to install it on your Android device. The installation process may vary depending on the source of the file and the device model, but generally, it follows these steps:</p>
|
126 |
-
<h3>Steps to follow</h3>
|
127 |
-
<p>The steps to install FIFA 22 APK from the Google Play Store are as follows:</p>
|
128 |
-
<ol>
|
129 |
-
<li>Open the Google Play Store app on your Android device.</li>
|
130 |
-
<li>Search for "FIFA 22" in the search bar.</li>
|
131 |
-
<li>Select the game from the list of results and tap on "Install".</li>
|
132 |
-
<li>The game will be automatically installed on your device.</li>
|
133 |
-
<li>Launch the game and enjoy!</li>
|
134 |
-
</ol>
|
135 |
-
<p>The steps to install FIFA 22 APK from a third-party website are as follows:</p>
|
136 |
-
<ol>
|
137 |
-
<li>Locate the downloaded file in your device's file manager and tap on it to open it.</li>
|
138 |
-
<li>You may need to enable "Unknown sources" in your device's settings to allow the installation of apps from outside the Google Play Store.</li>
|
139 |
-
<li>Follow the on-screen instructions to install the game.</li>
|
140 |
-
<li>Launch the game and enjoy!</li>
|
141 |
-
</ol>
|
142 |
-
<h3>Troubleshooting</h3>
|
143 |
-
<p>If you encounter any problems or errors during or after the installation process, here are some possible solutions:</p>
|
144 |
-
<ul>
|
145 |
-
<li>Restart your device and try again.</li>
|
146 |
-
<li>Check your internet connection and make sure it is stable and fast.</li>
|
147 |
-
<li>Check your storage space and make sure you have enough room for the game.</li>
|
148 |
-
<li>Check your device compatibility and make sure it meets the minimum system requirements.</li>
|
149 |
-
<li>Check your file source and make sure it is reliable and trusted.</li>
|
150 |
-
<li>Check your file integrity and make sure it is not corrupted or damaged.</li>
|
151 |
-
<li>Contact EA Sports customer support or visit their official website for more help and information.</li>
|
152 |
-
</ul>
|
153 |
-
<h2>How to play FIFA 22 on Android devices?</h2>
|
154 |
-
<p>After you have successfully installed FIFA 22 on your Android device, you are ready to play and enjoy the game. Here are some tips and tricks to help you get started and have fun:</p>
|
155 |
-
<h3>Modes and options</h3>
|
156 |
-
<p>FIFA 22 offers a variety of modes and options to suit your playstyle and preferences. You can choose from different modes such as Career Mode, Volta Football, Ultimate Team, Pro Clubs, and more. You can also customize your settings such as difficulty level, camera angle, sound effects, language, and more. You can access these modes and options from the main menu of the game.</p>
|
157 |
-
<h3>Controls and settings</h3>
|
158 |
-
<p>FIFA 22 uses touch controls to let you control your players and actions on the pitch. You can use gestures such as tapping, swiping, dragging, and holding to perform different moves such as passing, shooting, dribbling, tackling, and more. You can also use virtual buttons that appear on the screen to access different functions such as sprinting, switching players, pausing, and more. You can adjust the sensitivity, size, position, and layout of these controls in the settings menu of the game.</p>
|
159 |
-
<h2>Conclusion</h2>
|
160 |
-
<p>FIFA 22 is an amazing soccer game that brings you closer to the action and excitement of the sport. It features stunning graphics, realistic physics, smooth animations, and immersive gameplay that will keep you hooked for hours. Whether you want to build your dream team, compete with other players online, or relive the glory of the World Cup, FIFA 22 has something for everyone. If you want to play FIFA 22 on your Android device, you can download and install the FIFA 22 APK file from either the Google Play Store or a third-party website. Just follow our guide above and you will be ready to play in no time. Have fun!</p>
|
161 |
-
<h2>FAQs</h2>
|
162 |
-
<p>Here are some frequently asked questions about FIFA 22 APK download:</p>
|
163 |
-
<h4>Q: Is FIFA 22 APK free?</h4>
|
164 |
-
<p>A: Yes, FIFA 22 APK is free to download and play. However, some features and items may require in-app purchases or subscriptions.</p>
|
165 |
-
<h4>Q: Is FIFA 22 APK safe?</h4>
|
166 |
-
<p>A: Yes, FIFA 22 APK is safe if you download it from a reliable and trusted source such as the Google Play Store or a reputable third-party website. However, you should always be careful and cautious when downloading files from unknown or unverified sources, as they may contain viruses or malware that can harm your device or compromise your privacy.</p>
|
167 |
-
<h4>Q: Is FIFA 22 APK legal?</h4>
|
168 |
-
<p>A: Yes, FIFA 22 APK is legal if you download it from the official Google Play Store or a licensed third-party website. However, you should avoid downloading or using any pirated, cracked, or modded versions of the game, as they may violate the terms and conditions of EA Sports and Google Play Store, and may result in legal actions or penalties.</p>
|
169 |
-
<h4>Q: How to update FIFA 22 APK?</h4>
|
170 |
-
<p>A: If you download FIFA 22 APK from the Google Play Store, you will receive automatic updates whenever there is a new version of the game available. You can also check for updates manually by opening the Google Play Store app and tapping on "My apps & games". If you download FIFA 22 APK from a third-party website, you will need to check for updates manually by visiting the website and looking for the latest version of the game. You will also need to download and install the new version of the game yourself.</p>
|
171 |
-
<h4>Q: How to uninstall FIFA 22 APK?</h4>
|
172 |
-
<p>A: If you want to uninstall FIFA 22 APK from your Android device, you can follow these steps:</p>
|
173 |
-
<ol>
|
174 |
-
<li>Open the Settings app on your Android device.</li>
|
175 |
-
<li>Tap on "Apps & notifications" or "Applications".</li>
|
176 |
-
<li>Find and tap on "FIFA 22".</li>
|
177 |
-
<li>Tap on "Uninstall".</li>
|
178 |
-
<li>Confirm your action and wait for the uninstallation to complete.</li>
|
179 |
-
</ol></p> 401be4b1e0<br />
|
180 |
-
<br />
|
181 |
-
<br />
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
spaces/4Taps/SadTalker/src/face3d/options/inference_options.py
DELETED
@@ -1,23 +0,0 @@
|
|
1 |
-
from face3d.options.base_options import BaseOptions
|
2 |
-
|
3 |
-
|
4 |
-
class InferenceOptions(BaseOptions):
|
5 |
-
"""This class includes test options.
|
6 |
-
|
7 |
-
It also includes shared options defined in BaseOptions.
|
8 |
-
"""
|
9 |
-
|
10 |
-
def initialize(self, parser):
|
11 |
-
parser = BaseOptions.initialize(self, parser) # define shared options
|
12 |
-
parser.add_argument('--phase', type=str, default='test', help='train, val, test, etc')
|
13 |
-
parser.add_argument('--dataset_mode', type=str, default=None, help='chooses how datasets are loaded. [None | flist]')
|
14 |
-
|
15 |
-
parser.add_argument('--input_dir', type=str, help='the folder of the input files')
|
16 |
-
parser.add_argument('--keypoint_dir', type=str, help='the folder of the keypoint files')
|
17 |
-
parser.add_argument('--output_dir', type=str, default='mp4', help='the output dir to save the extracted coefficients')
|
18 |
-
parser.add_argument('--save_split_files', action='store_true', help='save split files or not')
|
19 |
-
parser.add_argument('--inference_batch_size', type=int, default=8)
|
20 |
-
|
21 |
-
# Dropout and Batchnorm has different behavior during training and test.
|
22 |
-
self.isTrain = False
|
23 |
-
return parser
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
spaces/52Hz/CMFNet_deraindrop/README.md
DELETED
@@ -1,37 +0,0 @@
|
|
1 |
-
---
|
2 |
-
title: CMFNet_deraindrop
|
3 |
-
emoji: 💦
|
4 |
-
colorFrom: blue
|
5 |
-
colorTo: blue
|
6 |
-
sdk: gradio
|
7 |
-
app_file: app.py
|
8 |
-
pinned: false
|
9 |
-
---
|
10 |
-
|
11 |
-
# Configuration
|
12 |
-
|
13 |
-
`title`: _string_
|
14 |
-
Display title for the Space
|
15 |
-
|
16 |
-
`emoji`: _string_
|
17 |
-
Space emoji (emoji-only character allowed)
|
18 |
-
|
19 |
-
`colorFrom`: _string_
|
20 |
-
Color for Thumbnail gradient (red, yellow, green, blue, indigo, purple, pink, gray)
|
21 |
-
|
22 |
-
`colorTo`: _string_
|
23 |
-
Color for Thumbnail gradient (red, yellow, green, blue, indigo, purple, pink, gray)
|
24 |
-
|
25 |
-
`sdk`: _string_
|
26 |
-
Can be either `gradio`, `streamlit`, or `static`
|
27 |
-
|
28 |
-
`sdk_version` : _string_
|
29 |
-
Only applicable for `streamlit` SDK.
|
30 |
-
See [doc](https://hf.co/docs/hub/spaces) for more info on supported versions.
|
31 |
-
|
32 |
-
`app_file`: _string_
|
33 |
-
Path to your main application file (which contains either `gradio` or `streamlit` Python code, or `static` html code).
|
34 |
-
Path is relative to the root of the repository.
|
35 |
-
|
36 |
-
`pinned`: _boolean_
|
37 |
-
Whether the Space stays on top of your list.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
spaces/801artistry/RVC801/tools/infer_cli.py
DELETED
@@ -1,67 +0,0 @@
|
|
1 |
-
import argparse
|
2 |
-
import os
|
3 |
-
import sys
|
4 |
-
|
5 |
-
now_dir = os.getcwd()
|
6 |
-
sys.path.append(now_dir)
|
7 |
-
from dotenv import load_dotenv
|
8 |
-
from scipy.io import wavfile
|
9 |
-
|
10 |
-
from configs.config import Config
|
11 |
-
from infer.modules.vc.modules import VC
|
12 |
-
|
13 |
-
####
|
14 |
-
# USAGE
|
15 |
-
#
|
16 |
-
# In your Terminal or CMD or whatever
|
17 |
-
|
18 |
-
|
19 |
-
def arg_parse() -> tuple:
|
20 |
-
parser = argparse.ArgumentParser()
|
21 |
-
parser.add_argument("--f0up_key", type=int, default=0)
|
22 |
-
parser.add_argument("--input_path", type=str, help="input path")
|
23 |
-
parser.add_argument("--index_path", type=str, help="index path")
|
24 |
-
parser.add_argument("--f0method", type=str, default="harvest", help="harvest or pm")
|
25 |
-
parser.add_argument("--opt_path", type=str, help="opt path")
|
26 |
-
parser.add_argument("--model_name", type=str, help="store in assets/weight_root")
|
27 |
-
parser.add_argument("--index_rate", type=float, default=0.66, help="index rate")
|
28 |
-
parser.add_argument("--device", type=str, help="device")
|
29 |
-
parser.add_argument("--is_half", type=bool, help="use half -> True")
|
30 |
-
parser.add_argument("--filter_radius", type=int, default=3, help="filter radius")
|
31 |
-
parser.add_argument("--resample_sr", type=int, default=0, help="resample sr")
|
32 |
-
parser.add_argument("--rms_mix_rate", type=float, default=1, help="rms mix rate")
|
33 |
-
parser.add_argument("--protect", type=float, default=0.33, help="protect")
|
34 |
-
|
35 |
-
args = parser.parse_args()
|
36 |
-
sys.argv = sys.argv[:1]
|
37 |
-
|
38 |
-
return args
|
39 |
-
|
40 |
-
|
41 |
-
def main():
|
42 |
-
load_dotenv()
|
43 |
-
args = arg_parse()
|
44 |
-
config = Config()
|
45 |
-
config.device = args.device if args.device else config.device
|
46 |
-
config.is_half = args.is_half if args.is_half else config.is_half
|
47 |
-
vc = VC(config)
|
48 |
-
vc.get_vc(args.model_name)
|
49 |
-
_, wav_opt = vc.vc_single(
|
50 |
-
0,
|
51 |
-
args.input_path,
|
52 |
-
args.f0up_key,
|
53 |
-
None,
|
54 |
-
args.f0method,
|
55 |
-
args.index_path,
|
56 |
-
None,
|
57 |
-
args.index_rate,
|
58 |
-
args.filter_radius,
|
59 |
-
args.resample_sr,
|
60 |
-
args.rms_mix_rate,
|
61 |
-
args.protect,
|
62 |
-
)
|
63 |
-
wavfile.write(args.opt_path, wav_opt[0], wav_opt[1])
|
64 |
-
|
65 |
-
|
66 |
-
if __name__ == "__main__":
|
67 |
-
main()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
spaces/AbandonedMuse/UnlimitedMusicGen/audiocraft/__init__.py
DELETED
@@ -1,10 +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 |
-
# flake8: noqa
|
8 |
-
from . import data, modules, models
|
9 |
-
|
10 |
-
__version__ = '0.0.2a2'
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
spaces/Adapter/T2I-Adapter/train_sketch.py
DELETED
@@ -1,399 +0,0 @@
|
|
1 |
-
import argparse
|
2 |
-
import logging
|
3 |
-
import os
|
4 |
-
import os.path as osp
|
5 |
-
import time
|
6 |
-
|
7 |
-
import cv2
|
8 |
-
import matplotlib.pyplot as plt
|
9 |
-
import numpy as np
|
10 |
-
import torch
|
11 |
-
import torch.nn as nn
|
12 |
-
from basicsr.utils import (get_env_info, get_root_logger, get_time_str,
|
13 |
-
img2tensor, scandir, tensor2img)
|
14 |
-
from basicsr.utils.options import copy_opt_file, dict2str
|
15 |
-
from omegaconf import OmegaConf
|
16 |
-
from PIL import Image
|
17 |
-
|
18 |
-
from ldm.data.dataset_coco import dataset_coco_mask_color
|
19 |
-
from dist_util import get_bare_model, get_dist_info, init_dist, master_only
|
20 |
-
from ldm.models.diffusion.ddim import DDIMSampler
|
21 |
-
from ldm.models.diffusion.dpm_solver import DPMSolverSampler
|
22 |
-
from ldm.models.diffusion.plms import PLMSSampler
|
23 |
-
from ldm.modules.encoders.adapter import Adapter
|
24 |
-
from ldm.util import instantiate_from_config
|
25 |
-
from ldm.modules.structure_condition.model_edge import pidinet
|
26 |
-
|
27 |
-
|
28 |
-
def load_model_from_config(config, ckpt, verbose=False):
|
29 |
-
print(f"Loading model from {ckpt}")
|
30 |
-
pl_sd = torch.load(ckpt, map_location="cpu")
|
31 |
-
if "global_step" in pl_sd:
|
32 |
-
print(f"Global Step: {pl_sd['global_step']}")
|
33 |
-
sd = pl_sd["state_dict"]
|
34 |
-
model = instantiate_from_config(config.model)
|
35 |
-
m, u = model.load_state_dict(sd, strict=False)
|
36 |
-
if len(m) > 0 and verbose:
|
37 |
-
print("missing keys:")
|
38 |
-
print(m)
|
39 |
-
if len(u) > 0 and verbose:
|
40 |
-
print("unexpected keys:")
|
41 |
-
print(u)
|
42 |
-
|
43 |
-
model.cuda()
|
44 |
-
model.eval()
|
45 |
-
return model
|
46 |
-
|
47 |
-
@master_only
|
48 |
-
def mkdir_and_rename(path):
|
49 |
-
"""mkdirs. If path exists, rename it with timestamp and create a new one.
|
50 |
-
|
51 |
-
Args:
|
52 |
-
path (str): Folder path.
|
53 |
-
"""
|
54 |
-
if osp.exists(path):
|
55 |
-
new_name = path + '_archived_' + get_time_str()
|
56 |
-
print(f'Path already exists. Rename it to {new_name}', flush=True)
|
57 |
-
os.rename(path, new_name)
|
58 |
-
os.makedirs(path, exist_ok=True)
|
59 |
-
os.makedirs(osp.join(experiments_root, 'models'))
|
60 |
-
os.makedirs(osp.join(experiments_root, 'training_states'))
|
61 |
-
os.makedirs(osp.join(experiments_root, 'visualization'))
|
62 |
-
|
63 |
-
def load_resume_state(opt):
|
64 |
-
resume_state_path = None
|
65 |
-
if opt.auto_resume:
|
66 |
-
state_path = osp.join('experiments', opt.name, 'training_states')
|
67 |
-
if osp.isdir(state_path):
|
68 |
-
states = list(scandir(state_path, suffix='state', recursive=False, full_path=False))
|
69 |
-
if len(states) != 0:
|
70 |
-
states = [float(v.split('.state')[0]) for v in states]
|
71 |
-
resume_state_path = osp.join(state_path, f'{max(states):.0f}.state')
|
72 |
-
opt.resume_state_path = resume_state_path
|
73 |
-
# else:
|
74 |
-
# if opt['path'].get('resume_state'):
|
75 |
-
# resume_state_path = opt['path']['resume_state']
|
76 |
-
|
77 |
-
if resume_state_path is None:
|
78 |
-
resume_state = None
|
79 |
-
else:
|
80 |
-
device_id = torch.cuda.current_device()
|
81 |
-
resume_state = torch.load(resume_state_path, map_location=lambda storage, loc: storage.cuda(device_id))
|
82 |
-
# check_resume(opt, resume_state['iter'])
|
83 |
-
return resume_state
|
84 |
-
|
85 |
-
parser = argparse.ArgumentParser()
|
86 |
-
parser.add_argument(
|
87 |
-
"--bsize",
|
88 |
-
type=int,
|
89 |
-
default=8,
|
90 |
-
help="the prompt to render"
|
91 |
-
)
|
92 |
-
parser.add_argument(
|
93 |
-
"--epochs",
|
94 |
-
type=int,
|
95 |
-
default=10000,
|
96 |
-
help="the prompt to render"
|
97 |
-
)
|
98 |
-
parser.add_argument(
|
99 |
-
"--num_workers",
|
100 |
-
type=int,
|
101 |
-
default=8,
|
102 |
-
help="the prompt to render"
|
103 |
-
)
|
104 |
-
parser.add_argument(
|
105 |
-
"--use_shuffle",
|
106 |
-
type=bool,
|
107 |
-
default=True,
|
108 |
-
help="the prompt to render"
|
109 |
-
)
|
110 |
-
parser.add_argument(
|
111 |
-
"--dpm_solver",
|
112 |
-
action='store_true',
|
113 |
-
help="use dpm_solver sampling",
|
114 |
-
)
|
115 |
-
parser.add_argument(
|
116 |
-
"--plms",
|
117 |
-
action='store_true',
|
118 |
-
help="use plms sampling",
|
119 |
-
)
|
120 |
-
parser.add_argument(
|
121 |
-
"--auto_resume",
|
122 |
-
action='store_true',
|
123 |
-
help="use plms sampling",
|
124 |
-
)
|
125 |
-
parser.add_argument(
|
126 |
-
"--ckpt",
|
127 |
-
type=str,
|
128 |
-
default="models/sd-v1-4.ckpt",
|
129 |
-
help="path to checkpoint of model",
|
130 |
-
)
|
131 |
-
parser.add_argument(
|
132 |
-
"--config",
|
133 |
-
type=str,
|
134 |
-
default="configs/stable-diffusion/train_sketch.yaml",
|
135 |
-
help="path to config which constructs model",
|
136 |
-
)
|
137 |
-
parser.add_argument(
|
138 |
-
"--print_fq",
|
139 |
-
type=int,
|
140 |
-
default=100,
|
141 |
-
help="path to config which constructs model",
|
142 |
-
)
|
143 |
-
parser.add_argument(
|
144 |
-
"--H",
|
145 |
-
type=int,
|
146 |
-
default=512,
|
147 |
-
help="image height, in pixel space",
|
148 |
-
)
|
149 |
-
parser.add_argument(
|
150 |
-
"--W",
|
151 |
-
type=int,
|
152 |
-
default=512,
|
153 |
-
help="image width, in pixel space",
|
154 |
-
)
|
155 |
-
parser.add_argument(
|
156 |
-
"--C",
|
157 |
-
type=int,
|
158 |
-
default=4,
|
159 |
-
help="latent channels",
|
160 |
-
)
|
161 |
-
parser.add_argument(
|
162 |
-
"--f",
|
163 |
-
type=int,
|
164 |
-
default=8,
|
165 |
-
help="downsampling factor",
|
166 |
-
)
|
167 |
-
parser.add_argument(
|
168 |
-
"--ddim_steps",
|
169 |
-
type=int,
|
170 |
-
default=50,
|
171 |
-
help="number of ddim sampling steps",
|
172 |
-
)
|
173 |
-
parser.add_argument(
|
174 |
-
"--n_samples",
|
175 |
-
type=int,
|
176 |
-
default=1,
|
177 |
-
help="how many samples to produce for each given prompt. A.k.a. batch size",
|
178 |
-
)
|
179 |
-
parser.add_argument(
|
180 |
-
"--ddim_eta",
|
181 |
-
type=float,
|
182 |
-
default=0.0,
|
183 |
-
help="ddim eta (eta=0.0 corresponds to deterministic sampling",
|
184 |
-
)
|
185 |
-
parser.add_argument(
|
186 |
-
"--scale",
|
187 |
-
type=float,
|
188 |
-
default=7.5,
|
189 |
-
help="unconditional guidance scale: eps = eps(x, empty) + scale * (eps(x, cond) - eps(x, empty))",
|
190 |
-
)
|
191 |
-
parser.add_argument(
|
192 |
-
"--gpus",
|
193 |
-
default=[0,1,2,3],
|
194 |
-
help="gpu idx",
|
195 |
-
)
|
196 |
-
parser.add_argument(
|
197 |
-
'--local_rank',
|
198 |
-
default=0,
|
199 |
-
type=int,
|
200 |
-
help='node rank for distributed training'
|
201 |
-
)
|
202 |
-
parser.add_argument(
|
203 |
-
'--launcher',
|
204 |
-
default='pytorch',
|
205 |
-
type=str,
|
206 |
-
help='node rank for distributed training'
|
207 |
-
)
|
208 |
-
parser.add_argument(
|
209 |
-
'--l_cond',
|
210 |
-
default=4,
|
211 |
-
type=int,
|
212 |
-
help='number of scales'
|
213 |
-
)
|
214 |
-
opt = parser.parse_args()
|
215 |
-
|
216 |
-
if __name__ == '__main__':
|
217 |
-
config = OmegaConf.load(f"{opt.config}")
|
218 |
-
opt.name = config['name']
|
219 |
-
|
220 |
-
# distributed setting
|
221 |
-
init_dist(opt.launcher)
|
222 |
-
torch.backends.cudnn.benchmark = True
|
223 |
-
device='cuda'
|
224 |
-
torch.cuda.set_device(opt.local_rank)
|
225 |
-
|
226 |
-
# dataset
|
227 |
-
path_json_train = 'coco_stuff/mask/annotations/captions_train2017.json'
|
228 |
-
path_json_val = 'coco_stuff/mask/annotations/captions_val2017.json'
|
229 |
-
train_dataset = dataset_coco_mask_color(path_json_train,
|
230 |
-
root_path_im='coco/train2017',
|
231 |
-
root_path_mask='coco_stuff/mask/train2017_color',
|
232 |
-
image_size=512
|
233 |
-
)
|
234 |
-
train_sampler = torch.utils.data.distributed.DistributedSampler(train_dataset)
|
235 |
-
val_dataset = dataset_coco_mask_color(path_json_val,
|
236 |
-
root_path_im='coco/val2017',
|
237 |
-
root_path_mask='coco_stuff/mask/val2017_color',
|
238 |
-
image_size=512
|
239 |
-
)
|
240 |
-
train_dataloader = torch.utils.data.DataLoader(
|
241 |
-
train_dataset,
|
242 |
-
batch_size=opt.bsize,
|
243 |
-
shuffle=(train_sampler is None),
|
244 |
-
num_workers=opt.num_workers,
|
245 |
-
pin_memory=True,
|
246 |
-
sampler=train_sampler)
|
247 |
-
val_dataloader = torch.utils.data.DataLoader(
|
248 |
-
val_dataset,
|
249 |
-
batch_size=1,
|
250 |
-
shuffle=False,
|
251 |
-
num_workers=1,
|
252 |
-
pin_memory=False)
|
253 |
-
|
254 |
-
# edge_generator
|
255 |
-
net_G = pidinet()
|
256 |
-
ckp = torch.load('models/table5_pidinet.pth', map_location='cpu')['state_dict']
|
257 |
-
net_G.load_state_dict({k.replace('module.',''):v for k, v in ckp.items()})
|
258 |
-
net_G.cuda()
|
259 |
-
|
260 |
-
# stable diffusion
|
261 |
-
model = load_model_from_config(config, f"{opt.ckpt}").to(device)
|
262 |
-
|
263 |
-
# sketch encoder
|
264 |
-
model_ad = Adapter(channels=[320, 640, 1280, 1280][:4], nums_rb=2, ksize=1, sk=True, use_conv=False).to(device)
|
265 |
-
|
266 |
-
# to gpus
|
267 |
-
model_ad = torch.nn.parallel.DistributedDataParallel(
|
268 |
-
model_ad,
|
269 |
-
device_ids=[opt.local_rank],
|
270 |
-
output_device=opt.local_rank)
|
271 |
-
model = torch.nn.parallel.DistributedDataParallel(
|
272 |
-
model,
|
273 |
-
device_ids=[opt.local_rank],
|
274 |
-
output_device=opt.local_rank)
|
275 |
-
# device_ids=[torch.cuda.current_device()])
|
276 |
-
net_G = torch.nn.parallel.DistributedDataParallel(
|
277 |
-
net_G,
|
278 |
-
device_ids=[opt.local_rank],
|
279 |
-
output_device=opt.local_rank)
|
280 |
-
# device_ids=[torch.cuda.current_device()])
|
281 |
-
|
282 |
-
# optimizer
|
283 |
-
params = list(model_ad.parameters())
|
284 |
-
optimizer = torch.optim.AdamW(params, lr=config['training']['lr'])
|
285 |
-
|
286 |
-
experiments_root = osp.join('experiments', opt.name)
|
287 |
-
|
288 |
-
# resume state
|
289 |
-
resume_state = load_resume_state(opt)
|
290 |
-
if resume_state is None:
|
291 |
-
mkdir_and_rename(experiments_root)
|
292 |
-
start_epoch = 0
|
293 |
-
current_iter = 0
|
294 |
-
# WARNING: should not use get_root_logger in the above codes, including the called functions
|
295 |
-
# Otherwise the logger will not be properly initialized
|
296 |
-
log_file = osp.join(experiments_root, f"train_{opt.name}_{get_time_str()}.log")
|
297 |
-
logger = get_root_logger(logger_name='basicsr', log_level=logging.INFO, log_file=log_file)
|
298 |
-
logger.info(get_env_info())
|
299 |
-
logger.info(dict2str(config))
|
300 |
-
else:
|
301 |
-
# WARNING: should not use get_root_logger in the above codes, including the called functions
|
302 |
-
# Otherwise the logger will not be properly initialized
|
303 |
-
log_file = osp.join(experiments_root, f"train_{opt.name}_{get_time_str()}.log")
|
304 |
-
logger = get_root_logger(logger_name='basicsr', log_level=logging.INFO, log_file=log_file)
|
305 |
-
logger.info(get_env_info())
|
306 |
-
logger.info(dict2str(config))
|
307 |
-
resume_optimizers = resume_state['optimizers']
|
308 |
-
optimizer.load_state_dict(resume_optimizers)
|
309 |
-
logger.info(f"Resuming training from epoch: {resume_state['epoch']}, " f"iter: {resume_state['iter']}.")
|
310 |
-
start_epoch = resume_state['epoch']
|
311 |
-
current_iter = resume_state['iter']
|
312 |
-
|
313 |
-
# copy the yml file to the experiment root
|
314 |
-
copy_opt_file(opt.config, experiments_root)
|
315 |
-
|
316 |
-
|
317 |
-
# training
|
318 |
-
logger.info(f'Start training from epoch: {start_epoch}, iter: {current_iter}')
|
319 |
-
for epoch in range(start_epoch, opt.epochs):
|
320 |
-
train_dataloader.sampler.set_epoch(epoch)
|
321 |
-
# train
|
322 |
-
for _, data in enumerate(train_dataloader):
|
323 |
-
current_iter += 1
|
324 |
-
with torch.no_grad():
|
325 |
-
edge = net_G(data['im'].cuda(non_blocking=True))[-1]
|
326 |
-
edge = edge>0.5
|
327 |
-
edge = edge.float()
|
328 |
-
c = model.module.get_learned_conditioning(data['sentence'])
|
329 |
-
z = model.module.encode_first_stage((data['im']*2-1.).cuda(non_blocking=True))
|
330 |
-
z = model.module.get_first_stage_encoding(z)
|
331 |
-
|
332 |
-
optimizer.zero_grad()
|
333 |
-
model.zero_grad()
|
334 |
-
features_adapter = model_ad(edge)
|
335 |
-
l_pixel, loss_dict = model(z, c=c, features_adapter = features_adapter)
|
336 |
-
l_pixel.backward()
|
337 |
-
optimizer.step()
|
338 |
-
|
339 |
-
if (current_iter+1)%opt.print_fq == 0:
|
340 |
-
logger.info(loss_dict)
|
341 |
-
|
342 |
-
# save checkpoint
|
343 |
-
rank, _ = get_dist_info()
|
344 |
-
if (rank==0) and ((current_iter+1)%config['training']['save_freq'] == 0):
|
345 |
-
save_filename = f'model_ad_{current_iter+1}.pth'
|
346 |
-
save_path = os.path.join(experiments_root, 'models', save_filename)
|
347 |
-
save_dict = {}
|
348 |
-
model_ad_bare = get_bare_model(model_ad)
|
349 |
-
state_dict = model_ad_bare.state_dict()
|
350 |
-
for key, param in state_dict.items():
|
351 |
-
if key.startswith('module.'): # remove unnecessary 'module.'
|
352 |
-
key = key[7:]
|
353 |
-
save_dict[key] = param.cpu()
|
354 |
-
torch.save(save_dict, save_path)
|
355 |
-
# save state
|
356 |
-
state = {'epoch': epoch, 'iter': current_iter+1, 'optimizers': optimizer.state_dict()}
|
357 |
-
save_filename = f'{current_iter+1}.state'
|
358 |
-
save_path = os.path.join(experiments_root, 'training_states', save_filename)
|
359 |
-
torch.save(state, save_path)
|
360 |
-
|
361 |
-
# val
|
362 |
-
rank, _ = get_dist_info()
|
363 |
-
if rank==0:
|
364 |
-
for data in val_dataloader:
|
365 |
-
with torch.no_grad():
|
366 |
-
if opt.dpm_solver:
|
367 |
-
sampler = DPMSolverSampler(model.module)
|
368 |
-
elif opt.plms:
|
369 |
-
sampler = PLMSSampler(model.module)
|
370 |
-
else:
|
371 |
-
sampler = DDIMSampler(model.module)
|
372 |
-
print(data['im'].shape)
|
373 |
-
c = model.module.get_learned_conditioning(data['sentence'])
|
374 |
-
edge = net_G(data['im'].cuda(non_blocking=True))[-1]
|
375 |
-
edge = edge>0.5
|
376 |
-
edge = edge.float()
|
377 |
-
im_edge = tensor2img(edge)
|
378 |
-
cv2.imwrite(os.path.join(experiments_root, 'visualization', 'edge_%04d.png'%epoch), im_edge)
|
379 |
-
features_adapter = model_ad(edge)
|
380 |
-
shape = [opt.C, opt.H // opt.f, opt.W // opt.f]
|
381 |
-
samples_ddim, _ = sampler.sample(S=opt.ddim_steps,
|
382 |
-
conditioning=c,
|
383 |
-
batch_size=opt.n_samples,
|
384 |
-
shape=shape,
|
385 |
-
verbose=False,
|
386 |
-
unconditional_guidance_scale=opt.scale,
|
387 |
-
unconditional_conditioning=model.module.get_learned_conditioning(opt.n_samples * [""]),
|
388 |
-
eta=opt.ddim_eta,
|
389 |
-
x_T=None,
|
390 |
-
features_adapter=features_adapter)
|
391 |
-
x_samples_ddim = model.module.decode_first_stage(samples_ddim)
|
392 |
-
x_samples_ddim = torch.clamp((x_samples_ddim + 1.0) / 2.0, min=0.0, max=1.0)
|
393 |
-
x_samples_ddim = x_samples_ddim.cpu().permute(0, 2, 3, 1).numpy()
|
394 |
-
for id_sample, x_sample in enumerate(x_samples_ddim):
|
395 |
-
x_sample = 255.*x_sample
|
396 |
-
img = x_sample.astype(np.uint8)
|
397 |
-
img = cv2.putText(img.copy(), data['sentence'][0], (10,30), cv2.FONT_HERSHEY_SIMPLEX, 0.5, (0,255,0), 2)
|
398 |
-
cv2.imwrite(os.path.join(experiments_root, 'visualization', 'sample_e%04d_s%04d.png'%(epoch, id_sample)), img[:,:,::-1])
|
399 |
-
break
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
spaces/AgentVerse/agentVerse/dataloader/responsegen.py
DELETED
@@ -1,21 +0,0 @@
|
|
1 |
-
from .dataloader import DataLoader
|
2 |
-
from . import dataloader_registry
|
3 |
-
import json
|
4 |
-
|
5 |
-
|
6 |
-
@dataloader_registry.register("tasksolving/responsegen/gpt-3.5")
|
7 |
-
@dataloader_registry.register("tasksolving/responsegen/gpt-4")
|
8 |
-
class ResponseGenLoader(DataLoader):
|
9 |
-
def __init__(self, path: str):
|
10 |
-
super().__init__(path)
|
11 |
-
|
12 |
-
def load(self):
|
13 |
-
with open(self.path) as f:
|
14 |
-
for line in f:
|
15 |
-
line = json.loads(line)
|
16 |
-
self.examples.append(
|
17 |
-
{
|
18 |
-
"input": line["input"],
|
19 |
-
"answer": line["answer"],
|
20 |
-
}
|
21 |
-
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
spaces/AgentVerse/agentVerse/ui/src/phaser3-rex-plugins/templates/ui/basesizer/BaseSizer.js
DELETED
@@ -1,241 +0,0 @@
|
|
1 |
-
import Container from '../container/Container.js';
|
2 |
-
import Methods from './Methods.js';
|
3 |
-
import { GetDisplayWidth, GetDisplayHeight } from '../../../plugins/utils/size/GetDisplaySize.js';
|
4 |
-
import Clear from '../../../plugins/utils/object/Clear.js'
|
5 |
-
|
6 |
-
const GetValue = Phaser.Utils.Objects.GetValue;
|
7 |
-
|
8 |
-
class Base extends Container {
|
9 |
-
constructor(scene, x, y, minWidth, minHeight, config) {
|
10 |
-
super(scene, x, y, 1, 1);
|
11 |
-
|
12 |
-
this.isRexSizer = true;
|
13 |
-
this.setMinSize(minWidth, minHeight);
|
14 |
-
this.setName(GetValue(config, 'name', ''));
|
15 |
-
this.rexSizer = {};
|
16 |
-
this.space = {};
|
17 |
-
this.backgroundChildren = undefined;
|
18 |
-
this.sizerChildren = undefined; // [] or {}
|
19 |
-
this.childrenMap = {};
|
20 |
-
this.layoutedChildren = undefined;
|
21 |
-
|
22 |
-
var anchorConfig = GetValue(config, 'anchor', undefined);
|
23 |
-
if (anchorConfig) {
|
24 |
-
this.setAnchor(anchorConfig);
|
25 |
-
}
|
26 |
-
|
27 |
-
this.setInnerPadding(GetValue(config, 'space', 0));
|
28 |
-
|
29 |
-
var draggable = GetValue(config, 'draggable', false);
|
30 |
-
if (draggable) {
|
31 |
-
this.setDraggable(draggable);
|
32 |
-
}
|
33 |
-
|
34 |
-
this.setSizerEventsEnable(GetValue(config, 'sizerEvents', false));
|
35 |
-
this.setDirty(true);
|
36 |
-
|
37 |
-
if (GetValue(config, 'enableLayer', false)) {
|
38 |
-
this.enableLayer();
|
39 |
-
}
|
40 |
-
}
|
41 |
-
|
42 |
-
destroy(fromScene) {
|
43 |
-
// This Game Object has already been destroyed
|
44 |
-
if (!this.scene || this.ignoreDestroy) {
|
45 |
-
return;
|
46 |
-
}
|
47 |
-
|
48 |
-
if (fromScene) {
|
49 |
-
// In this case, children will be cleared and destroy in scene level
|
50 |
-
var sizers = this.getAllChildrenSizers([this]);
|
51 |
-
for (var i = 0, cnt = sizers.length; i < cnt; i++) {
|
52 |
-
sizers[i].sizerEventsEnable = false;
|
53 |
-
}
|
54 |
-
}
|
55 |
-
|
56 |
-
super.destroy(fromScene);
|
57 |
-
|
58 |
-
Clear(this.backgroundChildren);
|
59 |
-
Clear(this.sizerChildren);
|
60 |
-
this.childrenMap = undefined;
|
61 |
-
this.space = undefined;
|
62 |
-
this.rexSizer = undefined;
|
63 |
-
this.layoutedChildren = undefined;
|
64 |
-
}
|
65 |
-
|
66 |
-
setMinSize(minWidth, minHeight) {
|
67 |
-
this.setMinWidth(minWidth).setMinHeight(minHeight);
|
68 |
-
return this;
|
69 |
-
}
|
70 |
-
|
71 |
-
setMinWidth(minWidth) {
|
72 |
-
if (minWidth == null) {
|
73 |
-
minWidth = 0;
|
74 |
-
}
|
75 |
-
this.minWidth = minWidth;
|
76 |
-
return this;
|
77 |
-
}
|
78 |
-
|
79 |
-
setMinHeight(minHeight) {
|
80 |
-
if (minHeight == null) {
|
81 |
-
minHeight = 0;
|
82 |
-
}
|
83 |
-
this.minHeight = minHeight;
|
84 |
-
return this;
|
85 |
-
}
|
86 |
-
|
87 |
-
setDirty(dirty) {
|
88 |
-
if (dirty === undefined) {
|
89 |
-
dirty = true;
|
90 |
-
}
|
91 |
-
this.dirty = dirty;
|
92 |
-
return this;
|
93 |
-
}
|
94 |
-
|
95 |
-
setSizerEventsEnable(enable) {
|
96 |
-
if (enable === undefined) {
|
97 |
-
enable = true;
|
98 |
-
}
|
99 |
-
|
100 |
-
this.sizerEventsEnable = enable;
|
101 |
-
return this;
|
102 |
-
}
|
103 |
-
|
104 |
-
get ignoreLayout() {
|
105 |
-
// Skip hidden or !dirty sizer
|
106 |
-
return this.rexSizer.hidden || (!this.dirty);
|
107 |
-
}
|
108 |
-
|
109 |
-
get childrenWidth() {
|
110 |
-
if (this._childrenWidth === undefined) {
|
111 |
-
this._childrenWidth = this.getChildrenWidth();
|
112 |
-
}
|
113 |
-
return this._childrenWidth;
|
114 |
-
}
|
115 |
-
|
116 |
-
get childrenHeight() {
|
117 |
-
if (this._childrenHeight === undefined) {
|
118 |
-
this._childrenHeight = this.getChildrenHeight();
|
119 |
-
}
|
120 |
-
return this._childrenHeight;
|
121 |
-
}
|
122 |
-
|
123 |
-
get left() {
|
124 |
-
return this.x - (GetDisplayWidth(this) * this.originX);
|
125 |
-
}
|
126 |
-
|
127 |
-
set left(value) {
|
128 |
-
this.x += (value - this.left);
|
129 |
-
}
|
130 |
-
|
131 |
-
alignLeft(value) {
|
132 |
-
this.left = value;
|
133 |
-
return this;
|
134 |
-
}
|
135 |
-
|
136 |
-
get right() {
|
137 |
-
return this.left + GetDisplayWidth(this);
|
138 |
-
}
|
139 |
-
|
140 |
-
set right(value) {
|
141 |
-
this.x += (value - this.right);
|
142 |
-
}
|
143 |
-
|
144 |
-
alignRight(value) {
|
145 |
-
this.right = value;
|
146 |
-
return this;
|
147 |
-
}
|
148 |
-
|
149 |
-
get centerX() {
|
150 |
-
return this.left + (GetDisplayWidth(this) / 2);
|
151 |
-
}
|
152 |
-
|
153 |
-
set centerX(value) {
|
154 |
-
this.x += (value - this.centerX);
|
155 |
-
}
|
156 |
-
|
157 |
-
alignCenterX(value) {
|
158 |
-
this.centerX = value;
|
159 |
-
return this;
|
160 |
-
}
|
161 |
-
|
162 |
-
get top() {
|
163 |
-
return this.y - (GetDisplayHeight(this) * this.originY);
|
164 |
-
}
|
165 |
-
|
166 |
-
set top(value) {
|
167 |
-
this.y += (value - this.top);
|
168 |
-
}
|
169 |
-
|
170 |
-
alignTop(value) {
|
171 |
-
this.top = value;
|
172 |
-
return this;
|
173 |
-
}
|
174 |
-
|
175 |
-
get bottom() {
|
176 |
-
return this.top + GetDisplayHeight(this);
|
177 |
-
}
|
178 |
-
|
179 |
-
set bottom(value) {
|
180 |
-
this.y += (value - this.bottom);
|
181 |
-
}
|
182 |
-
|
183 |
-
alignBottom(value) {
|
184 |
-
this.bottom = value;
|
185 |
-
return this;
|
186 |
-
}
|
187 |
-
|
188 |
-
get centerY() {
|
189 |
-
return this.top + (GetDisplayHeight(this) / 2);
|
190 |
-
}
|
191 |
-
|
192 |
-
set centerY(value) {
|
193 |
-
this.y += (value - this.centerY);
|
194 |
-
}
|
195 |
-
|
196 |
-
alignCenterY(value) {
|
197 |
-
this.centerY = value;
|
198 |
-
return this;
|
199 |
-
}
|
200 |
-
|
201 |
-
get innerLeft() {
|
202 |
-
return this.left + this.space.left;
|
203 |
-
}
|
204 |
-
|
205 |
-
get innerRight() {
|
206 |
-
return this.right - this.space.right;
|
207 |
-
}
|
208 |
-
|
209 |
-
get innerTop() {
|
210 |
-
return this.top + this.space.top;
|
211 |
-
}
|
212 |
-
|
213 |
-
get innerBottom() {
|
214 |
-
return this.bottom - this.space.bottom;
|
215 |
-
}
|
216 |
-
|
217 |
-
get innerWidth() {
|
218 |
-
return this.width - this.space.left - this.space.right;
|
219 |
-
}
|
220 |
-
|
221 |
-
get innerHeight() {
|
222 |
-
return this.height - this.space.top - this.space.bottom;
|
223 |
-
}
|
224 |
-
|
225 |
-
get minInnerWidth() {
|
226 |
-
var result = this.minWidth - this.space.left - this.space.right;
|
227 |
-
return Math.max(result, 0);
|
228 |
-
}
|
229 |
-
|
230 |
-
get minInnerHeight() {
|
231 |
-
var result = this.minHeight - this.space.top - this.space.bottom;
|
232 |
-
return Math.max(result, 0);
|
233 |
-
}
|
234 |
-
}
|
235 |
-
|
236 |
-
Object.assign(
|
237 |
-
Base.prototype,
|
238 |
-
Methods
|
239 |
-
);
|
240 |
-
|
241 |
-
export default Base;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
spaces/AgentVerse/agentVerse/ui/src/phaser3-rex-plugins/templates/ui/fixwidthsizer/AddChildMethods.js
DELETED
@@ -1,74 +0,0 @@
|
|
1 |
-
import AddChild from '../basesizer/utils/AddChild.js';
|
2 |
-
import GetBoundsConfig from '../utils/GetBoundsConfig.js';
|
3 |
-
import IsArray from '../../../plugins/utils/object/IsArray.js';
|
4 |
-
import GetNearestChildIndex from './GetNearestChildIndex.js';
|
5 |
-
|
6 |
-
const IsPlainObject = Phaser.Utils.Objects.IsPlainObject;
|
7 |
-
const GetValue = Phaser.Utils.Objects.GetValue;
|
8 |
-
const ALIGN_CENTER = Phaser.Display.Align.CENTER;
|
9 |
-
|
10 |
-
var Add = function (gameObject, paddingConfig, childKey, index) {
|
11 |
-
if (gameObject === '\n') {
|
12 |
-
this.addNewLine();
|
13 |
-
return this;
|
14 |
-
}
|
15 |
-
|
16 |
-
AddChild.call(this, gameObject);
|
17 |
-
|
18 |
-
if (IsPlainObject(paddingConfig)) {
|
19 |
-
var config = paddingConfig;
|
20 |
-
paddingConfig = GetValue(config, 'padding', 0);
|
21 |
-
childKey = GetValue(config, 'key', undefined);
|
22 |
-
index = GetValue(config, 'index', undefined);
|
23 |
-
}
|
24 |
-
if (paddingConfig === undefined) {
|
25 |
-
paddingConfig = 0;
|
26 |
-
}
|
27 |
-
|
28 |
-
var config = this.getSizerConfig(gameObject);
|
29 |
-
config.align = ALIGN_CENTER;
|
30 |
-
config.padding = GetBoundsConfig(paddingConfig);
|
31 |
-
if ((index === undefined) || (index >= this.sizerChildren.length)) {
|
32 |
-
this.sizerChildren.push(gameObject);
|
33 |
-
} else {
|
34 |
-
this.sizerChildren.splice(index, 0, gameObject);
|
35 |
-
}
|
36 |
-
|
37 |
-
if (childKey !== undefined) {
|
38 |
-
this.addChildrenMap(childKey, gameObject)
|
39 |
-
}
|
40 |
-
return this;
|
41 |
-
};
|
42 |
-
|
43 |
-
export default {
|
44 |
-
add(gameObject, paddingConfig, childKey) {
|
45 |
-
if (IsArray(gameObject)) {
|
46 |
-
var gameObjects = gameObject;
|
47 |
-
for (var i = 0, cnt = gameObjects.length; i < cnt; i++) {
|
48 |
-
Add.call(this, gameObjects[i], paddingConfig);
|
49 |
-
}
|
50 |
-
} else {
|
51 |
-
Add.call(this, gameObject, paddingConfig, childKey);
|
52 |
-
}
|
53 |
-
return this;
|
54 |
-
},
|
55 |
-
|
56 |
-
addNewLine() {
|
57 |
-
this.sizerChildren.push('\n');
|
58 |
-
return this;
|
59 |
-
},
|
60 |
-
|
61 |
-
insert(index, gameObject, paddingConfig, childKey) {
|
62 |
-
Add.call(this, gameObject, paddingConfig, childKey, index);
|
63 |
-
return this;
|
64 |
-
},
|
65 |
-
|
66 |
-
insertAtPosition(x, y, gameObject, paddingConfig, childKey) {
|
67 |
-
var index = GetNearestChildIndex.call(this, x, y);
|
68 |
-
if (index === -1) {
|
69 |
-
index = undefined;
|
70 |
-
}
|
71 |
-
this.insert(index, gameObject, paddingConfig, childKey);
|
72 |
-
return this;
|
73 |
-
}
|
74 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
spaces/AgentVerse/agentVerse/ui/src/phaser3-rex-plugins/templates/ui/namevaluelabel/methods/SetValueMethods.js
DELETED
@@ -1,50 +0,0 @@
|
|
1 |
-
const Clamp = Phaser.Math.Clamp;
|
2 |
-
|
3 |
-
export default {
|
4 |
-
setValueTextFormatCallback(callback, scope) {
|
5 |
-
this.valueTextFormatCallback = callback;
|
6 |
-
this.valueTextFormatCallbackScope = scope;
|
7 |
-
return this;
|
8 |
-
},
|
9 |
-
|
10 |
-
getFormatValueText(value, min, max) {
|
11 |
-
if (value === undefined) {
|
12 |
-
value = this.value;
|
13 |
-
}
|
14 |
-
if (min === undefined) {
|
15 |
-
min = this.minValue;
|
16 |
-
}
|
17 |
-
if (max === undefined) {
|
18 |
-
max = this.maxValue;
|
19 |
-
}
|
20 |
-
|
21 |
-
var text;
|
22 |
-
if (this.valueTextFormatCallbackScope) {
|
23 |
-
text = this.valueTextFormatCallback(value, min, max);
|
24 |
-
} else {
|
25 |
-
text = this.valueTextFormatCallback.call(this.valueTextFormatCallbackScope, value, min, max);
|
26 |
-
}
|
27 |
-
return text;
|
28 |
-
},
|
29 |
-
|
30 |
-
updateValueText(value, min, max) {
|
31 |
-
var textObject = this.childrenMap.value;
|
32 |
-
if (textObject && this.valueTextFormatCallback) {
|
33 |
-
textObject.setText(this.getFormatValueText(value, min, max));
|
34 |
-
if (textObject.layout) {
|
35 |
-
textObject.layout();
|
36 |
-
}
|
37 |
-
}
|
38 |
-
return this;
|
39 |
-
},
|
40 |
-
|
41 |
-
setValue(value, min, max) {
|
42 |
-
value = Clamp(value, min, max);
|
43 |
-
this.value = value;
|
44 |
-
this.minValue = min;
|
45 |
-
this.maxValue = max;
|
46 |
-
this.updateValueText(value, min, max);
|
47 |
-
this.setBarValue(value, min, max);
|
48 |
-
return this;
|
49 |
-
},
|
50 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
spaces/AgentVerse/agentVerse/ui/src/phaser3-rex-plugins/templates/ui/sizer/Methods.js
DELETED
@@ -1,39 +0,0 @@
|
|
1 |
-
import GetChildrenWidth from './GetChildrenWidth.js';
|
2 |
-
import GetChildrenHeight from './GetChildrenHeight.js';
|
3 |
-
import GetExpandedChildWidth from './GetExpandedChildWidth.js';
|
4 |
-
import GetExpandedChildHeight from './GetExpandedChildHeight.js';
|
5 |
-
import GetChildrenSizers from './GetChildrenSizers.js';
|
6 |
-
import PreLayout from './PreLayout.js';
|
7 |
-
import PostResolveSize from './PostResolveSize.js';
|
8 |
-
import LayoutChildren from './LayoutChildren.js';
|
9 |
-
import ResolveWidth from './ResolveWidth.js';
|
10 |
-
import ResolveHeight from './ResolveHeight.js';
|
11 |
-
import AddChildMethods from './AddChildMethods.js';
|
12 |
-
import RemoveChildMethods from './RemoveChildMethods.js';
|
13 |
-
import AlignMethods from './AlignMethods.js';
|
14 |
-
import ProportionMethods from './ProportionMethods.js';
|
15 |
-
import ExpandMethods from './ExpandMethods.js';
|
16 |
-
|
17 |
-
var methods = {
|
18 |
-
getChildrenWidth: GetChildrenWidth,
|
19 |
-
getChildrenHeight: GetChildrenHeight,
|
20 |
-
getExpandedChildWidth: GetExpandedChildWidth,
|
21 |
-
getExpandedChildHeight: GetExpandedChildHeight,
|
22 |
-
getChildrenSizers: GetChildrenSizers,
|
23 |
-
preLayout: PreLayout,
|
24 |
-
postResolveSize: PostResolveSize,
|
25 |
-
layoutChildren: LayoutChildren,
|
26 |
-
resolveWidth: ResolveWidth,
|
27 |
-
resolveHeight: ResolveHeight,
|
28 |
-
};
|
29 |
-
|
30 |
-
Object.assign(
|
31 |
-
methods,
|
32 |
-
AddChildMethods,
|
33 |
-
RemoveChildMethods,
|
34 |
-
AlignMethods,
|
35 |
-
ProportionMethods,
|
36 |
-
ExpandMethods,
|
37 |
-
);
|
38 |
-
|
39 |
-
export default methods;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
spaces/Akmyradov/TurkmenTTSweSTT/vits/data_utils.py
DELETED
@@ -1,392 +0,0 @@
|
|
1 |
-
import time
|
2 |
-
import os
|
3 |
-
import random
|
4 |
-
import numpy as np
|
5 |
-
import torch
|
6 |
-
import torch.utils.data
|
7 |
-
|
8 |
-
import commons
|
9 |
-
from mel_processing import spectrogram_torch
|
10 |
-
from utils import load_wav_to_torch, load_filepaths_and_text
|
11 |
-
from text import text_to_sequence, cleaned_text_to_sequence
|
12 |
-
|
13 |
-
|
14 |
-
class TextAudioLoader(torch.utils.data.Dataset):
|
15 |
-
"""
|
16 |
-
1) loads audio, text pairs
|
17 |
-
2) normalizes text and converts them to sequences of integers
|
18 |
-
3) computes spectrograms from audio files.
|
19 |
-
"""
|
20 |
-
def __init__(self, audiopaths_and_text, hparams):
|
21 |
-
self.audiopaths_and_text = load_filepaths_and_text(audiopaths_and_text)
|
22 |
-
self.text_cleaners = hparams.text_cleaners
|
23 |
-
self.max_wav_value = hparams.max_wav_value
|
24 |
-
self.sampling_rate = hparams.sampling_rate
|
25 |
-
self.filter_length = hparams.filter_length
|
26 |
-
self.hop_length = hparams.hop_length
|
27 |
-
self.win_length = hparams.win_length
|
28 |
-
self.sampling_rate = hparams.sampling_rate
|
29 |
-
|
30 |
-
self.cleaned_text = getattr(hparams, "cleaned_text", False)
|
31 |
-
|
32 |
-
self.add_blank = hparams.add_blank
|
33 |
-
self.min_text_len = getattr(hparams, "min_text_len", 1)
|
34 |
-
self.max_text_len = getattr(hparams, "max_text_len", 190)
|
35 |
-
|
36 |
-
random.seed(1234)
|
37 |
-
random.shuffle(self.audiopaths_and_text)
|
38 |
-
self._filter()
|
39 |
-
|
40 |
-
|
41 |
-
def _filter(self):
|
42 |
-
"""
|
43 |
-
Filter text & store spec lengths
|
44 |
-
"""
|
45 |
-
# Store spectrogram lengths for Bucketing
|
46 |
-
# wav_length ~= file_size / (wav_channels * Bytes per dim) = file_size / (1 * 2)
|
47 |
-
# spec_length = wav_length // hop_length
|
48 |
-
|
49 |
-
audiopaths_and_text_new = []
|
50 |
-
lengths = []
|
51 |
-
for audiopath, text in self.audiopaths_and_text:
|
52 |
-
if self.min_text_len <= len(text) and len(text) <= self.max_text_len:
|
53 |
-
audiopaths_and_text_new.append([audiopath, text])
|
54 |
-
lengths.append(os.path.getsize(audiopath) // (2 * self.hop_length))
|
55 |
-
self.audiopaths_and_text = audiopaths_and_text_new
|
56 |
-
self.lengths = lengths
|
57 |
-
|
58 |
-
def get_audio_text_pair(self, audiopath_and_text):
|
59 |
-
# separate filename and text
|
60 |
-
audiopath, text = audiopath_and_text[0], audiopath_and_text[1]
|
61 |
-
text = self.get_text(text)
|
62 |
-
spec, wav = self.get_audio(audiopath)
|
63 |
-
return (text, spec, wav)
|
64 |
-
|
65 |
-
def get_audio(self, filename):
|
66 |
-
audio, sampling_rate = load_wav_to_torch(filename)
|
67 |
-
if sampling_rate != self.sampling_rate:
|
68 |
-
raise ValueError("{} {} SR doesn't match target {} SR".format(
|
69 |
-
sampling_rate, self.sampling_rate))
|
70 |
-
audio_norm = audio / self.max_wav_value
|
71 |
-
audio_norm = audio_norm.unsqueeze(0)
|
72 |
-
spec_filename = filename.replace(".wav", ".spec.pt")
|
73 |
-
if os.path.exists(spec_filename):
|
74 |
-
spec = torch.load(spec_filename)
|
75 |
-
else:
|
76 |
-
spec = spectrogram_torch(audio_norm, self.filter_length,
|
77 |
-
self.sampling_rate, self.hop_length, self.win_length,
|
78 |
-
center=False)
|
79 |
-
spec = torch.squeeze(spec, 0)
|
80 |
-
torch.save(spec, spec_filename)
|
81 |
-
return spec, audio_norm
|
82 |
-
|
83 |
-
def get_text(self, text):
|
84 |
-
if self.cleaned_text:
|
85 |
-
text_norm = cleaned_text_to_sequence(text)
|
86 |
-
else:
|
87 |
-
text_norm = text_to_sequence(text, self.text_cleaners)
|
88 |
-
if self.add_blank:
|
89 |
-
text_norm = commons.intersperse(text_norm, 0)
|
90 |
-
text_norm = torch.LongTensor(text_norm)
|
91 |
-
return text_norm
|
92 |
-
|
93 |
-
def __getitem__(self, index):
|
94 |
-
return self.get_audio_text_pair(self.audiopaths_and_text[index])
|
95 |
-
|
96 |
-
def __len__(self):
|
97 |
-
return len(self.audiopaths_and_text)
|
98 |
-
|
99 |
-
|
100 |
-
class TextAudioCollate():
|
101 |
-
""" Zero-pads model inputs and targets
|
102 |
-
"""
|
103 |
-
def __init__(self, return_ids=False):
|
104 |
-
self.return_ids = return_ids
|
105 |
-
|
106 |
-
def __call__(self, batch):
|
107 |
-
"""Collate's training batch from normalized text and aduio
|
108 |
-
PARAMS
|
109 |
-
------
|
110 |
-
batch: [text_normalized, spec_normalized, wav_normalized]
|
111 |
-
"""
|
112 |
-
# Right zero-pad all one-hot text sequences to max input length
|
113 |
-
_, ids_sorted_decreasing = torch.sort(
|
114 |
-
torch.LongTensor([x[1].size(1) for x in batch]),
|
115 |
-
dim=0, descending=True)
|
116 |
-
|
117 |
-
max_text_len = max([len(x[0]) for x in batch])
|
118 |
-
max_spec_len = max([x[1].size(1) for x in batch])
|
119 |
-
max_wav_len = max([x[2].size(1) for x in batch])
|
120 |
-
|
121 |
-
text_lengths = torch.LongTensor(len(batch))
|
122 |
-
spec_lengths = torch.LongTensor(len(batch))
|
123 |
-
wav_lengths = torch.LongTensor(len(batch))
|
124 |
-
|
125 |
-
text_padded = torch.LongTensor(len(batch), max_text_len)
|
126 |
-
spec_padded = torch.FloatTensor(len(batch), batch[0][1].size(0), max_spec_len)
|
127 |
-
wav_padded = torch.FloatTensor(len(batch), 1, max_wav_len)
|
128 |
-
text_padded.zero_()
|
129 |
-
spec_padded.zero_()
|
130 |
-
wav_padded.zero_()
|
131 |
-
for i in range(len(ids_sorted_decreasing)):
|
132 |
-
row = batch[ids_sorted_decreasing[i]]
|
133 |
-
|
134 |
-
text = row[0]
|
135 |
-
text_padded[i, :text.size(0)] = text
|
136 |
-
text_lengths[i] = text.size(0)
|
137 |
-
|
138 |
-
spec = row[1]
|
139 |
-
spec_padded[i, :, :spec.size(1)] = spec
|
140 |
-
spec_lengths[i] = spec.size(1)
|
141 |
-
|
142 |
-
wav = row[2]
|
143 |
-
wav_padded[i, :, :wav.size(1)] = wav
|
144 |
-
wav_lengths[i] = wav.size(1)
|
145 |
-
|
146 |
-
if self.return_ids:
|
147 |
-
return text_padded, text_lengths, spec_padded, spec_lengths, wav_padded, wav_lengths, ids_sorted_decreasing
|
148 |
-
return text_padded, text_lengths, spec_padded, spec_lengths, wav_padded, wav_lengths
|
149 |
-
|
150 |
-
|
151 |
-
"""Multi speaker version"""
|
152 |
-
class TextAudioSpeakerLoader(torch.utils.data.Dataset):
|
153 |
-
"""
|
154 |
-
1) loads audio, speaker_id, text pairs
|
155 |
-
2) normalizes text and converts them to sequences of integers
|
156 |
-
3) computes spectrograms from audio files.
|
157 |
-
"""
|
158 |
-
def __init__(self, audiopaths_sid_text, hparams):
|
159 |
-
self.audiopaths_sid_text = load_filepaths_and_text(audiopaths_sid_text)
|
160 |
-
self.text_cleaners = hparams.text_cleaners
|
161 |
-
self.max_wav_value = hparams.max_wav_value
|
162 |
-
self.sampling_rate = hparams.sampling_rate
|
163 |
-
self.filter_length = hparams.filter_length
|
164 |
-
self.hop_length = hparams.hop_length
|
165 |
-
self.win_length = hparams.win_length
|
166 |
-
self.sampling_rate = hparams.sampling_rate
|
167 |
-
|
168 |
-
self.cleaned_text = getattr(hparams, "cleaned_text", False)
|
169 |
-
|
170 |
-
self.add_blank = hparams.add_blank
|
171 |
-
self.min_text_len = getattr(hparams, "min_text_len", 1)
|
172 |
-
self.max_text_len = getattr(hparams, "max_text_len", 190)
|
173 |
-
|
174 |
-
random.seed(1234)
|
175 |
-
random.shuffle(self.audiopaths_sid_text)
|
176 |
-
self._filter()
|
177 |
-
|
178 |
-
def _filter(self):
|
179 |
-
"""
|
180 |
-
Filter text & store spec lengths
|
181 |
-
"""
|
182 |
-
# Store spectrogram lengths for Bucketing
|
183 |
-
# wav_length ~= file_size / (wav_channels * Bytes per dim) = file_size / (1 * 2)
|
184 |
-
# spec_length = wav_length // hop_length
|
185 |
-
|
186 |
-
audiopaths_sid_text_new = []
|
187 |
-
lengths = []
|
188 |
-
for audiopath, sid, text in self.audiopaths_sid_text:
|
189 |
-
if self.min_text_len <= len(text) and len(text) <= self.max_text_len:
|
190 |
-
audiopaths_sid_text_new.append([audiopath, sid, text])
|
191 |
-
lengths.append(os.path.getsize(audiopath) // (2 * self.hop_length))
|
192 |
-
self.audiopaths_sid_text = audiopaths_sid_text_new
|
193 |
-
self.lengths = lengths
|
194 |
-
|
195 |
-
def get_audio_text_speaker_pair(self, audiopath_sid_text):
|
196 |
-
# separate filename, speaker_id and text
|
197 |
-
audiopath, sid, text = audiopath_sid_text[0], audiopath_sid_text[1], audiopath_sid_text[2]
|
198 |
-
text = self.get_text(text)
|
199 |
-
spec, wav = self.get_audio(audiopath)
|
200 |
-
sid = self.get_sid(sid)
|
201 |
-
return (text, spec, wav, sid)
|
202 |
-
|
203 |
-
def get_audio(self, filename):
|
204 |
-
audio, sampling_rate = load_wav_to_torch(filename)
|
205 |
-
if sampling_rate != self.sampling_rate:
|
206 |
-
raise ValueError("{} {} SR doesn't match target {} SR".format(
|
207 |
-
sampling_rate, self.sampling_rate))
|
208 |
-
audio_norm = audio / self.max_wav_value
|
209 |
-
audio_norm = audio_norm.unsqueeze(0)
|
210 |
-
spec_filename = filename.replace(".wav", ".spec.pt")
|
211 |
-
if os.path.exists(spec_filename):
|
212 |
-
spec = torch.load(spec_filename)
|
213 |
-
else:
|
214 |
-
spec = spectrogram_torch(audio_norm, self.filter_length,
|
215 |
-
self.sampling_rate, self.hop_length, self.win_length,
|
216 |
-
center=False)
|
217 |
-
spec = torch.squeeze(spec, 0)
|
218 |
-
torch.save(spec, spec_filename)
|
219 |
-
return spec, audio_norm
|
220 |
-
|
221 |
-
def get_text(self, text):
|
222 |
-
if self.cleaned_text:
|
223 |
-
text_norm = cleaned_text_to_sequence(text)
|
224 |
-
else:
|
225 |
-
text_norm = text_to_sequence(text, self.text_cleaners)
|
226 |
-
if self.add_blank:
|
227 |
-
text_norm = commons.intersperse(text_norm, 0)
|
228 |
-
text_norm = torch.LongTensor(text_norm)
|
229 |
-
return text_norm
|
230 |
-
|
231 |
-
def get_sid(self, sid):
|
232 |
-
sid = torch.LongTensor([int(sid)])
|
233 |
-
return sid
|
234 |
-
|
235 |
-
def __getitem__(self, index):
|
236 |
-
return self.get_audio_text_speaker_pair(self.audiopaths_sid_text[index])
|
237 |
-
|
238 |
-
def __len__(self):
|
239 |
-
return len(self.audiopaths_sid_text)
|
240 |
-
|
241 |
-
|
242 |
-
class TextAudioSpeakerCollate():
|
243 |
-
""" Zero-pads model inputs and targets
|
244 |
-
"""
|
245 |
-
def __init__(self, return_ids=False):
|
246 |
-
self.return_ids = return_ids
|
247 |
-
|
248 |
-
def __call__(self, batch):
|
249 |
-
"""Collate's training batch from normalized text, audio and speaker identities
|
250 |
-
PARAMS
|
251 |
-
------
|
252 |
-
batch: [text_normalized, spec_normalized, wav_normalized, sid]
|
253 |
-
"""
|
254 |
-
# Right zero-pad all one-hot text sequences to max input length
|
255 |
-
_, ids_sorted_decreasing = torch.sort(
|
256 |
-
torch.LongTensor([x[1].size(1) for x in batch]),
|
257 |
-
dim=0, descending=True)
|
258 |
-
|
259 |
-
max_text_len = max([len(x[0]) for x in batch])
|
260 |
-
max_spec_len = max([x[1].size(1) for x in batch])
|
261 |
-
max_wav_len = max([x[2].size(1) for x in batch])
|
262 |
-
|
263 |
-
text_lengths = torch.LongTensor(len(batch))
|
264 |
-
spec_lengths = torch.LongTensor(len(batch))
|
265 |
-
wav_lengths = torch.LongTensor(len(batch))
|
266 |
-
sid = torch.LongTensor(len(batch))
|
267 |
-
|
268 |
-
text_padded = torch.LongTensor(len(batch), max_text_len)
|
269 |
-
spec_padded = torch.FloatTensor(len(batch), batch[0][1].size(0), max_spec_len)
|
270 |
-
wav_padded = torch.FloatTensor(len(batch), 1, max_wav_len)
|
271 |
-
text_padded.zero_()
|
272 |
-
spec_padded.zero_()
|
273 |
-
wav_padded.zero_()
|
274 |
-
for i in range(len(ids_sorted_decreasing)):
|
275 |
-
row = batch[ids_sorted_decreasing[i]]
|
276 |
-
|
277 |
-
text = row[0]
|
278 |
-
text_padded[i, :text.size(0)] = text
|
279 |
-
text_lengths[i] = text.size(0)
|
280 |
-
|
281 |
-
spec = row[1]
|
282 |
-
spec_padded[i, :, :spec.size(1)] = spec
|
283 |
-
spec_lengths[i] = spec.size(1)
|
284 |
-
|
285 |
-
wav = row[2]
|
286 |
-
wav_padded[i, :, :wav.size(1)] = wav
|
287 |
-
wav_lengths[i] = wav.size(1)
|
288 |
-
|
289 |
-
sid[i] = row[3]
|
290 |
-
|
291 |
-
if self.return_ids:
|
292 |
-
return text_padded, text_lengths, spec_padded, spec_lengths, wav_padded, wav_lengths, sid, ids_sorted_decreasing
|
293 |
-
return text_padded, text_lengths, spec_padded, spec_lengths, wav_padded, wav_lengths, sid
|
294 |
-
|
295 |
-
|
296 |
-
class DistributedBucketSampler(torch.utils.data.distributed.DistributedSampler):
|
297 |
-
"""
|
298 |
-
Maintain similar input lengths in a batch.
|
299 |
-
Length groups are specified by boundaries.
|
300 |
-
Ex) boundaries = [b1, b2, b3] -> any batch is included either {x | b1 < length(x) <=b2} or {x | b2 < length(x) <= b3}.
|
301 |
-
|
302 |
-
It removes samples which are not included in the boundaries.
|
303 |
-
Ex) boundaries = [b1, b2, b3] -> any x s.t. length(x) <= b1 or length(x) > b3 are discarded.
|
304 |
-
"""
|
305 |
-
def __init__(self, dataset, batch_size, boundaries, num_replicas=None, rank=None, shuffle=True):
|
306 |
-
super().__init__(dataset, num_replicas=num_replicas, rank=rank, shuffle=shuffle)
|
307 |
-
self.lengths = dataset.lengths
|
308 |
-
self.batch_size = batch_size
|
309 |
-
self.boundaries = boundaries
|
310 |
-
|
311 |
-
self.buckets, self.num_samples_per_bucket = self._create_buckets()
|
312 |
-
self.total_size = sum(self.num_samples_per_bucket)
|
313 |
-
self.num_samples = self.total_size // self.num_replicas
|
314 |
-
|
315 |
-
def _create_buckets(self):
|
316 |
-
buckets = [[] for _ in range(len(self.boundaries) - 1)]
|
317 |
-
for i in range(len(self.lengths)):
|
318 |
-
length = self.lengths[i]
|
319 |
-
idx_bucket = self._bisect(length)
|
320 |
-
if idx_bucket != -1:
|
321 |
-
buckets[idx_bucket].append(i)
|
322 |
-
|
323 |
-
for i in range(len(buckets) - 1, 0, -1):
|
324 |
-
if len(buckets[i]) == 0:
|
325 |
-
buckets.pop(i)
|
326 |
-
self.boundaries.pop(i+1)
|
327 |
-
|
328 |
-
num_samples_per_bucket = []
|
329 |
-
for i in range(len(buckets)):
|
330 |
-
len_bucket = len(buckets[i])
|
331 |
-
total_batch_size = self.num_replicas * self.batch_size
|
332 |
-
rem = (total_batch_size - (len_bucket % total_batch_size)) % total_batch_size
|
333 |
-
num_samples_per_bucket.append(len_bucket + rem)
|
334 |
-
return buckets, num_samples_per_bucket
|
335 |
-
|
336 |
-
def __iter__(self):
|
337 |
-
# deterministically shuffle based on epoch
|
338 |
-
g = torch.Generator()
|
339 |
-
g.manual_seed(self.epoch)
|
340 |
-
|
341 |
-
indices = []
|
342 |
-
if self.shuffle:
|
343 |
-
for bucket in self.buckets:
|
344 |
-
indices.append(torch.randperm(len(bucket), generator=g).tolist())
|
345 |
-
else:
|
346 |
-
for bucket in self.buckets:
|
347 |
-
indices.append(list(range(len(bucket))))
|
348 |
-
|
349 |
-
batches = []
|
350 |
-
for i in range(len(self.buckets)):
|
351 |
-
bucket = self.buckets[i]
|
352 |
-
len_bucket = len(bucket)
|
353 |
-
ids_bucket = indices[i]
|
354 |
-
num_samples_bucket = self.num_samples_per_bucket[i]
|
355 |
-
|
356 |
-
# add extra samples to make it evenly divisible
|
357 |
-
rem = num_samples_bucket - len_bucket
|
358 |
-
ids_bucket = ids_bucket + ids_bucket * (rem // len_bucket) + ids_bucket[:(rem % len_bucket)]
|
359 |
-
|
360 |
-
# subsample
|
361 |
-
ids_bucket = ids_bucket[self.rank::self.num_replicas]
|
362 |
-
|
363 |
-
# batching
|
364 |
-
for j in range(len(ids_bucket) // self.batch_size):
|
365 |
-
batch = [bucket[idx] for idx in ids_bucket[j*self.batch_size:(j+1)*self.batch_size]]
|
366 |
-
batches.append(batch)
|
367 |
-
|
368 |
-
if self.shuffle:
|
369 |
-
batch_ids = torch.randperm(len(batches), generator=g).tolist()
|
370 |
-
batches = [batches[i] for i in batch_ids]
|
371 |
-
self.batches = batches
|
372 |
-
|
373 |
-
assert len(self.batches) * self.batch_size == self.num_samples
|
374 |
-
return iter(self.batches)
|
375 |
-
|
376 |
-
def _bisect(self, x, lo=0, hi=None):
|
377 |
-
if hi is None:
|
378 |
-
hi = len(self.boundaries) - 1
|
379 |
-
|
380 |
-
if hi > lo:
|
381 |
-
mid = (hi + lo) // 2
|
382 |
-
if self.boundaries[mid] < x and x <= self.boundaries[mid+1]:
|
383 |
-
return mid
|
384 |
-
elif x <= self.boundaries[mid]:
|
385 |
-
return self._bisect(x, lo, mid)
|
386 |
-
else:
|
387 |
-
return self._bisect(x, mid + 1, hi)
|
388 |
-
else:
|
389 |
-
return -1
|
390 |
-
|
391 |
-
def __len__(self):
|
392 |
-
return self.num_samples // self.batch_size
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
spaces/Ama434/neutral-barlow/app.py
DELETED
@@ -1,145 +0,0 @@
|
|
1 |
-
import time
|
2 |
-
|
3 |
-
import gradio as gr
|
4 |
-
from gradio.themes.utils.theme_dropdown import create_theme_dropdown
|
5 |
-
|
6 |
-
dropdown, js = create_theme_dropdown()
|
7 |
-
|
8 |
-
with gr.Blocks(theme='Ama434/neutral-barlow') as demo:
|
9 |
-
with gr.Row().style(equal_height=True):
|
10 |
-
with gr.Column(scale=10):
|
11 |
-
gr.Markdown(
|
12 |
-
"""
|
13 |
-
# Theme preview: `neutral-barlow`
|
14 |
-
To use this theme, set `theme='Ama434/neutral-barlow'` in `gr.Blocks()` or `gr.Interface()`.
|
15 |
-
You can append an `@` and a semantic version expression, e.g. @>=1.0.0,<2.0.0 to pin to a given version
|
16 |
-
of this theme.
|
17 |
-
"""
|
18 |
-
)
|
19 |
-
with gr.Column(scale=3):
|
20 |
-
with gr.Box():
|
21 |
-
dropdown.render()
|
22 |
-
toggle_dark = gr.Button(value="Toggle Dark").style(full_width=True)
|
23 |
-
|
24 |
-
dropdown.change(None, dropdown, None, _js=js)
|
25 |
-
toggle_dark.click(
|
26 |
-
None,
|
27 |
-
_js="""
|
28 |
-
() => {
|
29 |
-
document.body.classList.toggle('dark');
|
30 |
-
}
|
31 |
-
""",
|
32 |
-
)
|
33 |
-
|
34 |
-
name = gr.Textbox(
|
35 |
-
label="Name",
|
36 |
-
info="Full name, including middle name. No special characters.",
|
37 |
-
placeholder="John Doe",
|
38 |
-
value="John Doe",
|
39 |
-
interactive=True,
|
40 |
-
)
|
41 |
-
|
42 |
-
with gr.Row():
|
43 |
-
slider1 = gr.Slider(label="Slider 1")
|
44 |
-
slider2 = gr.Slider(label="Slider 2")
|
45 |
-
gr.CheckboxGroup(["A", "B", "C"], label="Checkbox Group")
|
46 |
-
|
47 |
-
with gr.Row():
|
48 |
-
with gr.Column(variant="panel", scale=1):
|
49 |
-
gr.Markdown("## Panel 1")
|
50 |
-
radio = gr.Radio(
|
51 |
-
["A", "B", "C"],
|
52 |
-
label="Radio",
|
53 |
-
info="Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.",
|
54 |
-
)
|
55 |
-
drop = gr.Dropdown(["Option 1", "Option 2", "Option 3"], show_label=False)
|
56 |
-
drop_2 = gr.Dropdown(
|
57 |
-
["Option A", "Option B", "Option C"],
|
58 |
-
multiselect=True,
|
59 |
-
value=["Option A"],
|
60 |
-
label="Dropdown",
|
61 |
-
interactive=True,
|
62 |
-
)
|
63 |
-
check = gr.Checkbox(label="Go")
|
64 |
-
with gr.Column(variant="panel", scale=2):
|
65 |
-
img = gr.Image(
|
66 |
-
"https://gradio.app/assets/img/header-image.jpg", label="Image"
|
67 |
-
).style(height=320)
|
68 |
-
with gr.Row():
|
69 |
-
go_btn = gr.Button("Go", label="Primary Button", variant="primary")
|
70 |
-
clear_btn = gr.Button(
|
71 |
-
"Clear", label="Secondary Button", variant="secondary"
|
72 |
-
)
|
73 |
-
|
74 |
-
def go(*args):
|
75 |
-
time.sleep(3)
|
76 |
-
return "https://gradio.app/assets/img/header-image.jpg"
|
77 |
-
|
78 |
-
go_btn.click(go, [radio, drop, drop_2, check, name], img, api_name="go")
|
79 |
-
|
80 |
-
def clear():
|
81 |
-
time.sleep(0.2)
|
82 |
-
return None
|
83 |
-
|
84 |
-
clear_btn.click(clear, None, img)
|
85 |
-
|
86 |
-
with gr.Row():
|
87 |
-
btn1 = gr.Button("Button 1").style(size="sm")
|
88 |
-
btn2 = gr.UploadButton().style(size="sm")
|
89 |
-
stop_btn = gr.Button("Stop", label="Stop Button", variant="stop").style(
|
90 |
-
size="sm"
|
91 |
-
)
|
92 |
-
|
93 |
-
with gr.Row():
|
94 |
-
gr.Dataframe(value=[[1, 2, 3], [4, 5, 6], [7, 8, 9]], label="Dataframe")
|
95 |
-
gr.JSON(
|
96 |
-
value={"a": 1, "b": 2, "c": {"test": "a", "test2": [1, 2, 3]}}, label="JSON"
|
97 |
-
)
|
98 |
-
gr.Label(value={"cat": 0.7, "dog": 0.2, "fish": 0.1})
|
99 |
-
gr.File()
|
100 |
-
with gr.Row():
|
101 |
-
gr.ColorPicker()
|
102 |
-
gr.Video("https://gradio-static-files.s3.us-west-2.amazonaws.com/world.mp4")
|
103 |
-
gr.Gallery(
|
104 |
-
[
|
105 |
-
(
|
106 |
-
"https://gradio-static-files.s3.us-west-2.amazonaws.com/lion.jpg",
|
107 |
-
"lion",
|
108 |
-
),
|
109 |
-
(
|
110 |
-
"https://gradio-static-files.s3.us-west-2.amazonaws.com/logo.png",
|
111 |
-
"logo",
|
112 |
-
),
|
113 |
-
(
|
114 |
-
"https://gradio-static-files.s3.us-west-2.amazonaws.com/tower.jpg",
|
115 |
-
"tower",
|
116 |
-
),
|
117 |
-
]
|
118 |
-
).style(height="200px", grid=2)
|
119 |
-
|
120 |
-
with gr.Row():
|
121 |
-
with gr.Column(scale=2):
|
122 |
-
chatbot = gr.Chatbot([("Hello", "Hi")], label="Chatbot")
|
123 |
-
chat_btn = gr.Button("Add messages")
|
124 |
-
|
125 |
-
def chat(history):
|
126 |
-
time.sleep(2)
|
127 |
-
yield [["How are you?", "I am good."]]
|
128 |
-
|
129 |
-
chat_btn.click(
|
130 |
-
lambda history: history
|
131 |
-
+ [["How are you?", "I am good."]]
|
132 |
-
+ (time.sleep(2) or []),
|
133 |
-
chatbot,
|
134 |
-
chatbot,
|
135 |
-
)
|
136 |
-
with gr.Column(scale=1):
|
137 |
-
with gr.Accordion("Advanced Settings"):
|
138 |
-
gr.Markdown("Hello")
|
139 |
-
gr.Number(label="Chatbot control 1")
|
140 |
-
gr.Number(label="Chatbot control 2")
|
141 |
-
gr.Number(label="Chatbot control 3")
|
142 |
-
|
143 |
-
|
144 |
-
if __name__ == "__main__":
|
145 |
-
demo.queue().launch()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
spaces/Amrrs/DragGan-Inversion/PTI/evaluation/qualitative_edit_comparison.py
DELETED
@@ -1,156 +0,0 @@
|
|
1 |
-
import os
|
2 |
-
from random import choice
|
3 |
-
from string import ascii_uppercase
|
4 |
-
from PIL import Image
|
5 |
-
from tqdm import tqdm
|
6 |
-
from scripts.latent_editor_wrapper import LatentEditorWrapper
|
7 |
-
from evaluation.experiment_setting_creator import ExperimentRunner
|
8 |
-
import torch
|
9 |
-
from configs import paths_config, hyperparameters, evaluation_config
|
10 |
-
from utils.log_utils import save_concat_image, save_single_image
|
11 |
-
from utils.models_utils import load_tuned_G
|
12 |
-
|
13 |
-
|
14 |
-
class EditComparison:
|
15 |
-
|
16 |
-
def __init__(self, save_single_images, save_concatenated_images, run_id):
|
17 |
-
|
18 |
-
self.run_id = run_id
|
19 |
-
self.experiment_creator = ExperimentRunner(run_id)
|
20 |
-
self.save_single_images = save_single_images
|
21 |
-
self.save_concatenated_images = save_concatenated_images
|
22 |
-
self.latent_editor = LatentEditorWrapper()
|
23 |
-
|
24 |
-
def save_reconstruction_images(self, image_latents, new_inv_image_latent, new_G, target_image):
|
25 |
-
if self.save_concatenated_images:
|
26 |
-
save_concat_image(self.concat_base_dir, image_latents, new_inv_image_latent, new_G,
|
27 |
-
self.experiment_creator.old_G,
|
28 |
-
'rec',
|
29 |
-
target_image)
|
30 |
-
|
31 |
-
if self.save_single_images:
|
32 |
-
save_single_image(self.single_base_dir, new_inv_image_latent, new_G, 'rec')
|
33 |
-
target_image.save(f'{self.single_base_dir}/Original.jpg')
|
34 |
-
|
35 |
-
def create_output_dirs(self, full_image_name):
|
36 |
-
output_base_dir_path = f'{paths_config.experiments_output_dir}/{paths_config.input_data_id}/{self.run_id}/{full_image_name}'
|
37 |
-
os.makedirs(output_base_dir_path, exist_ok=True)
|
38 |
-
|
39 |
-
self.concat_base_dir = f'{output_base_dir_path}/concat_images'
|
40 |
-
self.single_base_dir = f'{output_base_dir_path}/single_images'
|
41 |
-
|
42 |
-
os.makedirs(self.concat_base_dir, exist_ok=True)
|
43 |
-
os.makedirs(self.single_base_dir, exist_ok=True)
|
44 |
-
|
45 |
-
def get_image_latent_codes(self, image_name):
|
46 |
-
image_latents = []
|
47 |
-
for method in evaluation_config.evaluated_methods:
|
48 |
-
if method == 'SG2':
|
49 |
-
image_latents.append(torch.load(
|
50 |
-
f'{paths_config.embedding_base_dir}/{paths_config.input_data_id}/'
|
51 |
-
f'{paths_config.pti_results_keyword}/{image_name}/0.pt'))
|
52 |
-
else:
|
53 |
-
image_latents.append(torch.load(
|
54 |
-
f'{paths_config.embedding_base_dir}/{paths_config.input_data_id}/{method}/{image_name}/0.pt'))
|
55 |
-
new_inv_image_latent = torch.load(
|
56 |
-
f'{paths_config.embedding_base_dir}/{paths_config.input_data_id}/{paths_config.pti_results_keyword}/{image_name}/0.pt')
|
57 |
-
|
58 |
-
return image_latents, new_inv_image_latent
|
59 |
-
|
60 |
-
def save_interfacegan_edits(self, image_latents, new_inv_image_latent, interfacegan_factors, new_G, target_image):
|
61 |
-
new_w_inv_edits = self.latent_editor.get_single_interface_gan_edits(new_inv_image_latent,
|
62 |
-
interfacegan_factors)
|
63 |
-
|
64 |
-
inv_edits = []
|
65 |
-
for latent in image_latents:
|
66 |
-
inv_edits.append(self.latent_editor.get_single_interface_gan_edits(latent, interfacegan_factors))
|
67 |
-
|
68 |
-
for direction, edits in new_w_inv_edits.items():
|
69 |
-
for factor, edit_tensor in edits.items():
|
70 |
-
if self.save_concatenated_images:
|
71 |
-
save_concat_image(self.concat_base_dir, [edits[direction][factor] for edits in inv_edits],
|
72 |
-
new_w_inv_edits[direction][factor],
|
73 |
-
new_G,
|
74 |
-
self.experiment_creator.old_G,
|
75 |
-
f'{direction}_{factor}', target_image)
|
76 |
-
if self.save_single_images:
|
77 |
-
save_single_image(self.single_base_dir, new_w_inv_edits[direction][factor], new_G,
|
78 |
-
f'{direction}_{factor}')
|
79 |
-
|
80 |
-
def save_ganspace_edits(self, image_latents, new_inv_image_latent, factors, new_G, target_image):
|
81 |
-
new_w_inv_edits = self.latent_editor.get_single_ganspace_edits(new_inv_image_latent, factors)
|
82 |
-
inv_edits = []
|
83 |
-
for latent in image_latents:
|
84 |
-
inv_edits.append(self.latent_editor.get_single_ganspace_edits(latent, factors))
|
85 |
-
|
86 |
-
for idx in range(len(new_w_inv_edits)):
|
87 |
-
if self.save_concatenated_images:
|
88 |
-
save_concat_image(self.concat_base_dir, [edit[idx] for edit in inv_edits], new_w_inv_edits[idx],
|
89 |
-
new_G,
|
90 |
-
self.experiment_creator.old_G,
|
91 |
-
f'ganspace_{idx}', target_image)
|
92 |
-
if self.save_single_images:
|
93 |
-
save_single_image(self.single_base_dir, new_w_inv_edits[idx], new_G,
|
94 |
-
f'ganspace_{idx}')
|
95 |
-
|
96 |
-
def run_experiment(self, run_pt, create_other_latents, use_multi_id_training, use_wandb=False):
|
97 |
-
images_counter = 0
|
98 |
-
new_G = None
|
99 |
-
interfacegan_factors = [val / 2 for val in range(-6, 7) if val != 0]
|
100 |
-
ganspace_factors = range(-20, 25, 5)
|
101 |
-
self.experiment_creator.run_experiment(run_pt, create_other_latents, use_multi_id_training, use_wandb)
|
102 |
-
|
103 |
-
if use_multi_id_training:
|
104 |
-
new_G = load_tuned_G(self.run_id, paths_config.multi_id_model_type)
|
105 |
-
|
106 |
-
for idx, image_path in tqdm(enumerate(self.experiment_creator.images_paths),
|
107 |
-
total=len(self.experiment_creator.images_paths)):
|
108 |
-
|
109 |
-
if images_counter >= hyperparameters.max_images_to_invert:
|
110 |
-
break
|
111 |
-
|
112 |
-
image_name = image_path.split('.')[0].split('/')[-1]
|
113 |
-
target_image = Image.open(self.experiment_creator.target_paths[idx])
|
114 |
-
|
115 |
-
if not use_multi_id_training:
|
116 |
-
new_G = load_tuned_G(self.run_id, image_name)
|
117 |
-
|
118 |
-
image_latents, new_inv_image_latent = self.get_image_latent_codes(image_name)
|
119 |
-
|
120 |
-
self.create_output_dirs(image_name)
|
121 |
-
|
122 |
-
self.save_reconstruction_images(image_latents, new_inv_image_latent, new_G, target_image)
|
123 |
-
|
124 |
-
self.save_interfacegan_edits(image_latents, new_inv_image_latent, interfacegan_factors, new_G, target_image)
|
125 |
-
|
126 |
-
self.save_ganspace_edits(image_latents, new_inv_image_latent, ganspace_factors, new_G, target_image)
|
127 |
-
|
128 |
-
target_image.close()
|
129 |
-
torch.cuda.empty_cache()
|
130 |
-
images_counter += 1
|
131 |
-
|
132 |
-
|
133 |
-
def run_pti_and_full_edit(iid):
|
134 |
-
evaluation_config.evaluated_methods = ['SG2Plus', 'e4e', 'SG2']
|
135 |
-
edit_figure_creator = EditComparison(save_single_images=True, save_concatenated_images=True,
|
136 |
-
run_id=f'{paths_config.input_data_id}_pti_full_edit_{iid}')
|
137 |
-
edit_figure_creator.run_experiment(True, True, use_multi_id_training=False, use_wandb=False)
|
138 |
-
|
139 |
-
|
140 |
-
def pti_no_comparison(iid):
|
141 |
-
evaluation_config.evaluated_methods = []
|
142 |
-
edit_figure_creator = EditComparison(save_single_images=True, save_concatenated_images=True,
|
143 |
-
run_id=f'{paths_config.input_data_id}_pti_no_comparison_{iid}')
|
144 |
-
edit_figure_creator.run_experiment(True, False, use_multi_id_training=False, use_wandb=False)
|
145 |
-
|
146 |
-
|
147 |
-
def edits_for_existed_experiment(run_id):
|
148 |
-
evaluation_config.evaluated_methods = ['SG2Plus', 'e4e', 'SG2']
|
149 |
-
edit_figure_creator = EditComparison(save_single_images=True, save_concatenated_images=True,
|
150 |
-
run_id=run_id)
|
151 |
-
edit_figure_creator.run_experiment(False, True, use_multi_id_training=False, use_wandb=False)
|
152 |
-
|
153 |
-
|
154 |
-
if __name__ == '__main__':
|
155 |
-
iid = ''.join(choice(ascii_uppercase) for i in range(7))
|
156 |
-
pti_no_comparison(iid)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
spaces/Androidonnxfork/CivitAi-to-Diffusers/diffusers/scripts/convert_diffusers_to_original_stable_diffusion.py
DELETED
@@ -1,333 +0,0 @@
|
|
1 |
-
# Script for converting a HF Diffusers saved pipeline to a Stable Diffusion checkpoint.
|
2 |
-
# *Only* converts the UNet, VAE, and Text Encoder.
|
3 |
-
# Does not convert optimizer state or any other thing.
|
4 |
-
|
5 |
-
import argparse
|
6 |
-
import os.path as osp
|
7 |
-
import re
|
8 |
-
|
9 |
-
import torch
|
10 |
-
from safetensors.torch import load_file, save_file
|
11 |
-
|
12 |
-
|
13 |
-
# =================#
|
14 |
-
# UNet Conversion #
|
15 |
-
# =================#
|
16 |
-
|
17 |
-
unet_conversion_map = [
|
18 |
-
# (stable-diffusion, HF Diffusers)
|
19 |
-
("time_embed.0.weight", "time_embedding.linear_1.weight"),
|
20 |
-
("time_embed.0.bias", "time_embedding.linear_1.bias"),
|
21 |
-
("time_embed.2.weight", "time_embedding.linear_2.weight"),
|
22 |
-
("time_embed.2.bias", "time_embedding.linear_2.bias"),
|
23 |
-
("input_blocks.0.0.weight", "conv_in.weight"),
|
24 |
-
("input_blocks.0.0.bias", "conv_in.bias"),
|
25 |
-
("out.0.weight", "conv_norm_out.weight"),
|
26 |
-
("out.0.bias", "conv_norm_out.bias"),
|
27 |
-
("out.2.weight", "conv_out.weight"),
|
28 |
-
("out.2.bias", "conv_out.bias"),
|
29 |
-
]
|
30 |
-
|
31 |
-
unet_conversion_map_resnet = [
|
32 |
-
# (stable-diffusion, HF Diffusers)
|
33 |
-
("in_layers.0", "norm1"),
|
34 |
-
("in_layers.2", "conv1"),
|
35 |
-
("out_layers.0", "norm2"),
|
36 |
-
("out_layers.3", "conv2"),
|
37 |
-
("emb_layers.1", "time_emb_proj"),
|
38 |
-
("skip_connection", "conv_shortcut"),
|
39 |
-
]
|
40 |
-
|
41 |
-
unet_conversion_map_layer = []
|
42 |
-
# hardcoded number of downblocks and resnets/attentions...
|
43 |
-
# would need smarter logic for other networks.
|
44 |
-
for i in range(4):
|
45 |
-
# loop over downblocks/upblocks
|
46 |
-
|
47 |
-
for j in range(2):
|
48 |
-
# loop over resnets/attentions for downblocks
|
49 |
-
hf_down_res_prefix = f"down_blocks.{i}.resnets.{j}."
|
50 |
-
sd_down_res_prefix = f"input_blocks.{3*i + j + 1}.0."
|
51 |
-
unet_conversion_map_layer.append((sd_down_res_prefix, hf_down_res_prefix))
|
52 |
-
|
53 |
-
if i < 3:
|
54 |
-
# no attention layers in down_blocks.3
|
55 |
-
hf_down_atn_prefix = f"down_blocks.{i}.attentions.{j}."
|
56 |
-
sd_down_atn_prefix = f"input_blocks.{3*i + j + 1}.1."
|
57 |
-
unet_conversion_map_layer.append((sd_down_atn_prefix, hf_down_atn_prefix))
|
58 |
-
|
59 |
-
for j in range(3):
|
60 |
-
# loop over resnets/attentions for upblocks
|
61 |
-
hf_up_res_prefix = f"up_blocks.{i}.resnets.{j}."
|
62 |
-
sd_up_res_prefix = f"output_blocks.{3*i + j}.0."
|
63 |
-
unet_conversion_map_layer.append((sd_up_res_prefix, hf_up_res_prefix))
|
64 |
-
|
65 |
-
if i > 0:
|
66 |
-
# no attention layers in up_blocks.0
|
67 |
-
hf_up_atn_prefix = f"up_blocks.{i}.attentions.{j}."
|
68 |
-
sd_up_atn_prefix = f"output_blocks.{3*i + j}.1."
|
69 |
-
unet_conversion_map_layer.append((sd_up_atn_prefix, hf_up_atn_prefix))
|
70 |
-
|
71 |
-
if i < 3:
|
72 |
-
# no downsample in down_blocks.3
|
73 |
-
hf_downsample_prefix = f"down_blocks.{i}.downsamplers.0.conv."
|
74 |
-
sd_downsample_prefix = f"input_blocks.{3*(i+1)}.0.op."
|
75 |
-
unet_conversion_map_layer.append((sd_downsample_prefix, hf_downsample_prefix))
|
76 |
-
|
77 |
-
# no upsample in up_blocks.3
|
78 |
-
hf_upsample_prefix = f"up_blocks.{i}.upsamplers.0."
|
79 |
-
sd_upsample_prefix = f"output_blocks.{3*i + 2}.{1 if i == 0 else 2}."
|
80 |
-
unet_conversion_map_layer.append((sd_upsample_prefix, hf_upsample_prefix))
|
81 |
-
|
82 |
-
hf_mid_atn_prefix = "mid_block.attentions.0."
|
83 |
-
sd_mid_atn_prefix = "middle_block.1."
|
84 |
-
unet_conversion_map_layer.append((sd_mid_atn_prefix, hf_mid_atn_prefix))
|
85 |
-
|
86 |
-
for j in range(2):
|
87 |
-
hf_mid_res_prefix = f"mid_block.resnets.{j}."
|
88 |
-
sd_mid_res_prefix = f"middle_block.{2*j}."
|
89 |
-
unet_conversion_map_layer.append((sd_mid_res_prefix, hf_mid_res_prefix))
|
90 |
-
|
91 |
-
|
92 |
-
def convert_unet_state_dict(unet_state_dict):
|
93 |
-
# buyer beware: this is a *brittle* function,
|
94 |
-
# and correct output requires that all of these pieces interact in
|
95 |
-
# the exact order in which I have arranged them.
|
96 |
-
mapping = {k: k for k in unet_state_dict.keys()}
|
97 |
-
for sd_name, hf_name in unet_conversion_map:
|
98 |
-
mapping[hf_name] = sd_name
|
99 |
-
for k, v in mapping.items():
|
100 |
-
if "resnets" in k:
|
101 |
-
for sd_part, hf_part in unet_conversion_map_resnet:
|
102 |
-
v = v.replace(hf_part, sd_part)
|
103 |
-
mapping[k] = v
|
104 |
-
for k, v in mapping.items():
|
105 |
-
for sd_part, hf_part in unet_conversion_map_layer:
|
106 |
-
v = v.replace(hf_part, sd_part)
|
107 |
-
mapping[k] = v
|
108 |
-
new_state_dict = {v: unet_state_dict[k] for k, v in mapping.items()}
|
109 |
-
return new_state_dict
|
110 |
-
|
111 |
-
|
112 |
-
# ================#
|
113 |
-
# VAE Conversion #
|
114 |
-
# ================#
|
115 |
-
|
116 |
-
vae_conversion_map = [
|
117 |
-
# (stable-diffusion, HF Diffusers)
|
118 |
-
("nin_shortcut", "conv_shortcut"),
|
119 |
-
("norm_out", "conv_norm_out"),
|
120 |
-
("mid.attn_1.", "mid_block.attentions.0."),
|
121 |
-
]
|
122 |
-
|
123 |
-
for i in range(4):
|
124 |
-
# down_blocks have two resnets
|
125 |
-
for j in range(2):
|
126 |
-
hf_down_prefix = f"encoder.down_blocks.{i}.resnets.{j}."
|
127 |
-
sd_down_prefix = f"encoder.down.{i}.block.{j}."
|
128 |
-
vae_conversion_map.append((sd_down_prefix, hf_down_prefix))
|
129 |
-
|
130 |
-
if i < 3:
|
131 |
-
hf_downsample_prefix = f"down_blocks.{i}.downsamplers.0."
|
132 |
-
sd_downsample_prefix = f"down.{i}.downsample."
|
133 |
-
vae_conversion_map.append((sd_downsample_prefix, hf_downsample_prefix))
|
134 |
-
|
135 |
-
hf_upsample_prefix = f"up_blocks.{i}.upsamplers.0."
|
136 |
-
sd_upsample_prefix = f"up.{3-i}.upsample."
|
137 |
-
vae_conversion_map.append((sd_upsample_prefix, hf_upsample_prefix))
|
138 |
-
|
139 |
-
# up_blocks have three resnets
|
140 |
-
# also, up blocks in hf are numbered in reverse from sd
|
141 |
-
for j in range(3):
|
142 |
-
hf_up_prefix = f"decoder.up_blocks.{i}.resnets.{j}."
|
143 |
-
sd_up_prefix = f"decoder.up.{3-i}.block.{j}."
|
144 |
-
vae_conversion_map.append((sd_up_prefix, hf_up_prefix))
|
145 |
-
|
146 |
-
# this part accounts for mid blocks in both the encoder and the decoder
|
147 |
-
for i in range(2):
|
148 |
-
hf_mid_res_prefix = f"mid_block.resnets.{i}."
|
149 |
-
sd_mid_res_prefix = f"mid.block_{i+1}."
|
150 |
-
vae_conversion_map.append((sd_mid_res_prefix, hf_mid_res_prefix))
|
151 |
-
|
152 |
-
|
153 |
-
vae_conversion_map_attn = [
|
154 |
-
# (stable-diffusion, HF Diffusers)
|
155 |
-
("norm.", "group_norm."),
|
156 |
-
("q.", "query."),
|
157 |
-
("k.", "key."),
|
158 |
-
("v.", "value."),
|
159 |
-
("proj_out.", "proj_attn."),
|
160 |
-
]
|
161 |
-
|
162 |
-
|
163 |
-
def reshape_weight_for_sd(w):
|
164 |
-
# convert HF linear weights to SD conv2d weights
|
165 |
-
return w.reshape(*w.shape, 1, 1)
|
166 |
-
|
167 |
-
|
168 |
-
def convert_vae_state_dict(vae_state_dict):
|
169 |
-
mapping = {k: k for k in vae_state_dict.keys()}
|
170 |
-
for k, v in mapping.items():
|
171 |
-
for sd_part, hf_part in vae_conversion_map:
|
172 |
-
v = v.replace(hf_part, sd_part)
|
173 |
-
mapping[k] = v
|
174 |
-
for k, v in mapping.items():
|
175 |
-
if "attentions" in k:
|
176 |
-
for sd_part, hf_part in vae_conversion_map_attn:
|
177 |
-
v = v.replace(hf_part, sd_part)
|
178 |
-
mapping[k] = v
|
179 |
-
new_state_dict = {v: vae_state_dict[k] for k, v in mapping.items()}
|
180 |
-
weights_to_convert = ["q", "k", "v", "proj_out"]
|
181 |
-
for k, v in new_state_dict.items():
|
182 |
-
for weight_name in weights_to_convert:
|
183 |
-
if f"mid.attn_1.{weight_name}.weight" in k:
|
184 |
-
print(f"Reshaping {k} for SD format")
|
185 |
-
new_state_dict[k] = reshape_weight_for_sd(v)
|
186 |
-
return new_state_dict
|
187 |
-
|
188 |
-
|
189 |
-
# =========================#
|
190 |
-
# Text Encoder Conversion #
|
191 |
-
# =========================#
|
192 |
-
|
193 |
-
|
194 |
-
textenc_conversion_lst = [
|
195 |
-
# (stable-diffusion, HF Diffusers)
|
196 |
-
("resblocks.", "text_model.encoder.layers."),
|
197 |
-
("ln_1", "layer_norm1"),
|
198 |
-
("ln_2", "layer_norm2"),
|
199 |
-
(".c_fc.", ".fc1."),
|
200 |
-
(".c_proj.", ".fc2."),
|
201 |
-
(".attn", ".self_attn"),
|
202 |
-
("ln_final.", "transformer.text_model.final_layer_norm."),
|
203 |
-
("token_embedding.weight", "transformer.text_model.embeddings.token_embedding.weight"),
|
204 |
-
("positional_embedding", "transformer.text_model.embeddings.position_embedding.weight"),
|
205 |
-
]
|
206 |
-
protected = {re.escape(x[1]): x[0] for x in textenc_conversion_lst}
|
207 |
-
textenc_pattern = re.compile("|".join(protected.keys()))
|
208 |
-
|
209 |
-
# Ordering is from https://github.com/pytorch/pytorch/blob/master/test/cpp/api/modules.cpp
|
210 |
-
code2idx = {"q": 0, "k": 1, "v": 2}
|
211 |
-
|
212 |
-
|
213 |
-
def convert_text_enc_state_dict_v20(text_enc_dict):
|
214 |
-
new_state_dict = {}
|
215 |
-
capture_qkv_weight = {}
|
216 |
-
capture_qkv_bias = {}
|
217 |
-
for k, v in text_enc_dict.items():
|
218 |
-
if (
|
219 |
-
k.endswith(".self_attn.q_proj.weight")
|
220 |
-
or k.endswith(".self_attn.k_proj.weight")
|
221 |
-
or k.endswith(".self_attn.v_proj.weight")
|
222 |
-
):
|
223 |
-
k_pre = k[: -len(".q_proj.weight")]
|
224 |
-
k_code = k[-len("q_proj.weight")]
|
225 |
-
if k_pre not in capture_qkv_weight:
|
226 |
-
capture_qkv_weight[k_pre] = [None, None, None]
|
227 |
-
capture_qkv_weight[k_pre][code2idx[k_code]] = v
|
228 |
-
continue
|
229 |
-
|
230 |
-
if (
|
231 |
-
k.endswith(".self_attn.q_proj.bias")
|
232 |
-
or k.endswith(".self_attn.k_proj.bias")
|
233 |
-
or k.endswith(".self_attn.v_proj.bias")
|
234 |
-
):
|
235 |
-
k_pre = k[: -len(".q_proj.bias")]
|
236 |
-
k_code = k[-len("q_proj.bias")]
|
237 |
-
if k_pre not in capture_qkv_bias:
|
238 |
-
capture_qkv_bias[k_pre] = [None, None, None]
|
239 |
-
capture_qkv_bias[k_pre][code2idx[k_code]] = v
|
240 |
-
continue
|
241 |
-
|
242 |
-
relabelled_key = textenc_pattern.sub(lambda m: protected[re.escape(m.group(0))], k)
|
243 |
-
new_state_dict[relabelled_key] = v
|
244 |
-
|
245 |
-
for k_pre, tensors in capture_qkv_weight.items():
|
246 |
-
if None in tensors:
|
247 |
-
raise Exception("CORRUPTED MODEL: one of the q-k-v values for the text encoder was missing")
|
248 |
-
relabelled_key = textenc_pattern.sub(lambda m: protected[re.escape(m.group(0))], k_pre)
|
249 |
-
new_state_dict[relabelled_key + ".in_proj_weight"] = torch.cat(tensors)
|
250 |
-
|
251 |
-
for k_pre, tensors in capture_qkv_bias.items():
|
252 |
-
if None in tensors:
|
253 |
-
raise Exception("CORRUPTED MODEL: one of the q-k-v values for the text encoder was missing")
|
254 |
-
relabelled_key = textenc_pattern.sub(lambda m: protected[re.escape(m.group(0))], k_pre)
|
255 |
-
new_state_dict[relabelled_key + ".in_proj_bias"] = torch.cat(tensors)
|
256 |
-
|
257 |
-
return new_state_dict
|
258 |
-
|
259 |
-
|
260 |
-
def convert_text_enc_state_dict(text_enc_dict):
|
261 |
-
return text_enc_dict
|
262 |
-
|
263 |
-
|
264 |
-
if __name__ == "__main__":
|
265 |
-
parser = argparse.ArgumentParser()
|
266 |
-
|
267 |
-
parser.add_argument("--model_path", default=None, type=str, required=True, help="Path to the model to convert.")
|
268 |
-
parser.add_argument("--checkpoint_path", default=None, type=str, required=True, help="Path to the output model.")
|
269 |
-
parser.add_argument("--half", action="store_true", help="Save weights in half precision.")
|
270 |
-
parser.add_argument(
|
271 |
-
"--use_safetensors", action="store_true", help="Save weights use safetensors, default is ckpt."
|
272 |
-
)
|
273 |
-
|
274 |
-
args = parser.parse_args()
|
275 |
-
|
276 |
-
assert args.model_path is not None, "Must provide a model path!"
|
277 |
-
|
278 |
-
assert args.checkpoint_path is not None, "Must provide a checkpoint path!"
|
279 |
-
|
280 |
-
# Path for safetensors
|
281 |
-
unet_path = osp.join(args.model_path, "unet", "diffusion_pytorch_model.safetensors")
|
282 |
-
vae_path = osp.join(args.model_path, "vae", "diffusion_pytorch_model.safetensors")
|
283 |
-
text_enc_path = osp.join(args.model_path, "text_encoder", "model.safetensors")
|
284 |
-
|
285 |
-
# Load models from safetensors if it exists, if it doesn't pytorch
|
286 |
-
if osp.exists(unet_path):
|
287 |
-
unet_state_dict = load_file(unet_path, device="cpu")
|
288 |
-
else:
|
289 |
-
unet_path = osp.join(args.model_path, "unet", "diffusion_pytorch_model.bin")
|
290 |
-
unet_state_dict = torch.load(unet_path, map_location="cpu")
|
291 |
-
|
292 |
-
if osp.exists(vae_path):
|
293 |
-
vae_state_dict = load_file(vae_path, device="cpu")
|
294 |
-
else:
|
295 |
-
vae_path = osp.join(args.model_path, "vae", "diffusion_pytorch_model.bin")
|
296 |
-
vae_state_dict = torch.load(vae_path, map_location="cpu")
|
297 |
-
|
298 |
-
if osp.exists(text_enc_path):
|
299 |
-
text_enc_dict = load_file(text_enc_path, device="cpu")
|
300 |
-
else:
|
301 |
-
text_enc_path = osp.join(args.model_path, "text_encoder", "pytorch_model.bin")
|
302 |
-
text_enc_dict = torch.load(text_enc_path, map_location="cpu")
|
303 |
-
|
304 |
-
# Convert the UNet model
|
305 |
-
unet_state_dict = convert_unet_state_dict(unet_state_dict)
|
306 |
-
unet_state_dict = {"model.diffusion_model." + k: v for k, v in unet_state_dict.items()}
|
307 |
-
|
308 |
-
# Convert the VAE model
|
309 |
-
vae_state_dict = convert_vae_state_dict(vae_state_dict)
|
310 |
-
vae_state_dict = {"first_stage_model." + k: v for k, v in vae_state_dict.items()}
|
311 |
-
|
312 |
-
# Easiest way to identify v2.0 model seems to be that the text encoder (OpenCLIP) is deeper
|
313 |
-
is_v20_model = "text_model.encoder.layers.22.layer_norm2.bias" in text_enc_dict
|
314 |
-
|
315 |
-
if is_v20_model:
|
316 |
-
# Need to add the tag 'transformer' in advance so we can knock it out from the final layer-norm
|
317 |
-
text_enc_dict = {"transformer." + k: v for k, v in text_enc_dict.items()}
|
318 |
-
text_enc_dict = convert_text_enc_state_dict_v20(text_enc_dict)
|
319 |
-
text_enc_dict = {"cond_stage_model.model." + k: v for k, v in text_enc_dict.items()}
|
320 |
-
else:
|
321 |
-
text_enc_dict = convert_text_enc_state_dict(text_enc_dict)
|
322 |
-
text_enc_dict = {"cond_stage_model.transformer." + k: v for k, v in text_enc_dict.items()}
|
323 |
-
|
324 |
-
# Put together new checkpoint
|
325 |
-
state_dict = {**unet_state_dict, **vae_state_dict, **text_enc_dict}
|
326 |
-
if args.half:
|
327 |
-
state_dict = {k: v.half() for k, v in state_dict.items()}
|
328 |
-
|
329 |
-
if args.use_safetensors:
|
330 |
-
save_file(state_dict, args.checkpoint_path)
|
331 |
-
else:
|
332 |
-
state_dict = {"state_dict": state_dict}
|
333 |
-
torch.save(state_dict, args.checkpoint_path)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
spaces/Androidonnxfork/CivitAi-to-Diffusers/diffusers/src/diffusers/utils/dummy_transformers_and_torch_and_note_seq_objects.py
DELETED
@@ -1,17 +0,0 @@
|
|
1 |
-
# This file is autogenerated by the command `make fix-copies`, do not edit.
|
2 |
-
from ..utils import DummyObject, requires_backends
|
3 |
-
|
4 |
-
|
5 |
-
class SpectrogramDiffusionPipeline(metaclass=DummyObject):
|
6 |
-
_backends = ["transformers", "torch", "note_seq"]
|
7 |
-
|
8 |
-
def __init__(self, *args, **kwargs):
|
9 |
-
requires_backends(self, ["transformers", "torch", "note_seq"])
|
10 |
-
|
11 |
-
@classmethod
|
12 |
-
def from_config(cls, *args, **kwargs):
|
13 |
-
requires_backends(cls, ["transformers", "torch", "note_seq"])
|
14 |
-
|
15 |
-
@classmethod
|
16 |
-
def from_pretrained(cls, *args, **kwargs):
|
17 |
-
requires_backends(cls, ["transformers", "torch", "note_seq"])
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
spaces/Androidonnxfork/CivitAi-to-Diffusers/diffusers/tests/pipelines/stable_diffusion/test_stable_diffusion_adapter.py
DELETED
@@ -1,316 +0,0 @@
|
|
1 |
-
# coding=utf-8
|
2 |
-
# Copyright 2022 HuggingFace Inc.
|
3 |
-
#
|
4 |
-
# Licensed under the Apache License, Version 2.0 (the "License");
|
5 |
-
# you may not use this file except in compliance with the License.
|
6 |
-
# You may obtain a copy of the License at
|
7 |
-
#
|
8 |
-
# http://www.apache.org/licenses/LICENSE-2.0
|
9 |
-
#
|
10 |
-
# Unless required by applicable law or agreed to in writing, software
|
11 |
-
# distributed under the License is distributed on an "AS IS" BASIS,
|
12 |
-
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
13 |
-
# See the License for the specific language governing permissions and
|
14 |
-
# limitations under the License.
|
15 |
-
|
16 |
-
import gc
|
17 |
-
import random
|
18 |
-
import unittest
|
19 |
-
|
20 |
-
import numpy as np
|
21 |
-
import torch
|
22 |
-
from transformers import CLIPTextConfig, CLIPTextModel, CLIPTokenizer
|
23 |
-
|
24 |
-
from diffusers import (
|
25 |
-
AutoencoderKL,
|
26 |
-
PNDMScheduler,
|
27 |
-
StableDiffusionAdapterPipeline,
|
28 |
-
T2IAdapter,
|
29 |
-
UNet2DConditionModel,
|
30 |
-
)
|
31 |
-
from diffusers.utils import floats_tensor, load_image, load_numpy, slow, torch_device
|
32 |
-
from diffusers.utils.import_utils import is_xformers_available
|
33 |
-
from diffusers.utils.testing_utils import enable_full_determinism, require_torch_gpu
|
34 |
-
|
35 |
-
from ..pipeline_params import TEXT_GUIDED_IMAGE_VARIATION_BATCH_PARAMS, TEXT_GUIDED_IMAGE_VARIATION_PARAMS
|
36 |
-
from ..test_pipelines_common import PipelineTesterMixin
|
37 |
-
|
38 |
-
|
39 |
-
enable_full_determinism()
|
40 |
-
|
41 |
-
|
42 |
-
class AdapterTests:
|
43 |
-
pipeline_class = StableDiffusionAdapterPipeline
|
44 |
-
params = TEXT_GUIDED_IMAGE_VARIATION_PARAMS
|
45 |
-
batch_params = TEXT_GUIDED_IMAGE_VARIATION_BATCH_PARAMS
|
46 |
-
|
47 |
-
def get_dummy_components(self, adapter_type):
|
48 |
-
torch.manual_seed(0)
|
49 |
-
unet = UNet2DConditionModel(
|
50 |
-
block_out_channels=(32, 64),
|
51 |
-
layers_per_block=2,
|
52 |
-
sample_size=32,
|
53 |
-
in_channels=4,
|
54 |
-
out_channels=4,
|
55 |
-
down_block_types=("CrossAttnDownBlock2D", "DownBlock2D"),
|
56 |
-
up_block_types=("CrossAttnUpBlock2D", "UpBlock2D"),
|
57 |
-
cross_attention_dim=32,
|
58 |
-
)
|
59 |
-
scheduler = PNDMScheduler(skip_prk_steps=True)
|
60 |
-
torch.manual_seed(0)
|
61 |
-
vae = AutoencoderKL(
|
62 |
-
block_out_channels=[32, 64],
|
63 |
-
in_channels=3,
|
64 |
-
out_channels=3,
|
65 |
-
down_block_types=["DownEncoderBlock2D", "DownEncoderBlock2D"],
|
66 |
-
up_block_types=["UpDecoderBlock2D", "UpDecoderBlock2D"],
|
67 |
-
latent_channels=4,
|
68 |
-
)
|
69 |
-
torch.manual_seed(0)
|
70 |
-
text_encoder_config = CLIPTextConfig(
|
71 |
-
bos_token_id=0,
|
72 |
-
eos_token_id=2,
|
73 |
-
hidden_size=32,
|
74 |
-
intermediate_size=37,
|
75 |
-
layer_norm_eps=1e-05,
|
76 |
-
num_attention_heads=4,
|
77 |
-
num_hidden_layers=5,
|
78 |
-
pad_token_id=1,
|
79 |
-
vocab_size=1000,
|
80 |
-
)
|
81 |
-
text_encoder = CLIPTextModel(text_encoder_config)
|
82 |
-
tokenizer = CLIPTokenizer.from_pretrained("hf-internal-testing/tiny-random-clip")
|
83 |
-
|
84 |
-
torch.manual_seed(0)
|
85 |
-
adapter = T2IAdapter(
|
86 |
-
in_channels=3,
|
87 |
-
channels=[32, 64],
|
88 |
-
num_res_blocks=2,
|
89 |
-
downscale_factor=2,
|
90 |
-
adapter_type=adapter_type,
|
91 |
-
)
|
92 |
-
|
93 |
-
components = {
|
94 |
-
"adapter": adapter,
|
95 |
-
"unet": unet,
|
96 |
-
"scheduler": scheduler,
|
97 |
-
"vae": vae,
|
98 |
-
"text_encoder": text_encoder,
|
99 |
-
"tokenizer": tokenizer,
|
100 |
-
"safety_checker": None,
|
101 |
-
"feature_extractor": None,
|
102 |
-
}
|
103 |
-
return components
|
104 |
-
|
105 |
-
def get_dummy_inputs(self, device, seed=0):
|
106 |
-
image = floats_tensor((1, 3, 64, 64), rng=random.Random(seed)).to(device)
|
107 |
-
if str(device).startswith("mps"):
|
108 |
-
generator = torch.manual_seed(seed)
|
109 |
-
else:
|
110 |
-
generator = torch.Generator(device=device).manual_seed(seed)
|
111 |
-
inputs = {
|
112 |
-
"prompt": "A painting of a squirrel eating a burger",
|
113 |
-
"image": image,
|
114 |
-
"generator": generator,
|
115 |
-
"num_inference_steps": 2,
|
116 |
-
"guidance_scale": 6.0,
|
117 |
-
"output_type": "numpy",
|
118 |
-
}
|
119 |
-
return inputs
|
120 |
-
|
121 |
-
def test_attention_slicing_forward_pass(self):
|
122 |
-
return self._test_attention_slicing_forward_pass(expected_max_diff=2e-3)
|
123 |
-
|
124 |
-
@unittest.skipIf(
|
125 |
-
torch_device != "cuda" or not is_xformers_available(),
|
126 |
-
reason="XFormers attention is only available with CUDA and `xformers` installed",
|
127 |
-
)
|
128 |
-
def test_xformers_attention_forwardGenerator_pass(self):
|
129 |
-
self._test_xformers_attention_forwardGenerator_pass(expected_max_diff=2e-3)
|
130 |
-
|
131 |
-
def test_inference_batch_single_identical(self):
|
132 |
-
self._test_inference_batch_single_identical(expected_max_diff=2e-3)
|
133 |
-
|
134 |
-
|
135 |
-
class StableDiffusionFullAdapterPipelineFastTests(AdapterTests, PipelineTesterMixin, unittest.TestCase):
|
136 |
-
def get_dummy_components(self):
|
137 |
-
return super().get_dummy_components("full_adapter")
|
138 |
-
|
139 |
-
def test_stable_diffusion_adapter_default_case(self):
|
140 |
-
device = "cpu" # ensure determinism for the device-dependent torch.Generator
|
141 |
-
components = self.get_dummy_components()
|
142 |
-
sd_pipe = StableDiffusionAdapterPipeline(**components)
|
143 |
-
sd_pipe = sd_pipe.to(device)
|
144 |
-
sd_pipe.set_progress_bar_config(disable=None)
|
145 |
-
|
146 |
-
inputs = self.get_dummy_inputs(device)
|
147 |
-
image = sd_pipe(**inputs).images
|
148 |
-
image_slice = image[0, -3:, -3:, -1]
|
149 |
-
|
150 |
-
assert image.shape == (1, 64, 64, 3)
|
151 |
-
expected_slice = np.array([0.4858, 0.5500, 0.4278, 0.4669, 0.6184, 0.4322, 0.5010, 0.5033, 0.4746])
|
152 |
-
assert np.abs(image_slice.flatten() - expected_slice).max() < 5e-3
|
153 |
-
|
154 |
-
|
155 |
-
class StableDiffusionLightAdapterPipelineFastTests(AdapterTests, PipelineTesterMixin, unittest.TestCase):
|
156 |
-
def get_dummy_components(self):
|
157 |
-
return super().get_dummy_components("light_adapter")
|
158 |
-
|
159 |
-
def test_stable_diffusion_adapter_default_case(self):
|
160 |
-
device = "cpu" # ensure determinism for the device-dependent torch.Generator
|
161 |
-
components = self.get_dummy_components()
|
162 |
-
sd_pipe = StableDiffusionAdapterPipeline(**components)
|
163 |
-
sd_pipe = sd_pipe.to(device)
|
164 |
-
sd_pipe.set_progress_bar_config(disable=None)
|
165 |
-
|
166 |
-
inputs = self.get_dummy_inputs(device)
|
167 |
-
image = sd_pipe(**inputs).images
|
168 |
-
image_slice = image[0, -3:, -3:, -1]
|
169 |
-
|
170 |
-
assert image.shape == (1, 64, 64, 3)
|
171 |
-
expected_slice = np.array([0.4965, 0.5548, 0.4330, 0.4771, 0.6226, 0.4382, 0.5037, 0.5071, 0.4782])
|
172 |
-
assert np.abs(image_slice.flatten() - expected_slice).max() < 5e-3
|
173 |
-
|
174 |
-
|
175 |
-
@slow
|
176 |
-
@require_torch_gpu
|
177 |
-
class StableDiffusionAdapterPipelineSlowTests(unittest.TestCase):
|
178 |
-
def tearDown(self):
|
179 |
-
super().tearDown()
|
180 |
-
gc.collect()
|
181 |
-
torch.cuda.empty_cache()
|
182 |
-
|
183 |
-
def test_stable_diffusion_adapter(self):
|
184 |
-
test_cases = [
|
185 |
-
(
|
186 |
-
"TencentARC/t2iadapter_color_sd14v1",
|
187 |
-
"CompVis/stable-diffusion-v1-4",
|
188 |
-
"snail",
|
189 |
-
"https://huggingface.co/datasets/hf-internal-testing/diffusers-images/resolve/main/t2i_adapter/color.png",
|
190 |
-
3,
|
191 |
-
"https://huggingface.co/datasets/hf-internal-testing/diffusers-images/resolve/main/t2i_adapter/t2iadapter_color_sd14v1.npy",
|
192 |
-
),
|
193 |
-
(
|
194 |
-
"TencentARC/t2iadapter_depth_sd14v1",
|
195 |
-
"CompVis/stable-diffusion-v1-4",
|
196 |
-
"desk",
|
197 |
-
"https://huggingface.co/datasets/hf-internal-testing/diffusers-images/resolve/main/t2i_adapter/desk_depth.png",
|
198 |
-
3,
|
199 |
-
"https://huggingface.co/datasets/hf-internal-testing/diffusers-images/resolve/main/t2i_adapter/t2iadapter_depth_sd14v1.npy",
|
200 |
-
),
|
201 |
-
(
|
202 |
-
"TencentARC/t2iadapter_depth_sd15v2",
|
203 |
-
"runwayml/stable-diffusion-v1-5",
|
204 |
-
"desk",
|
205 |
-
"https://huggingface.co/datasets/hf-internal-testing/diffusers-images/resolve/main/t2i_adapter/desk_depth.png",
|
206 |
-
3,
|
207 |
-
"https://huggingface.co/datasets/hf-internal-testing/diffusers-images/resolve/main/t2i_adapter/t2iadapter_depth_sd15v2.npy",
|
208 |
-
),
|
209 |
-
(
|
210 |
-
"TencentARC/t2iadapter_keypose_sd14v1",
|
211 |
-
"CompVis/stable-diffusion-v1-4",
|
212 |
-
"person",
|
213 |
-
"https://huggingface.co/datasets/hf-internal-testing/diffusers-images/resolve/main/t2i_adapter/person_keypose.png",
|
214 |
-
3,
|
215 |
-
"https://huggingface.co/datasets/hf-internal-testing/diffusers-images/resolve/main/t2i_adapter/t2iadapter_keypose_sd14v1.npy",
|
216 |
-
),
|
217 |
-
(
|
218 |
-
"TencentARC/t2iadapter_openpose_sd14v1",
|
219 |
-
"CompVis/stable-diffusion-v1-4",
|
220 |
-
"person",
|
221 |
-
"https://huggingface.co/datasets/hf-internal-testing/diffusers-images/resolve/main/t2i_adapter/iron_man_pose.png",
|
222 |
-
3,
|
223 |
-
"https://huggingface.co/datasets/hf-internal-testing/diffusers-images/resolve/main/t2i_adapter/t2iadapter_openpose_sd14v1.npy",
|
224 |
-
),
|
225 |
-
(
|
226 |
-
"TencentARC/t2iadapter_seg_sd14v1",
|
227 |
-
"CompVis/stable-diffusion-v1-4",
|
228 |
-
"motorcycle",
|
229 |
-
"https://huggingface.co/datasets/hf-internal-testing/diffusers-images/resolve/main/t2i_adapter/motor.png",
|
230 |
-
3,
|
231 |
-
"https://huggingface.co/datasets/hf-internal-testing/diffusers-images/resolve/main/t2i_adapter/t2iadapter_seg_sd14v1.npy",
|
232 |
-
),
|
233 |
-
(
|
234 |
-
"TencentARC/t2iadapter_zoedepth_sd15v1",
|
235 |
-
"runwayml/stable-diffusion-v1-5",
|
236 |
-
"motorcycle",
|
237 |
-
"https://huggingface.co/datasets/hf-internal-testing/diffusers-images/resolve/main/t2i_adapter/motorcycle.png",
|
238 |
-
3,
|
239 |
-
"https://huggingface.co/datasets/hf-internal-testing/diffusers-images/resolve/main/t2i_adapter/t2iadapter_zoedepth_sd15v1.npy",
|
240 |
-
),
|
241 |
-
(
|
242 |
-
"TencentARC/t2iadapter_canny_sd14v1",
|
243 |
-
"CompVis/stable-diffusion-v1-4",
|
244 |
-
"toy",
|
245 |
-
"https://huggingface.co/datasets/hf-internal-testing/diffusers-images/resolve/main/t2i_adapter/toy_canny.png",
|
246 |
-
1,
|
247 |
-
"https://huggingface.co/datasets/hf-internal-testing/diffusers-images/resolve/main/t2i_adapter/t2iadapter_canny_sd14v1.npy",
|
248 |
-
),
|
249 |
-
(
|
250 |
-
"TencentARC/t2iadapter_canny_sd15v2",
|
251 |
-
"runwayml/stable-diffusion-v1-5",
|
252 |
-
"toy",
|
253 |
-
"https://huggingface.co/datasets/hf-internal-testing/diffusers-images/resolve/main/t2i_adapter/toy_canny.png",
|
254 |
-
1,
|
255 |
-
"https://huggingface.co/datasets/hf-internal-testing/diffusers-images/resolve/main/t2i_adapter/t2iadapter_canny_sd15v2.npy",
|
256 |
-
),
|
257 |
-
(
|
258 |
-
"TencentARC/t2iadapter_sketch_sd14v1",
|
259 |
-
"CompVis/stable-diffusion-v1-4",
|
260 |
-
"cat",
|
261 |
-
"https://huggingface.co/datasets/hf-internal-testing/diffusers-images/resolve/main/t2i_adapter/edge.png",
|
262 |
-
1,
|
263 |
-
"https://huggingface.co/datasets/hf-internal-testing/diffusers-images/resolve/main/t2i_adapter/t2iadapter_sketch_sd14v1.npy",
|
264 |
-
),
|
265 |
-
(
|
266 |
-
"TencentARC/t2iadapter_sketch_sd15v2",
|
267 |
-
"runwayml/stable-diffusion-v1-5",
|
268 |
-
"cat",
|
269 |
-
"https://huggingface.co/datasets/hf-internal-testing/diffusers-images/resolve/main/t2i_adapter/edge.png",
|
270 |
-
1,
|
271 |
-
"https://huggingface.co/datasets/hf-internal-testing/diffusers-images/resolve/main/t2i_adapter/t2iadapter_sketch_sd15v2.npy",
|
272 |
-
),
|
273 |
-
]
|
274 |
-
|
275 |
-
for adapter_model, sd_model, prompt, image_url, input_channels, out_url in test_cases:
|
276 |
-
image = load_image(image_url)
|
277 |
-
expected_out = load_numpy(out_url)
|
278 |
-
|
279 |
-
if input_channels == 1:
|
280 |
-
image = image.convert("L")
|
281 |
-
|
282 |
-
adapter = T2IAdapter.from_pretrained(adapter_model, torch_dtype=torch.float16)
|
283 |
-
|
284 |
-
pipe = StableDiffusionAdapterPipeline.from_pretrained(sd_model, adapter=adapter, safety_checker=None)
|
285 |
-
pipe.to(torch_device)
|
286 |
-
pipe.set_progress_bar_config(disable=None)
|
287 |
-
pipe.enable_attention_slicing()
|
288 |
-
|
289 |
-
generator = torch.Generator(device="cpu").manual_seed(0)
|
290 |
-
|
291 |
-
out = pipe(prompt=prompt, image=image, generator=generator, num_inference_steps=2, output_type="np").images
|
292 |
-
|
293 |
-
self.assertTrue(np.allclose(out, expected_out))
|
294 |
-
|
295 |
-
def test_stable_diffusion_adapter_pipeline_with_sequential_cpu_offloading(self):
|
296 |
-
torch.cuda.empty_cache()
|
297 |
-
torch.cuda.reset_max_memory_allocated()
|
298 |
-
torch.cuda.reset_peak_memory_stats()
|
299 |
-
|
300 |
-
adapter = T2IAdapter.from_pretrained("TencentARC/t2iadapter_seg_sd14v1")
|
301 |
-
pipe = StableDiffusionAdapterPipeline.from_pretrained(
|
302 |
-
"CompVis/stable-diffusion-v1-4", adapter=adapter, safety_checker=None
|
303 |
-
)
|
304 |
-
pipe = pipe.to(torch_device)
|
305 |
-
pipe.set_progress_bar_config(disable=None)
|
306 |
-
pipe.enable_attention_slicing(1)
|
307 |
-
pipe.enable_sequential_cpu_offload()
|
308 |
-
|
309 |
-
image = load_image(
|
310 |
-
"https://huggingface.co/datasets/hf-internal-testing/diffusers-images/resolve/main/t2i_adapter/motor.png"
|
311 |
-
)
|
312 |
-
|
313 |
-
pipe(prompt="foo", image=image, num_inference_steps=2)
|
314 |
-
|
315 |
-
mem_bytes = torch.cuda.max_memory_allocated()
|
316 |
-
assert mem_bytes < 5 * 10**9
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
spaces/Andy1621/uniformer_image_detection/configs/guided_anchoring/ga_faster_x101_64x4d_fpn_1x_coco.py
DELETED
@@ -1,13 +0,0 @@
|
|
1 |
-
_base_ = './ga_faster_r50_fpn_1x_coco.py'
|
2 |
-
model = dict(
|
3 |
-
pretrained='open-mmlab://resnext101_64x4d',
|
4 |
-
backbone=dict(
|
5 |
-
type='ResNeXt',
|
6 |
-
depth=101,
|
7 |
-
groups=64,
|
8 |
-
base_width=4,
|
9 |
-
num_stages=4,
|
10 |
-
out_indices=(0, 1, 2, 3),
|
11 |
-
frozen_stages=1,
|
12 |
-
norm_cfg=dict(type='BN', requires_grad=True),
|
13 |
-
style='pytorch'))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
spaces/Ankit6396/100-Free-ChatGPT4/app.py
DELETED
@@ -1,193 +0,0 @@
|
|
1 |
-
import gradio as gr
|
2 |
-
import os
|
3 |
-
import json
|
4 |
-
import requests
|
5 |
-
|
6 |
-
#Streaming endpoint
|
7 |
-
API_URL = "https://api.openai.com/v1/chat/completions" #os.getenv("API_URL") + "/generate_stream"
|
8 |
-
|
9 |
-
#Huggingface provided GPT4 OpenAI API Key
|
10 |
-
OPENAI_API_KEY = os.getenv("OPENAI_API_KEY")
|
11 |
-
|
12 |
-
#Inferenec function
|
13 |
-
def predict(system_msg, inputs, top_p, temperature, chat_counter, chatbot=[], history=[]):
|
14 |
-
|
15 |
-
headers = {
|
16 |
-
"Content-Type": "application/json",
|
17 |
-
"Authorization": f"Bearer {OPENAI_API_KEY}"
|
18 |
-
}
|
19 |
-
print(f"system message is ^^ {system_msg}")
|
20 |
-
if system_msg.strip() == '':
|
21 |
-
initial_message = [{"role": "user", "content": f"{inputs}"},]
|
22 |
-
multi_turn_message = []
|
23 |
-
else:
|
24 |
-
initial_message= [{"role": "system", "content": system_msg},
|
25 |
-
{"role": "user", "content": f"{inputs}"},]
|
26 |
-
multi_turn_message = [{"role": "system", "content": system_msg},]
|
27 |
-
|
28 |
-
if chat_counter == 0 :
|
29 |
-
payload = {
|
30 |
-
"model": "gpt-4",
|
31 |
-
"messages": initial_message ,
|
32 |
-
"temperature" : 1.0,
|
33 |
-
"top_p":1.0,
|
34 |
-
"n" : 1,
|
35 |
-
"stream": True,
|
36 |
-
"presence_penalty":0,
|
37 |
-
"frequency_penalty":0,
|
38 |
-
}
|
39 |
-
print(f"chat_counter - {chat_counter}")
|
40 |
-
else: #if chat_counter != 0 :
|
41 |
-
messages=multi_turn_message # Of the type of - [{"role": "system", "content": system_msg},]
|
42 |
-
for data in chatbot:
|
43 |
-
user = {}
|
44 |
-
user["role"] = "user"
|
45 |
-
user["content"] = data[0]
|
46 |
-
assistant = {}
|
47 |
-
assistant["role"] = "assistant"
|
48 |
-
assistant["content"] = data[1]
|
49 |
-
messages.append(user)
|
50 |
-
messages.append(assistant)
|
51 |
-
temp = {}
|
52 |
-
temp["role"] = "user"
|
53 |
-
temp["content"] = inputs
|
54 |
-
messages.append(temp)
|
55 |
-
#messages
|
56 |
-
payload = {
|
57 |
-
"model": "gpt-4",
|
58 |
-
"messages": messages, # Of the type of [{"role": "user", "content": f"{inputs}"}],
|
59 |
-
"temperature" : temperature, #1.0,
|
60 |
-
"top_p": top_p, #1.0,
|
61 |
-
"n" : 1,
|
62 |
-
"stream": True,
|
63 |
-
"presence_penalty":0,
|
64 |
-
"frequency_penalty":0,}
|
65 |
-
|
66 |
-
chat_counter+=1
|
67 |
-
|
68 |
-
history.append(inputs)
|
69 |
-
print(f"Logging : payload is - {payload}")
|
70 |
-
# make a POST request to the API endpoint using the requests.post method, passing in stream=True
|
71 |
-
response = requests.post(API_URL, headers=headers, json=payload, stream=True)
|
72 |
-
print(f"Logging : response code - {response}")
|
73 |
-
token_counter = 0
|
74 |
-
partial_words = ""
|
75 |
-
|
76 |
-
counter=0
|
77 |
-
for chunk in response.iter_lines():
|
78 |
-
#Skipping first chunk
|
79 |
-
if counter == 0:
|
80 |
-
counter+=1
|
81 |
-
continue
|
82 |
-
# check whether each line is non-empty
|
83 |
-
if chunk.decode() :
|
84 |
-
chunk = chunk.decode()
|
85 |
-
# decode each line as response data is in bytes
|
86 |
-
if len(chunk) > 12 and "content" in json.loads(chunk[6:])['choices'][0]['delta']:
|
87 |
-
partial_words = partial_words + json.loads(chunk[6:])['choices'][0]["delta"]["content"]
|
88 |
-
if token_counter == 0:
|
89 |
-
history.append(" " + partial_words)
|
90 |
-
else:
|
91 |
-
history[-1] = partial_words
|
92 |
-
chat = [(history[i], history[i + 1]) for i in range(0, len(history) - 1, 2) ] # convert to tuples of list
|
93 |
-
token_counter+=1
|
94 |
-
yield chat, history, chat_counter, response # resembles {chatbot: chat, state: history}
|
95 |
-
|
96 |
-
#Resetting to blank
|
97 |
-
def reset_textbox():
|
98 |
-
return gr.update(value='')
|
99 |
-
|
100 |
-
#to set a component as visible=False
|
101 |
-
def set_visible_false():
|
102 |
-
return gr.update(visible=False)
|
103 |
-
|
104 |
-
#to set a component as visible=True
|
105 |
-
def set_visible_true():
|
106 |
-
return gr.update(visible=True)
|
107 |
-
|
108 |
-
title = """<h1 align="center">🔥GPT4 with ChatCompletions API +🚀Gradio-Streaming</h1>"""
|
109 |
-
|
110 |
-
#display message for themes feature
|
111 |
-
theme_addon_msg = """<center>🌟 Discover Gradio Themes with this Demo, featuring v3.22.0! Gradio v3.23.0 also enables seamless Theme sharing. You can develop or modify a theme, and send it to the hub using simple <code>theme.push_to_hub()</code>.
|
112 |
-
<br>🏆Participate in Gradio's Theme Building Hackathon to exhibit your creative flair and win fabulous rewards! Join here - <a href="https://huggingface.co/Gradio-Themes" target="_blank">Gradio-Themes-Party🎨</a> 🏆</center>
|
113 |
-
"""
|
114 |
-
|
115 |
-
#Using info to add additional information about System message in GPT4
|
116 |
-
system_msg_info = """A conversation could begin with a system message to gently instruct the assistant.
|
117 |
-
System message helps set the behavior of the AI Assistant. For example, the assistant could be instructed with 'You are a helpful assistant.'"""
|
118 |
-
|
119 |
-
#Modifying existing Gradio Theme
|
120 |
-
theme = gr.themes.Soft(primary_hue="zinc", secondary_hue="green", neutral_hue="green",
|
121 |
-
text_size=gr.themes.sizes.text_lg)
|
122 |
-
|
123 |
-
with gr.Blocks(css = """#col_container { margin-left: auto; margin-right: auto;} #chatbot {height: 520px; overflow: auto;}""",
|
124 |
-
theme=theme) as demo:
|
125 |
-
gr.HTML(title)
|
126 |
-
gr.HTML("""<h3 align="center">🔥This Huggingface Gradio Demo provides you full access to GPT4 API (4096 token limit). 🎉🥳🎉You don't need any OPENAI API key🙌</h1>""")
|
127 |
-
gr.HTML(theme_addon_msg)
|
128 |
-
gr.HTML('''<center><a href="https://huggingface.co/spaces/ysharma/ChatGPT4?duplicate=true"><img src="https://bit.ly/3gLdBN6" alt="Duplicate Space"></a>Duplicate the Space and run securely with your OpenAI API Key</center>''')
|
129 |
-
|
130 |
-
with gr.Column(elem_id = "col_container"):
|
131 |
-
#GPT4 API Key is provided by Huggingface
|
132 |
-
with gr.Accordion(label="System message:", open=False):
|
133 |
-
system_msg = gr.Textbox(label="Instruct the AI Assistant to set its beaviour", info = system_msg_info, value="")
|
134 |
-
accordion_msg = gr.HTML(value="🚧 To set System message you will have to refresh the app", visible=False)
|
135 |
-
chatbot = gr.Chatbot(label='GPT4', elem_id="chatbot")
|
136 |
-
inputs = gr.Textbox(placeholder= "Hi there!", label= "Type an input and press Enter")
|
137 |
-
state = gr.State([])
|
138 |
-
with gr.Row():
|
139 |
-
with gr.Column(scale=7):
|
140 |
-
b1 = gr.Button().style(full_width=True)
|
141 |
-
with gr.Column(scale=3):
|
142 |
-
server_status_code = gr.Textbox(label="Status code from OpenAI server", )
|
143 |
-
|
144 |
-
#top_p, temperature
|
145 |
-
with gr.Accordion("Parameters", open=False):
|
146 |
-
top_p = gr.Slider( minimum=-0, maximum=1.0, value=1.0, step=0.05, interactive=True, label="Top-p (nucleus sampling)",)
|
147 |
-
temperature = gr.Slider( minimum=-0, maximum=5.0, value=1.0, step=0.1, interactive=True, label="Temperature",)
|
148 |
-
chat_counter = gr.Number(value=0, visible=False, precision=0)
|
149 |
-
|
150 |
-
#Event handling
|
151 |
-
inputs.submit( predict, [system_msg, inputs, top_p, temperature, chat_counter, chatbot, state], [chatbot, state, chat_counter, server_status_code],) #openai_api_key
|
152 |
-
b1.click( predict, [system_msg, inputs, top_p, temperature, chat_counter, chatbot, state], [chatbot, state, chat_counter, server_status_code],) #openai_api_key
|
153 |
-
|
154 |
-
inputs.submit(set_visible_false, [], [system_msg])
|
155 |
-
b1.click(set_visible_false, [], [system_msg])
|
156 |
-
inputs.submit(set_visible_true, [], [accordion_msg])
|
157 |
-
b1.click(set_visible_true, [], [accordion_msg])
|
158 |
-
|
159 |
-
b1.click(reset_textbox, [], [inputs])
|
160 |
-
inputs.submit(reset_textbox, [], [inputs])
|
161 |
-
|
162 |
-
#Examples
|
163 |
-
with gr.Accordion(label="Examples for System message:", open=False):
|
164 |
-
gr.Examples(
|
165 |
-
examples = [["""You are an AI programming assistant.
|
166 |
-
|
167 |
-
- Follow the user's requirements carefully and to the letter.
|
168 |
-
- First think step-by-step -- describe your plan for what to build in pseudocode, written out in great detail.
|
169 |
-
- Then output the code in a single code block.
|
170 |
-
- Minimize any other prose."""], ["""You are ComedianGPT who is a helpful assistant. You answer everything with a joke and witty replies."""],
|
171 |
-
["You are ChefGPT, a helpful assistant who answers questions with culinary expertise and a pinch of humor."],
|
172 |
-
["You are FitnessGuruGPT, a fitness expert who shares workout tips and motivation with a playful twist."],
|
173 |
-
["You are SciFiGPT, an AI assistant who discusses science fiction topics with a blend of knowledge and wit."],
|
174 |
-
["You are PhilosopherGPT, a thoughtful assistant who responds to inquiries with philosophical insights and a touch of humor."],
|
175 |
-
["You are EcoWarriorGPT, a helpful assistant who shares environment-friendly advice with a lighthearted approach."],
|
176 |
-
["You are MusicMaestroGPT, a knowledgeable AI who discusses music and its history with a mix of facts and playful banter."],
|
177 |
-
["You are SportsFanGPT, an enthusiastic assistant who talks about sports and shares amusing anecdotes."],
|
178 |
-
["You are TechWhizGPT, a tech-savvy AI who can help users troubleshoot issues and answer questions with a dash of humor."],
|
179 |
-
["You are FashionistaGPT, an AI fashion expert who shares style advice and trends with a sprinkle of wit."],
|
180 |
-
["You are ArtConnoisseurGPT, an AI assistant who discusses art and its history with a blend of knowledge and playful commentary."],
|
181 |
-
["You are a helpful assistant that provides detailed and accurate information."],
|
182 |
-
["You are an assistant that speaks like Shakespeare."],
|
183 |
-
["You are a friendly assistant who uses casual language and humor."],
|
184 |
-
["You are a financial advisor who gives expert advice on investments and budgeting."],
|
185 |
-
["You are a health and fitness expert who provides advice on nutrition and exercise."],
|
186 |
-
["You are a travel consultant who offers recommendations for destinations, accommodations, and attractions."],
|
187 |
-
["You are a movie critic who shares insightful opinions on films and their themes."],
|
188 |
-
["You are a history enthusiast who loves to discuss historical events and figures."],
|
189 |
-
["You are a tech-savvy assistant who can help users troubleshoot issues and answer questions about gadgets and software."],
|
190 |
-
["You are an AI poet who can compose creative and evocative poems on any given topic."],],
|
191 |
-
inputs = system_msg,)
|
192 |
-
|
193 |
-
demo.queue(max_size=99, concurrency_count=20).launch(debug=True)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
spaces/Arnx/MusicGenXvAKN/audiocraft/modules/__init__.py
DELETED
@@ -1,20 +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 |
-
# flake8: noqa
|
8 |
-
from .conv import (
|
9 |
-
NormConv1d,
|
10 |
-
NormConv2d,
|
11 |
-
NormConvTranspose1d,
|
12 |
-
NormConvTranspose2d,
|
13 |
-
StreamableConv1d,
|
14 |
-
StreamableConvTranspose1d,
|
15 |
-
pad_for_conv1d,
|
16 |
-
pad1d,
|
17 |
-
unpad1d,
|
18 |
-
)
|
19 |
-
from .lstm import StreamableLSTM
|
20 |
-
from .seanet import SEANetEncoder, SEANetDecoder
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
spaces/Ataturk-Chatbot/HuggingFaceChat/venv/lib/python3.11/site-packages/pip/_vendor/rich/errors.py
DELETED
@@ -1,34 +0,0 @@
|
|
1 |
-
class ConsoleError(Exception):
|
2 |
-
"""An error in console operation."""
|
3 |
-
|
4 |
-
|
5 |
-
class StyleError(Exception):
|
6 |
-
"""An error in styles."""
|
7 |
-
|
8 |
-
|
9 |
-
class StyleSyntaxError(ConsoleError):
|
10 |
-
"""Style was badly formatted."""
|
11 |
-
|
12 |
-
|
13 |
-
class MissingStyle(StyleError):
|
14 |
-
"""No such style."""
|
15 |
-
|
16 |
-
|
17 |
-
class StyleStackError(ConsoleError):
|
18 |
-
"""Style stack is invalid."""
|
19 |
-
|
20 |
-
|
21 |
-
class NotRenderableError(ConsoleError):
|
22 |
-
"""Object is not renderable."""
|
23 |
-
|
24 |
-
|
25 |
-
class MarkupError(ConsoleError):
|
26 |
-
"""Markup was badly formatted."""
|
27 |
-
|
28 |
-
|
29 |
-
class LiveError(ConsoleError):
|
30 |
-
"""Error related to Live display."""
|
31 |
-
|
32 |
-
|
33 |
-
class NoAltScreen(ConsoleError):
|
34 |
-
"""Alt screen mode was required."""
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
spaces/Awiny/Image2Paragraph/models/grit_src/grit/__init__.py
DELETED
@@ -1,7 +0,0 @@
|
|
1 |
-
from .modeling.meta_arch import grit
|
2 |
-
from .modeling.roi_heads import grit_roi_heads
|
3 |
-
from .modeling.backbone import vit
|
4 |
-
|
5 |
-
from .data.datasets import object365
|
6 |
-
from .data.datasets import vg
|
7 |
-
from .data.datasets import grit_coco
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
spaces/Awiny/Image2Paragraph/models/grit_src/third_party/CenterNet2/tests/layers/test_mask_ops.py
DELETED
@@ -1,202 +0,0 @@
|
|
1 |
-
# -*- coding: utf-8 -*-
|
2 |
-
# Copyright (c) Facebook, Inc. and its affiliates.
|
3 |
-
|
4 |
-
import contextlib
|
5 |
-
import io
|
6 |
-
import numpy as np
|
7 |
-
import unittest
|
8 |
-
from collections import defaultdict
|
9 |
-
import torch
|
10 |
-
import tqdm
|
11 |
-
from fvcore.common.benchmark import benchmark
|
12 |
-
from pycocotools.coco import COCO
|
13 |
-
from tabulate import tabulate
|
14 |
-
from torch.nn import functional as F
|
15 |
-
|
16 |
-
from detectron2.data import MetadataCatalog
|
17 |
-
from detectron2.layers.mask_ops import (
|
18 |
-
pad_masks,
|
19 |
-
paste_mask_in_image_old,
|
20 |
-
paste_masks_in_image,
|
21 |
-
scale_boxes,
|
22 |
-
)
|
23 |
-
from detectron2.structures import BitMasks, Boxes, BoxMode, PolygonMasks
|
24 |
-
from detectron2.structures.masks import polygons_to_bitmask
|
25 |
-
from detectron2.utils.file_io import PathManager
|
26 |
-
from detectron2.utils.testing import random_boxes
|
27 |
-
|
28 |
-
|
29 |
-
def iou_between_full_image_bit_masks(a, b):
|
30 |
-
intersect = (a & b).sum()
|
31 |
-
union = (a | b).sum()
|
32 |
-
return intersect / union
|
33 |
-
|
34 |
-
|
35 |
-
def rasterize_polygons_with_grid_sample(full_image_bit_mask, box, mask_size, threshold=0.5):
|
36 |
-
x0, y0, x1, y1 = box[0], box[1], box[2], box[3]
|
37 |
-
|
38 |
-
img_h, img_w = full_image_bit_mask.shape
|
39 |
-
|
40 |
-
mask_y = np.arange(0.0, mask_size) + 0.5 # mask y sample coords in [0.5, mask_size - 0.5]
|
41 |
-
mask_x = np.arange(0.0, mask_size) + 0.5 # mask x sample coords in [0.5, mask_size - 0.5]
|
42 |
-
mask_y = mask_y / mask_size * (y1 - y0) + y0
|
43 |
-
mask_x = mask_x / mask_size * (x1 - x0) + x0
|
44 |
-
|
45 |
-
mask_x = (mask_x - 0.5) / (img_w - 1) * 2 + -1
|
46 |
-
mask_y = (mask_y - 0.5) / (img_h - 1) * 2 + -1
|
47 |
-
gy, gx = torch.meshgrid(torch.from_numpy(mask_y), torch.from_numpy(mask_x))
|
48 |
-
ind = torch.stack([gx, gy], dim=-1).to(dtype=torch.float32)
|
49 |
-
|
50 |
-
full_image_bit_mask = torch.from_numpy(full_image_bit_mask)
|
51 |
-
mask = F.grid_sample(
|
52 |
-
full_image_bit_mask[None, None, :, :].to(dtype=torch.float32),
|
53 |
-
ind[None, :, :, :],
|
54 |
-
align_corners=True,
|
55 |
-
)
|
56 |
-
|
57 |
-
return mask[0, 0] >= threshold
|
58 |
-
|
59 |
-
|
60 |
-
class TestMaskCropPaste(unittest.TestCase):
|
61 |
-
def setUp(self):
|
62 |
-
json_file = MetadataCatalog.get("coco_2017_val_100").json_file
|
63 |
-
if not PathManager.isfile(json_file):
|
64 |
-
raise unittest.SkipTest("{} not found".format(json_file))
|
65 |
-
with contextlib.redirect_stdout(io.StringIO()):
|
66 |
-
json_file = PathManager.get_local_path(json_file)
|
67 |
-
self.coco = COCO(json_file)
|
68 |
-
|
69 |
-
def test_crop_paste_consistency(self):
|
70 |
-
"""
|
71 |
-
rasterize_polygons_within_box (used in training)
|
72 |
-
and
|
73 |
-
paste_masks_in_image (used in inference)
|
74 |
-
should be inverse operations to each other.
|
75 |
-
|
76 |
-
This function runs several implementation of the above two operations and prints
|
77 |
-
the reconstruction error.
|
78 |
-
"""
|
79 |
-
|
80 |
-
anns = self.coco.loadAnns(self.coco.getAnnIds(iscrowd=False)) # avoid crowd annotations
|
81 |
-
|
82 |
-
selected_anns = anns[:100]
|
83 |
-
|
84 |
-
ious = []
|
85 |
-
for ann in tqdm.tqdm(selected_anns):
|
86 |
-
results = self.process_annotation(ann)
|
87 |
-
ious.append([k[2] for k in results])
|
88 |
-
|
89 |
-
ious = np.array(ious)
|
90 |
-
mean_ious = ious.mean(axis=0)
|
91 |
-
table = []
|
92 |
-
res_dic = defaultdict(dict)
|
93 |
-
for row, iou in zip(results, mean_ious):
|
94 |
-
table.append((row[0], row[1], iou))
|
95 |
-
res_dic[row[0]][row[1]] = iou
|
96 |
-
print(tabulate(table, headers=["rasterize", "paste", "iou"], tablefmt="simple"))
|
97 |
-
# assert that the reconstruction is good:
|
98 |
-
self.assertTrue(res_dic["polygon"]["aligned"] > 0.94)
|
99 |
-
self.assertTrue(res_dic["roialign"]["aligned"] > 0.95)
|
100 |
-
|
101 |
-
def process_annotation(self, ann, mask_side_len=28):
|
102 |
-
# Parse annotation data
|
103 |
-
img_info = self.coco.loadImgs(ids=[ann["image_id"]])[0]
|
104 |
-
height, width = img_info["height"], img_info["width"]
|
105 |
-
gt_polygons = [np.array(p, dtype=np.float64) for p in ann["segmentation"]]
|
106 |
-
gt_bbox = BoxMode.convert(ann["bbox"], BoxMode.XYWH_ABS, BoxMode.XYXY_ABS)
|
107 |
-
gt_bit_mask = polygons_to_bitmask(gt_polygons, height, width)
|
108 |
-
|
109 |
-
# Run rasterize ..
|
110 |
-
torch_gt_bbox = torch.tensor(gt_bbox).to(dtype=torch.float32).reshape(-1, 4)
|
111 |
-
box_bitmasks = {
|
112 |
-
"polygon": PolygonMasks([gt_polygons]).crop_and_resize(torch_gt_bbox, mask_side_len)[0],
|
113 |
-
"gridsample": rasterize_polygons_with_grid_sample(gt_bit_mask, gt_bbox, mask_side_len),
|
114 |
-
"roialign": BitMasks(torch.from_numpy(gt_bit_mask[None, :, :])).crop_and_resize(
|
115 |
-
torch_gt_bbox, mask_side_len
|
116 |
-
)[0],
|
117 |
-
}
|
118 |
-
|
119 |
-
# Run paste ..
|
120 |
-
results = defaultdict(dict)
|
121 |
-
for k, box_bitmask in box_bitmasks.items():
|
122 |
-
padded_bitmask, scale = pad_masks(box_bitmask[None, :, :], 1)
|
123 |
-
scaled_boxes = scale_boxes(torch_gt_bbox, scale)
|
124 |
-
|
125 |
-
r = results[k]
|
126 |
-
r["old"] = paste_mask_in_image_old(
|
127 |
-
padded_bitmask[0], scaled_boxes[0], height, width, threshold=0.5
|
128 |
-
)
|
129 |
-
r["aligned"] = paste_masks_in_image(
|
130 |
-
box_bitmask[None, :, :], Boxes(torch_gt_bbox), (height, width)
|
131 |
-
)[0]
|
132 |
-
|
133 |
-
table = []
|
134 |
-
for rasterize_method, r in results.items():
|
135 |
-
for paste_method, mask in r.items():
|
136 |
-
mask = np.asarray(mask)
|
137 |
-
iou = iou_between_full_image_bit_masks(gt_bit_mask.astype("uint8"), mask)
|
138 |
-
table.append((rasterize_method, paste_method, iou))
|
139 |
-
return table
|
140 |
-
|
141 |
-
def test_polygon_area(self):
|
142 |
-
# Draw polygon boxes
|
143 |
-
for d in [5.0, 10.0, 1000.0]:
|
144 |
-
polygon = PolygonMasks([[[0, 0, 0, d, d, d, d, 0]]])
|
145 |
-
area = polygon.area()[0]
|
146 |
-
target = d ** 2
|
147 |
-
self.assertEqual(area, target)
|
148 |
-
|
149 |
-
# Draw polygon triangles
|
150 |
-
for d in [5.0, 10.0, 1000.0]:
|
151 |
-
polygon = PolygonMasks([[[0, 0, 0, d, d, d]]])
|
152 |
-
area = polygon.area()[0]
|
153 |
-
target = d ** 2 / 2
|
154 |
-
self.assertEqual(area, target)
|
155 |
-
|
156 |
-
def test_paste_mask_scriptable(self):
|
157 |
-
scripted_f = torch.jit.script(paste_masks_in_image)
|
158 |
-
N = 10
|
159 |
-
masks = torch.rand(N, 28, 28)
|
160 |
-
boxes = Boxes(random_boxes(N, 100)).tensor
|
161 |
-
image_shape = (150, 150)
|
162 |
-
|
163 |
-
out = paste_masks_in_image(masks, boxes, image_shape)
|
164 |
-
scripted_out = scripted_f(masks, boxes, image_shape)
|
165 |
-
self.assertTrue(torch.equal(out, scripted_out))
|
166 |
-
|
167 |
-
|
168 |
-
def benchmark_paste():
|
169 |
-
S = 800
|
170 |
-
H, W = image_shape = (S, S)
|
171 |
-
N = 64
|
172 |
-
torch.manual_seed(42)
|
173 |
-
masks = torch.rand(N, 28, 28)
|
174 |
-
|
175 |
-
center = torch.rand(N, 2) * 600 + 100
|
176 |
-
wh = torch.clamp(torch.randn(N, 2) * 40 + 200, min=50)
|
177 |
-
x0y0 = torch.clamp(center - wh * 0.5, min=0.0)
|
178 |
-
x1y1 = torch.clamp(center + wh * 0.5, max=S)
|
179 |
-
boxes = Boxes(torch.cat([x0y0, x1y1], axis=1))
|
180 |
-
|
181 |
-
def func(device, n=3):
|
182 |
-
m = masks.to(device=device)
|
183 |
-
b = boxes.to(device=device)
|
184 |
-
|
185 |
-
def bench():
|
186 |
-
for _ in range(n):
|
187 |
-
paste_masks_in_image(m, b, image_shape)
|
188 |
-
if device.type == "cuda":
|
189 |
-
torch.cuda.synchronize()
|
190 |
-
|
191 |
-
return bench
|
192 |
-
|
193 |
-
specs = [{"device": torch.device("cpu"), "n": 3}]
|
194 |
-
if torch.cuda.is_available():
|
195 |
-
specs.append({"device": torch.device("cuda"), "n": 3})
|
196 |
-
|
197 |
-
benchmark(func, "paste_masks", specs, num_iters=10, warmup_iters=2)
|
198 |
-
|
199 |
-
|
200 |
-
if __name__ == "__main__":
|
201 |
-
benchmark_paste()
|
202 |
-
unittest.main()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
spaces/AzumaSeren100/XuanShen-Bert-VITS2/text/cleaner.py
DELETED
@@ -1,27 +0,0 @@
|
|
1 |
-
from text import chinese, cleaned_text_to_sequence
|
2 |
-
|
3 |
-
|
4 |
-
language_module_map = {
|
5 |
-
'ZH': chinese
|
6 |
-
}
|
7 |
-
|
8 |
-
|
9 |
-
def clean_text(text, language):
|
10 |
-
language_module = language_module_map[language]
|
11 |
-
norm_text = language_module.text_normalize(text)
|
12 |
-
phones, tones, word2ph = language_module.g2p(norm_text)
|
13 |
-
return norm_text, phones, tones, word2ph
|
14 |
-
|
15 |
-
def clean_text_bert(text, language):
|
16 |
-
language_module = language_module_map[language]
|
17 |
-
norm_text = language_module.text_normalize(text)
|
18 |
-
phones, tones, word2ph = language_module.g2p(norm_text)
|
19 |
-
bert = language_module.get_bert_feature(norm_text, word2ph)
|
20 |
-
return phones, tones, bert
|
21 |
-
|
22 |
-
def text_to_sequence(text, language):
|
23 |
-
norm_text, phones, tones, word2ph = clean_text(text, language)
|
24 |
-
return cleaned_text_to_sequence(phones, tones, language)
|
25 |
-
|
26 |
-
if __name__ == '__main__':
|
27 |
-
pass
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
spaces/Bart92/RVC_HF/infer/lib/csvutil.py
DELETED
@@ -1,41 +0,0 @@
|
|
1 |
-
|
2 |
-
import numpy as np
|
3 |
-
|
4 |
-
# import praatio
|
5 |
-
# import praatio.praat_scripts
|
6 |
-
import os
|
7 |
-
import sys
|
8 |
-
|
9 |
-
import random
|
10 |
-
|
11 |
-
import csv
|
12 |
-
|
13 |
-
# praatEXE = join('.',os.path.abspath(os.getcwd()) + r"\Praat.exe")
|
14 |
-
|
15 |
-
|
16 |
-
def CSVutil(file, rw, type, *args):
|
17 |
-
if type == "formanting":
|
18 |
-
if rw == "r":
|
19 |
-
with open(file) as fileCSVread:
|
20 |
-
csv_reader = list(csv.reader(fileCSVread))
|
21 |
-
return (
|
22 |
-
(csv_reader[0][0], csv_reader[0][1], csv_reader[0][2])
|
23 |
-
if csv_reader is not None
|
24 |
-
else (lambda: exec('raise ValueError("No data")'))()
|
25 |
-
)
|
26 |
-
else:
|
27 |
-
if args:
|
28 |
-
doformnt = args[0]
|
29 |
-
else:
|
30 |
-
doformnt = False
|
31 |
-
qfr = args[1] if len(args) > 1 else 1.0
|
32 |
-
tmb = args[2] if len(args) > 2 else 1.0
|
33 |
-
with open(file, rw, newline="") as fileCSVwrite:
|
34 |
-
csv_writer = csv.writer(fileCSVwrite, delimiter=",")
|
35 |
-
csv_writer.writerow([doformnt, qfr, tmb])
|
36 |
-
elif type == "stop":
|
37 |
-
stop = args[0] if args else False
|
38 |
-
with open(file, rw, newline="") as fileCSVwrite:
|
39 |
-
csv_writer = csv.writer(fileCSVwrite, delimiter=",")
|
40 |
-
csv_writer.writerow([stop])
|
41 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
spaces/Big-Web/MMSD/env/Lib/site-packages/pip/_internal/commands/show.py
DELETED
@@ -1,189 +0,0 @@
|
|
1 |
-
import logging
|
2 |
-
from optparse import Values
|
3 |
-
from typing import Generator, Iterable, Iterator, List, NamedTuple, Optional
|
4 |
-
|
5 |
-
from pip._vendor.packaging.utils import canonicalize_name
|
6 |
-
|
7 |
-
from pip._internal.cli.base_command import Command
|
8 |
-
from pip._internal.cli.status_codes import ERROR, SUCCESS
|
9 |
-
from pip._internal.metadata import BaseDistribution, get_default_environment
|
10 |
-
from pip._internal.utils.misc import write_output
|
11 |
-
|
12 |
-
logger = logging.getLogger(__name__)
|
13 |
-
|
14 |
-
|
15 |
-
class ShowCommand(Command):
|
16 |
-
"""
|
17 |
-
Show information about one or more installed packages.
|
18 |
-
|
19 |
-
The output is in RFC-compliant mail header format.
|
20 |
-
"""
|
21 |
-
|
22 |
-
usage = """
|
23 |
-
%prog [options] <package> ..."""
|
24 |
-
ignore_require_venv = True
|
25 |
-
|
26 |
-
def add_options(self) -> None:
|
27 |
-
self.cmd_opts.add_option(
|
28 |
-
"-f",
|
29 |
-
"--files",
|
30 |
-
dest="files",
|
31 |
-
action="store_true",
|
32 |
-
default=False,
|
33 |
-
help="Show the full list of installed files for each package.",
|
34 |
-
)
|
35 |
-
|
36 |
-
self.parser.insert_option_group(0, self.cmd_opts)
|
37 |
-
|
38 |
-
def run(self, options: Values, args: List[str]) -> int:
|
39 |
-
if not args:
|
40 |
-
logger.warning("ERROR: Please provide a package name or names.")
|
41 |
-
return ERROR
|
42 |
-
query = args
|
43 |
-
|
44 |
-
results = search_packages_info(query)
|
45 |
-
if not print_results(
|
46 |
-
results, list_files=options.files, verbose=options.verbose
|
47 |
-
):
|
48 |
-
return ERROR
|
49 |
-
return SUCCESS
|
50 |
-
|
51 |
-
|
52 |
-
class _PackageInfo(NamedTuple):
|
53 |
-
name: str
|
54 |
-
version: str
|
55 |
-
location: str
|
56 |
-
editable_project_location: Optional[str]
|
57 |
-
requires: List[str]
|
58 |
-
required_by: List[str]
|
59 |
-
installer: str
|
60 |
-
metadata_version: str
|
61 |
-
classifiers: List[str]
|
62 |
-
summary: str
|
63 |
-
homepage: str
|
64 |
-
project_urls: List[str]
|
65 |
-
author: str
|
66 |
-
author_email: str
|
67 |
-
license: str
|
68 |
-
entry_points: List[str]
|
69 |
-
files: Optional[List[str]]
|
70 |
-
|
71 |
-
|
72 |
-
def search_packages_info(query: List[str]) -> Generator[_PackageInfo, None, None]:
|
73 |
-
"""
|
74 |
-
Gather details from installed distributions. Print distribution name,
|
75 |
-
version, location, and installed files. Installed files requires a
|
76 |
-
pip generated 'installed-files.txt' in the distributions '.egg-info'
|
77 |
-
directory.
|
78 |
-
"""
|
79 |
-
env = get_default_environment()
|
80 |
-
|
81 |
-
installed = {dist.canonical_name: dist for dist in env.iter_all_distributions()}
|
82 |
-
query_names = [canonicalize_name(name) for name in query]
|
83 |
-
missing = sorted(
|
84 |
-
[name for name, pkg in zip(query, query_names) if pkg not in installed]
|
85 |
-
)
|
86 |
-
if missing:
|
87 |
-
logger.warning("Package(s) not found: %s", ", ".join(missing))
|
88 |
-
|
89 |
-
def _get_requiring_packages(current_dist: BaseDistribution) -> Iterator[str]:
|
90 |
-
return (
|
91 |
-
dist.metadata["Name"] or "UNKNOWN"
|
92 |
-
for dist in installed.values()
|
93 |
-
if current_dist.canonical_name
|
94 |
-
in {canonicalize_name(d.name) for d in dist.iter_dependencies()}
|
95 |
-
)
|
96 |
-
|
97 |
-
for query_name in query_names:
|
98 |
-
try:
|
99 |
-
dist = installed[query_name]
|
100 |
-
except KeyError:
|
101 |
-
continue
|
102 |
-
|
103 |
-
requires = sorted((req.name for req in dist.iter_dependencies()), key=str.lower)
|
104 |
-
required_by = sorted(_get_requiring_packages(dist), key=str.lower)
|
105 |
-
|
106 |
-
try:
|
107 |
-
entry_points_text = dist.read_text("entry_points.txt")
|
108 |
-
entry_points = entry_points_text.splitlines(keepends=False)
|
109 |
-
except FileNotFoundError:
|
110 |
-
entry_points = []
|
111 |
-
|
112 |
-
files_iter = dist.iter_declared_entries()
|
113 |
-
if files_iter is None:
|
114 |
-
files: Optional[List[str]] = None
|
115 |
-
else:
|
116 |
-
files = sorted(files_iter)
|
117 |
-
|
118 |
-
metadata = dist.metadata
|
119 |
-
|
120 |
-
yield _PackageInfo(
|
121 |
-
name=dist.raw_name,
|
122 |
-
version=str(dist.version),
|
123 |
-
location=dist.location or "",
|
124 |
-
editable_project_location=dist.editable_project_location,
|
125 |
-
requires=requires,
|
126 |
-
required_by=required_by,
|
127 |
-
installer=dist.installer,
|
128 |
-
metadata_version=dist.metadata_version or "",
|
129 |
-
classifiers=metadata.get_all("Classifier", []),
|
130 |
-
summary=metadata.get("Summary", ""),
|
131 |
-
homepage=metadata.get("Home-page", ""),
|
132 |
-
project_urls=metadata.get_all("Project-URL", []),
|
133 |
-
author=metadata.get("Author", ""),
|
134 |
-
author_email=metadata.get("Author-email", ""),
|
135 |
-
license=metadata.get("License", ""),
|
136 |
-
entry_points=entry_points,
|
137 |
-
files=files,
|
138 |
-
)
|
139 |
-
|
140 |
-
|
141 |
-
def print_results(
|
142 |
-
distributions: Iterable[_PackageInfo],
|
143 |
-
list_files: bool,
|
144 |
-
verbose: bool,
|
145 |
-
) -> bool:
|
146 |
-
"""
|
147 |
-
Print the information from installed distributions found.
|
148 |
-
"""
|
149 |
-
results_printed = False
|
150 |
-
for i, dist in enumerate(distributions):
|
151 |
-
results_printed = True
|
152 |
-
if i > 0:
|
153 |
-
write_output("---")
|
154 |
-
|
155 |
-
write_output("Name: %s", dist.name)
|
156 |
-
write_output("Version: %s", dist.version)
|
157 |
-
write_output("Summary: %s", dist.summary)
|
158 |
-
write_output("Home-page: %s", dist.homepage)
|
159 |
-
write_output("Author: %s", dist.author)
|
160 |
-
write_output("Author-email: %s", dist.author_email)
|
161 |
-
write_output("License: %s", dist.license)
|
162 |
-
write_output("Location: %s", dist.location)
|
163 |
-
if dist.editable_project_location is not None:
|
164 |
-
write_output(
|
165 |
-
"Editable project location: %s", dist.editable_project_location
|
166 |
-
)
|
167 |
-
write_output("Requires: %s", ", ".join(dist.requires))
|
168 |
-
write_output("Required-by: %s", ", ".join(dist.required_by))
|
169 |
-
|
170 |
-
if verbose:
|
171 |
-
write_output("Metadata-Version: %s", dist.metadata_version)
|
172 |
-
write_output("Installer: %s", dist.installer)
|
173 |
-
write_output("Classifiers:")
|
174 |
-
for classifier in dist.classifiers:
|
175 |
-
write_output(" %s", classifier)
|
176 |
-
write_output("Entry-points:")
|
177 |
-
for entry in dist.entry_points:
|
178 |
-
write_output(" %s", entry.strip())
|
179 |
-
write_output("Project-URLs:")
|
180 |
-
for project_url in dist.project_urls:
|
181 |
-
write_output(" %s", project_url)
|
182 |
-
if list_files:
|
183 |
-
write_output("Files:")
|
184 |
-
if dist.files is None:
|
185 |
-
write_output("Cannot locate RECORD or installed-files.txt")
|
186 |
-
else:
|
187 |
-
for line in dist.files:
|
188 |
-
write_output(" %s", line.strip())
|
189 |
-
return results_printed
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
spaces/Big-Web/MMSD/env/Lib/site-packages/pip/_vendor/packaging/_manylinux.py
DELETED
@@ -1,301 +0,0 @@
|
|
1 |
-
import collections
|
2 |
-
import functools
|
3 |
-
import os
|
4 |
-
import re
|
5 |
-
import struct
|
6 |
-
import sys
|
7 |
-
import warnings
|
8 |
-
from typing import IO, Dict, Iterator, NamedTuple, Optional, Tuple
|
9 |
-
|
10 |
-
|
11 |
-
# Python does not provide platform information at sufficient granularity to
|
12 |
-
# identify the architecture of the running executable in some cases, so we
|
13 |
-
# determine it dynamically by reading the information from the running
|
14 |
-
# process. This only applies on Linux, which uses the ELF format.
|
15 |
-
class _ELFFileHeader:
|
16 |
-
# https://en.wikipedia.org/wiki/Executable_and_Linkable_Format#File_header
|
17 |
-
class _InvalidELFFileHeader(ValueError):
|
18 |
-
"""
|
19 |
-
An invalid ELF file header was found.
|
20 |
-
"""
|
21 |
-
|
22 |
-
ELF_MAGIC_NUMBER = 0x7F454C46
|
23 |
-
ELFCLASS32 = 1
|
24 |
-
ELFCLASS64 = 2
|
25 |
-
ELFDATA2LSB = 1
|
26 |
-
ELFDATA2MSB = 2
|
27 |
-
EM_386 = 3
|
28 |
-
EM_S390 = 22
|
29 |
-
EM_ARM = 40
|
30 |
-
EM_X86_64 = 62
|
31 |
-
EF_ARM_ABIMASK = 0xFF000000
|
32 |
-
EF_ARM_ABI_VER5 = 0x05000000
|
33 |
-
EF_ARM_ABI_FLOAT_HARD = 0x00000400
|
34 |
-
|
35 |
-
def __init__(self, file: IO[bytes]) -> None:
|
36 |
-
def unpack(fmt: str) -> int:
|
37 |
-
try:
|
38 |
-
data = file.read(struct.calcsize(fmt))
|
39 |
-
result: Tuple[int, ...] = struct.unpack(fmt, data)
|
40 |
-
except struct.error:
|
41 |
-
raise _ELFFileHeader._InvalidELFFileHeader()
|
42 |
-
return result[0]
|
43 |
-
|
44 |
-
self.e_ident_magic = unpack(">I")
|
45 |
-
if self.e_ident_magic != self.ELF_MAGIC_NUMBER:
|
46 |
-
raise _ELFFileHeader._InvalidELFFileHeader()
|
47 |
-
self.e_ident_class = unpack("B")
|
48 |
-
if self.e_ident_class not in {self.ELFCLASS32, self.ELFCLASS64}:
|
49 |
-
raise _ELFFileHeader._InvalidELFFileHeader()
|
50 |
-
self.e_ident_data = unpack("B")
|
51 |
-
if self.e_ident_data not in {self.ELFDATA2LSB, self.ELFDATA2MSB}:
|
52 |
-
raise _ELFFileHeader._InvalidELFFileHeader()
|
53 |
-
self.e_ident_version = unpack("B")
|
54 |
-
self.e_ident_osabi = unpack("B")
|
55 |
-
self.e_ident_abiversion = unpack("B")
|
56 |
-
self.e_ident_pad = file.read(7)
|
57 |
-
format_h = "<H" if self.e_ident_data == self.ELFDATA2LSB else ">H"
|
58 |
-
format_i = "<I" if self.e_ident_data == self.ELFDATA2LSB else ">I"
|
59 |
-
format_q = "<Q" if self.e_ident_data == self.ELFDATA2LSB else ">Q"
|
60 |
-
format_p = format_i if self.e_ident_class == self.ELFCLASS32 else format_q
|
61 |
-
self.e_type = unpack(format_h)
|
62 |
-
self.e_machine = unpack(format_h)
|
63 |
-
self.e_version = unpack(format_i)
|
64 |
-
self.e_entry = unpack(format_p)
|
65 |
-
self.e_phoff = unpack(format_p)
|
66 |
-
self.e_shoff = unpack(format_p)
|
67 |
-
self.e_flags = unpack(format_i)
|
68 |
-
self.e_ehsize = unpack(format_h)
|
69 |
-
self.e_phentsize = unpack(format_h)
|
70 |
-
self.e_phnum = unpack(format_h)
|
71 |
-
self.e_shentsize = unpack(format_h)
|
72 |
-
self.e_shnum = unpack(format_h)
|
73 |
-
self.e_shstrndx = unpack(format_h)
|
74 |
-
|
75 |
-
|
76 |
-
def _get_elf_header() -> Optional[_ELFFileHeader]:
|
77 |
-
try:
|
78 |
-
with open(sys.executable, "rb") as f:
|
79 |
-
elf_header = _ELFFileHeader(f)
|
80 |
-
except (OSError, TypeError, _ELFFileHeader._InvalidELFFileHeader):
|
81 |
-
return None
|
82 |
-
return elf_header
|
83 |
-
|
84 |
-
|
85 |
-
def _is_linux_armhf() -> bool:
|
86 |
-
# hard-float ABI can be detected from the ELF header of the running
|
87 |
-
# process
|
88 |
-
# https://static.docs.arm.com/ihi0044/g/aaelf32.pdf
|
89 |
-
elf_header = _get_elf_header()
|
90 |
-
if elf_header is None:
|
91 |
-
return False
|
92 |
-
result = elf_header.e_ident_class == elf_header.ELFCLASS32
|
93 |
-
result &= elf_header.e_ident_data == elf_header.ELFDATA2LSB
|
94 |
-
result &= elf_header.e_machine == elf_header.EM_ARM
|
95 |
-
result &= (
|
96 |
-
elf_header.e_flags & elf_header.EF_ARM_ABIMASK
|
97 |
-
) == elf_header.EF_ARM_ABI_VER5
|
98 |
-
result &= (
|
99 |
-
elf_header.e_flags & elf_header.EF_ARM_ABI_FLOAT_HARD
|
100 |
-
) == elf_header.EF_ARM_ABI_FLOAT_HARD
|
101 |
-
return result
|
102 |
-
|
103 |
-
|
104 |
-
def _is_linux_i686() -> bool:
|
105 |
-
elf_header = _get_elf_header()
|
106 |
-
if elf_header is None:
|
107 |
-
return False
|
108 |
-
result = elf_header.e_ident_class == elf_header.ELFCLASS32
|
109 |
-
result &= elf_header.e_ident_data == elf_header.ELFDATA2LSB
|
110 |
-
result &= elf_header.e_machine == elf_header.EM_386
|
111 |
-
return result
|
112 |
-
|
113 |
-
|
114 |
-
def _have_compatible_abi(arch: str) -> bool:
|
115 |
-
if arch == "armv7l":
|
116 |
-
return _is_linux_armhf()
|
117 |
-
if arch == "i686":
|
118 |
-
return _is_linux_i686()
|
119 |
-
return arch in {"x86_64", "aarch64", "ppc64", "ppc64le", "s390x"}
|
120 |
-
|
121 |
-
|
122 |
-
# If glibc ever changes its major version, we need to know what the last
|
123 |
-
# minor version was, so we can build the complete list of all versions.
|
124 |
-
# For now, guess what the highest minor version might be, assume it will
|
125 |
-
# be 50 for testing. Once this actually happens, update the dictionary
|
126 |
-
# with the actual value.
|
127 |
-
_LAST_GLIBC_MINOR: Dict[int, int] = collections.defaultdict(lambda: 50)
|
128 |
-
|
129 |
-
|
130 |
-
class _GLibCVersion(NamedTuple):
|
131 |
-
major: int
|
132 |
-
minor: int
|
133 |
-
|
134 |
-
|
135 |
-
def _glibc_version_string_confstr() -> Optional[str]:
|
136 |
-
"""
|
137 |
-
Primary implementation of glibc_version_string using os.confstr.
|
138 |
-
"""
|
139 |
-
# os.confstr is quite a bit faster than ctypes.DLL. It's also less likely
|
140 |
-
# to be broken or missing. This strategy is used in the standard library
|
141 |
-
# platform module.
|
142 |
-
# https://github.com/python/cpython/blob/fcf1d003bf4f0100c/Lib/platform.py#L175-L183
|
143 |
-
try:
|
144 |
-
# os.confstr("CS_GNU_LIBC_VERSION") returns a string like "glibc 2.17".
|
145 |
-
version_string = os.confstr("CS_GNU_LIBC_VERSION")
|
146 |
-
assert version_string is not None
|
147 |
-
_, version = version_string.split()
|
148 |
-
except (AssertionError, AttributeError, OSError, ValueError):
|
149 |
-
# os.confstr() or CS_GNU_LIBC_VERSION not available (or a bad value)...
|
150 |
-
return None
|
151 |
-
return version
|
152 |
-
|
153 |
-
|
154 |
-
def _glibc_version_string_ctypes() -> Optional[str]:
|
155 |
-
"""
|
156 |
-
Fallback implementation of glibc_version_string using ctypes.
|
157 |
-
"""
|
158 |
-
try:
|
159 |
-
import ctypes
|
160 |
-
except ImportError:
|
161 |
-
return None
|
162 |
-
|
163 |
-
# ctypes.CDLL(None) internally calls dlopen(NULL), and as the dlopen
|
164 |
-
# manpage says, "If filename is NULL, then the returned handle is for the
|
165 |
-
# main program". This way we can let the linker do the work to figure out
|
166 |
-
# which libc our process is actually using.
|
167 |
-
#
|
168 |
-
# We must also handle the special case where the executable is not a
|
169 |
-
# dynamically linked executable. This can occur when using musl libc,
|
170 |
-
# for example. In this situation, dlopen() will error, leading to an
|
171 |
-
# OSError. Interestingly, at least in the case of musl, there is no
|
172 |
-
# errno set on the OSError. The single string argument used to construct
|
173 |
-
# OSError comes from libc itself and is therefore not portable to
|
174 |
-
# hard code here. In any case, failure to call dlopen() means we
|
175 |
-
# can proceed, so we bail on our attempt.
|
176 |
-
try:
|
177 |
-
process_namespace = ctypes.CDLL(None)
|
178 |
-
except OSError:
|
179 |
-
return None
|
180 |
-
|
181 |
-
try:
|
182 |
-
gnu_get_libc_version = process_namespace.gnu_get_libc_version
|
183 |
-
except AttributeError:
|
184 |
-
# Symbol doesn't exist -> therefore, we are not linked to
|
185 |
-
# glibc.
|
186 |
-
return None
|
187 |
-
|
188 |
-
# Call gnu_get_libc_version, which returns a string like "2.5"
|
189 |
-
gnu_get_libc_version.restype = ctypes.c_char_p
|
190 |
-
version_str: str = gnu_get_libc_version()
|
191 |
-
# py2 / py3 compatibility:
|
192 |
-
if not isinstance(version_str, str):
|
193 |
-
version_str = version_str.decode("ascii")
|
194 |
-
|
195 |
-
return version_str
|
196 |
-
|
197 |
-
|
198 |
-
def _glibc_version_string() -> Optional[str]:
|
199 |
-
"""Returns glibc version string, or None if not using glibc."""
|
200 |
-
return _glibc_version_string_confstr() or _glibc_version_string_ctypes()
|
201 |
-
|
202 |
-
|
203 |
-
def _parse_glibc_version(version_str: str) -> Tuple[int, int]:
|
204 |
-
"""Parse glibc version.
|
205 |
-
|
206 |
-
We use a regexp instead of str.split because we want to discard any
|
207 |
-
random junk that might come after the minor version -- this might happen
|
208 |
-
in patched/forked versions of glibc (e.g. Linaro's version of glibc
|
209 |
-
uses version strings like "2.20-2014.11"). See gh-3588.
|
210 |
-
"""
|
211 |
-
m = re.match(r"(?P<major>[0-9]+)\.(?P<minor>[0-9]+)", version_str)
|
212 |
-
if not m:
|
213 |
-
warnings.warn(
|
214 |
-
"Expected glibc version with 2 components major.minor,"
|
215 |
-
" got: %s" % version_str,
|
216 |
-
RuntimeWarning,
|
217 |
-
)
|
218 |
-
return -1, -1
|
219 |
-
return int(m.group("major")), int(m.group("minor"))
|
220 |
-
|
221 |
-
|
222 |
-
@functools.lru_cache()
|
223 |
-
def _get_glibc_version() -> Tuple[int, int]:
|
224 |
-
version_str = _glibc_version_string()
|
225 |
-
if version_str is None:
|
226 |
-
return (-1, -1)
|
227 |
-
return _parse_glibc_version(version_str)
|
228 |
-
|
229 |
-
|
230 |
-
# From PEP 513, PEP 600
|
231 |
-
def _is_compatible(name: str, arch: str, version: _GLibCVersion) -> bool:
|
232 |
-
sys_glibc = _get_glibc_version()
|
233 |
-
if sys_glibc < version:
|
234 |
-
return False
|
235 |
-
# Check for presence of _manylinux module.
|
236 |
-
try:
|
237 |
-
import _manylinux # noqa
|
238 |
-
except ImportError:
|
239 |
-
return True
|
240 |
-
if hasattr(_manylinux, "manylinux_compatible"):
|
241 |
-
result = _manylinux.manylinux_compatible(version[0], version[1], arch)
|
242 |
-
if result is not None:
|
243 |
-
return bool(result)
|
244 |
-
return True
|
245 |
-
if version == _GLibCVersion(2, 5):
|
246 |
-
if hasattr(_manylinux, "manylinux1_compatible"):
|
247 |
-
return bool(_manylinux.manylinux1_compatible)
|
248 |
-
if version == _GLibCVersion(2, 12):
|
249 |
-
if hasattr(_manylinux, "manylinux2010_compatible"):
|
250 |
-
return bool(_manylinux.manylinux2010_compatible)
|
251 |
-
if version == _GLibCVersion(2, 17):
|
252 |
-
if hasattr(_manylinux, "manylinux2014_compatible"):
|
253 |
-
return bool(_manylinux.manylinux2014_compatible)
|
254 |
-
return True
|
255 |
-
|
256 |
-
|
257 |
-
_LEGACY_MANYLINUX_MAP = {
|
258 |
-
# CentOS 7 w/ glibc 2.17 (PEP 599)
|
259 |
-
(2, 17): "manylinux2014",
|
260 |
-
# CentOS 6 w/ glibc 2.12 (PEP 571)
|
261 |
-
(2, 12): "manylinux2010",
|
262 |
-
# CentOS 5 w/ glibc 2.5 (PEP 513)
|
263 |
-
(2, 5): "manylinux1",
|
264 |
-
}
|
265 |
-
|
266 |
-
|
267 |
-
def platform_tags(linux: str, arch: str) -> Iterator[str]:
|
268 |
-
if not _have_compatible_abi(arch):
|
269 |
-
return
|
270 |
-
# Oldest glibc to be supported regardless of architecture is (2, 17).
|
271 |
-
too_old_glibc2 = _GLibCVersion(2, 16)
|
272 |
-
if arch in {"x86_64", "i686"}:
|
273 |
-
# On x86/i686 also oldest glibc to be supported is (2, 5).
|
274 |
-
too_old_glibc2 = _GLibCVersion(2, 4)
|
275 |
-
current_glibc = _GLibCVersion(*_get_glibc_version())
|
276 |
-
glibc_max_list = [current_glibc]
|
277 |
-
# We can assume compatibility across glibc major versions.
|
278 |
-
# https://sourceware.org/bugzilla/show_bug.cgi?id=24636
|
279 |
-
#
|
280 |
-
# Build a list of maximum glibc versions so that we can
|
281 |
-
# output the canonical list of all glibc from current_glibc
|
282 |
-
# down to too_old_glibc2, including all intermediary versions.
|
283 |
-
for glibc_major in range(current_glibc.major - 1, 1, -1):
|
284 |
-
glibc_minor = _LAST_GLIBC_MINOR[glibc_major]
|
285 |
-
glibc_max_list.append(_GLibCVersion(glibc_major, glibc_minor))
|
286 |
-
for glibc_max in glibc_max_list:
|
287 |
-
if glibc_max.major == too_old_glibc2.major:
|
288 |
-
min_minor = too_old_glibc2.minor
|
289 |
-
else:
|
290 |
-
# For other glibc major versions oldest supported is (x, 0).
|
291 |
-
min_minor = -1
|
292 |
-
for glibc_minor in range(glibc_max.minor, min_minor, -1):
|
293 |
-
glibc_version = _GLibCVersion(glibc_max.major, glibc_minor)
|
294 |
-
tag = "manylinux_{}_{}".format(*glibc_version)
|
295 |
-
if _is_compatible(tag, arch, glibc_version):
|
296 |
-
yield linux.replace("linux", tag)
|
297 |
-
# Handle the legacy manylinux1, manylinux2010, manylinux2014 tags.
|
298 |
-
if glibc_version in _LEGACY_MANYLINUX_MAP:
|
299 |
-
legacy_tag = _LEGACY_MANYLINUX_MAP[glibc_version]
|
300 |
-
if _is_compatible(legacy_tag, arch, glibc_version):
|
301 |
-
yield linux.replace("linux", legacy_tag)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
spaces/Big-Web/MMSD/env/Lib/site-packages/setuptools/command/editable_wheel.py
DELETED
@@ -1,844 +0,0 @@
|
|
1 |
-
"""
|
2 |
-
Create a wheel that, when installed, will make the source package 'editable'
|
3 |
-
(add it to the interpreter's path, including metadata) per PEP 660. Replaces
|
4 |
-
'setup.py develop'.
|
5 |
-
|
6 |
-
.. note::
|
7 |
-
One of the mechanisms briefly mentioned in PEP 660 to implement editable installs is
|
8 |
-
to create a separated directory inside ``build`` and use a .pth file to point to that
|
9 |
-
directory. In the context of this file such directory is referred as
|
10 |
-
*auxiliary build directory* or ``auxiliary_dir``.
|
11 |
-
"""
|
12 |
-
|
13 |
-
import logging
|
14 |
-
import os
|
15 |
-
import re
|
16 |
-
import shutil
|
17 |
-
import sys
|
18 |
-
import traceback
|
19 |
-
import warnings
|
20 |
-
from contextlib import suppress
|
21 |
-
from enum import Enum
|
22 |
-
from inspect import cleandoc
|
23 |
-
from itertools import chain
|
24 |
-
from pathlib import Path
|
25 |
-
from tempfile import TemporaryDirectory
|
26 |
-
from typing import (
|
27 |
-
TYPE_CHECKING,
|
28 |
-
Dict,
|
29 |
-
Iterable,
|
30 |
-
Iterator,
|
31 |
-
List,
|
32 |
-
Mapping,
|
33 |
-
Optional,
|
34 |
-
Tuple,
|
35 |
-
TypeVar,
|
36 |
-
Union,
|
37 |
-
)
|
38 |
-
|
39 |
-
from setuptools import Command, SetuptoolsDeprecationWarning, errors, namespaces
|
40 |
-
from setuptools.command.build_py import build_py as build_py_cls
|
41 |
-
from setuptools.discovery import find_package_path
|
42 |
-
from setuptools.dist import Distribution
|
43 |
-
|
44 |
-
if TYPE_CHECKING:
|
45 |
-
from wheel.wheelfile import WheelFile # noqa
|
46 |
-
|
47 |
-
if sys.version_info >= (3, 8):
|
48 |
-
from typing import Protocol
|
49 |
-
elif TYPE_CHECKING:
|
50 |
-
from typing_extensions import Protocol
|
51 |
-
else:
|
52 |
-
from abc import ABC as Protocol
|
53 |
-
|
54 |
-
_Path = Union[str, Path]
|
55 |
-
_P = TypeVar("_P", bound=_Path)
|
56 |
-
_logger = logging.getLogger(__name__)
|
57 |
-
|
58 |
-
|
59 |
-
class _EditableMode(Enum):
|
60 |
-
"""
|
61 |
-
Possible editable installation modes:
|
62 |
-
`lenient` (new files automatically added to the package - DEFAULT);
|
63 |
-
`strict` (requires a new installation when files are added/removed); or
|
64 |
-
`compat` (attempts to emulate `python setup.py develop` - DEPRECATED).
|
65 |
-
"""
|
66 |
-
|
67 |
-
STRICT = "strict"
|
68 |
-
LENIENT = "lenient"
|
69 |
-
COMPAT = "compat" # TODO: Remove `compat` after Dec/2022.
|
70 |
-
|
71 |
-
@classmethod
|
72 |
-
def convert(cls, mode: Optional[str]) -> "_EditableMode":
|
73 |
-
if not mode:
|
74 |
-
return _EditableMode.LENIENT # default
|
75 |
-
|
76 |
-
_mode = mode.upper()
|
77 |
-
if _mode not in _EditableMode.__members__:
|
78 |
-
raise errors.OptionError(f"Invalid editable mode: {mode!r}. Try: 'strict'.")
|
79 |
-
|
80 |
-
if _mode == "COMPAT":
|
81 |
-
msg = """
|
82 |
-
The 'compat' editable mode is transitional and will be removed
|
83 |
-
in future versions of `setuptools`.
|
84 |
-
Please adapt your code accordingly to use either the 'strict' or the
|
85 |
-
'lenient' modes.
|
86 |
-
|
87 |
-
For more information, please check:
|
88 |
-
https://setuptools.pypa.io/en/latest/userguide/development_mode.html
|
89 |
-
"""
|
90 |
-
warnings.warn(msg, SetuptoolsDeprecationWarning)
|
91 |
-
|
92 |
-
return _EditableMode[_mode]
|
93 |
-
|
94 |
-
|
95 |
-
_STRICT_WARNING = """
|
96 |
-
New or renamed files may not be automatically picked up without a new installation.
|
97 |
-
"""
|
98 |
-
|
99 |
-
_LENIENT_WARNING = """
|
100 |
-
Options like `package-data`, `include/exclude-package-data` or
|
101 |
-
`packages.find.exclude/include` may have no effect.
|
102 |
-
"""
|
103 |
-
|
104 |
-
|
105 |
-
class editable_wheel(Command):
|
106 |
-
"""Build 'editable' wheel for development.
|
107 |
-
(This command is reserved for internal use of setuptools).
|
108 |
-
"""
|
109 |
-
|
110 |
-
description = "create a PEP 660 'editable' wheel"
|
111 |
-
|
112 |
-
user_options = [
|
113 |
-
("dist-dir=", "d", "directory to put final built distributions in"),
|
114 |
-
("dist-info-dir=", "I", "path to a pre-build .dist-info directory"),
|
115 |
-
("mode=", None, cleandoc(_EditableMode.__doc__ or "")),
|
116 |
-
]
|
117 |
-
|
118 |
-
def initialize_options(self):
|
119 |
-
self.dist_dir = None
|
120 |
-
self.dist_info_dir = None
|
121 |
-
self.project_dir = None
|
122 |
-
self.mode = None
|
123 |
-
|
124 |
-
def finalize_options(self):
|
125 |
-
dist = self.distribution
|
126 |
-
self.project_dir = dist.src_root or os.curdir
|
127 |
-
self.package_dir = dist.package_dir or {}
|
128 |
-
self.dist_dir = Path(self.dist_dir or os.path.join(self.project_dir, "dist"))
|
129 |
-
|
130 |
-
def run(self):
|
131 |
-
try:
|
132 |
-
self.dist_dir.mkdir(exist_ok=True)
|
133 |
-
self._ensure_dist_info()
|
134 |
-
|
135 |
-
# Add missing dist_info files
|
136 |
-
self.reinitialize_command("bdist_wheel")
|
137 |
-
bdist_wheel = self.get_finalized_command("bdist_wheel")
|
138 |
-
bdist_wheel.write_wheelfile(self.dist_info_dir)
|
139 |
-
|
140 |
-
self._create_wheel_file(bdist_wheel)
|
141 |
-
except Exception as ex:
|
142 |
-
traceback.print_exc()
|
143 |
-
msg = """
|
144 |
-
Support for editable installs via PEP 660 was recently introduced
|
145 |
-
in `setuptools`. If you are seeing this error, please report to:
|
146 |
-
|
147 |
-
https://github.com/pypa/setuptools/issues
|
148 |
-
|
149 |
-
Meanwhile you can try the legacy behavior by setting an
|
150 |
-
environment variable and trying to install again:
|
151 |
-
|
152 |
-
SETUPTOOLS_ENABLE_FEATURES="legacy-editable"
|
153 |
-
"""
|
154 |
-
raise errors.InternalError(cleandoc(msg)) from ex
|
155 |
-
|
156 |
-
def _ensure_dist_info(self):
|
157 |
-
if self.dist_info_dir is None:
|
158 |
-
dist_info = self.reinitialize_command("dist_info")
|
159 |
-
dist_info.output_dir = self.dist_dir
|
160 |
-
dist_info.ensure_finalized()
|
161 |
-
dist_info.run()
|
162 |
-
self.dist_info_dir = dist_info.dist_info_dir
|
163 |
-
else:
|
164 |
-
assert str(self.dist_info_dir).endswith(".dist-info")
|
165 |
-
assert Path(self.dist_info_dir, "METADATA").exists()
|
166 |
-
|
167 |
-
def _install_namespaces(self, installation_dir, pth_prefix):
|
168 |
-
# XXX: Only required to support the deprecated namespace practice
|
169 |
-
dist = self.distribution
|
170 |
-
if not dist.namespace_packages:
|
171 |
-
return
|
172 |
-
|
173 |
-
src_root = Path(self.project_dir, self.package_dir.get("", ".")).resolve()
|
174 |
-
installer = _NamespaceInstaller(dist, installation_dir, pth_prefix, src_root)
|
175 |
-
installer.install_namespaces()
|
176 |
-
|
177 |
-
def _find_egg_info_dir(self) -> Optional[str]:
|
178 |
-
parent_dir = Path(self.dist_info_dir).parent if self.dist_info_dir else Path()
|
179 |
-
candidates = map(str, parent_dir.glob("*.egg-info"))
|
180 |
-
return next(candidates, None)
|
181 |
-
|
182 |
-
def _configure_build(
|
183 |
-
self, name: str, unpacked_wheel: _Path, build_lib: _Path, tmp_dir: _Path
|
184 |
-
):
|
185 |
-
"""Configure commands to behave in the following ways:
|
186 |
-
|
187 |
-
- Build commands can write to ``build_lib`` if they really want to...
|
188 |
-
(but this folder is expected to be ignored and modules are expected to live
|
189 |
-
in the project directory...)
|
190 |
-
- Binary extensions should be built in-place (editable_mode = True)
|
191 |
-
- Data/header/script files are not part of the "editable" specification
|
192 |
-
so they are written directly to the unpacked_wheel directory.
|
193 |
-
"""
|
194 |
-
# Non-editable files (data, headers, scripts) are written directly to the
|
195 |
-
# unpacked_wheel
|
196 |
-
|
197 |
-
dist = self.distribution
|
198 |
-
wheel = str(unpacked_wheel)
|
199 |
-
build_lib = str(build_lib)
|
200 |
-
data = str(Path(unpacked_wheel, f"{name}.data", "data"))
|
201 |
-
headers = str(Path(unpacked_wheel, f"{name}.data", "headers"))
|
202 |
-
scripts = str(Path(unpacked_wheel, f"{name}.data", "scripts"))
|
203 |
-
|
204 |
-
# egg-info may be generated again to create a manifest (used for package data)
|
205 |
-
egg_info = dist.reinitialize_command("egg_info", reinit_subcommands=True)
|
206 |
-
egg_info.egg_base = str(tmp_dir)
|
207 |
-
egg_info.ignore_egg_info_in_manifest = True
|
208 |
-
|
209 |
-
build = dist.reinitialize_command("build", reinit_subcommands=True)
|
210 |
-
install = dist.reinitialize_command("install", reinit_subcommands=True)
|
211 |
-
|
212 |
-
build.build_platlib = build.build_purelib = build.build_lib = build_lib
|
213 |
-
install.install_purelib = install.install_platlib = install.install_lib = wheel
|
214 |
-
install.install_scripts = build.build_scripts = scripts
|
215 |
-
install.install_headers = headers
|
216 |
-
install.install_data = data
|
217 |
-
|
218 |
-
install_scripts = dist.get_command_obj("install_scripts")
|
219 |
-
install_scripts.no_ep = True
|
220 |
-
|
221 |
-
build.build_temp = str(tmp_dir)
|
222 |
-
|
223 |
-
build_py = dist.get_command_obj("build_py")
|
224 |
-
build_py.compile = False
|
225 |
-
build_py.existing_egg_info_dir = self._find_egg_info_dir()
|
226 |
-
|
227 |
-
self._set_editable_mode()
|
228 |
-
|
229 |
-
build.ensure_finalized()
|
230 |
-
install.ensure_finalized()
|
231 |
-
|
232 |
-
def _set_editable_mode(self):
|
233 |
-
"""Set the ``editable_mode`` flag in the build sub-commands"""
|
234 |
-
dist = self.distribution
|
235 |
-
build = dist.get_command_obj("build")
|
236 |
-
for cmd_name in build.get_sub_commands():
|
237 |
-
cmd = dist.get_command_obj(cmd_name)
|
238 |
-
if hasattr(cmd, "editable_mode"):
|
239 |
-
cmd.editable_mode = True
|
240 |
-
elif hasattr(cmd, "inplace"):
|
241 |
-
cmd.inplace = True # backward compatibility with distutils
|
242 |
-
|
243 |
-
def _collect_build_outputs(self) -> Tuple[List[str], Dict[str, str]]:
|
244 |
-
files: List[str] = []
|
245 |
-
mapping: Dict[str, str] = {}
|
246 |
-
build = self.get_finalized_command("build")
|
247 |
-
|
248 |
-
for cmd_name in build.get_sub_commands():
|
249 |
-
cmd = self.get_finalized_command(cmd_name)
|
250 |
-
if hasattr(cmd, "get_outputs"):
|
251 |
-
files.extend(cmd.get_outputs() or [])
|
252 |
-
if hasattr(cmd, "get_output_mapping"):
|
253 |
-
mapping.update(cmd.get_output_mapping() or {})
|
254 |
-
|
255 |
-
return files, mapping
|
256 |
-
|
257 |
-
def _run_build_commands(
|
258 |
-
self, dist_name: str, unpacked_wheel: _Path, build_lib: _Path, tmp_dir: _Path
|
259 |
-
) -> Tuple[List[str], Dict[str, str]]:
|
260 |
-
self._configure_build(dist_name, unpacked_wheel, build_lib, tmp_dir)
|
261 |
-
self._run_build_subcommands()
|
262 |
-
files, mapping = self._collect_build_outputs()
|
263 |
-
self._run_install("headers")
|
264 |
-
self._run_install("scripts")
|
265 |
-
self._run_install("data")
|
266 |
-
return files, mapping
|
267 |
-
|
268 |
-
def _run_build_subcommands(self):
|
269 |
-
"""
|
270 |
-
Issue #3501 indicates that some plugins/customizations might rely on:
|
271 |
-
|
272 |
-
1. ``build_py`` not running
|
273 |
-
2. ``build_py`` always copying files to ``build_lib``
|
274 |
-
|
275 |
-
However both these assumptions may be false in editable_wheel.
|
276 |
-
This method implements a temporary workaround to support the ecosystem
|
277 |
-
while the implementations catch up.
|
278 |
-
"""
|
279 |
-
# TODO: Once plugins/customisations had the chance to catch up, replace
|
280 |
-
# `self._run_build_subcommands()` with `self.run_command("build")`.
|
281 |
-
# Also remove _safely_run, TestCustomBuildPy. Suggested date: Aug/2023.
|
282 |
-
build: Command = self.get_finalized_command("build")
|
283 |
-
for name in build.get_sub_commands():
|
284 |
-
cmd = self.get_finalized_command(name)
|
285 |
-
if name == "build_py" and type(cmd) != build_py_cls:
|
286 |
-
self._safely_run(name)
|
287 |
-
else:
|
288 |
-
self.run_command(name)
|
289 |
-
|
290 |
-
def _safely_run(self, cmd_name: str):
|
291 |
-
try:
|
292 |
-
return self.run_command(cmd_name)
|
293 |
-
except Exception:
|
294 |
-
msg = f"""{traceback.format_exc()}\n
|
295 |
-
If you are seeing this warning it is very likely that a setuptools
|
296 |
-
plugin or customization overrides the `{cmd_name}` command, without
|
297 |
-
taking into consideration how editable installs run build steps
|
298 |
-
starting from v64.0.0.
|
299 |
-
|
300 |
-
Plugin authors and developers relying on custom build steps are encouraged
|
301 |
-
to update their `{cmd_name}` implementation considering the information in
|
302 |
-
https://setuptools.pypa.io/en/latest/userguide/extension.html
|
303 |
-
about editable installs.
|
304 |
-
|
305 |
-
For the time being `setuptools` will silence this error and ignore
|
306 |
-
the faulty command, but this behaviour will change in future versions.\n
|
307 |
-
"""
|
308 |
-
warnings.warn(msg, SetuptoolsDeprecationWarning, stacklevel=2)
|
309 |
-
|
310 |
-
def _create_wheel_file(self, bdist_wheel):
|
311 |
-
from wheel.wheelfile import WheelFile
|
312 |
-
|
313 |
-
dist_info = self.get_finalized_command("dist_info")
|
314 |
-
dist_name = dist_info.name
|
315 |
-
tag = "-".join(bdist_wheel.get_tag())
|
316 |
-
build_tag = "0.editable" # According to PEP 427 needs to start with digit
|
317 |
-
archive_name = f"{dist_name}-{build_tag}-{tag}.whl"
|
318 |
-
wheel_path = Path(self.dist_dir, archive_name)
|
319 |
-
if wheel_path.exists():
|
320 |
-
wheel_path.unlink()
|
321 |
-
|
322 |
-
unpacked_wheel = TemporaryDirectory(suffix=archive_name)
|
323 |
-
build_lib = TemporaryDirectory(suffix=".build-lib")
|
324 |
-
build_tmp = TemporaryDirectory(suffix=".build-temp")
|
325 |
-
|
326 |
-
with unpacked_wheel as unpacked, build_lib as lib, build_tmp as tmp:
|
327 |
-
unpacked_dist_info = Path(unpacked, Path(self.dist_info_dir).name)
|
328 |
-
shutil.copytree(self.dist_info_dir, unpacked_dist_info)
|
329 |
-
self._install_namespaces(unpacked, dist_info.name)
|
330 |
-
files, mapping = self._run_build_commands(dist_name, unpacked, lib, tmp)
|
331 |
-
strategy = self._select_strategy(dist_name, tag, lib)
|
332 |
-
with strategy, WheelFile(wheel_path, "w") as wheel_obj:
|
333 |
-
strategy(wheel_obj, files, mapping)
|
334 |
-
wheel_obj.write_files(unpacked)
|
335 |
-
|
336 |
-
return wheel_path
|
337 |
-
|
338 |
-
def _run_install(self, category: str):
|
339 |
-
has_category = getattr(self.distribution, f"has_{category}", None)
|
340 |
-
if has_category and has_category():
|
341 |
-
_logger.info(f"Installing {category} as non editable")
|
342 |
-
self.run_command(f"install_{category}")
|
343 |
-
|
344 |
-
def _select_strategy(
|
345 |
-
self,
|
346 |
-
name: str,
|
347 |
-
tag: str,
|
348 |
-
build_lib: _Path,
|
349 |
-
) -> "EditableStrategy":
|
350 |
-
"""Decides which strategy to use to implement an editable installation."""
|
351 |
-
build_name = f"__editable__.{name}-{tag}"
|
352 |
-
project_dir = Path(self.project_dir)
|
353 |
-
mode = _EditableMode.convert(self.mode)
|
354 |
-
|
355 |
-
if mode is _EditableMode.STRICT:
|
356 |
-
auxiliary_dir = _empty_dir(Path(self.project_dir, "build", build_name))
|
357 |
-
return _LinkTree(self.distribution, name, auxiliary_dir, build_lib)
|
358 |
-
|
359 |
-
packages = _find_packages(self.distribution)
|
360 |
-
has_simple_layout = _simple_layout(packages, self.package_dir, project_dir)
|
361 |
-
is_compat_mode = mode is _EditableMode.COMPAT
|
362 |
-
if set(self.package_dir) == {""} and has_simple_layout or is_compat_mode:
|
363 |
-
# src-layout(ish) is relatively safe for a simple pth file
|
364 |
-
src_dir = self.package_dir.get("", ".")
|
365 |
-
return _StaticPth(self.distribution, name, [Path(project_dir, src_dir)])
|
366 |
-
|
367 |
-
# Use a MetaPathFinder to avoid adding accidental top-level packages/modules
|
368 |
-
return _TopLevelFinder(self.distribution, name)
|
369 |
-
|
370 |
-
|
371 |
-
class EditableStrategy(Protocol):
|
372 |
-
def __call__(self, wheel: "WheelFile", files: List[str], mapping: Dict[str, str]):
|
373 |
-
...
|
374 |
-
|
375 |
-
def __enter__(self):
|
376 |
-
...
|
377 |
-
|
378 |
-
def __exit__(self, _exc_type, _exc_value, _traceback):
|
379 |
-
...
|
380 |
-
|
381 |
-
|
382 |
-
class _StaticPth:
|
383 |
-
def __init__(self, dist: Distribution, name: str, path_entries: List[Path]):
|
384 |
-
self.dist = dist
|
385 |
-
self.name = name
|
386 |
-
self.path_entries = path_entries
|
387 |
-
|
388 |
-
def __call__(self, wheel: "WheelFile", files: List[str], mapping: Dict[str, str]):
|
389 |
-
entries = "\n".join((str(p.resolve()) for p in self.path_entries))
|
390 |
-
contents = bytes(f"{entries}\n", "utf-8")
|
391 |
-
wheel.writestr(f"__editable__.{self.name}.pth", contents)
|
392 |
-
|
393 |
-
def __enter__(self):
|
394 |
-
msg = f"""
|
395 |
-
Editable install will be performed using .pth file to extend `sys.path` with:
|
396 |
-
{list(map(os.fspath, self.path_entries))!r}
|
397 |
-
"""
|
398 |
-
_logger.warning(msg + _LENIENT_WARNING)
|
399 |
-
return self
|
400 |
-
|
401 |
-
def __exit__(self, _exc_type, _exc_value, _traceback):
|
402 |
-
...
|
403 |
-
|
404 |
-
|
405 |
-
class _LinkTree(_StaticPth):
|
406 |
-
"""
|
407 |
-
Creates a ``.pth`` file that points to a link tree in the ``auxiliary_dir``.
|
408 |
-
|
409 |
-
This strategy will only link files (not dirs), so it can be implemented in
|
410 |
-
any OS, even if that means using hardlinks instead of symlinks.
|
411 |
-
|
412 |
-
By collocating ``auxiliary_dir`` and the original source code, limitations
|
413 |
-
with hardlinks should be avoided.
|
414 |
-
"""
|
415 |
-
def __init__(
|
416 |
-
self, dist: Distribution,
|
417 |
-
name: str,
|
418 |
-
auxiliary_dir: _Path,
|
419 |
-
build_lib: _Path,
|
420 |
-
):
|
421 |
-
self.auxiliary_dir = Path(auxiliary_dir)
|
422 |
-
self.build_lib = Path(build_lib).resolve()
|
423 |
-
self._file = dist.get_command_obj("build_py").copy_file
|
424 |
-
super().__init__(dist, name, [self.auxiliary_dir])
|
425 |
-
|
426 |
-
def __call__(self, wheel: "WheelFile", files: List[str], mapping: Dict[str, str]):
|
427 |
-
self._create_links(files, mapping)
|
428 |
-
super().__call__(wheel, files, mapping)
|
429 |
-
|
430 |
-
def _normalize_output(self, file: str) -> Optional[str]:
|
431 |
-
# Files relative to build_lib will be normalized to None
|
432 |
-
with suppress(ValueError):
|
433 |
-
path = Path(file).resolve().relative_to(self.build_lib)
|
434 |
-
return str(path).replace(os.sep, '/')
|
435 |
-
return None
|
436 |
-
|
437 |
-
def _create_file(self, relative_output: str, src_file: str, link=None):
|
438 |
-
dest = self.auxiliary_dir / relative_output
|
439 |
-
if not dest.parent.is_dir():
|
440 |
-
dest.parent.mkdir(parents=True)
|
441 |
-
self._file(src_file, dest, link=link)
|
442 |
-
|
443 |
-
def _create_links(self, outputs, output_mapping):
|
444 |
-
self.auxiliary_dir.mkdir(parents=True, exist_ok=True)
|
445 |
-
link_type = "sym" if _can_symlink_files(self.auxiliary_dir) else "hard"
|
446 |
-
mappings = {
|
447 |
-
self._normalize_output(k): v
|
448 |
-
for k, v in output_mapping.items()
|
449 |
-
}
|
450 |
-
mappings.pop(None, None) # remove files that are not relative to build_lib
|
451 |
-
|
452 |
-
for output in outputs:
|
453 |
-
relative = self._normalize_output(output)
|
454 |
-
if relative and relative not in mappings:
|
455 |
-
self._create_file(relative, output)
|
456 |
-
|
457 |
-
for relative, src in mappings.items():
|
458 |
-
self._create_file(relative, src, link=link_type)
|
459 |
-
|
460 |
-
def __enter__(self):
|
461 |
-
msg = "Strict editable install will be performed using a link tree.\n"
|
462 |
-
_logger.warning(msg + _STRICT_WARNING)
|
463 |
-
return self
|
464 |
-
|
465 |
-
def __exit__(self, _exc_type, _exc_value, _traceback):
|
466 |
-
msg = f"""\n
|
467 |
-
Strict editable installation performed using the auxiliary directory:
|
468 |
-
{self.auxiliary_dir}
|
469 |
-
|
470 |
-
Please be careful to not remove this directory, otherwise you might not be able
|
471 |
-
to import/use your package.
|
472 |
-
"""
|
473 |
-
warnings.warn(msg, InformationOnly)
|
474 |
-
|
475 |
-
|
476 |
-
class _TopLevelFinder:
|
477 |
-
def __init__(self, dist: Distribution, name: str):
|
478 |
-
self.dist = dist
|
479 |
-
self.name = name
|
480 |
-
|
481 |
-
def __call__(self, wheel: "WheelFile", files: List[str], mapping: Dict[str, str]):
|
482 |
-
src_root = self.dist.src_root or os.curdir
|
483 |
-
top_level = chain(_find_packages(self.dist), _find_top_level_modules(self.dist))
|
484 |
-
package_dir = self.dist.package_dir or {}
|
485 |
-
roots = _find_package_roots(top_level, package_dir, src_root)
|
486 |
-
|
487 |
-
namespaces_: Dict[str, List[str]] = dict(chain(
|
488 |
-
_find_namespaces(self.dist.packages or [], roots),
|
489 |
-
((ns, []) for ns in _find_virtual_namespaces(roots)),
|
490 |
-
))
|
491 |
-
|
492 |
-
name = f"__editable__.{self.name}.finder"
|
493 |
-
finder = _make_identifier(name)
|
494 |
-
content = bytes(_finder_template(name, roots, namespaces_), "utf-8")
|
495 |
-
wheel.writestr(f"{finder}.py", content)
|
496 |
-
|
497 |
-
content = bytes(f"import {finder}; {finder}.install()", "utf-8")
|
498 |
-
wheel.writestr(f"__editable__.{self.name}.pth", content)
|
499 |
-
|
500 |
-
def __enter__(self):
|
501 |
-
msg = "Editable install will be performed using a meta path finder.\n"
|
502 |
-
_logger.warning(msg + _LENIENT_WARNING)
|
503 |
-
return self
|
504 |
-
|
505 |
-
def __exit__(self, _exc_type, _exc_value, _traceback):
|
506 |
-
msg = """\n
|
507 |
-
Please be careful with folders in your working directory with the same
|
508 |
-
name as your package as they may take precedence during imports.
|
509 |
-
"""
|
510 |
-
warnings.warn(msg, InformationOnly)
|
511 |
-
|
512 |
-
|
513 |
-
def _can_symlink_files(base_dir: Path) -> bool:
|
514 |
-
with TemporaryDirectory(dir=str(base_dir.resolve())) as tmp:
|
515 |
-
path1, path2 = Path(tmp, "file1.txt"), Path(tmp, "file2.txt")
|
516 |
-
path1.write_text("file1", encoding="utf-8")
|
517 |
-
with suppress(AttributeError, NotImplementedError, OSError):
|
518 |
-
os.symlink(path1, path2)
|
519 |
-
if path2.is_symlink() and path2.read_text(encoding="utf-8") == "file1":
|
520 |
-
return True
|
521 |
-
|
522 |
-
try:
|
523 |
-
os.link(path1, path2) # Ensure hard links can be created
|
524 |
-
except Exception as ex:
|
525 |
-
msg = (
|
526 |
-
"File system does not seem to support either symlinks or hard links. "
|
527 |
-
"Strict editable installs require one of them to be supported."
|
528 |
-
)
|
529 |
-
raise LinksNotSupported(msg) from ex
|
530 |
-
return False
|
531 |
-
|
532 |
-
|
533 |
-
def _simple_layout(
|
534 |
-
packages: Iterable[str], package_dir: Dict[str, str], project_dir: Path
|
535 |
-
) -> bool:
|
536 |
-
"""Return ``True`` if:
|
537 |
-
- all packages are contained by the same parent directory, **and**
|
538 |
-
- all packages become importable if the parent directory is added to ``sys.path``.
|
539 |
-
|
540 |
-
>>> _simple_layout(['a'], {"": "src"}, "/tmp/myproj")
|
541 |
-
True
|
542 |
-
>>> _simple_layout(['a', 'a.b'], {"": "src"}, "/tmp/myproj")
|
543 |
-
True
|
544 |
-
>>> _simple_layout(['a', 'a.b'], {}, "/tmp/myproj")
|
545 |
-
True
|
546 |
-
>>> _simple_layout(['a', 'a.a1', 'a.a1.a2', 'b'], {"": "src"}, "/tmp/myproj")
|
547 |
-
True
|
548 |
-
>>> _simple_layout(['a', 'a.a1', 'a.a1.a2', 'b'], {"a": "a", "b": "b"}, ".")
|
549 |
-
True
|
550 |
-
>>> _simple_layout(['a', 'a.a1', 'a.a1.a2', 'b'], {"a": "_a", "b": "_b"}, ".")
|
551 |
-
False
|
552 |
-
>>> _simple_layout(['a', 'a.a1', 'a.a1.a2', 'b'], {"a": "_a"}, "/tmp/myproj")
|
553 |
-
False
|
554 |
-
>>> _simple_layout(['a', 'a.a1', 'a.a1.a2', 'b'], {"a.a1.a2": "_a2"}, ".")
|
555 |
-
False
|
556 |
-
>>> _simple_layout(['a', 'a.b'], {"": "src", "a.b": "_ab"}, "/tmp/myproj")
|
557 |
-
False
|
558 |
-
>>> # Special cases, no packages yet:
|
559 |
-
>>> _simple_layout([], {"": "src"}, "/tmp/myproj")
|
560 |
-
True
|
561 |
-
>>> _simple_layout([], {"a": "_a", "": "src"}, "/tmp/myproj")
|
562 |
-
False
|
563 |
-
"""
|
564 |
-
layout = {
|
565 |
-
pkg: find_package_path(pkg, package_dir, project_dir)
|
566 |
-
for pkg in packages
|
567 |
-
}
|
568 |
-
if not layout:
|
569 |
-
return set(package_dir) in ({}, {""})
|
570 |
-
parent = os.path.commonpath([_parent_path(k, v) for k, v in layout.items()])
|
571 |
-
return all(
|
572 |
-
_normalize_path(Path(parent, *key.split('.'))) == _normalize_path(value)
|
573 |
-
for key, value in layout.items()
|
574 |
-
)
|
575 |
-
|
576 |
-
|
577 |
-
def _parent_path(pkg, pkg_path):
|
578 |
-
"""Infer the parent path containing a package, that if added to ``sys.path`` would
|
579 |
-
allow importing that package.
|
580 |
-
When ``pkg`` is directly mapped into a directory with a different name, return its
|
581 |
-
own path.
|
582 |
-
>>> _parent_path("a", "src/a")
|
583 |
-
'src'
|
584 |
-
>>> _parent_path("b", "src/c")
|
585 |
-
'src/c'
|
586 |
-
"""
|
587 |
-
parent = pkg_path[:-len(pkg)] if pkg_path.endswith(pkg) else pkg_path
|
588 |
-
return parent.rstrip("/" + os.sep)
|
589 |
-
|
590 |
-
|
591 |
-
def _find_packages(dist: Distribution) -> Iterator[str]:
|
592 |
-
yield from iter(dist.packages or [])
|
593 |
-
|
594 |
-
py_modules = dist.py_modules or []
|
595 |
-
nested_modules = [mod for mod in py_modules if "." in mod]
|
596 |
-
if dist.ext_package:
|
597 |
-
yield dist.ext_package
|
598 |
-
else:
|
599 |
-
ext_modules = dist.ext_modules or []
|
600 |
-
nested_modules += [x.name for x in ext_modules if "." in x.name]
|
601 |
-
|
602 |
-
for module in nested_modules:
|
603 |
-
package, _, _ = module.rpartition(".")
|
604 |
-
yield package
|
605 |
-
|
606 |
-
|
607 |
-
def _find_top_level_modules(dist: Distribution) -> Iterator[str]:
|
608 |
-
py_modules = dist.py_modules or []
|
609 |
-
yield from (mod for mod in py_modules if "." not in mod)
|
610 |
-
|
611 |
-
if not dist.ext_package:
|
612 |
-
ext_modules = dist.ext_modules or []
|
613 |
-
yield from (x.name for x in ext_modules if "." not in x.name)
|
614 |
-
|
615 |
-
|
616 |
-
def _find_package_roots(
|
617 |
-
packages: Iterable[str],
|
618 |
-
package_dir: Mapping[str, str],
|
619 |
-
src_root: _Path,
|
620 |
-
) -> Dict[str, str]:
|
621 |
-
pkg_roots: Dict[str, str] = {
|
622 |
-
pkg: _absolute_root(find_package_path(pkg, package_dir, src_root))
|
623 |
-
for pkg in sorted(packages)
|
624 |
-
}
|
625 |
-
|
626 |
-
return _remove_nested(pkg_roots)
|
627 |
-
|
628 |
-
|
629 |
-
def _absolute_root(path: _Path) -> str:
|
630 |
-
"""Works for packages and top-level modules"""
|
631 |
-
path_ = Path(path)
|
632 |
-
parent = path_.parent
|
633 |
-
|
634 |
-
if path_.exists():
|
635 |
-
return str(path_.resolve())
|
636 |
-
else:
|
637 |
-
return str(parent.resolve() / path_.name)
|
638 |
-
|
639 |
-
|
640 |
-
def _find_virtual_namespaces(pkg_roots: Dict[str, str]) -> Iterator[str]:
|
641 |
-
"""By carefully designing ``package_dir``, it is possible to implement the logical
|
642 |
-
structure of PEP 420 in a package without the corresponding directories.
|
643 |
-
|
644 |
-
Moreover a parent package can be purposefully/accidentally skipped in the discovery
|
645 |
-
phase (e.g. ``find_packages(include=["mypkg.*"])``, when ``mypkg.foo`` is included
|
646 |
-
by ``mypkg`` itself is not).
|
647 |
-
We consider this case to also be a virtual namespace (ignoring the original
|
648 |
-
directory) to emulate a non-editable installation.
|
649 |
-
|
650 |
-
This function will try to find these kinds of namespaces.
|
651 |
-
"""
|
652 |
-
for pkg in pkg_roots:
|
653 |
-
if "." not in pkg:
|
654 |
-
continue
|
655 |
-
parts = pkg.split(".")
|
656 |
-
for i in range(len(parts) - 1, 0, -1):
|
657 |
-
partial_name = ".".join(parts[:i])
|
658 |
-
path = Path(find_package_path(partial_name, pkg_roots, ""))
|
659 |
-
if not path.exists() or partial_name not in pkg_roots:
|
660 |
-
# partial_name not in pkg_roots ==> purposefully/accidentally skipped
|
661 |
-
yield partial_name
|
662 |
-
|
663 |
-
|
664 |
-
def _find_namespaces(
|
665 |
-
packages: List[str], pkg_roots: Dict[str, str]
|
666 |
-
) -> Iterator[Tuple[str, List[str]]]:
|
667 |
-
for pkg in packages:
|
668 |
-
path = find_package_path(pkg, pkg_roots, "")
|
669 |
-
if Path(path).exists() and not Path(path, "__init__.py").exists():
|
670 |
-
yield (pkg, [path])
|
671 |
-
|
672 |
-
|
673 |
-
def _remove_nested(pkg_roots: Dict[str, str]) -> Dict[str, str]:
|
674 |
-
output = dict(pkg_roots.copy())
|
675 |
-
|
676 |
-
for pkg, path in reversed(list(pkg_roots.items())):
|
677 |
-
if any(
|
678 |
-
pkg != other and _is_nested(pkg, path, other, other_path)
|
679 |
-
for other, other_path in pkg_roots.items()
|
680 |
-
):
|
681 |
-
output.pop(pkg)
|
682 |
-
|
683 |
-
return output
|
684 |
-
|
685 |
-
|
686 |
-
def _is_nested(pkg: str, pkg_path: str, parent: str, parent_path: str) -> bool:
|
687 |
-
"""
|
688 |
-
Return ``True`` if ``pkg`` is nested inside ``parent`` both logically and in the
|
689 |
-
file system.
|
690 |
-
>>> _is_nested("a.b", "path/a/b", "a", "path/a")
|
691 |
-
True
|
692 |
-
>>> _is_nested("a.b", "path/a/b", "a", "otherpath/a")
|
693 |
-
False
|
694 |
-
>>> _is_nested("a.b", "path/a/b", "c", "path/c")
|
695 |
-
False
|
696 |
-
>>> _is_nested("a.a", "path/a/a", "a", "path/a")
|
697 |
-
True
|
698 |
-
>>> _is_nested("b.a", "path/b/a", "a", "path/a")
|
699 |
-
False
|
700 |
-
"""
|
701 |
-
norm_pkg_path = _normalize_path(pkg_path)
|
702 |
-
rest = pkg.replace(parent, "", 1).strip(".").split(".")
|
703 |
-
return (
|
704 |
-
pkg.startswith(parent)
|
705 |
-
and norm_pkg_path == _normalize_path(Path(parent_path, *rest))
|
706 |
-
)
|
707 |
-
|
708 |
-
|
709 |
-
def _normalize_path(filename: _Path) -> str:
|
710 |
-
"""Normalize a file/dir name for comparison purposes"""
|
711 |
-
# See pkg_resources.normalize_path
|
712 |
-
file = os.path.abspath(filename) if sys.platform == 'cygwin' else filename
|
713 |
-
return os.path.normcase(os.path.realpath(os.path.normpath(file)))
|
714 |
-
|
715 |
-
|
716 |
-
def _empty_dir(dir_: _P) -> _P:
|
717 |
-
"""Create a directory ensured to be empty. Existing files may be removed."""
|
718 |
-
shutil.rmtree(dir_, ignore_errors=True)
|
719 |
-
os.makedirs(dir_)
|
720 |
-
return dir_
|
721 |
-
|
722 |
-
|
723 |
-
def _make_identifier(name: str) -> str:
|
724 |
-
"""Make a string safe to be used as Python identifier.
|
725 |
-
>>> _make_identifier("12abc")
|
726 |
-
'_12abc'
|
727 |
-
>>> _make_identifier("__editable__.myns.pkg-78.9.3_local")
|
728 |
-
'__editable___myns_pkg_78_9_3_local'
|
729 |
-
"""
|
730 |
-
safe = re.sub(r'\W|^(?=\d)', '_', name)
|
731 |
-
assert safe.isidentifier()
|
732 |
-
return safe
|
733 |
-
|
734 |
-
|
735 |
-
class _NamespaceInstaller(namespaces.Installer):
|
736 |
-
def __init__(self, distribution, installation_dir, editable_name, src_root):
|
737 |
-
self.distribution = distribution
|
738 |
-
self.src_root = src_root
|
739 |
-
self.installation_dir = installation_dir
|
740 |
-
self.editable_name = editable_name
|
741 |
-
self.outputs = []
|
742 |
-
self.dry_run = False
|
743 |
-
|
744 |
-
def _get_target(self):
|
745 |
-
"""Installation target."""
|
746 |
-
return os.path.join(self.installation_dir, self.editable_name)
|
747 |
-
|
748 |
-
def _get_root(self):
|
749 |
-
"""Where the modules/packages should be loaded from."""
|
750 |
-
return repr(str(self.src_root))
|
751 |
-
|
752 |
-
|
753 |
-
_FINDER_TEMPLATE = """\
|
754 |
-
import sys
|
755 |
-
from importlib.machinery import ModuleSpec
|
756 |
-
from importlib.machinery import all_suffixes as module_suffixes
|
757 |
-
from importlib.util import spec_from_file_location
|
758 |
-
from itertools import chain
|
759 |
-
from pathlib import Path
|
760 |
-
|
761 |
-
MAPPING = {mapping!r}
|
762 |
-
NAMESPACES = {namespaces!r}
|
763 |
-
PATH_PLACEHOLDER = {name!r} + ".__path_hook__"
|
764 |
-
|
765 |
-
|
766 |
-
class _EditableFinder: # MetaPathFinder
|
767 |
-
@classmethod
|
768 |
-
def find_spec(cls, fullname, path=None, target=None):
|
769 |
-
for pkg, pkg_path in reversed(list(MAPPING.items())):
|
770 |
-
if fullname == pkg or fullname.startswith(f"{{pkg}}."):
|
771 |
-
rest = fullname.replace(pkg, "", 1).strip(".").split(".")
|
772 |
-
return cls._find_spec(fullname, Path(pkg_path, *rest))
|
773 |
-
|
774 |
-
return None
|
775 |
-
|
776 |
-
@classmethod
|
777 |
-
def _find_spec(cls, fullname, candidate_path):
|
778 |
-
init = candidate_path / "__init__.py"
|
779 |
-
candidates = (candidate_path.with_suffix(x) for x in module_suffixes())
|
780 |
-
for candidate in chain([init], candidates):
|
781 |
-
if candidate.exists():
|
782 |
-
return spec_from_file_location(fullname, candidate)
|
783 |
-
|
784 |
-
|
785 |
-
class _EditableNamespaceFinder: # PathEntryFinder
|
786 |
-
@classmethod
|
787 |
-
def _path_hook(cls, path):
|
788 |
-
if path == PATH_PLACEHOLDER:
|
789 |
-
return cls
|
790 |
-
raise ImportError
|
791 |
-
|
792 |
-
@classmethod
|
793 |
-
def _paths(cls, fullname):
|
794 |
-
# Ensure __path__ is not empty for the spec to be considered a namespace.
|
795 |
-
return NAMESPACES[fullname] or MAPPING.get(fullname) or [PATH_PLACEHOLDER]
|
796 |
-
|
797 |
-
@classmethod
|
798 |
-
def find_spec(cls, fullname, target=None):
|
799 |
-
if fullname in NAMESPACES:
|
800 |
-
spec = ModuleSpec(fullname, None, is_package=True)
|
801 |
-
spec.submodule_search_locations = cls._paths(fullname)
|
802 |
-
return spec
|
803 |
-
return None
|
804 |
-
|
805 |
-
@classmethod
|
806 |
-
def find_module(cls, fullname):
|
807 |
-
return None
|
808 |
-
|
809 |
-
|
810 |
-
def install():
|
811 |
-
if not any(finder == _EditableFinder for finder in sys.meta_path):
|
812 |
-
sys.meta_path.append(_EditableFinder)
|
813 |
-
|
814 |
-
if not NAMESPACES:
|
815 |
-
return
|
816 |
-
|
817 |
-
if not any(hook == _EditableNamespaceFinder._path_hook for hook in sys.path_hooks):
|
818 |
-
# PathEntryFinder is needed to create NamespaceSpec without private APIS
|
819 |
-
sys.path_hooks.append(_EditableNamespaceFinder._path_hook)
|
820 |
-
if PATH_PLACEHOLDER not in sys.path:
|
821 |
-
sys.path.append(PATH_PLACEHOLDER) # Used just to trigger the path hook
|
822 |
-
"""
|
823 |
-
|
824 |
-
|
825 |
-
def _finder_template(
|
826 |
-
name: str, mapping: Mapping[str, str], namespaces: Dict[str, List[str]]
|
827 |
-
) -> str:
|
828 |
-
"""Create a string containing the code for the``MetaPathFinder`` and
|
829 |
-
``PathEntryFinder``.
|
830 |
-
"""
|
831 |
-
mapping = dict(sorted(mapping.items(), key=lambda p: p[0]))
|
832 |
-
return _FINDER_TEMPLATE.format(name=name, mapping=mapping, namespaces=namespaces)
|
833 |
-
|
834 |
-
|
835 |
-
class InformationOnly(UserWarning):
|
836 |
-
"""Currently there is no clear way of displaying messages to the users
|
837 |
-
that use the setuptools backend directly via ``pip``.
|
838 |
-
The only thing that might work is a warning, although it is not the
|
839 |
-
most appropriate tool for the job...
|
840 |
-
"""
|
841 |
-
|
842 |
-
|
843 |
-
class LinksNotSupported(errors.FileError):
|
844 |
-
"""File system does not seem to support either symlinks or hard links."""
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
spaces/Bonosa2/movies/app1.py
DELETED
@@ -1,76 +0,0 @@
|
|
1 |
-
import pandas as pd
|
2 |
-
import numpy as np
|
3 |
-
import torch
|
4 |
-
from sentence_transformers import SentenceTransformer
|
5 |
-
import scipy.spatial
|
6 |
-
import gradio as gr
|
7 |
-
import re
|
8 |
-
|
9 |
-
# Load the dataset
|
10 |
-
url = 'https://storage.googleapis.com/movves123/movies.csv'
|
11 |
-
df = pd.read_csv(url)
|
12 |
-
|
13 |
-
# Load BERT model
|
14 |
-
model = SentenceTransformer('all-MiniLM-L6-v2')
|
15 |
-
|
16 |
-
# Precompute movie title embeddings
|
17 |
-
titles = df['title'].tolist()
|
18 |
-
genres = df['genres'].tolist()
|
19 |
-
|
20 |
-
# Combine title and genre into a single string and compute embeddings
|
21 |
-
combined = [f"{title} {genre}" for title, genre in zip(titles, genres)]
|
22 |
-
embeddings = model.encode(combined, convert_to_tensor=True)
|
23 |
-
|
24 |
-
# List of movie genres
|
25 |
-
genre_keywords = ['Action', 'Adventure', 'Animation', 'Children', 'Comedy', 'Crime',
|
26 |
-
'Documentary', 'Drama', 'Fantasy', 'Film-Noir', 'Horror', 'Musical',
|
27 |
-
'Mystery', 'Romance', 'Sci-Fi', 'Thriller', 'War', 'Western']
|
28 |
-
|
29 |
-
def recommend_movies(user_input):
|
30 |
-
# Detect genre from user's input
|
31 |
-
user_genre = [genre for genre in genre_keywords if genre.lower() in user_input.lower()]
|
32 |
-
|
33 |
-
# If a genre is detected, recommend movies from that genre
|
34 |
-
if user_genre:
|
35 |
-
query_embedding = model.encode([user_genre[0]], convert_to_tensor=True) # Ensure the input to encode is a list
|
36 |
-
else:
|
37 |
-
query_embedding = model.encode([user_input], convert_to_tensor=True)
|
38 |
-
|
39 |
-
# Compute cosine similarity scores
|
40 |
-
cosine_scores = scipy.spatial.distance.cdist(query_embedding.cpu().numpy(), embeddings.cpu().numpy(), "cosine")[0]
|
41 |
-
|
42 |
-
# Get top 5 matches
|
43 |
-
top_results = np.argpartition(cosine_scores, range(5))[:5]
|
44 |
-
|
45 |
-
# Check if user input includes negation phrases
|
46 |
-
negation_phrases = ["not", "anything but", "except", "don't", "dont", "do not", "no", "none","besides","hate","dislike", "neither", "never"]
|
47 |
-
genres_to_avoid = []
|
48 |
-
for phrase in negation_phrases:
|
49 |
-
if phrase in user_input.lower():
|
50 |
-
# Get the word following the negation phrase, assuming it's a genre
|
51 |
-
genre_to_avoid = user_input.lower().split(phrase)[1].strip().split()[0]
|
52 |
-
genres_to_avoid.append(genre_to_avoid)
|
53 |
-
|
54 |
-
# Filter out movies from unwanted genres
|
55 |
-
final_recommendations = []
|
56 |
-
for rec in top_results:
|
57 |
-
movie_genres = df.iloc[rec]['genres'].lower().split("|")
|
58 |
-
if not any(genre in genres_to_avoid for genre in movie_genres):
|
59 |
-
# Generate a list of numbered recommendations
|
60 |
-
final_recommendations.append(f"{len(final_recommendations)+1}. {df.iloc[rec]['title']}")
|
61 |
-
|
62 |
-
|
63 |
-
return "\n".join(final_recommendations) # Return as a numbered list
|
64 |
-
|
65 |
-
examples = [
|
66 |
-
['I\'m in the mood for a comedy.'],
|
67 |
-
['How about some action?'],
|
68 |
-
['I want to watch a romance movie.']
|
69 |
-
]
|
70 |
-
|
71 |
-
iface = gr.Interface(fn=recommend_movies,
|
72 |
-
inputs=gr.inputs.Textbox(lines=2, placeholder='Type something...'),
|
73 |
-
outputs=gr.outputs.Textbox(),
|
74 |
-
examples=examples) # Include examples
|
75 |
-
iface.launch()
|
76 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
spaces/CVPR/Dual-Key_Backdoor_Attacks/datagen/detectron2/detectron2/data/samplers/__init__.py
DELETED
@@ -1,10 +0,0 @@
|
|
1 |
-
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved
|
2 |
-
from .distributed_sampler import InferenceSampler, RepeatFactorTrainingSampler, TrainingSampler
|
3 |
-
from .grouped_batch_sampler import GroupedBatchSampler
|
4 |
-
|
5 |
-
__all__ = [
|
6 |
-
"GroupedBatchSampler",
|
7 |
-
"TrainingSampler",
|
8 |
-
"InferenceSampler",
|
9 |
-
"RepeatFactorTrainingSampler",
|
10 |
-
]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
spaces/CVPR/LIVE/pybind11/tests/test_virtual_functions.cpp
DELETED
@@ -1,498 +0,0 @@
|
|
1 |
-
/*
|
2 |
-
tests/test_virtual_functions.cpp -- overriding virtual functions from Python
|
3 |
-
|
4 |
-
Copyright (c) 2016 Wenzel Jakob <[email protected]>
|
5 |
-
|
6 |
-
All rights reserved. Use of this source code is governed by a
|
7 |
-
BSD-style license that can be found in the LICENSE file.
|
8 |
-
*/
|
9 |
-
|
10 |
-
#include "pybind11_tests.h"
|
11 |
-
#include "constructor_stats.h"
|
12 |
-
#include <pybind11/functional.h>
|
13 |
-
#include <thread>
|
14 |
-
|
15 |
-
/* This is an example class that we'll want to be able to extend from Python */
|
16 |
-
class ExampleVirt {
|
17 |
-
public:
|
18 |
-
ExampleVirt(int state) : state(state) { print_created(this, state); }
|
19 |
-
ExampleVirt(const ExampleVirt &e) : state(e.state) { print_copy_created(this); }
|
20 |
-
ExampleVirt(ExampleVirt &&e) : state(e.state) { print_move_created(this); e.state = 0; }
|
21 |
-
virtual ~ExampleVirt() { print_destroyed(this); }
|
22 |
-
|
23 |
-
virtual int run(int value) {
|
24 |
-
py::print("Original implementation of "
|
25 |
-
"ExampleVirt::run(state={}, value={}, str1={}, str2={})"_s.format(state, value, get_string1(), *get_string2()));
|
26 |
-
return state + value;
|
27 |
-
}
|
28 |
-
|
29 |
-
virtual bool run_bool() = 0;
|
30 |
-
virtual void pure_virtual() = 0;
|
31 |
-
|
32 |
-
// Returning a reference/pointer to a type converted from python (numbers, strings, etc.) is a
|
33 |
-
// bit trickier, because the actual int& or std::string& or whatever only exists temporarily, so
|
34 |
-
// we have to handle it specially in the trampoline class (see below).
|
35 |
-
virtual const std::string &get_string1() { return str1; }
|
36 |
-
virtual const std::string *get_string2() { return &str2; }
|
37 |
-
|
38 |
-
private:
|
39 |
-
int state;
|
40 |
-
const std::string str1{"default1"}, str2{"default2"};
|
41 |
-
};
|
42 |
-
|
43 |
-
/* This is a wrapper class that must be generated */
|
44 |
-
class PyExampleVirt : public ExampleVirt {
|
45 |
-
public:
|
46 |
-
using ExampleVirt::ExampleVirt; /* Inherit constructors */
|
47 |
-
|
48 |
-
int run(int value) override {
|
49 |
-
/* Generate wrapping code that enables native function overloading */
|
50 |
-
PYBIND11_OVERLOAD(
|
51 |
-
int, /* Return type */
|
52 |
-
ExampleVirt, /* Parent class */
|
53 |
-
run, /* Name of function */
|
54 |
-
value /* Argument(s) */
|
55 |
-
);
|
56 |
-
}
|
57 |
-
|
58 |
-
bool run_bool() override {
|
59 |
-
PYBIND11_OVERLOAD_PURE(
|
60 |
-
bool, /* Return type */
|
61 |
-
ExampleVirt, /* Parent class */
|
62 |
-
run_bool, /* Name of function */
|
63 |
-
/* This function has no arguments. The trailing comma
|
64 |
-
in the previous line is needed for some compilers */
|
65 |
-
);
|
66 |
-
}
|
67 |
-
|
68 |
-
void pure_virtual() override {
|
69 |
-
PYBIND11_OVERLOAD_PURE(
|
70 |
-
void, /* Return type */
|
71 |
-
ExampleVirt, /* Parent class */
|
72 |
-
pure_virtual, /* Name of function */
|
73 |
-
/* This function has no arguments. The trailing comma
|
74 |
-
in the previous line is needed for some compilers */
|
75 |
-
);
|
76 |
-
}
|
77 |
-
|
78 |
-
// We can return reference types for compatibility with C++ virtual interfaces that do so, but
|
79 |
-
// note they have some significant limitations (see the documentation).
|
80 |
-
const std::string &get_string1() override {
|
81 |
-
PYBIND11_OVERLOAD(
|
82 |
-
const std::string &, /* Return type */
|
83 |
-
ExampleVirt, /* Parent class */
|
84 |
-
get_string1, /* Name of function */
|
85 |
-
/* (no arguments) */
|
86 |
-
);
|
87 |
-
}
|
88 |
-
|
89 |
-
const std::string *get_string2() override {
|
90 |
-
PYBIND11_OVERLOAD(
|
91 |
-
const std::string *, /* Return type */
|
92 |
-
ExampleVirt, /* Parent class */
|
93 |
-
get_string2, /* Name of function */
|
94 |
-
/* (no arguments) */
|
95 |
-
);
|
96 |
-
}
|
97 |
-
|
98 |
-
};
|
99 |
-
|
100 |
-
class NonCopyable {
|
101 |
-
public:
|
102 |
-
NonCopyable(int a, int b) : value{new int(a*b)} { print_created(this, a, b); }
|
103 |
-
NonCopyable(NonCopyable &&o) { value = std::move(o.value); print_move_created(this); }
|
104 |
-
NonCopyable(const NonCopyable &) = delete;
|
105 |
-
NonCopyable() = delete;
|
106 |
-
void operator=(const NonCopyable &) = delete;
|
107 |
-
void operator=(NonCopyable &&) = delete;
|
108 |
-
std::string get_value() const {
|
109 |
-
if (value) return std::to_string(*value); else return "(null)";
|
110 |
-
}
|
111 |
-
~NonCopyable() { print_destroyed(this); }
|
112 |
-
|
113 |
-
private:
|
114 |
-
std::unique_ptr<int> value;
|
115 |
-
};
|
116 |
-
|
117 |
-
// This is like the above, but is both copy and movable. In effect this means it should get moved
|
118 |
-
// when it is not referenced elsewhere, but copied if it is still referenced.
|
119 |
-
class Movable {
|
120 |
-
public:
|
121 |
-
Movable(int a, int b) : value{a+b} { print_created(this, a, b); }
|
122 |
-
Movable(const Movable &m) { value = m.value; print_copy_created(this); }
|
123 |
-
Movable(Movable &&m) { value = std::move(m.value); print_move_created(this); }
|
124 |
-
std::string get_value() const { return std::to_string(value); }
|
125 |
-
~Movable() { print_destroyed(this); }
|
126 |
-
private:
|
127 |
-
int value;
|
128 |
-
};
|
129 |
-
|
130 |
-
class NCVirt {
|
131 |
-
public:
|
132 |
-
virtual ~NCVirt() { }
|
133 |
-
NCVirt() = default;
|
134 |
-
NCVirt(const NCVirt&) = delete;
|
135 |
-
virtual NonCopyable get_noncopyable(int a, int b) { return NonCopyable(a, b); }
|
136 |
-
virtual Movable get_movable(int a, int b) = 0;
|
137 |
-
|
138 |
-
std::string print_nc(int a, int b) { return get_noncopyable(a, b).get_value(); }
|
139 |
-
std::string print_movable(int a, int b) { return get_movable(a, b).get_value(); }
|
140 |
-
};
|
141 |
-
class NCVirtTrampoline : public NCVirt {
|
142 |
-
#if !defined(__INTEL_COMPILER)
|
143 |
-
NonCopyable get_noncopyable(int a, int b) override {
|
144 |
-
PYBIND11_OVERLOAD(NonCopyable, NCVirt, get_noncopyable, a, b);
|
145 |
-
}
|
146 |
-
#endif
|
147 |
-
Movable get_movable(int a, int b) override {
|
148 |
-
PYBIND11_OVERLOAD_PURE(Movable, NCVirt, get_movable, a, b);
|
149 |
-
}
|
150 |
-
};
|
151 |
-
|
152 |
-
struct Base {
|
153 |
-
/* for some reason MSVC2015 can't compile this if the function is pure virtual */
|
154 |
-
virtual std::string dispatch() const { return {}; };
|
155 |
-
virtual ~Base() = default;
|
156 |
-
Base() = default;
|
157 |
-
Base(const Base&) = delete;
|
158 |
-
};
|
159 |
-
|
160 |
-
struct DispatchIssue : Base {
|
161 |
-
virtual std::string dispatch() const {
|
162 |
-
PYBIND11_OVERLOAD_PURE(std::string, Base, dispatch, /* no arguments */);
|
163 |
-
}
|
164 |
-
};
|
165 |
-
|
166 |
-
static void test_gil() {
|
167 |
-
{
|
168 |
-
py::gil_scoped_acquire lock;
|
169 |
-
py::print("1st lock acquired");
|
170 |
-
|
171 |
-
}
|
172 |
-
|
173 |
-
{
|
174 |
-
py::gil_scoped_acquire lock;
|
175 |
-
py::print("2nd lock acquired");
|
176 |
-
}
|
177 |
-
|
178 |
-
}
|
179 |
-
|
180 |
-
static void test_gil_from_thread() {
|
181 |
-
py::gil_scoped_release release;
|
182 |
-
|
183 |
-
std::thread t(test_gil);
|
184 |
-
t.join();
|
185 |
-
}
|
186 |
-
|
187 |
-
|
188 |
-
// Forward declaration (so that we can put the main tests here; the inherited virtual approaches are
|
189 |
-
// rather long).
|
190 |
-
void initialize_inherited_virtuals(py::module &m);
|
191 |
-
|
192 |
-
TEST_SUBMODULE(virtual_functions, m) {
|
193 |
-
// test_override
|
194 |
-
py::class_<ExampleVirt, PyExampleVirt>(m, "ExampleVirt")
|
195 |
-
.def(py::init<int>())
|
196 |
-
/* Reference original class in function definitions */
|
197 |
-
.def("run", &ExampleVirt::run)
|
198 |
-
.def("run_bool", &ExampleVirt::run_bool)
|
199 |
-
.def("pure_virtual", &ExampleVirt::pure_virtual);
|
200 |
-
|
201 |
-
py::class_<NonCopyable>(m, "NonCopyable")
|
202 |
-
.def(py::init<int, int>());
|
203 |
-
|
204 |
-
py::class_<Movable>(m, "Movable")
|
205 |
-
.def(py::init<int, int>());
|
206 |
-
|
207 |
-
// test_move_support
|
208 |
-
#if !defined(__INTEL_COMPILER)
|
209 |
-
py::class_<NCVirt, NCVirtTrampoline>(m, "NCVirt")
|
210 |
-
.def(py::init<>())
|
211 |
-
.def("get_noncopyable", &NCVirt::get_noncopyable)
|
212 |
-
.def("get_movable", &NCVirt::get_movable)
|
213 |
-
.def("print_nc", &NCVirt::print_nc)
|
214 |
-
.def("print_movable", &NCVirt::print_movable);
|
215 |
-
#endif
|
216 |
-
|
217 |
-
m.def("runExampleVirt", [](ExampleVirt *ex, int value) { return ex->run(value); });
|
218 |
-
m.def("runExampleVirtBool", [](ExampleVirt* ex) { return ex->run_bool(); });
|
219 |
-
m.def("runExampleVirtVirtual", [](ExampleVirt *ex) { ex->pure_virtual(); });
|
220 |
-
|
221 |
-
m.def("cstats_debug", &ConstructorStats::get<ExampleVirt>);
|
222 |
-
initialize_inherited_virtuals(m);
|
223 |
-
|
224 |
-
// test_alias_delay_initialization1
|
225 |
-
// don't invoke Python dispatch classes by default when instantiating C++ classes
|
226 |
-
// that were not extended on the Python side
|
227 |
-
struct A {
|
228 |
-
A() = default;
|
229 |
-
A(const A&) = delete;
|
230 |
-
virtual ~A() {}
|
231 |
-
virtual void f() { py::print("A.f()"); }
|
232 |
-
};
|
233 |
-
|
234 |
-
struct PyA : A {
|
235 |
-
PyA() { py::print("PyA.PyA()"); }
|
236 |
-
PyA(const PyA&) = delete;
|
237 |
-
~PyA() { py::print("PyA.~PyA()"); }
|
238 |
-
|
239 |
-
void f() override {
|
240 |
-
py::print("PyA.f()");
|
241 |
-
// This convolution just gives a `void`, but tests that PYBIND11_TYPE() works to protect
|
242 |
-
// a type containing a ,
|
243 |
-
PYBIND11_OVERLOAD(PYBIND11_TYPE(typename std::enable_if<true, void>::type), A, f);
|
244 |
-
}
|
245 |
-
};
|
246 |
-
|
247 |
-
py::class_<A, PyA>(m, "A")
|
248 |
-
.def(py::init<>())
|
249 |
-
.def("f", &A::f);
|
250 |
-
|
251 |
-
m.def("call_f", [](A *a) { a->f(); });
|
252 |
-
|
253 |
-
// test_alias_delay_initialization2
|
254 |
-
// ... unless we explicitly request it, as in this example:
|
255 |
-
struct A2 {
|
256 |
-
A2() = default;
|
257 |
-
A2(const A2&) = delete;
|
258 |
-
virtual ~A2() {}
|
259 |
-
virtual void f() { py::print("A2.f()"); }
|
260 |
-
};
|
261 |
-
|
262 |
-
struct PyA2 : A2 {
|
263 |
-
PyA2() { py::print("PyA2.PyA2()"); }
|
264 |
-
PyA2(const PyA2&) = delete;
|
265 |
-
~PyA2() { py::print("PyA2.~PyA2()"); }
|
266 |
-
void f() override {
|
267 |
-
py::print("PyA2.f()");
|
268 |
-
PYBIND11_OVERLOAD(void, A2, f);
|
269 |
-
}
|
270 |
-
};
|
271 |
-
|
272 |
-
py::class_<A2, PyA2>(m, "A2")
|
273 |
-
.def(py::init_alias<>())
|
274 |
-
.def(py::init([](int) { return new PyA2(); }))
|
275 |
-
.def("f", &A2::f);
|
276 |
-
|
277 |
-
m.def("call_f", [](A2 *a2) { a2->f(); });
|
278 |
-
|
279 |
-
// test_dispatch_issue
|
280 |
-
// #159: virtual function dispatch has problems with similar-named functions
|
281 |
-
py::class_<Base, DispatchIssue>(m, "DispatchIssue")
|
282 |
-
.def(py::init<>())
|
283 |
-
.def("dispatch", &Base::dispatch);
|
284 |
-
|
285 |
-
m.def("dispatch_issue_go", [](const Base * b) { return b->dispatch(); });
|
286 |
-
|
287 |
-
// test_override_ref
|
288 |
-
// #392/397: overriding reference-returning functions
|
289 |
-
class OverrideTest {
|
290 |
-
public:
|
291 |
-
struct A { std::string value = "hi"; };
|
292 |
-
std::string v;
|
293 |
-
A a;
|
294 |
-
explicit OverrideTest(const std::string &v) : v{v} {}
|
295 |
-
OverrideTest() = default;
|
296 |
-
OverrideTest(const OverrideTest&) = delete;
|
297 |
-
virtual std::string str_value() { return v; }
|
298 |
-
virtual std::string &str_ref() { return v; }
|
299 |
-
virtual A A_value() { return a; }
|
300 |
-
virtual A &A_ref() { return a; }
|
301 |
-
virtual ~OverrideTest() = default;
|
302 |
-
};
|
303 |
-
|
304 |
-
class PyOverrideTest : public OverrideTest {
|
305 |
-
public:
|
306 |
-
using OverrideTest::OverrideTest;
|
307 |
-
std::string str_value() override { PYBIND11_OVERLOAD(std::string, OverrideTest, str_value); }
|
308 |
-
// Not allowed (uncommenting should hit a static_assert failure): we can't get a reference
|
309 |
-
// to a python numeric value, since we only copy values in the numeric type caster:
|
310 |
-
// std::string &str_ref() override { PYBIND11_OVERLOAD(std::string &, OverrideTest, str_ref); }
|
311 |
-
// But we can work around it like this:
|
312 |
-
private:
|
313 |
-
std::string _tmp;
|
314 |
-
std::string str_ref_helper() { PYBIND11_OVERLOAD(std::string, OverrideTest, str_ref); }
|
315 |
-
public:
|
316 |
-
std::string &str_ref() override { return _tmp = str_ref_helper(); }
|
317 |
-
|
318 |
-
A A_value() override { PYBIND11_OVERLOAD(A, OverrideTest, A_value); }
|
319 |
-
A &A_ref() override { PYBIND11_OVERLOAD(A &, OverrideTest, A_ref); }
|
320 |
-
};
|
321 |
-
|
322 |
-
py::class_<OverrideTest::A>(m, "OverrideTest_A")
|
323 |
-
.def_readwrite("value", &OverrideTest::A::value);
|
324 |
-
py::class_<OverrideTest, PyOverrideTest>(m, "OverrideTest")
|
325 |
-
.def(py::init<const std::string &>())
|
326 |
-
.def("str_value", &OverrideTest::str_value)
|
327 |
-
// .def("str_ref", &OverrideTest::str_ref)
|
328 |
-
.def("A_value", &OverrideTest::A_value)
|
329 |
-
.def("A_ref", &OverrideTest::A_ref);
|
330 |
-
}
|
331 |
-
|
332 |
-
|
333 |
-
// Inheriting virtual methods. We do two versions here: the repeat-everything version and the
|
334 |
-
// templated trampoline versions mentioned in docs/advanced.rst.
|
335 |
-
//
|
336 |
-
// These base classes are exactly the same, but we technically need distinct
|
337 |
-
// classes for this example code because we need to be able to bind them
|
338 |
-
// properly (pybind11, sensibly, doesn't allow us to bind the same C++ class to
|
339 |
-
// multiple python classes).
|
340 |
-
class A_Repeat {
|
341 |
-
#define A_METHODS \
|
342 |
-
public: \
|
343 |
-
virtual int unlucky_number() = 0; \
|
344 |
-
virtual std::string say_something(unsigned times) { \
|
345 |
-
std::string s = ""; \
|
346 |
-
for (unsigned i = 0; i < times; ++i) \
|
347 |
-
s += "hi"; \
|
348 |
-
return s; \
|
349 |
-
} \
|
350 |
-
std::string say_everything() { \
|
351 |
-
return say_something(1) + " " + std::to_string(unlucky_number()); \
|
352 |
-
}
|
353 |
-
A_METHODS
|
354 |
-
A_Repeat() = default;
|
355 |
-
A_Repeat(const A_Repeat&) = delete;
|
356 |
-
virtual ~A_Repeat() = default;
|
357 |
-
};
|
358 |
-
class B_Repeat : public A_Repeat {
|
359 |
-
#define B_METHODS \
|
360 |
-
public: \
|
361 |
-
int unlucky_number() override { return 13; } \
|
362 |
-
std::string say_something(unsigned times) override { \
|
363 |
-
return "B says hi " + std::to_string(times) + " times"; \
|
364 |
-
} \
|
365 |
-
virtual double lucky_number() { return 7.0; }
|
366 |
-
B_METHODS
|
367 |
-
};
|
368 |
-
class C_Repeat : public B_Repeat {
|
369 |
-
#define C_METHODS \
|
370 |
-
public: \
|
371 |
-
int unlucky_number() override { return 4444; } \
|
372 |
-
double lucky_number() override { return 888; }
|
373 |
-
C_METHODS
|
374 |
-
};
|
375 |
-
class D_Repeat : public C_Repeat {
|
376 |
-
#define D_METHODS // Nothing overridden.
|
377 |
-
D_METHODS
|
378 |
-
};
|
379 |
-
|
380 |
-
// Base classes for templated inheritance trampolines. Identical to the repeat-everything version:
|
381 |
-
class A_Tpl {
|
382 |
-
A_METHODS;
|
383 |
-
A_Tpl() = default;
|
384 |
-
A_Tpl(const A_Tpl&) = delete;
|
385 |
-
virtual ~A_Tpl() = default;
|
386 |
-
};
|
387 |
-
class B_Tpl : public A_Tpl { B_METHODS };
|
388 |
-
class C_Tpl : public B_Tpl { C_METHODS };
|
389 |
-
class D_Tpl : public C_Tpl { D_METHODS };
|
390 |
-
|
391 |
-
|
392 |
-
// Inheritance approach 1: each trampoline gets every virtual method (11 in total)
|
393 |
-
class PyA_Repeat : public A_Repeat {
|
394 |
-
public:
|
395 |
-
using A_Repeat::A_Repeat;
|
396 |
-
int unlucky_number() override { PYBIND11_OVERLOAD_PURE(int, A_Repeat, unlucky_number, ); }
|
397 |
-
std::string say_something(unsigned times) override { PYBIND11_OVERLOAD(std::string, A_Repeat, say_something, times); }
|
398 |
-
};
|
399 |
-
class PyB_Repeat : public B_Repeat {
|
400 |
-
public:
|
401 |
-
using B_Repeat::B_Repeat;
|
402 |
-
int unlucky_number() override { PYBIND11_OVERLOAD(int, B_Repeat, unlucky_number, ); }
|
403 |
-
std::string say_something(unsigned times) override { PYBIND11_OVERLOAD(std::string, B_Repeat, say_something, times); }
|
404 |
-
double lucky_number() override { PYBIND11_OVERLOAD(double, B_Repeat, lucky_number, ); }
|
405 |
-
};
|
406 |
-
class PyC_Repeat : public C_Repeat {
|
407 |
-
public:
|
408 |
-
using C_Repeat::C_Repeat;
|
409 |
-
int unlucky_number() override { PYBIND11_OVERLOAD(int, C_Repeat, unlucky_number, ); }
|
410 |
-
std::string say_something(unsigned times) override { PYBIND11_OVERLOAD(std::string, C_Repeat, say_something, times); }
|
411 |
-
double lucky_number() override { PYBIND11_OVERLOAD(double, C_Repeat, lucky_number, ); }
|
412 |
-
};
|
413 |
-
class PyD_Repeat : public D_Repeat {
|
414 |
-
public:
|
415 |
-
using D_Repeat::D_Repeat;
|
416 |
-
int unlucky_number() override { PYBIND11_OVERLOAD(int, D_Repeat, unlucky_number, ); }
|
417 |
-
std::string say_something(unsigned times) override { PYBIND11_OVERLOAD(std::string, D_Repeat, say_something, times); }
|
418 |
-
double lucky_number() override { PYBIND11_OVERLOAD(double, D_Repeat, lucky_number, ); }
|
419 |
-
};
|
420 |
-
|
421 |
-
// Inheritance approach 2: templated trampoline classes.
|
422 |
-
//
|
423 |
-
// Advantages:
|
424 |
-
// - we have only 2 (template) class and 4 method declarations (one per virtual method, plus one for
|
425 |
-
// any override of a pure virtual method), versus 4 classes and 6 methods (MI) or 4 classes and 11
|
426 |
-
// methods (repeat).
|
427 |
-
// - Compared to MI, we also don't have to change the non-trampoline inheritance to virtual, and can
|
428 |
-
// properly inherit constructors.
|
429 |
-
//
|
430 |
-
// Disadvantage:
|
431 |
-
// - the compiler must still generate and compile 14 different methods (more, even, than the 11
|
432 |
-
// required for the repeat approach) instead of the 6 required for MI. (If there was no pure
|
433 |
-
// method (or no pure method override), the number would drop down to the same 11 as the repeat
|
434 |
-
// approach).
|
435 |
-
template <class Base = A_Tpl>
|
436 |
-
class PyA_Tpl : public Base {
|
437 |
-
public:
|
438 |
-
using Base::Base; // Inherit constructors
|
439 |
-
int unlucky_number() override { PYBIND11_OVERLOAD_PURE(int, Base, unlucky_number, ); }
|
440 |
-
std::string say_something(unsigned times) override { PYBIND11_OVERLOAD(std::string, Base, say_something, times); }
|
441 |
-
};
|
442 |
-
template <class Base = B_Tpl>
|
443 |
-
class PyB_Tpl : public PyA_Tpl<Base> {
|
444 |
-
public:
|
445 |
-
using PyA_Tpl<Base>::PyA_Tpl; // Inherit constructors (via PyA_Tpl's inherited constructors)
|
446 |
-
int unlucky_number() override { PYBIND11_OVERLOAD(int, Base, unlucky_number, ); }
|
447 |
-
double lucky_number() override { PYBIND11_OVERLOAD(double, Base, lucky_number, ); }
|
448 |
-
};
|
449 |
-
// Since C_Tpl and D_Tpl don't declare any new virtual methods, we don't actually need these (we can
|
450 |
-
// use PyB_Tpl<C_Tpl> and PyB_Tpl<D_Tpl> for the trampoline classes instead):
|
451 |
-
/*
|
452 |
-
template <class Base = C_Tpl> class PyC_Tpl : public PyB_Tpl<Base> {
|
453 |
-
public:
|
454 |
-
using PyB_Tpl<Base>::PyB_Tpl;
|
455 |
-
};
|
456 |
-
template <class Base = D_Tpl> class PyD_Tpl : public PyC_Tpl<Base> {
|
457 |
-
public:
|
458 |
-
using PyC_Tpl<Base>::PyC_Tpl;
|
459 |
-
};
|
460 |
-
*/
|
461 |
-
|
462 |
-
void initialize_inherited_virtuals(py::module &m) {
|
463 |
-
// test_inherited_virtuals
|
464 |
-
|
465 |
-
// Method 1: repeat
|
466 |
-
py::class_<A_Repeat, PyA_Repeat>(m, "A_Repeat")
|
467 |
-
.def(py::init<>())
|
468 |
-
.def("unlucky_number", &A_Repeat::unlucky_number)
|
469 |
-
.def("say_something", &A_Repeat::say_something)
|
470 |
-
.def("say_everything", &A_Repeat::say_everything);
|
471 |
-
py::class_<B_Repeat, A_Repeat, PyB_Repeat>(m, "B_Repeat")
|
472 |
-
.def(py::init<>())
|
473 |
-
.def("lucky_number", &B_Repeat::lucky_number);
|
474 |
-
py::class_<C_Repeat, B_Repeat, PyC_Repeat>(m, "C_Repeat")
|
475 |
-
.def(py::init<>());
|
476 |
-
py::class_<D_Repeat, C_Repeat, PyD_Repeat>(m, "D_Repeat")
|
477 |
-
.def(py::init<>());
|
478 |
-
|
479 |
-
// test_
|
480 |
-
// Method 2: Templated trampolines
|
481 |
-
py::class_<A_Tpl, PyA_Tpl<>>(m, "A_Tpl")
|
482 |
-
.def(py::init<>())
|
483 |
-
.def("unlucky_number", &A_Tpl::unlucky_number)
|
484 |
-
.def("say_something", &A_Tpl::say_something)
|
485 |
-
.def("say_everything", &A_Tpl::say_everything);
|
486 |
-
py::class_<B_Tpl, A_Tpl, PyB_Tpl<>>(m, "B_Tpl")
|
487 |
-
.def(py::init<>())
|
488 |
-
.def("lucky_number", &B_Tpl::lucky_number);
|
489 |
-
py::class_<C_Tpl, B_Tpl, PyB_Tpl<C_Tpl>>(m, "C_Tpl")
|
490 |
-
.def(py::init<>());
|
491 |
-
py::class_<D_Tpl, C_Tpl, PyB_Tpl<D_Tpl>>(m, "D_Tpl")
|
492 |
-
.def(py::init<>());
|
493 |
-
|
494 |
-
|
495 |
-
// Fix issue #1454 (crash when acquiring/releasing GIL on another thread in Python 2.7)
|
496 |
-
m.def("test_gil", &test_gil);
|
497 |
-
m.def("test_gil_from_thread", &test_gil_from_thread);
|
498 |
-
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
spaces/CVPR/WALT/mmdet/core/bbox/iou_calculators/iou2d_calculator.py
DELETED
@@ -1,159 +0,0 @@
|
|
1 |
-
import torch
|
2 |
-
|
3 |
-
from .builder import IOU_CALCULATORS
|
4 |
-
|
5 |
-
|
6 |
-
@IOU_CALCULATORS.register_module()
|
7 |
-
class BboxOverlaps2D(object):
|
8 |
-
"""2D Overlaps (e.g. IoUs, GIoUs) Calculator."""
|
9 |
-
|
10 |
-
def __call__(self, bboxes1, bboxes2, mode='iou', is_aligned=False):
|
11 |
-
"""Calculate IoU between 2D bboxes.
|
12 |
-
|
13 |
-
Args:
|
14 |
-
bboxes1 (Tensor): bboxes have shape (m, 4) in <x1, y1, x2, y2>
|
15 |
-
format, or shape (m, 5) in <x1, y1, x2, y2, score> format.
|
16 |
-
bboxes2 (Tensor): bboxes have shape (m, 4) in <x1, y1, x2, y2>
|
17 |
-
format, shape (m, 5) in <x1, y1, x2, y2, score> format, or be
|
18 |
-
empty. If ``is_aligned `` is ``True``, then m and n must be
|
19 |
-
equal.
|
20 |
-
mode (str): "iou" (intersection over union), "iof" (intersection
|
21 |
-
over foreground), or "giou" (generalized intersection over
|
22 |
-
union).
|
23 |
-
is_aligned (bool, optional): If True, then m and n must be equal.
|
24 |
-
Default False.
|
25 |
-
|
26 |
-
Returns:
|
27 |
-
Tensor: shape (m, n) if ``is_aligned `` is False else shape (m,)
|
28 |
-
"""
|
29 |
-
assert bboxes1.size(-1) in [0, 4, 5]
|
30 |
-
assert bboxes2.size(-1) in [0, 4, 5]
|
31 |
-
if bboxes2.size(-1) == 5:
|
32 |
-
bboxes2 = bboxes2[..., :4]
|
33 |
-
if bboxes1.size(-1) == 5:
|
34 |
-
bboxes1 = bboxes1[..., :4]
|
35 |
-
return bbox_overlaps(bboxes1, bboxes2, mode, is_aligned)
|
36 |
-
|
37 |
-
def __repr__(self):
|
38 |
-
"""str: a string describing the module"""
|
39 |
-
repr_str = self.__class__.__name__ + '()'
|
40 |
-
return repr_str
|
41 |
-
|
42 |
-
|
43 |
-
def bbox_overlaps(bboxes1, bboxes2, mode='iou', is_aligned=False, eps=1e-6):
|
44 |
-
"""Calculate overlap between two set of bboxes.
|
45 |
-
|
46 |
-
If ``is_aligned `` is ``False``, then calculate the overlaps between each
|
47 |
-
bbox of bboxes1 and bboxes2, otherwise the overlaps between each aligned
|
48 |
-
pair of bboxes1 and bboxes2.
|
49 |
-
|
50 |
-
Args:
|
51 |
-
bboxes1 (Tensor): shape (B, m, 4) in <x1, y1, x2, y2> format or empty.
|
52 |
-
bboxes2 (Tensor): shape (B, n, 4) in <x1, y1, x2, y2> format or empty.
|
53 |
-
B indicates the batch dim, in shape (B1, B2, ..., Bn).
|
54 |
-
If ``is_aligned `` is ``True``, then m and n must be equal.
|
55 |
-
mode (str): "iou" (intersection over union), "iof" (intersection over
|
56 |
-
foreground) or "giou" (generalized intersection over union).
|
57 |
-
Default "iou".
|
58 |
-
is_aligned (bool, optional): If True, then m and n must be equal.
|
59 |
-
Default False.
|
60 |
-
eps (float, optional): A value added to the denominator for numerical
|
61 |
-
stability. Default 1e-6.
|
62 |
-
|
63 |
-
Returns:
|
64 |
-
Tensor: shape (m, n) if ``is_aligned `` is False else shape (m,)
|
65 |
-
|
66 |
-
Example:
|
67 |
-
>>> bboxes1 = torch.FloatTensor([
|
68 |
-
>>> [0, 0, 10, 10],
|
69 |
-
>>> [10, 10, 20, 20],
|
70 |
-
>>> [32, 32, 38, 42],
|
71 |
-
>>> ])
|
72 |
-
>>> bboxes2 = torch.FloatTensor([
|
73 |
-
>>> [0, 0, 10, 20],
|
74 |
-
>>> [0, 10, 10, 19],
|
75 |
-
>>> [10, 10, 20, 20],
|
76 |
-
>>> ])
|
77 |
-
>>> overlaps = bbox_overlaps(bboxes1, bboxes2)
|
78 |
-
>>> assert overlaps.shape == (3, 3)
|
79 |
-
>>> overlaps = bbox_overlaps(bboxes1, bboxes2, is_aligned=True)
|
80 |
-
>>> assert overlaps.shape == (3, )
|
81 |
-
|
82 |
-
Example:
|
83 |
-
>>> empty = torch.empty(0, 4)
|
84 |
-
>>> nonempty = torch.FloatTensor([[0, 0, 10, 9]])
|
85 |
-
>>> assert tuple(bbox_overlaps(empty, nonempty).shape) == (0, 1)
|
86 |
-
>>> assert tuple(bbox_overlaps(nonempty, empty).shape) == (1, 0)
|
87 |
-
>>> assert tuple(bbox_overlaps(empty, empty).shape) == (0, 0)
|
88 |
-
"""
|
89 |
-
|
90 |
-
assert mode in ['iou', 'iof', 'giou'], f'Unsupported mode {mode}'
|
91 |
-
# Either the boxes are empty or the length of boxes' last dimension is 4
|
92 |
-
assert (bboxes1.size(-1) == 4 or bboxes1.size(0) == 0)
|
93 |
-
assert (bboxes2.size(-1) == 4 or bboxes2.size(0) == 0)
|
94 |
-
|
95 |
-
# Batch dim must be the same
|
96 |
-
# Batch dim: (B1, B2, ... Bn)
|
97 |
-
assert bboxes1.shape[:-2] == bboxes2.shape[:-2]
|
98 |
-
batch_shape = bboxes1.shape[:-2]
|
99 |
-
|
100 |
-
rows = bboxes1.size(-2)
|
101 |
-
cols = bboxes2.size(-2)
|
102 |
-
if is_aligned:
|
103 |
-
assert rows == cols
|
104 |
-
|
105 |
-
if rows * cols == 0:
|
106 |
-
if is_aligned:
|
107 |
-
return bboxes1.new(batch_shape + (rows, ))
|
108 |
-
else:
|
109 |
-
return bboxes1.new(batch_shape + (rows, cols))
|
110 |
-
|
111 |
-
area1 = (bboxes1[..., 2] - bboxes1[..., 0]) * (
|
112 |
-
bboxes1[..., 3] - bboxes1[..., 1])
|
113 |
-
area2 = (bboxes2[..., 2] - bboxes2[..., 0]) * (
|
114 |
-
bboxes2[..., 3] - bboxes2[..., 1])
|
115 |
-
|
116 |
-
if is_aligned:
|
117 |
-
lt = torch.max(bboxes1[..., :2], bboxes2[..., :2]) # [B, rows, 2]
|
118 |
-
rb = torch.min(bboxes1[..., 2:], bboxes2[..., 2:]) # [B, rows, 2]
|
119 |
-
|
120 |
-
wh = (rb - lt).clamp(min=0) # [B, rows, 2]
|
121 |
-
overlap = wh[..., 0] * wh[..., 1]
|
122 |
-
|
123 |
-
if mode in ['iou', 'giou']:
|
124 |
-
union = area1 + area2 - overlap
|
125 |
-
else:
|
126 |
-
union = area1
|
127 |
-
if mode == 'giou':
|
128 |
-
enclosed_lt = torch.min(bboxes1[..., :2], bboxes2[..., :2])
|
129 |
-
enclosed_rb = torch.max(bboxes1[..., 2:], bboxes2[..., 2:])
|
130 |
-
else:
|
131 |
-
lt = torch.max(bboxes1[..., :, None, :2],
|
132 |
-
bboxes2[..., None, :, :2]) # [B, rows, cols, 2]
|
133 |
-
rb = torch.min(bboxes1[..., :, None, 2:],
|
134 |
-
bboxes2[..., None, :, 2:]) # [B, rows, cols, 2]
|
135 |
-
|
136 |
-
wh = (rb - lt).clamp(min=0) # [B, rows, cols, 2]
|
137 |
-
overlap = wh[..., 0] * wh[..., 1]
|
138 |
-
|
139 |
-
if mode in ['iou', 'giou']:
|
140 |
-
union = area1[..., None] + area2[..., None, :] - overlap
|
141 |
-
else:
|
142 |
-
union = area1[..., None]
|
143 |
-
if mode == 'giou':
|
144 |
-
enclosed_lt = torch.min(bboxes1[..., :, None, :2],
|
145 |
-
bboxes2[..., None, :, :2])
|
146 |
-
enclosed_rb = torch.max(bboxes1[..., :, None, 2:],
|
147 |
-
bboxes2[..., None, :, 2:])
|
148 |
-
|
149 |
-
eps = union.new_tensor([eps])
|
150 |
-
union = torch.max(union, eps)
|
151 |
-
ious = overlap / union
|
152 |
-
if mode in ['iou', 'iof']:
|
153 |
-
return ious
|
154 |
-
# calculate gious
|
155 |
-
enclose_wh = (enclosed_rb - enclosed_lt).clamp(min=0)
|
156 |
-
enclose_area = enclose_wh[..., 0] * enclose_wh[..., 1]
|
157 |
-
enclose_area = torch.max(enclose_area, eps)
|
158 |
-
gious = ious - (enclose_area - union) / enclose_area
|
159 |
-
return gious
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
spaces/CVPR/WALT/mmdet/core/export/__init__.py
DELETED
@@ -1,8 +0,0 @@
|
|
1 |
-
from .pytorch2onnx import (build_model_from_cfg,
|
2 |
-
generate_inputs_and_wrap_model,
|
3 |
-
preprocess_example_input)
|
4 |
-
|
5 |
-
__all__ = [
|
6 |
-
'build_model_from_cfg', 'generate_inputs_and_wrap_model',
|
7 |
-
'preprocess_example_input'
|
8 |
-
]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
spaces/CamodDew/youtubelegal/README.md
DELETED
@@ -1,12 +0,0 @@
|
|
1 |
-
---
|
2 |
-
title: Youtubelegal
|
3 |
-
emoji: 🏃
|
4 |
-
colorFrom: blue
|
5 |
-
colorTo: blue
|
6 |
-
sdk: gradio
|
7 |
-
sdk_version: 3.44.4
|
8 |
-
app_file: app.py
|
9 |
-
pinned: false
|
10 |
-
---
|
11 |
-
|
12 |
-
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
spaces/CikeyQI/meme-api/meme_generator/memes/caoshen_bite/__init__.py
DELETED
@@ -1,34 +0,0 @@
|
|
1 |
-
from pathlib import Path
|
2 |
-
from typing import List
|
3 |
-
|
4 |
-
from PIL.Image import Image as IMG
|
5 |
-
from pil_utils import BuildImage
|
6 |
-
|
7 |
-
from meme_generator import add_meme
|
8 |
-
from meme_generator.utils import save_gif
|
9 |
-
|
10 |
-
img_dir = Path(__file__).parent / "images"
|
11 |
-
|
12 |
-
|
13 |
-
def caoshen_bite(images: List[BuildImage], texts, args):
|
14 |
-
img = images[0].convert("RGBA").resize((160, 140), keep_ratio=True)
|
15 |
-
# fmt: off
|
16 |
-
locs = [
|
17 |
-
(123, 356, 158, 124), (123, 356, 158, 124), (123, 355, 158, 125),
|
18 |
-
(122, 352, 159, 128), (122, 350, 159, 130), (122, 348, 159, 132),
|
19 |
-
(122, 345, 159, 135), (121, 343, 160, 137), (121, 342, 160, 138),
|
20 |
-
(121, 341, 160, 139), (121, 341, 160, 139), (121, 342, 160, 138),
|
21 |
-
(121, 344, 160, 136), (121, 346, 160, 134), (122, 349, 159, 131),
|
22 |
-
(122, 351, 159, 129), (122, 353, 159, 127), (123, 355, 158, 125),
|
23 |
-
]
|
24 |
-
# fmt: on
|
25 |
-
frames: List[IMG] = []
|
26 |
-
for i in range(38):
|
27 |
-
frame = BuildImage.open(img_dir / f"{i}.png")
|
28 |
-
x, y, w, h = locs[i % len(locs)]
|
29 |
-
frame.paste(img.resize((w, h)), (x, y), below=True)
|
30 |
-
frames.append(frame.image)
|
31 |
-
return save_gif(frames, 0.1)
|
32 |
-
|
33 |
-
|
34 |
-
add_meme("caoshen_bite", caoshen_bite, min_images=1, max_images=1, keywords=["草神啃"])
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
spaces/CikeyQI/meme-api/meme_generator/memes/kiss/__init__.py
DELETED
@@ -1,35 +0,0 @@
|
|
1 |
-
from pathlib import Path
|
2 |
-
from typing import List
|
3 |
-
|
4 |
-
from PIL.Image import Image as IMG
|
5 |
-
from pil_utils import BuildImage
|
6 |
-
|
7 |
-
from meme_generator import add_meme
|
8 |
-
from meme_generator.utils import save_gif
|
9 |
-
|
10 |
-
img_dir = Path(__file__).parent / "images"
|
11 |
-
|
12 |
-
|
13 |
-
def kiss(images: List[BuildImage], texts, args):
|
14 |
-
self_head = images[0].convert("RGBA").circle().resize((40, 40))
|
15 |
-
user_head = images[1].convert("RGBA").circle().resize((50, 50))
|
16 |
-
# fmt: off
|
17 |
-
user_locs = [
|
18 |
-
(58, 90), (62, 95), (42, 100), (50, 100), (56, 100), (18, 120), (28, 110),
|
19 |
-
(54, 100), (46, 100), (60, 100), (35, 115), (20, 120), (40, 96)
|
20 |
-
]
|
21 |
-
self_locs = [
|
22 |
-
(92, 64), (135, 40), (84, 105), (80, 110), (155, 82), (60, 96), (50, 80),
|
23 |
-
(98, 55), (35, 65), (38, 100), (70, 80), (84, 65), (75, 65)
|
24 |
-
]
|
25 |
-
# fmt: on
|
26 |
-
frames: List[IMG] = []
|
27 |
-
for i in range(13):
|
28 |
-
frame = BuildImage.open(img_dir / f"{i}.png")
|
29 |
-
frame.paste(user_head, user_locs[i], alpha=True)
|
30 |
-
frame.paste(self_head, self_locs[i], alpha=True)
|
31 |
-
frames.append(frame.image)
|
32 |
-
return save_gif(frames, 0.05)
|
33 |
-
|
34 |
-
|
35 |
-
add_meme("kiss", kiss, min_images=2, max_images=2, keywords=["亲", "亲亲"])
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
spaces/Clatonh/moth_or_butterfly/README.md
DELETED
@@ -1,13 +0,0 @@
|
|
1 |
-
---
|
2 |
-
title: Moth Or Butterfly
|
3 |
-
emoji: 💻
|
4 |
-
colorFrom: indigo
|
5 |
-
colorTo: pink
|
6 |
-
sdk: gradio
|
7 |
-
sdk_version: 3.1.7
|
8 |
-
app_file: app.py
|
9 |
-
pinned: false
|
10 |
-
license: apache-2.0
|
11 |
-
---
|
12 |
-
|
13 |
-
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
spaces/DEEMOSTECH/ChatAvatar/static/js/main.459a2347.js
DELETED
The diff for this file is too large to render.
See raw diff
|
|
spaces/DQChoi/gpt-demo/venv/lib/python3.11/site-packages/PIL/Image.py
DELETED
The diff for this file is too large to render.
See raw diff
|
|
spaces/DQChoi/gpt-demo/venv/lib/python3.11/site-packages/fontTools/ttLib/tables/T_S_I_D_.py
DELETED
@@ -1,5 +0,0 @@
|
|
1 |
-
from .T_S_I_V_ import table_T_S_I_V_
|
2 |
-
|
3 |
-
|
4 |
-
class table_T_S_I_D_(table_T_S_I_V_):
|
5 |
-
pass
|
|
|
|
|
|
|
|
|
|
|
|
spaces/DQChoi/gpt-demo/venv/lib/python3.11/site-packages/fontTools/ttLib/tables/grUtils.py
DELETED
@@ -1,92 +0,0 @@
|
|
1 |
-
import struct, warnings
|
2 |
-
|
3 |
-
try:
|
4 |
-
import lz4
|
5 |
-
except ImportError:
|
6 |
-
lz4 = None
|
7 |
-
else:
|
8 |
-
import lz4.block
|
9 |
-
|
10 |
-
# old scheme for VERSION < 0.9 otherwise use lz4.block
|
11 |
-
|
12 |
-
|
13 |
-
def decompress(data):
|
14 |
-
(compression,) = struct.unpack(">L", data[4:8])
|
15 |
-
scheme = compression >> 27
|
16 |
-
size = compression & 0x07FFFFFF
|
17 |
-
if scheme == 0:
|
18 |
-
pass
|
19 |
-
elif scheme == 1 and lz4:
|
20 |
-
res = lz4.block.decompress(struct.pack("<L", size) + data[8:])
|
21 |
-
if len(res) != size:
|
22 |
-
warnings.warn("Table decompression failed.")
|
23 |
-
else:
|
24 |
-
data = res
|
25 |
-
else:
|
26 |
-
warnings.warn("Table is compressed with an unsupported compression scheme")
|
27 |
-
return (data, scheme)
|
28 |
-
|
29 |
-
|
30 |
-
def compress(scheme, data):
|
31 |
-
hdr = data[:4] + struct.pack(">L", (scheme << 27) + (len(data) & 0x07FFFFFF))
|
32 |
-
if scheme == 0:
|
33 |
-
return data
|
34 |
-
elif scheme == 1 and lz4:
|
35 |
-
res = lz4.block.compress(
|
36 |
-
data, mode="high_compression", compression=16, store_size=False
|
37 |
-
)
|
38 |
-
return hdr + res
|
39 |
-
else:
|
40 |
-
warnings.warn("Table failed to compress by unsupported compression scheme")
|
41 |
-
return data
|
42 |
-
|
43 |
-
|
44 |
-
def _entries(attrs, sameval):
|
45 |
-
ak = 0
|
46 |
-
vals = []
|
47 |
-
lastv = 0
|
48 |
-
for k, v in attrs:
|
49 |
-
if len(vals) and (k != ak + 1 or (sameval and v != lastv)):
|
50 |
-
yield (ak - len(vals) + 1, len(vals), vals)
|
51 |
-
vals = []
|
52 |
-
ak = k
|
53 |
-
vals.append(v)
|
54 |
-
lastv = v
|
55 |
-
yield (ak - len(vals) + 1, len(vals), vals)
|
56 |
-
|
57 |
-
|
58 |
-
def entries(attributes, sameval=False):
|
59 |
-
g = _entries(sorted(attributes.items(), key=lambda x: int(x[0])), sameval)
|
60 |
-
return g
|
61 |
-
|
62 |
-
|
63 |
-
def bininfo(num, size=1):
|
64 |
-
if num == 0:
|
65 |
-
return struct.pack(">4H", 0, 0, 0, 0)
|
66 |
-
srange = 1
|
67 |
-
select = 0
|
68 |
-
while srange <= num:
|
69 |
-
srange *= 2
|
70 |
-
select += 1
|
71 |
-
select -= 1
|
72 |
-
srange //= 2
|
73 |
-
srange *= size
|
74 |
-
shift = num * size - srange
|
75 |
-
return struct.pack(">4H", num, srange, select, shift)
|
76 |
-
|
77 |
-
|
78 |
-
def num2tag(n):
|
79 |
-
if n < 0x200000:
|
80 |
-
return str(n)
|
81 |
-
else:
|
82 |
-
return (
|
83 |
-
struct.unpack("4s", struct.pack(">L", n))[0].replace(b"\000", b"").decode()
|
84 |
-
)
|
85 |
-
|
86 |
-
|
87 |
-
def tag2num(n):
|
88 |
-
try:
|
89 |
-
return int(n)
|
90 |
-
except ValueError:
|
91 |
-
n = (n + " ")[:4]
|
92 |
-
return struct.unpack(">L", n.encode("ascii"))[0]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
spaces/DQChoi/gpt-demo/venv/lib/python3.11/site-packages/gradio/templates/cdn/assets/Login-9c3cc0eb.css
DELETED
@@ -1 +0,0 @@
|
|
1 |
-
.wrap.svelte-1ogxbi0{display:flex;flex-direction:column;justify-content:center;align-items:center;margin-top:var(--size-3);background:var(--background-fill-primary);width:var(--size-full)}h2.svelte-1ogxbi0{margin-bottom:var(--size-3);color:var(--body-text-color);font-weight:var(--section-header-text-weight);font-size:var(--text-xl)}.auth.svelte-1ogxbi0{margin-top:var(--size-1);margin-bottom:var(--size-1);color:var(--body-text-color)}.creds.svelte-1ogxbi0{margin-top:var(--size-4);margin-bottom:var(--size-4);color:var(--error-text-color);font-weight:var(--weight-semibold)}
|
|
|
|