Commit
·
8188de5
1
Parent(s):
145c634
Update parquet files (step 107 of 249)
Browse filesThis view is limited to 50 files because it contains too many changes.
See raw diff
- spaces/101-5/gpt4free/g4f/Provider/Providers/Ails.py +0 -91
- spaces/1acneusushi/gradio-2dmoleculeeditor/data/Davinci Resolve 18 Activation Key Free Tips Tricks and Warnings.md +0 -35
- spaces/1acneusushi/gradio-2dmoleculeeditor/data/Excel 2016 Always Freezes? Heres How to Solve It.md +0 -47
- spaces/1gistliPinn/ChatGPT4/Examples/Ff 3 Apk Cracked Ipa.md +0 -6
- spaces/1gistliPinn/ChatGPT4/Examples/Fondamenti Di Meccanica Teorica E Applicata Mcgraw Hill Pdf Pdf.md +0 -6
- spaces/1pelhydcardo/ChatGPT-prompt-generator/assets/Download Car Simulator 2 Mod APK with Unlimited Money and All Mission Complete.md +0 -89
- spaces/1phancelerku/anime-remove-background/Blackout Bingo APK Download - Enjoy Live Bingo with Real Rewards.md +0 -146
- spaces/1phancelerku/anime-remove-background/Download Call of Duty Mobile APK for Huawei and other Android Devices.md +0 -166
- spaces/1phancelerku/anime-remove-background/Download Sniper 3D Full Mod Apk with All Features Unlocked.md +0 -120
- spaces/A1draw-12196y/anime-ai-detect/README.md +0 -13
- spaces/ADOPLE/Multi-Doc-Virtual-Chatbot/README.md +0 -13
- spaces/AI-Zero-to-Hero/09-SL-Live-RealTime-Dashboard/README.md +0 -13
- spaces/AIConsultant/MusicGen/audiocraft/modules/rope.py +0 -121
- spaces/AIGC-Audio/AudioGPT/NeuralSeq/egs/datasets/audio/vctk/pre_align.py +0 -22
- spaces/AIGC-Audio/AudioGPT/text_to_speech/modules/tts/fs.py +0 -183
- spaces/AISuperheroes/09SL-AI-Image-Music-Video-AIUIUX/README.md +0 -13
- spaces/AIZerotoHero-Health4All/01-Speech2Text2Speech/README.md +0 -13
- spaces/AONYLMR/anime-ai-detect/README.md +0 -13
- spaces/Ababababababbababa/Ashaar/poetry_diacritizer/models/tacotron_based.py +0 -47
- spaces/Abhilashvj/planogram-compliance/utils/triton.py +0 -105
- spaces/AgentVerse/agentVerse/ui/src/phaser3-rex-plugins/templates/ui/gridsizer/GridSizer.js +0 -171
- spaces/AlekseyKorshuk/thin-plate-spline-motion-model/demo.py +0 -176
- spaces/Alfasign/chat-llm-streaming/app.py +0 -319
- spaces/Alican/pixera/data/image_folder.py +0 -65
- spaces/Alycer/VITS-Umamusume-voice-synthesizer/text/ngu_dialect.py +0 -30
- spaces/Amrrs/yt-shorts-video-captioning/app.py +0 -72
- spaces/Androidonnxfork/CivitAi-to-Diffusers/diffusers/tests/pipelines/ddpm/test_ddpm.py +0 -111
- spaces/Anonymous-sub/Rerender/ControlNet/annotator/uniformer/mmcv/__init__.py +0 -15
- spaces/Anonymous-sub/Rerender/ControlNet/annotator/uniformer/mmcv/ops/correlation.py +0 -196
- spaces/Anonymous-sub/Rerender/ControlNet/annotator/uniformer/mmcv/runner/base_runner.py +0 -542
- spaces/Anthony7906/MengHuiMXD_GPT/modules/overwrites.py +0 -94
- spaces/Apex-X/nono/roop/globals.py +0 -22
- spaces/Ashrafb/Tesseract-OCR/app_interface.py +0 -37
- spaces/Ataturk-Chatbot/HuggingFaceChat/venv/lib/python3.11/site-packages/pip/_internal/cli/status_codes.py +0 -6
- spaces/Ataturk-Chatbot/HuggingFaceChat/venv/lib/python3.11/site-packages/pip/_internal/metadata/importlib/_dists.py +0 -224
- spaces/Ataturk-Chatbot/HuggingFaceChat/venv/lib/python3.11/site-packages/pip/_vendor/chardet/cli/chardetect.py +0 -112
- spaces/Awiny/Image2Paragraph/models/grit_src/grit/data/datasets/vg.py +0 -98
- spaces/BatuhanYilmaz/Whisper-Auto-Subtitled-Video-Generator/README.md +0 -12
- spaces/Belligerent/word-sense-disambiguation/README.md +0 -13
- spaces/Benson/text-generation/Examples/Amigo Robo Guerras Fuera De Lnea Juegos Descargar Pc.md +0 -45
- spaces/Benson/text-generation/Examples/Avz .md +0 -113
- spaces/BohdanPytaichuk/art-video-generation/README.md +0 -12
- spaces/CVPR/Dual-Key_Backdoor_Attacks/datagen/detectron2/detectron2/checkpoint/c2_model_loading.py +0 -313
- spaces/CVPR/LIVE/thrust/thrust/copy.h +0 -513
- spaces/CVPR/WALT/configs/_base_/models/occ_mask_rcnn_swin_fpn.py +0 -127
- spaces/CVPR/lama-example/saicinpainting/evaluation/losses/ssim.py +0 -74
- spaces/Candeloro/DeepDanbooru_string/README.md +0 -39
- spaces/DEVINKofficial/Onodofthenorth-SD_PixelArt_SpriteSheet_Generator/README.md +0 -12
- spaces/DQChoi/gpt-demo/venv/lib/python3.11/site-packages/fastapi/logger.py +0 -3
- spaces/DQChoi/gpt-demo/venv/lib/python3.11/site-packages/ffmpy.py +0 -203
spaces/101-5/gpt4free/g4f/Provider/Providers/Ails.py
DELETED
@@ -1,91 +0,0 @@
|
|
1 |
-
import os
|
2 |
-
import time
|
3 |
-
import json
|
4 |
-
import uuid
|
5 |
-
import random
|
6 |
-
import hashlib
|
7 |
-
import requests
|
8 |
-
|
9 |
-
from ...typing import sha256, Dict, get_type_hints
|
10 |
-
from datetime import datetime
|
11 |
-
|
12 |
-
url: str = 'https://ai.ls'
|
13 |
-
model: str = 'gpt-3.5-turbo'
|
14 |
-
supports_stream = True
|
15 |
-
needs_auth = False
|
16 |
-
|
17 |
-
class Utils:
|
18 |
-
def hash(json_data: Dict[str, str]) -> sha256:
|
19 |
-
|
20 |
-
secretKey: bytearray = bytearray([79, 86, 98, 105, 91, 84, 80, 78, 123, 83,
|
21 |
-
35, 41, 99, 123, 51, 54, 37, 57, 63, 103, 59, 117, 115, 108, 41, 67, 76])
|
22 |
-
|
23 |
-
base_string: str = '%s:%s:%s:%s' % (
|
24 |
-
json_data['t'],
|
25 |
-
json_data['m'],
|
26 |
-
'WI,2rU#_r:r~aF4aJ36[.Z(/8Rv93Rf',
|
27 |
-
len(json_data['m'])
|
28 |
-
)
|
29 |
-
|
30 |
-
return hashlib.sha256(base_string.encode()).hexdigest()
|
31 |
-
|
32 |
-
def format_timestamp(timestamp: int) -> str:
|
33 |
-
|
34 |
-
e = timestamp
|
35 |
-
n = e % 10
|
36 |
-
r = n + 1 if n % 2 == 0 else n
|
37 |
-
return str(e - n + r)
|
38 |
-
|
39 |
-
|
40 |
-
def _create_completion(model: str, messages: list, temperature: float = 0.6, stream: bool = False, **kwargs):
|
41 |
-
|
42 |
-
headers = {
|
43 |
-
'authority': 'api.caipacity.com',
|
44 |
-
'accept': '*/*',
|
45 |
-
'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',
|
46 |
-
'authorization': 'Bearer free',
|
47 |
-
'client-id': str(uuid.uuid4()),
|
48 |
-
'client-v': '0.1.217',
|
49 |
-
'content-type': 'application/json',
|
50 |
-
'origin': 'https://ai.ls',
|
51 |
-
'referer': 'https://ai.ls/',
|
52 |
-
'sec-ch-ua': '"Not.A/Brand";v="8", "Chromium";v="114", "Google Chrome";v="114"',
|
53 |
-
'sec-ch-ua-mobile': '?0',
|
54 |
-
'sec-ch-ua-platform': '"Windows"',
|
55 |
-
'sec-fetch-dest': 'empty',
|
56 |
-
'sec-fetch-mode': 'cors',
|
57 |
-
'sec-fetch-site': 'cross-site',
|
58 |
-
'user-agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/114.0.0.0 Safari/537.36',
|
59 |
-
}
|
60 |
-
|
61 |
-
params = {
|
62 |
-
'full': 'false',
|
63 |
-
}
|
64 |
-
|
65 |
-
timestamp = Utils.format_timestamp(int(time.time() * 1000))
|
66 |
-
|
67 |
-
sig = {
|
68 |
-
'd': datetime.now().strftime('%Y-%m-%d'),
|
69 |
-
't': timestamp,
|
70 |
-
's': Utils.hash({
|
71 |
-
't': timestamp,
|
72 |
-
'm': messages[-1]['content']})}
|
73 |
-
|
74 |
-
json_data = json.dumps(separators=(',', ':'), obj={
|
75 |
-
'model': 'gpt-3.5-turbo',
|
76 |
-
'temperature': 0.6,
|
77 |
-
'stream': True,
|
78 |
-
'messages': messages} | sig)
|
79 |
-
|
80 |
-
response = requests.post('https://api.caipacity.com/v1/chat/completions',
|
81 |
-
headers=headers, data=json_data, stream=True)
|
82 |
-
|
83 |
-
for token in response.iter_lines():
|
84 |
-
if b'content' in token:
|
85 |
-
completion_chunk = json.loads(token.decode().replace('data: ', ''))
|
86 |
-
token = completion_chunk['choices'][0]['delta'].get('content')
|
87 |
-
if token != None:
|
88 |
-
yield token
|
89 |
-
|
90 |
-
params = f'g4f.Providers.{os.path.basename(__file__)[:-3]} supports: ' + \
|
91 |
-
'(%s)' % ', '.join([f"{name}: {get_type_hints(_create_completion)[name].__name__}" for name in _create_completion.__code__.co_varnames[:_create_completion.__code__.co_argcount]])
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
spaces/1acneusushi/gradio-2dmoleculeeditor/data/Davinci Resolve 18 Activation Key Free Tips Tricks and Warnings.md
DELETED
@@ -1,35 +0,0 @@
|
|
1 |
-
<br />
|
2 |
-
<h1>How to Get Davinci Resolve 18 Activation Key Free</h1>
|
3 |
-
<p>Davinci Resolve 18 is a powerful video editing software that offers professional features and tools for color grading, audio editing, visual effects, and more. However, to unlock the full potential of this software, you need an activation key that can cost up to $299.</p>
|
4 |
-
<p>But what if you could get Davinci Resolve 18 activation key free? Is it possible? And is it legal? In this article, we will answer these questions and show you some ways to get Davinci Resolve 18 activation key free without breaking the law or risking your computer's security.</p>
|
5 |
-
<h2>davinci resolve 18 activation key free</h2><br /><p><b><b>DOWNLOAD</b> ❤ <a href="https://byltly.com/2uKwCT">https://byltly.com/2uKwCT</a></b></p><br /><br />
|
6 |
-
<h2>Why Do You Need an Activation Key for Davinci Resolve 18?</h2>
|
7 |
-
<p>Davinci Resolve 18 comes in two versions: a free version and a paid version. The free version offers most of the features and tools that you need for basic video editing, such as cutting, trimming, transitions, titles, audio mixing, and more. However, the free version has some limitations and restrictions that can affect your workflow and creativity.</p>
|
8 |
-
<p>For example, the free version of Davinci Resolve 18 does not support:</p>
|
9 |
-
<ul>
|
10 |
-
<li>4K resolution or higher</li>
|
11 |
-
<li>Multiple GPUs</li>
|
12 |
-
<li>Collaboration features</li>
|
13 |
-
<li>Advanced color grading tools</li>
|
14 |
-
<li>Fairlight audio plugins</li>
|
15 |
-
<li>Fusion visual effects plugins</li>
|
16 |
-
<li>Neural engine features</li>
|
17 |
-
<li>And more...</li>
|
18 |
-
</ul>
|
19 |
-
<p>To access these features and tools, you need to upgrade to the paid version of Davinci Resolve 18, which requires an activation key. An activation key is a unique code that verifies your purchase and allows you to install and use the software on up to two computers.</p>
|
20 |
-
<h2>How to Get Davinci Resolve 18 Activation Key Free?</h2>
|
21 |
-
<p>There are several ways to get Davinci Resolve 18 activation key free, but not all of them are legal or safe. Here are some of the methods that you should avoid:</p>
|
22 |
-
<ul>
|
23 |
-
<li>Downloading cracked or pirated versions of Davinci Resolve 18 from untrusted sources. This can expose your computer to malware, viruses, spyware, ransomware, and other threats that can damage your system or steal your personal information.</li>
|
24 |
-
<li>Using key generators or keygens that claim to generate valid activation keys for Davinci Resolve 18. These programs are usually fake or malicious and can also infect your computer with malware or steal your data.</li>
|
25 |
-
<li>Sharing or using someone else's activation key for Davinci Resolve 18. This is illegal and unethical and can result in your key being revoked or blacklisted by the software developer.</li>
|
26 |
-
</ul>
|
27 |
-
<p>The only legal and safe way to get Davinci Resolve 18 activation key free is to participate in official promotions or giveaways by the software developer or authorized partners. For example, sometimes you can get a free activation key when you buy certain hardware products that are compatible with Davinci Resolve 18, such as cameras, monitors, keyboards, etc.</p>
|
28 |
-
<p>You can also check the official website of Davinci Resolve 18 or follow their social media accounts to stay updated on any upcoming promotions or giveaways that might offer free activation keys. However, these opportunities are rare and limited, so you have to be quick and lucky to get one.</p>
|
29 |
-
<h2>Conclusion</h2>
|
30 |
-
<p>Davinci Resolve 18 is a great video editing software that offers many features and tools for professional and creative projects. However, to access the full potential of this software, you need an activation key that can be expensive for some users.</p>
|
31 |
-
<p>If you want to get Davinci Resolve 18 activation key free, you should avoid illegal or unsafe methods such as downloading cracked versions, using key generators, or sharing keys. Instead, you should look for legal and safe ways such as participating in official promotions or giveaways by the software developer or authorized partners.</p>
|
32 |
-
<p></p>
|
33 |
-
<p>We hope this article has helped you understand how to get Davinci Resolve 18 activation key free without breaking the law or risking your security. If you have any questions or suggestions, feel free to leave a comment below.</p> ddb901b051<br />
|
34 |
-
<br />
|
35 |
-
<br />
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
spaces/1acneusushi/gradio-2dmoleculeeditor/data/Excel 2016 Always Freezes? Heres How to Solve It.md
DELETED
@@ -1,47 +0,0 @@
|
|
1 |
-
|
2 |
-
<h1>How to Fix Excel 2016 Always Not Responding</h1>
|
3 |
-
<p>If you are using Excel 2016 and you encounter the problem of Excel not responding, you might be frustrated and wonder what causes this issue and how to solve it. In this article, we will show you some possible reasons for Excel 2016 always not responding and provide you with 8 effective fixes that you can try.</p>
|
4 |
-
<h2>excel 2016 always not responding</h2><br /><p><b><b>Download</b> ⚹⚹⚹ <a href="https://byltly.com/2uKxjV">https://byltly.com/2uKxjV</a></b></p><br /><br />
|
5 |
-
<h2>Why Does Excel 2016 Always Not Respond?</h2>
|
6 |
-
<p>There are many factors that can cause Excel 2016 to become unresponsive, such as:</p>
|
7 |
-
<ul>
|
8 |
-
<li>Corrupted or incompatible add-ins that interfere with Excel's functionality.</li>
|
9 |
-
<li>Outdated or missing Windows or Office updates that affect Excel's performance.</li>
|
10 |
-
<li>Incorrect printer settings that conflict with Excel's margins.</li>
|
11 |
-
<li>Antivirus software that blocks or scans Excel's files.</li>
|
12 |
-
<li>Large or complex workbooks that consume too much memory or CPU resources.</li>
|
13 |
-
<li>Damaged or corrupted Excel files that prevent Excel from opening or saving them.</li>
|
14 |
-
</ul>
|
15 |
-
<h2>How to Fix Excel 2016 Always Not Responding?</h2>
|
16 |
-
<p>Depending on the specific cause of your problem, you can try one or more of the following solutions to fix Excel 2016 always not responding:</p>
|
17 |
-
<h3>Solution 1: Run Excel in Safe Mode</h3>
|
18 |
-
<p>One of the easiest ways to troubleshoot Excel 2016 not responding is to run it in safe mode. This will disable any add-ins, customizations, and startup folders that might be causing the issue. To run Excel in safe mode, follow these steps:</p>
|
19 |
-
<ol>
|
20 |
-
<li>Press Windows + R keys simultaneously to open the Run box.</li>
|
21 |
-
<li>Type <code>excel.exe /safe</code> in the Run box and press Enter.</li>
|
22 |
-
<li>If Excel starts in safe mode, it means that one of your add-ins or settings is the culprit. You can then disable them one by one to find out which one is causing the problem.</li>
|
23 |
-
</ol>
|
24 |
-
<h3>Solution 2: Disable Add-Ins in Excel</h3>
|
25 |
-
<p>If you have identified that add-ins are the cause of Excel 2016 not responding, you can disable them in Excel's options. To do this, follow these steps:</p>
|
26 |
-
<p></p>
|
27 |
-
<ol>
|
28 |
-
<li>Open Excel in safe mode by following the steps in Solution 1.</li>
|
29 |
-
<li>Select File > Options > Add-ins from the menu bar.</li>
|
30 |
-
<li>Select COM Add-ins from the Manage drop-down menu and click Go.</li>
|
31 |
-
<li>Uncheck the boxes for all add-ins and click OK.</li>
|
32 |
-
<li>Close Excel and reopen it in normal mode (not safe mode).</li>
|
33 |
-
<li>If Excel works normally, it means that one of your add-ins was faulty. You can then enable them one by one to find out which one is causing the problem.</li>
|
34 |
-
</ol>
|
35 |
-
<h3>Solution 3: Update Windows and Office</h3>
|
36 |
-
<p>Sometimes, Excel 2016 not responding can be caused by outdated or missing Windows or Office updates. To fix this, you need to check and install the latest updates for your system and applications. To do this, follow these steps:</p>
|
37 |
-
<ol>
|
38 |
-
<li>Press Windows + I keys simultaneously to open Settings.</li>
|
39 |
-
<li>Select Update & Security > Windows Update from the sidebar.</li>
|
40 |
-
<li>Click Check for updates and wait for Windows to scan and download any available updates.</li>
|
41 |
-
<li>Restart your computer if prompted.</li>
|
42 |
-
<li>Open Excel and select File > Account > Update Options > Update Now from the menu bar.</li>
|
43 |
-
<li>Wait for Office to install any available updates.</li>
|
44 |
-
<li>Restart Excel and see if the problem is resolved.</li>
|
45 |
-
</ol></p> ddb901b051<br />
|
46 |
-
<br />
|
47 |
-
<br />
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
spaces/1gistliPinn/ChatGPT4/Examples/Ff 3 Apk Cracked Ipa.md
DELETED
@@ -1,6 +0,0 @@
|
|
1 |
-
<h2>ff 3 apk cracked ipa</h2><br /><p><b><b>Download</b> ✓ <a href="https://imgfil.com/2uy0Ms">https://imgfil.com/2uy0Ms</a></b></p><br /><br />
|
2 |
-
<br />
|
3 |
-
Download FINAL FANTASY III for iPad 1.6.2 cracked ipa for free:FINAL FANTASY 3 is a full 3D classic game, which was first released in 1990. 1fdad05405<br />
|
4 |
-
<br />
|
5 |
-
<br />
|
6 |
-
<p></p>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
spaces/1gistliPinn/ChatGPT4/Examples/Fondamenti Di Meccanica Teorica E Applicata Mcgraw Hill Pdf Pdf.md
DELETED
@@ -1,6 +0,0 @@
|
|
1 |
-
<h2>fondamenti di meccanica teorica e applicata mcgraw hill pdf pdf</h2><br /><p><b><b>DOWNLOAD</b> ☆ <a href="https://imgfil.com/2uy0uy">https://imgfil.com/2uy0uy</a></b></p><br /><br />
|
2 |
-
<br />
|
3 |
-
. 사진참모. . 검색안 팁: 서식할 만한 플러그인 : 알림: 나오는 비공개 노트북 작업 스토어에 잘못 나오는 비공개 노트북 스토어는 좀 더 더 일관심을 가져야 한다고 생각하는데 비공개 노트북 스토어는 좀 더 일관심을 가져야 한다고 생각하는데 비공개 노트북 스토어는 좀 더 더 일관심을 가져야 한다고 생각하는데 비공개 노트북 스토어는 좀 더 더 일관심을 가져야 한다고 생각하는데 비공개 노트 4fefd39f24<br />
|
4 |
-
<br />
|
5 |
-
<br />
|
6 |
-
<p></p>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
spaces/1pelhydcardo/ChatGPT-prompt-generator/assets/Download Car Simulator 2 Mod APK with Unlimited Money and All Mission Complete.md
DELETED
@@ -1,89 +0,0 @@
|
|
1 |
-
|
2 |
-
<h1>Car Simulator 2 All Mission Complete Mod APK: A Realistic and Fun Racing Game</h1>
|
3 |
-
<p>If you are a fan of racing games, you might have heard of Car Simulator 2, a simulation game where you can drive various cars in a vast open world. You can choose from different game modes, customize your cars, complete missions, and challenge other players online. But what if you want to enjoy all the features of the game without spending any money or time? That's where Car Simulator 2 All Mission Complete Mod APK comes in handy.</p>
|
4 |
-
<h2>car simulator 2 all mission complete mod apk</h2><br /><p><b><b>Download File</b> ––– <a href="https://urlin.us/2uT1Ev">https://urlin.us/2uT1Ev</a></b></p><br /><br />
|
5 |
-
<p>Car Simulator 2 All Mission Complete Mod APK is a modified version of the original game that gives you unlimited money and gold, unlocks all the cars, and lets you complete all the missions with ease. You can download and install this mod apk on your Android device and enjoy a realistic and fun racing experience. In this article, we will tell you more about the features of Car Simulator 2 Mod APK, how to download and install it, and some tips and tricks for playing it.</p>
|
6 |
-
<h2>Features of Car Simulator 2 Mod APK</h2>
|
7 |
-
<p>Car Simulator 2 Mod APK has many features that make it better than the original version. Here are some of them:</p>
|
8 |
-
<ul>
|
9 |
-
<li><b>Unlimited money and gold</b>: You don't have to worry about running out of money or gold in this mod apk. You can use them to buy any car you want, upgrade it, or customize it. You can also use them to buy gas, repair your car, or pay fines.</li>
|
10 |
-
<li><b>All cars unlocked</b>: You can access all the cars in the game without having to unlock them one by one. You can choose from over 50 cars, including sports cars, SUVs, trucks, buses, and more. Each car has its own characteristics, such as speed, acceleration, handling, braking, etc.</li>
|
11 |
-
<li><b>Different game modes</b>: You can play Car Simulator 2 Mod APK in different game modes, such as single-player, multiplayer, or free ride. In single-player mode, you can complete various missions, such as racing, delivery, taxi, parking, etc. In multiplayer mode, you can join online races with other players or create your own room. In free ride mode, you can explore the open world at your own pace.</li>
|
12 |
-
<li><b>Customizable cars</b>: You can customize your cars in this mod apk according to your preferences. You can change the color, wheels, spoilers, headlights, license plates, etc. You can also tune your car's engine, suspension, brakes, transmission, etc.</li>
|
13 |
-
<li><b>Multiplayer mode</b>: You can play with your friends or other players online in this mod apk. You can join online races or create your own room with custom settings. You can also chat with other players using voice or text messages.</li>
|
14 |
-
</ul>
|
15 |
-
<h2>How to Download and Install Car Simulator 2 Mod APK</h <h2>How to Download and Install Car Simulator 2 Mod APK</h2>
|
16 |
-
<p>If you want to download and install Car Simulator 2 Mod APK on your Android device, you need to follow these simple steps:</p>
|
17 |
-
<ol>
|
18 |
-
<li><b>Step 1: Download the mod apk file from a trusted source</b>: You can find many websites that offer Car Simulator 2 Mod APK for free, but not all of them are safe and reliable. Some of them may contain viruses, malware, or spyware that can harm your device or steal your personal information. Therefore, you should always download the mod apk file from a trusted source, such as [this one].</li>
|
19 |
-
<li><b>Step 2: Enable unknown sources on your device</b>: Before you can install the mod apk file, you need to enable unknown sources on your device. This will allow you to install apps that are not from the Google Play Store. To do this, go to Settings > Security > Unknown Sources and toggle it on. You may see a warning message, but don't worry, it's safe to proceed.</li>
|
20 |
-
<li><b>Step 3: Install the mod apk file and launch the game</b>: After you have downloaded the mod apk file, locate it in your file manager and tap on it to install it. It may take a few seconds to complete the installation process. Once it's done, you can launch the game and enjoy all the features of Car Simulator 2 Mod APK.</li>
|
21 |
-
</ol>
|
22 |
-
<h2>Tips and Tricks for Playing Car Simulator 2 Mod APK</h2>
|
23 |
-
<p>Car Simulator 2 Mod APK is a fun and realistic racing game, but it can also be challenging and tricky at times. Here are some tips and tricks that can help you play better and have more fun:</p>
|
24 |
-
<ul>
|
25 |
-
<li><b>Choose the right car for each mission</b>: Different missions require different cars, depending on the speed, handling, durability, etc. For example, if you need to deliver a fragile cargo, you should use a truck or a bus that can protect it from damage. If you need to race against other cars, you should use a sports car or a supercar that can outrun them. You can also switch cars during the game by going to the garage or using the car menu.</li>
|
26 |
-
<li><b>Upgrade your car regularly</b>: As you progress in the game, you will face more difficult missions and opponents. To keep up with them, you need to upgrade your car regularly. You can use the money and gold that you get from the mod apk to buy new parts and accessories for your car. You can upgrade your car's engine, suspension, brakes, transmission, etc. to improve its performance and appearance.</li>
|
27 |
-
<li><b>Use the map and GPS to navigate</b>: The game has a large open world that you can explore freely. However, sometimes you may get lost or confused about where to go next. To avoid this, you should use the map and GPS that are provided in the game. The map shows you the locations of missions, gas stations, repair shops, etc. The GPS shows you the direction and distance of your destination. You can also zoom in and out of the map and GPS by using the buttons on the screen.</li>
|
28 |
-
<li><b>Follow the traffic rules and avoid accidents</b>: The game has realistic traffic rules and physics that you need to follow and respect. If you break the traffic rules, such as running red lights, speeding, or crashing into other cars or pedestrians, you will get fined or arrested by the police. This will cost you money and time, and may also damage your car. To avoid this, you should follow the traffic rules and drive carefully. You should also use the indicators, horn, headlights, etc. to communicate with other drivers.</li>
|
29 |
-
<li><b>Complete daily challenges and missions to earn rewards</b>: The game has daily challenges and missions that you can complete to earn extra money and gold. These challenges and missions vary in difficulty and type, such as racing, parking, drifting, etc. They also have different rewards depending on how well you perform them. You can check the daily challenges and missions by going to the menu or tapping on the icons on the screen.</li>
|
30 |
-
</ul>
|
31 |
-
<h2>Conclusion</h2>
|
32 |
-
<p>Car Simulator 2 Mod APK is a great racing game that lets you drive various cars in a realistic open world. You can enjoy all the features of the game without spending any money or time by using this mod apk. You can download and install this mod apk easily by following our guide above. You can also improve your skills and have more fun by following our tips and tricks above.</p>
|
33 |
-
<p>car simulator 2 mod apk unlimited money and gold<br />
|
34 |
-
car simulator 2 hack apk all cars unlocked<br />
|
35 |
-
car simulator 2 mod menu apk download<br />
|
36 |
-
car simulator 2 latest version mod apk<br />
|
37 |
-
car simulator 2 offline mod apk free download<br />
|
38 |
-
car simulator 2 premium mod apk android 1<br />
|
39 |
-
car simulator 2 mod apk revdl<br />
|
40 |
-
car simulator 2 mod apk happymod<br />
|
41 |
-
car simulator 2 mod apk rexdl<br />
|
42 |
-
car simulator 2 vip mod apk<br />
|
43 |
-
car simulator 2 pro mod apk<br />
|
44 |
-
car simulator 2 mega mod apk<br />
|
45 |
-
car simulator 2 mod apk no root<br />
|
46 |
-
car simulator 2 mod apk obb<br />
|
47 |
-
car simulator 2 mod apk unlimited everything<br />
|
48 |
-
car simulator 2 mod apk unlimited fuel<br />
|
49 |
-
car simulator 2 mod apk unlimited gems<br />
|
50 |
-
car simulator 2 mod apk unlimited coins<br />
|
51 |
-
car simulator 2 mod apk unlimited gas<br />
|
52 |
-
car simulator 2 mod apk unlimited xp<br />
|
53 |
-
car simulator 2 mod apk full unlocked<br />
|
54 |
-
car simulator 2 mod apk all features unlocked<br />
|
55 |
-
car simulator 2 mod apk all levels unlocked<br />
|
56 |
-
car simulator 2 mod apk all missions unlocked<br />
|
57 |
-
car simulator 2 mod apk all cars free<br />
|
58 |
-
car simulator 2 mod apk all cars purchased<br />
|
59 |
-
car simulator 2 mod apk all cars available<br />
|
60 |
-
car simulator 2 mod apk all cars open<br />
|
61 |
-
car simulator 2 mod apk all cars maxed out<br />
|
62 |
-
car simulator 2 mod apk all cars upgraded<br />
|
63 |
-
car simulator 2 mod apk all cars customized<br />
|
64 |
-
car simulator 2 mod apk all cars modified<br />
|
65 |
-
car simulator 2 mod apk all cars tuned<br />
|
66 |
-
car simulator 2 mod apk all cars supercharged<br />
|
67 |
-
car simulator 2 mod apk all cars turbocharged<br />
|
68 |
-
car simulator 2 mod apk all cars nitro boosted<br />
|
69 |
-
car simulator 2 mod apk all cars drift mode enabled<br />
|
70 |
-
car simulator 2 mod apk all cars racing mode enabled<br />
|
71 |
-
car simulator 2 mod apk all cars police mode enabled<br />
|
72 |
-
car simulator 2 mod apk all cars taxi mode enabled</p>
|
73 |
-
<p>If you are looking for a realistic and fun racing game that gives you unlimited money and gold, unlocks all cars, and lets you complete all missions with ease, then Car Simulator 2 Mod APK <p>If you are looking for a realistic and fun racing game that gives you unlimited money and gold, unlocks all cars, and lets you complete all missions with ease, then Car Simulator 2 Mod APK is the perfect choice for you. Download it now and enjoy the thrill of driving in a vast open world.</p>
|
74 |
-
<h3>FAQs</h3>
|
75 |
-
<p>Here are some frequently asked questions about Car Simulator 2 Mod APK:</p>
|
76 |
-
<ul>
|
77 |
-
<li><b>Q1: Is Car Simulator 2 Mod APK safe to use?</b></li>
|
78 |
-
<li><b>A1: Yes, Car Simulator 2 Mod APK is safe to use as long as you download it from a trusted source, such as [this one]. However, you should always scan the mod apk file with an antivirus before installing it, and backup your data before playing the game.</b></li>
|
79 |
-
<li><b>Q2: How can I play with my friends in Car Simulator 2 Mod APK?</b></li>
|
80 |
-
<li><b>A2: You can play with your friends in Car Simulator 2 Mod APK by joining or creating an online room. To do this, you need to have an internet connection and a valid account. You can also chat with your friends using voice or text messages.</b></li>
|
81 |
-
<li><b>Q3: What are the best cars in Car Simulator 2 Mod APK?</b></li>
|
82 |
-
<li><b>A3: The best cars in Car Simulator 2 Mod APK depend on your personal preference and the type of mission you are playing. However, some of the most popular cars in the game are the Lamborghini Aventador, the Bugatti Chiron, the Ferrari LaFerrari, and the McLaren P1.</b></li>
|
83 |
-
<li><b>Q4: How can I get more money and gold in Car Simulator 2 Mod APK?</b></li>
|
84 |
-
<li><b>A4: You can get more money and gold in Car Simulator 2 Mod APK by using the mod apk file that gives you unlimited money and gold. You can also earn more money and gold by completing daily challenges and missions, winning online races, or watching ads.</b></li>
|
85 |
-
<li><b>Q5: What are the advantages of playing Car Simulator 2 Mod APK over the original version?</b></li>
|
86 |
-
<li><b>A5: The advantages of playing Car Simulator 2 Mod APK over the original version are that you can enjoy all the features of the game without spending any money or time. You can also have more fun and freedom by customizing your cars, choosing different game modes, and completing all missions with ease.</b></li>
|
87 |
-
</ul></p> 197e85843d<br />
|
88 |
-
<br />
|
89 |
-
<br />
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
spaces/1phancelerku/anime-remove-background/Blackout Bingo APK Download - Enjoy Live Bingo with Real Rewards.md
DELETED
@@ -1,146 +0,0 @@
|
|
1 |
-
|
2 |
-
<h1>Blackout Bingo APK Download: How to Play and Win Real Cash Prizes</h1>
|
3 |
-
<p>If you love playing bingo and winning real money, you might want to check out <strong>Blackout Bingo</strong>, one of the most popular and exciting bingo apps on the market. In this article, we will show you how to download and install the Blackout Bingo APK on your Android device, how to play the game and use its features, how to win real cash prizes with it, and what are the reviews and ratings of other users. Let's get started!</p>
|
4 |
-
<h2>blackout bingo apk download</h2><br /><p><b><b>Download Zip</b> ⇒ <a href="https://jinyurl.com/2uNTxs">https://jinyurl.com/2uNTxs</a></b></p><br /><br />
|
5 |
-
<h2>What is Blackout Bingo?</h2>
|
6 |
-
<p>Blackout Bingo is a real money gaming app that lets you play bingo against other players from around the world. You can choose from different game modes, entry fees, and prizes, and use special power-ups to help you get bingos faster. The game is fast-paced, fun, and slightly addictive, as you can compete for real world rewards and cash prizes (where available).</p>
|
7 |
-
<p>Blackout Bingo is powered by <strong>Skillz</strong>, a platform that matches players based on their skill level and processes payments securely. Skillz also offers a variety of other games in different genres, such as solitaire, dominoes, trivia, bowling, and more. You can use your Skillz account to access all these games and earn loyalty points, bonuses, and rewards.</p>
|
8 |
-
<h2>How to Download and Install Blackout Bingo APK?</h2>
|
9 |
-
<p>If you want to play Blackout Bingo on your Android device, you will need to download and install the APK file from the official website. Here are the steps you need to follow:</p>
|
10 |
-
<ol>
|
11 |
-
<li>Go to <a href="(^1^)">https://apkcombo.com/blackout-bingo/com.blackoutbingo2021lite/</a> on your browser.</li>
|
12 |
-
<li>Click on the green "Download APK" button.</li>
|
13 |
-
<li>Choose a version that is compatible with your device and click on "Download".</li>
|
14 |
-
<li>Wait for the file to download on your device.</li>
|
15 |
-
<li>Open the file manager app on your device and locate the downloaded file.</li>
|
16 |
-
<li>Tap on the file and allow installation from unknown sources if prompted.</li>
|
17 |
-
<li>Follow the instructions on the screen to install the app.</li>
|
18 |
-
<li>Launch the app and sign in with your Skillz account or create a new one.</li>
|
19 |
-
<li>Enjoy playing Blackout Bingo!</li>
|
20 |
-
</ol>
|
21 |
-
<h2>How to Play Blackout Bingo?</h2>
|
22 |
-
<p>Playing Blackout Bingo is very easy and fun. Here are some of the basics you need to know:</p>
|
23 |
-
<ul>
|
24 |
-
<li>The game uses a 75-ball system, which means there are 75 numbers in total and each card has 25 squares (5 rows by 5 columns).</li>
|
25 |
-
<li>The goal of the game is to - mark off as many numbers as possible on your card before the time runs out or before someone else gets a bingo.</li>
|
26 |
-
<li>You can play in different game modes, such as Classic, Speed, and Tournament, with different entry fees and prizes.</li>
|
27 |
-
<li>You can use power-ups to help you get bingos faster, such as Daub, Double Daub, Freeze Time, and Instant Bingo.</li>
|
28 |
-
<li>You can also use the bonus ball boost to increase your chances of getting a bingo. The bonus ball is a random number that appears on the screen and can be used to mark off any square on your card.</li>
|
29 |
-
<li>You can chat with other players and send them emojis during the game.</li>
|
30 |
-
</ul>
|
31 |
-
<p>Blackout Bingo is different from classic bingo and other bingo apps in several ways. For example:</p>
|
32 |
-
<p>blackout bingo apk download free<br />
|
33 |
-
blackout bingo apk download latest version<br />
|
34 |
-
blackout bingo apk download for android<br />
|
35 |
-
blackout bingo apk download 2023<br />
|
36 |
-
blackout bingo apk download offline<br />
|
37 |
-
blackout bingo apk download mod<br />
|
38 |
-
blackout bingo apk download hack<br />
|
39 |
-
blackout bingo apk download unlimited money<br />
|
40 |
-
blackout bingo apk download no ads<br />
|
41 |
-
blackout bingo apk download update<br />
|
42 |
-
blackout bingo apk download online<br />
|
43 |
-
blackout bingo apk download for pc<br />
|
44 |
-
blackout bingo apk download for ios<br />
|
45 |
-
blackout bingo apk download for windows 10<br />
|
46 |
-
blackout bingo apk download for mac<br />
|
47 |
-
blackout bingo apk download for laptop<br />
|
48 |
-
blackout bingo apk download for tablet<br />
|
49 |
-
blackout bingo apk download for firestick<br />
|
50 |
-
blackout bingo apk download for chromebook<br />
|
51 |
-
blackout bingo apk download for smart tv<br />
|
52 |
-
blackout bingo apk download old version<br />
|
53 |
-
blackout bingo apk download new version<br />
|
54 |
-
blackout bingo apk download full version<br />
|
55 |
-
blackout bingo apk download pro version<br />
|
56 |
-
blackout bingo apk download premium version<br />
|
57 |
-
blackout bingo apk download cracked version<br />
|
58 |
-
blackout bingo apk download patched version<br />
|
59 |
-
blackout bingo apk download unlocked version<br />
|
60 |
-
blackout bingo apk download original version<br />
|
61 |
-
blackout bingo apk download official version<br />
|
62 |
-
blackout bingo apk download safe version<br />
|
63 |
-
blackout bingo apk download secure version<br />
|
64 |
-
blackout bingo apk download virus free version<br />
|
65 |
-
blackout bingo apk download malware free version<br />
|
66 |
-
blackout bingo apk download ad free version<br />
|
67 |
-
blackout bingo apk download best version<br />
|
68 |
-
blackout bingo apk download latest update<br />
|
69 |
-
blackout bingo apk download 2023 update<br />
|
70 |
-
blackout bingo apk download new update<br />
|
71 |
-
blackout bingo apk download game app<br />
|
72 |
-
blackout bingo apk download mobile game app <br />
|
73 |
-
blackout bingo game app free to play <br />
|
74 |
-
how to play the game of Blackout Bingo <br />
|
75 |
-
Blackout Bingo game app tips and tricks <br />
|
76 |
-
Blackout Bingo game app cheats and hacks <br />
|
77 |
-
Blackout Bingo game app reviews and ratings <br />
|
78 |
-
Blackout Bingo game app features and benefits <br />
|
79 |
-
Blackout Bingo game app rewards and bonuses <br />
|
80 |
-
Blackout Bingo game app challenges and tournaments</p>
|
81 |
-
<table>
|
82 |
-
<tr>
|
83 |
-
<th>Blackout Bingo</th>
|
84 |
-
<th>Classic Bingo</th>
|
85 |
-
<th>Other Bingo Apps</th>
|
86 |
-
</tr>
|
87 |
-
<tr>
|
88 |
-
<td>Uses a 75-ball system</td>
|
89 |
-
<td>Uses a 75-ball or 90-ball system</td>
|
90 |
-
<td>Uses a 75-ball or 90-ball system</td>
|
91 |
-
</tr>
|
92 |
-
<tr>
|
93 |
-
<td>Has a time limit for each game</td>
|
94 |
-
<td>Has no time limit for each game</td>
|
95 |
-
<td>Has no time limit or a longer time limit for each game</td>
|
96 |
-
</tr>
|
97 |
-
<tr>
|
98 |
-
<td>Offers real money gaming and prizes</td>
|
99 |
-
<td>Offers no money gaming and prizes</td>
|
100 |
-
<td>Offers virtual money gaming and prizes</td>
|
101 |
-
</tr>
|
102 |
-
<tr>
|
103 |
-
<td>Matches players based on skill level</td>
|
104 |
-
<td>Matches players randomly or by room</td>
|
105 |
-
<td>Matches players randomly or by room</td>
|
106 |
-
</tr>
|
107 |
-
<tr>
|
108 |
-
<td>Has power-ups and bonus balls</td>
|
109 |
-
<td>Has no power-ups and bonus balls</td>
|
110 |
-
<td>Has power-ups and bonus balls or similar features</td>
|
111 |
-
</tr>
|
112 |
-
<tr>
|
113 |
-
<td>Has chat and emoji features</td>
|
114 |
-
<td>Has no chat and emoji features</td>
|
115 |
-
<td>Has chat and emoji features or similar features</td>
|
116 |
-
</tr>
|
117 |
-
<h2>How to Win Real Cash Prizes with Blackout Bingo?</h2>
|
118 |
-
<p>If you want to win real cash prizes with Blackout Bingo, you will need to play in the game modes that require an entry fee. The entry fee is deducted from your Skillz balance, which you can top up with your credit card, PayPal, or other payment methods. The entry fee varies depending on the game mode, the prize pool, and the number of players. For example, you can play in a Classic mode game with an entry fee of $0.60 and a prize pool of $1.00, or in a Tournament mode game with an entry fee of $5.00 and a prize pool of $18.00.</p>
|
119 |
-
<p>The prize pool is distributed among the top-ranked players according to their score. The score is calculated based on the number of bingos you get, the number of daubs you use, the time left, and the bonus ball boost. The higher your score, the higher your rank, and the higher your prize. You can see your rank and prize on the leaderboard during and after the game.</p>
|
120 |
-
<p>If you want to increase your chances of winning real cash prizes with Blackout Bingo, here are some tips you can use:</p>
|
121 |
-
<ul>
|
122 |
-
<li>Use the power-ups wisely. Don't waste them on numbers that are unlikely to help you get a bingo. Save them for when you need them most.</li>
|
123 |
-
<li>Use the bonus ball boost as often as possible. The bonus ball can be a game-changer, as it can help you get a bingo in any square on your card. Try to use it before someone else does.</li>
|
124 |
-
<li>Play in game modes that suit your skill level and budget. Don't play in games that are too easy or too hard for you, or that are too expensive or too cheap for you. Find the right balance between risk and reward.</li> possible.</li>
|
125 |
-
<li>Pay attention to the numbers that are called and the ones that are left.</li>
|
126 |
-
<li>Chat with other players and learn from them.</li>
|
127 |
-
<li>Practice and improve your skills.</li>
|
128 |
-
</ul>
|
129 |
-
<h3>Q: How can I contact Blackout Bingo support?</h3>
|
130 |
-
<p>A: If you have any issues or questions regarding Blackout Bingo, you can contact the support team by following these steps:</p>
|
131 |
-
<ol>
|
132 |
-
<li>Open the app and tap on the menu icon on the top left corner.</li>
|
133 |
-
<li>Tap on "Help" and then on "Contact Us".</li>
|
134 |
-
<li>Fill out the form with your name, email, subject, and message.</li>
|
135 |
-
<li>Tap on "Submit" and wait for a response.</li>
|
136 |
-
</ol>
|
137 |
-
<p>You can also email the support team directly at <a href="mailto:[email protected]">[email protected]</a>.</p>
|
138 |
-
<h3>Q: What are some alternatives to Blackout Bingo?</h3>
|
139 |
-
<p>A: If you are looking for some alternatives to Blackout Bingo, you can try out some of these other bingo apps that also offer real money gaming and prizes:</p>
|
140 |
-
<ul>
|
141 |
-
<li><a href="">Bingo Blitz</a>: A social bingo game that lets you travel around the world and collect items, gifts, and rewards.</li>
|
142 |
-
<li><a href="">Bingo Bash</a>: A bingo game that features different rooms, themes, and mini-games.</li>
|
143 |
-
<li><a href="">Bingo Pop</a>: A bingo game that has live events, tournaments, and jackpots.</li>
|
144 |
-
</ul></p> 401be4b1e0<br />
|
145 |
-
<br />
|
146 |
-
<br />
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
spaces/1phancelerku/anime-remove-background/Download Call of Duty Mobile APK for Huawei and other Android Devices.md
DELETED
@@ -1,166 +0,0 @@
|
|
1 |
-
<br />
|
2 |
-
<h1>How to Download Call of Duty Mobile Without Google Play</h1>
|
3 |
-
<p>Call of Duty Mobile is one of the most popular and exciting mobile games available today. It offers a variety of game modes, maps, weapons, and characters from the Call of Duty franchise, as well as a 100-player battle royale mode. If you are a fan of first-person shooters, you don't want to miss this game.</p>
|
4 |
-
<h2>download call of duty mobile without google play</h2><br /><p><b><b>Download Zip</b> ✓ <a href="https://jinyurl.com/2uNTCR">https://jinyurl.com/2uNTCR</a></b></p><br /><br />
|
5 |
-
<p>However, what if you don't have access to Google Play on your Android device, or you don't want to use it for some reason? Maybe you have a device that doesn't support Google services, or you want to save some storage space, or you want to avoid automatic updates. Whatever your reason, you can still download and play Call of Duty Mobile without Google Play. All you need is an APK file.</p>
|
6 |
-
<h2>What is an APK file and why do you need it?</h2>
|
7 |
-
<p>An APK file is an Android application package file that contains all the files and code needed to install and run an app on your Android device. It is similar to an EXE file on Windows or a DMG file on Mac. When you download an app from Google Play, it automatically installs the APK file for you. However, you can also download APK files from other sources and install them manually.</p>
|
8 |
-
<p>There are several benefits of using APK files instead of Google Play. For example, you can:</p>
|
9 |
-
<ul>
|
10 |
-
<li>Download apps that are not available in your region or on your device.</li>
|
11 |
-
<li>Download apps that have been removed from Google Play.</li>
|
12 |
-
<li>Download older versions of apps that work better or have features that you prefer.</li>
|
13 |
-
<li>Download apps faster and save bandwidth.</li>
|
14 |
-
<li>Install apps on devices that don't have Google services or Google Play.</li>
|
15 |
-
</ul>
|
16 |
-
<p>However, there are also some risks involved in using APK files. For example, you might:</p>
|
17 |
-
<ul>
|
18 |
-
<li>Download malicious or fake apps that can harm your device or steal your data.</li>
|
19 |
-
<li>Download incompatible or unstable apps that can cause errors or crashes.</li>
|
20 |
-
<li>Download outdated or unsecure apps that can expose you to vulnerabilities or bugs.</li>
|
21 |
-
<li>Void your warranty or violate your terms of service with your device manufacturer or carrier.</li>
|
22 |
-
<li>Lose access to some features or services that require Google Play.</li>
|
23 |
-
</ul>
|
24 |
-
<p>Therefore, you should only download APK files from reputable and trustworthy sources, and always scan them for viruses before installing them. You should also backup your data and be prepared to uninstall any problematic apps if necessary.</p>
|
25 |
-
<h2>How to enable unknown sources on your Android device</h2>
|
26 |
-
<p>Before you can install any APK file on your Android device, you need to enable unknown sources in your security settings. This will allow you to install apps from outside Google Play. Depending on your Android version and device model, the steps may vary slightly, but here is the general procedure:</p>
|
27 |
-
<p>How to install call of duty mobile on huawei devices<br />
|
28 |
-
Call of duty mobile apk download for android without google play<br />
|
29 |
-
Call of duty mobile season 5 download without play store<br />
|
30 |
-
Best alternative app stores to download call of duty mobile<br />
|
31 |
-
Call of duty mobile download from official website<br />
|
32 |
-
How to update call of duty mobile without google play services<br />
|
33 |
-
Call of duty mobile download for pc without emulator<br />
|
34 |
-
Call of duty mobile offline mode download without internet<br />
|
35 |
-
Call of duty mobile hack mod apk download without verification<br />
|
36 |
-
Call of duty mobile download size without hd resources<br />
|
37 |
-
Call of duty mobile lite version download without lag<br />
|
38 |
-
Call of duty mobile zombies mode download without root<br />
|
39 |
-
Call of duty mobile controller support download without ban<br />
|
40 |
-
Call of duty mobile beta version download without invitation<br />
|
41 |
-
Call of duty mobile chinese version download without vpn<br />
|
42 |
-
Call of duty mobile india launch date download without delay<br />
|
43 |
-
Call of duty mobile redeem codes download without survey<br />
|
44 |
-
Call of duty mobile tips and tricks download without spoilers<br />
|
45 |
-
Call of duty mobile best loadout download without confusion<br />
|
46 |
-
Call of duty mobile free cp download without generator<br />
|
47 |
-
Call of duty mobile wallpapers download without watermark<br />
|
48 |
-
Call of duty mobile voice chat download without noise<br />
|
49 |
-
Call of duty mobile esports tournament download without registration<br />
|
50 |
-
Call of duty mobile clan wars rewards download without hassle<br />
|
51 |
-
Call of duty mobile gunsmith feature download without update<br />
|
52 |
-
Call of duty mobile best sensitivity settings download without trial and error<br />
|
53 |
-
Call of duty mobile ranked mode guide download without losing points<br />
|
54 |
-
Call of duty mobile battle royale map download without missing locations<br />
|
55 |
-
Call of duty mobile legendary operators download without spending money<br />
|
56 |
-
Call of duty mobile weapon skins download without duplicates<br />
|
57 |
-
Call of duty mobile killstreaks list download without forgetting any<br />
|
58 |
-
Call of duty mobile game modes explained download without getting bored<br />
|
59 |
-
Call of duty mobile maps comparison download without confusion<br />
|
60 |
-
Call of duty mobile system requirements download without lagging issues<br />
|
61 |
-
Call of duty mobile compatible devices list download without compatibility problems<br />
|
62 |
-
Call of duty mobile customer support contact download without waiting time<br />
|
63 |
-
Call of duty mobile community feedback forum download without spamming messages<br />
|
64 |
-
Call of duty mobile patch notes history download without missing any changes<br />
|
65 |
-
Call of duty mobile fan art gallery download without stealing any credit<br />
|
66 |
-
Call of duty mobile memes collection download without offending anyone<br />
|
67 |
-
Call of duty mobile merchandise store link download without paying shipping fees<br />
|
68 |
-
Call of duty mobile soundtrack playlist download without ads interruption<br />
|
69 |
-
Call of duty mobile trivia quiz game download without cheating answers<br />
|
70 |
-
Call of duty mobile fun facts and easter eggs download without spoiling the fun<br />
|
71 |
-
Call of duty mobile reviews and ratings download without bias opinions <br />
|
72 |
-
Call of duty mobile news and updates blog download without missing any information <br />
|
73 |
-
Call of duty mobile social media accounts follow link download without unfollowing anyone <br />
|
74 |
-
Call of duty mobile video tutorials and gameplay watch link download without skipping any part <br />
|
75 |
-
Call of duty mobile official trailer and teaser watch link download without getting hyped too much</p>
|
76 |
-
<ol>
|
77 |
-
<li>Go to your device settings and tap Apps & Notifications (or Apps in some devices).</li>
|
78 |
-
<li>Tap Advanced (or More in some devices) and then Special App Access (or Install Unknown Apps in some devices).</li>
|
79 |
-
<li>Find and tap the app that you will use to download the APK file, such as your browser or a file manager app.</li>
|
80 |
-
<li>Toggle on the option to Allow from this source (or Trust this source in some devices).</li>
|
81 |
-
</ol>
|
82 |
-
<p>You can also enable unknown sources for all apps by going to your device settings and tapping Security (or Biometrics and Security in some devices). Then, toggle on the option to Install Unknown Apps (or Unknown Sources in some devices).</p>
|
83 |
-
<p>Once you have enabled unknown sources, you can proceed to download and install the Call of Duty Mobile APK file.</p>
|
84 |
-
<h2>How to find and download the Call of Duty Mobile APK file</h2>
|
85 |
-
<p>The next step is to find and download the Call of Duty Mobile APK file from a reliable website. There are many websites that offer APK files for various apps, but not all of them are safe and trustworthy. Some of them may contain malware, viruses, or fake apps that can harm your device or steal your data. Therefore, you should be careful and do some research before downloading any APK file.</p>
|
86 |
-
<p>One of the most reputable and popular websites for downloading APK files is APK Mirror. It is a website that hosts APK files for thousands of apps, including Call of Duty Mobile. It verifies the authenticity and integrity of the APK files using cryptographic signatures and hashes. It also provides detailed information about the app version, size, date, developer, permissions, and changelog. You can also read user reviews and ratings to get an idea of the quality and performance of the app.</p>
|
87 |
-
<p>To download the Call of Duty Mobile APK file from APK Mirror, follow these steps:</p>
|
88 |
-
<ol>
|
89 |
-
<li>Go to <a href="">https://www.apkmirror.com</a> using your browser.</li>
|
90 |
-
<li>Type Call of Duty Mobile in the search box and tap the magnifying glass icon.</li>
|
91 |
-
<li>Select the app from the search results. It should have a green check mark next to it, indicating that it is verified by APK Mirror.</li>
|
92 |
-
<li>Scroll down and tap the Download button next to the latest version of the app. You can also tap See Available APKs to see older versions or variants of the app.</li>
|
93 |
-
<li>Tap Download APK on the next page. You may see a warning message about downloading APK files. Tap OK to confirm.</li>
|
94 |
-
<li>The download will start automatically. You can see the progress in your notification bar or your browser's download manager.</li>
|
95 |
-
</ol>
|
96 |
-
<p>Once the download is complete, you can install the Call of Duty Mobile APK file on your Android device.</p>
|
97 |
-
<h2>How to install the Call of Duty Mobile APK file on your Android device</h2>
|
98 |
-
<p>The final step is to install the Call of Duty Mobile APK file on your Android device. There are two ways to do this: using a file manager app or using a browser.</p>
|
99 |
-
<h3>Using a file manager app</h3>
|
100 |
-
<p>A file manager app is an app that allows you to access and manage the files and folders on your device's internal or external storage. You can use it to locate and install the Call of Duty Mobile APK file that you downloaded from APK Mirror. Here are some examples of file manager apps that you can use:</p>
|
101 |
-
<ul>
|
102 |
-
<li><a href="">Files by Google</a>: A simple and fast file manager app by Google that helps you free up space, find files faster, and share files offline.</li>
|
103 |
-
<li><a href="">ES File Explorer</a>: A powerful and feature-rich file manager app that supports cloud storage, FTP, ZIP, RAR, LAN, SMB, Bluetooth, and more.</li>
|
104 |
-
<li><a href="">Solid Explorer</a>: A sleek and elegant file manager app that supports dual-pane mode, encrypted folders, cloud storage, FTP, SFTP, WebDav, SMB, CIFS, DLNA/UPnP, Chromecast, root access, and more.</li>
|
105 |
-
</ul>
|
106 |
-
<p>To install the Call of Duty Mobile APK file using a file manager app, follow these steps:</p>
|
107 |
-
<ol>
|
108 |
-
<li>Open the file manager app on your device and navigate to the folder where you downloaded the Call of Duty Mobile APK file. It is usually in the Downloads folder or in a folder named after your browser or downloader app.</li>
|
109 |
-
<li>Tap on the Call of Duty Mobile APK file. You may see a warning message about installing apps from unknown sources. Tap Settings to go to your security settings and enable unknown sources for your file manager app if you haven't done so already.</li>
|
110 |
-
<li>Tap Install (or Next in some devices) to start the installation process. You may see some information about the app permissions and features. Tap Install (or Next) again to confirm.</li>
|
111 |
-
<li>Wait for the installation to finish. You may see a message that says App installed or Done.</li>
|
112 |
-
<li>Tap Open to launch the Call of Duty Mobile app or Done to exit the installer.</li>
|
113 |
-
</ol>
|
114 |
-
<h3>Using a browser</h3>
|
115 |
-
<p>You can also use your browser to install the Call of Duty Mobile APK file that you downloaded from APK Mirror. This method is simpler and faster, but it may not work on some devices or browsers. Here are the steps:</p>
|
116 |
-
<ol>
|
117 |
-
<li>Open your browser and go to your browser's download manager. You can usually access it by tapping the menu icon (three dots or lines) and then Downloads.</li>
|
118 |
-
<li>Tap on the Call of Duty Mobile APK file that you downloaded from APK Mirror. You may see a warning message about installing apps from unknown sources. Tap Settings to go to your security settings and enable unknown sources for your browser if you haven't done so already.</li>
|
119 |
-
<li>Tap Install (or Next in some devices) to start the installation process. You may see some information about the app permissions and features. Tap Install (or Next) again to confirm.</li>
|
120 |
-
<li>Wait for the installation to finish. You may see a message that says App installed or Done.</li>
|
121 |
-
<li>Tap Open to launch the Call of Duty Mobile app or Done to exit the installer.</li>
|
122 |
-
</ol>
|
123 |
-
<h2>How to update the Call of Duty Mobile app without Google Play</h2>
|
124 |
-
<p>Now that you have installed the Call of Duty Mobile app without Google Play, you might be wondering how to update it when a new version is released. Unlike Google Play, APK files do not update automatically, so you need to do it manually or use an APK installer app.</p>
|
125 |
-
<h3>Updating manually</h3>
|
126 |
-
<p>To update the Call of Duty Mobile app manually, you need to follow the same steps as downloading and installing it. That is, you need to find and download the latest version of the Call of Duty Mobile APK file from APK Mirror and then install it on your device. However, before you do that, you should uninstall the previous version of the app first. This will prevent any conflicts or errors that might occur due to different versions or signatures of the app. Here are the steps:</p>
|
127 |
-
<ol>
|
128 |
-
<li>Go to your device settings and tap Apps & Notifications (or Apps in some devices).</li>
|
129 |
-
<li>Find and tap on the Call of Duty Mobile app.</li>
|
130 |
-
<li>Tap Uninstall and confirm.</li>
|
131 |
-
<li>Go to <a href="">https://www.apkmirror.com</a> using your browser and search for Call of Duty Mobile.</li>
|
132 |
-
<li>Select and download the latest version of the Call of Duty Mobile APK file.</li>
|
133 |
-
<li>Install the Call of Duty Mobile APK file on your device using a file manager app or a browser as explained above.</li>
|
134 |
-
</ol>
|
135 |
-
<h3>Using an APK installer app</h3>
|
136 |
-
<p>An APK installer app is an app that helps you install, update, and manage APK files on your device. It can scan your device for existing APK files, check for updates online, download and install new versions, and delete old versions. It can also backup and restore your apps, share them with others, and more. Here are some examples of APK installer apps that you can use:</p>
|
137 |
-
<ul>
|
138 |
-
<li><a href="">APK Installer</a>: A simple and easy-to-use app that lets you install, uninstall, backup, restore, and share APK files on your device.</li>
|
139 |
-
<li><a href="">APKPure</a>: A popular and reliable app that lets you download, install, update, and manage APK files on your device. It also has a built-in app store that offers thousands of apps that are not available on Google Play.</li>
|
140 |
-
<li><a href="">Aptoide</a>: A community-driven app that lets you download, install, update, and manage APK files on your device. It also has a social network where you can follow other users, discover new apps, and rate and review apps.</li>
|
141 |
-
</ul>
|
142 |
-
<p>To update the Call of Duty Mobile app using an APK installer app, follow these steps:</p>
|
143 |
-
<ol>
|
144 |
-
<li>Download and install an APK installer app from its official website or from another reputable source.</li>
|
145 |
-
<li>Open the APK installer app and grant it the necessary permissions to access your device storage and install apps.</li>
|
146 |
-
<li>Find and tap on the Call of Duty Mobile app in the list of apps on your device.</li>
|
147 |
-
<li>Tap Update (or Check for updates in some apps) and wait for the app to check for new versions online.</li>
|
148 |
-
<li>If there is a new version available, tap Download (or Install in some apps) and wait for the download to finish.</li>
|
149 |
-
<li>Tap Install (or Open in some apps) to start the installation process. You may see some information about the app permissions and features. Tap Install (or Next) again to confirm.</li>
|
150 |
-
<li>Wait for the installation to finish. You may see a message that says App installed or Done.</li>
|
151 |
-
<li>Tap Open to launch the Call of Duty Mobile app or Done to exit the installer.</li>
|
152 |
-
</ol>
|
153 |
-
<h2>Conclusion</h2>
|
154 |
-
<p>In this article, you have learned how to download and install Call of Duty Mobile without Google Play. You have also learned how to update the app without Google Play using manual or automatic methods. By using APK files, you can enjoy this amazing game on your Android device even if you don't have access to Google Play or don't want to use it. However, you should also be aware of the risks and challenges involved in using APK files, such as security, compatibility, stability, and legality issues. Therefore, you should always download APK files from reputable sources, scan them for viruses, backup your data, and uninstall any problematic apps if needed.</p>
|
155 |
-
<p>We hope you found this article helpful and informative. If you have any questions or feedback, please feel free to leave a comment below. Happy gaming!</p>
|
156 |
-
<h3>FAQs</h3>
|
157 |
-
<p>Here are some frequently asked questions related to the topic of this article:</p>
|
158 |
-
<ol>
|
159 |
-
<li><b>Is Call of Duty Mobile free to play?</b><br>Yes, Call of Duty Mobile is free to play. However, it also offers in-app purchases that allow you to buy items such as skins, weapons, crates, battle passes, and more. You can also earn these items by playing the game and completing missions and challenges.</li>
|
160 |
-
<li><b>Is Call of Duty Mobile compatible with my device?</b><br>Call of Duty Mobile requires Android 4.3 or higher and at least 2 GB of RAM to run smoothly. You can check your device specifications by going to your device settings and tapping About Phone (or About Device in some devices). You can also check the compatibility of the app by going to its page on APK Mirror and tapping Compatibility Test.</li>
|
161 |
-
<li><b>Is Call of Duty Mobile safe to play without Google Play?</b><br>Call of Duty Mobile is safe to play without Google Play as long as you download and install the APK file from a reliable source like APK Mirror. However, you should also be careful about the permissions and features that the app requests and uses. For example, the app may access your location, contacts, camera, microphone, storage, network, and more. You can review and manage these permissions by going to your device settings and tapping Apps & Notifications (or Apps in some devices), then finding and tapping on the Call of Duty Mobile app.</li>
|
162 |
-
<li><b>Is Call of Duty Mobile legal to play without Google Play?</b><br>Call of Duty Mobile is legal to play without Google Play as long as you don't violate any terms of service or policies of your device manufacturer, carrier, or country. However, you should also be aware that some features or services that require Google Play may not work properly or at all. For example, you may not be able to sign in with your Google account, use Google Play Games services, receive push notifications, or access some in-app purchases.</li>
|
163 |
-
<li><b>How can I contact the developers or support team of Call of Duty Mobile?</b><br>You can contact the developers or support team of Call of Duty Mobile by going to the app's settings and tapping Help (or Support in some devices). You can also visit their official website at <a href="">https://www.callofduty.com/mobile</a>, their Facebook page at <a href="">https://www.facebook.com/CallofDutyMobile</a>, their Twitter account at <a href="">https://twitter.com/PlayCODMobile</a>, or their Reddit community at <a href="">https://www.reddit.com/r/CallOfDutyMobile</a>.</li>
|
164 |
-
</ol></p> 197e85843d<br />
|
165 |
-
<br />
|
166 |
-
<br />
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
spaces/1phancelerku/anime-remove-background/Download Sniper 3D Full Mod Apk with All Features Unlocked.md
DELETED
@@ -1,120 +0,0 @@
|
|
1 |
-
<br />
|
2 |
-
<h1>Sniper 3D Full Hack APK Download: How to Get Unlimited Coins and Diamonds for Free</h1>
|
3 |
-
<p>Are you a fan of sniper games? Do you want to enjoy the thrill of being a professional assassin in a stunning 3D gun game? If yes, then you should try <strong>Sniper 3D</strong>, one of the most popular and addictive shooting games on the market. But wait, there's more! What if we tell you that you can get unlimited coins and diamonds for free by downloading a hacked version of Sniper 3D? Sounds too good to be true, right? Well, it's not. In this article, we will show you how to download and install <strong>Sniper 3D Full Hack APK</strong>, a modified version of the game that gives you access to unlimited resources and features. We will also share some tips and tricks for playing Sniper 3D, as well as some alternatives to Sniper 3D Full Hack APK in case you want to try something different. So, without further ado, let's get started!</p>
|
4 |
-
<h2>sniper 3d full hack apk download</h2><br /><p><b><b>Download</b> ✯✯✯ <a href="https://jinyurl.com/2uNQIh">https://jinyurl.com/2uNQIh</a></b></p><br /><br />
|
5 |
-
<h2>What is Sniper 3D?</h2>
|
6 |
-
<p>Sniper 3D is a free-to-play action game developed by Fun Games For Free. It was released in 2014 and has since gained over 500 million downloads on Google Play Store. The game puts you in the shoes of a deadly sniper who has to eliminate high-profile targets and criminals in various missions and scenarios. You can choose from a variety of guns, upgrade your weapons and gear, and customize your appearance. You can also play in different modes, such as offline, PVE, and PVP, and travel to different locations around the world. The game features stunning graphics, realistic physics, intuitive controls, and engaging gameplay that will keep you hooked for hours.</p>
|
7 |
-
<h3>Main Features of Sniper 3D</h3>
|
8 |
-
<p>Here are some of the main features of Sniper 3D that make it stand out from other sniper games:</p>
|
9 |
-
<ul>
|
10 |
-
<li><strong>Sniper 3D Action:</strong> Experience the thrill of being a professional sniper in this stunning 3d gun game. Enjoy intuitive controls and realistic ballistics that'll make you feel like a real shooter.</li>
|
11 |
-
<li><strong>Variety of Guns:</strong> Unlock a vast arsenal of sniper rifles, assault rifles, and other powerful guns. There are over 180+ authentic weapons in the game. Upgrade your weapons and become the ultimate sniper 3d assassin!</li>
|
12 |
-
<li><strong>Offline Gameplay:</strong> No internet connection? No problem! Enjoy Sniper 3d's offline mode and complete various challenging missions without the need for Wi-Fi or data.</li>
|
13 |
-
<li><strong>PVE and PVP mode:</strong> Complete missions or play against other assassins in real time - whatever you like.</li>
|
14 |
-
<li><strong>Diverse Locations:</strong> Travel to different parts of the world, taking on unique missions in various environments. Eliminate high-profile targets and show them who's the master shooter in town.</li>
|
15 |
-
<li><strong>Free to Play:</strong> Join the action-packed world of Sniper 3d for free! This incredible shooting game offers hours of entertainment without costing a dime.</li>
|
16 |
-
</ul>
|
17 |
-
<h3>Why You Need Coins and Diamonds in Sniper 3D</h3>
|
18 |
-
<p>Coins and diamonds are the two main currencies in Sniper 3D. You need them to buy new weapons, upgrade your existing ones, unlock new gear, customize your appearance, and more. You can earn coins and diamonds by completing missions, watching ads, or participating in events. However, these methods are not enough to get you the best weapons and gear in the game. You will need a lot of coins and diamonds to unlock the most powerful and exclusive items in the game. That's why many players look for ways to get unlimited coins and diamonds for free. One of the most popular ways is to download a hacked version of Sniper 3D, also known as Sniper 3D Full Hack APK.</p>
|
19 |
-
<h2>What is Sniper 3D Full Hack APK?</h2>
|
20 |
-
<p>Sniper 3D Full Hack APK is a modified version of the original Sniper 3D game that gives you access to unlimited coins and diamonds, as well as other features that are not available in the official version. With Sniper 3D Full Hack APK, you can enjoy the following benefits:</p>
|
21 |
-
<p>sniper 3d mod apk unlimited money and diamonds<br />
|
22 |
-
sniper 3d hack apk latest version<br />
|
23 |
-
sniper 3d full unlocked apk free download<br />
|
24 |
-
sniper 3d mod apk offline<br />
|
25 |
-
sniper 3d hack apk no root<br />
|
26 |
-
sniper 3d mod apk android 1<br />
|
27 |
-
sniper 3d full premium apk download<br />
|
28 |
-
sniper 3d hack apk ios<br />
|
29 |
-
sniper 3d mod apk unlimited coins and gems<br />
|
30 |
-
sniper 3d hack apk online<br />
|
31 |
-
sniper 3d full pro apk download<br />
|
32 |
-
sniper 3d mod apk rexdl<br />
|
33 |
-
sniper 3d hack apk without verification<br />
|
34 |
-
sniper 3d mod apk all guns unlocked<br />
|
35 |
-
sniper 3d full cracked apk download<br />
|
36 |
-
sniper 3d mod apk unlimited energy<br />
|
37 |
-
sniper 3d hack apk anti ban<br />
|
38 |
-
sniper 3d mod apk vip unlocked<br />
|
39 |
-
sniper 3d full modded apk download<br />
|
40 |
-
sniper 3d mod apk unlimited ammo<br />
|
41 |
-
sniper 3d hack apk with obb<br />
|
42 |
-
sniper 3d mod apk revdl<br />
|
43 |
-
sniper 3d full paid apk download<br />
|
44 |
-
sniper 3d mod apk god mode<br />
|
45 |
-
sniper 3d hack apk for pc<br />
|
46 |
-
sniper 3d mod apk happymod<br />
|
47 |
-
sniper 3d full version apk download<br />
|
48 |
-
sniper 3d mod apk unlimited everything<br />
|
49 |
-
sniper 3d hack apk free shopping<br />
|
50 |
-
sniper 3d mod apk no ads</p>
|
51 |
-
<ul>
|
52 |
-
<li><strong>Unlimited Coins and Diamonds:</strong> Get unlimited coins and diamonds for free and use them to buy and upgrade any weapon or gear you want. You can also use them to customize your appearance and unlock premium items.</li>
|
53 |
-
<li><strong>All Weapons and Gear Unlocked:</strong> Unlock all the weapons and gear in the game without having to complete missions or spend coins and diamonds. You can choose from over 180+ authentic weapons and equip yourself with the best gear possible.</li>
|
54 |
-
<li><strong>No Ads:</strong> Enjoy a smooth and uninterrupted gameplay without any annoying ads popping up on your screen. You can focus on your missions and sniping skills without any distractions.</li>
|
55 |
-
<li><strong>No Root Required:</strong> You don't need to root your device to install Sniper 3D Full Hack APK. You can simply download and install it like any other APK file.</li>
|
56 |
-
</ul>
|
57 |
-
<h3>How to Download and Install Sniper 3D Full Hack APK</h3>
|
58 |
-
<p>If you want to download and install Sniper 3D Full Hack APK, you need to follow these simple steps:</p>
|
59 |
-
<ol>
|
60 |
-
<li><strong>Download Sniper 3D Full Hack APK</strong> from a reliable source. You can search for it on Google or use this link to download it directly.</li>
|
61 |
-
<li><strong>Enable Unknown Sources</strong> on your device. To do this, go to Settings > Security > Unknown Sources and toggle it on. This will allow you to install apps from sources other than Google Play Store.</li>
|
62 |
-
<li><strong>Install Sniper 3D Full Hack APK</strong> on your device. Locate the downloaded file in your file manager and tap on it to start the installation process. Follow the instructions on the screen and wait for the installation to finish.</li>
|
63 |
-
<li><strong>Launch Sniper 3D Full Hack APK</strong> on your device. You will see a new icon on your home screen or app drawer with the name Sniper 3D Full Hack. Tap on it to open the game and enjoy unlimited coins and diamonds for free!</li>
|
64 |
-
</ol>
|
65 |
-
<h3>Benefits of Using Sniper 3D Full Hack APK</h3>
|
66 |
-
<p>By using Sniper 3D Full Hack APK, you can enjoy many benefits that will enhance your gaming experience. Here are some of them:</p>
|
67 |
-
<ul>
|
68 |
-
<li><strong>You can save money:</strong> You don't have to spend real money to buy coins and diamonds in the game. You can get them for free by using Sniper 3D Full Hack APK.</li>
|
69 |
-
<li><strong>You can save time:</strong> You don't have to waste time completing missions or watching ads to earn coins and diamonds in the game. You can get them instantly by using Sniper 3D Full Hack APK.</li>
|
70 |
-
<li><strong>You can have more fun:</strong> You can have more fun playing Sniper 3D with unlimited coins and diamonds. You can buy and upgrade any weapon or gear you want, customize your appearance, and unlock premium items. You can also try different modes and locations without any limitations.</li>
|
71 |
-
</ul>
|
72 |
-
<h2>Tips and Tricks for Playing Sniper 3D</h2>
|
73 |
-
<p>If you want to improve your sniping skills and become a master assassin in Sniper 3D, you should follow these tips and tricks:</p>
|
74 |
-
<h3>Master the Art of Sniping</h3>
|
75 |
-
<p>To be a successful sniper, you need to master the art of sniping. Here are some tips to help you do that:</p>
|
76 |
-
<ul>
|
77 |
-
<li><strong>Aim carefully:</strong> Use the scope to zoom in on your target and aim for the head or chest for a quick kill. You can also use the red dot indicator to help you aim better.</li>
|
78 |
-
<li><strong>Hold your breath:</strong> When you are ready to shoot, hold your breath by tapping on the breath icon on the screen. This will stabilize your aim and reduce the sway of your rifle.</li>
|
79 |
-
<li><strong>Use bullet time:</strong> When you shoot, you can activate the bullet time feature by tapping on the bullet icon on the screen. This will slow down the time and allow you to adjust your aim and shoot multiple targets in a row.</li>
|
80 |
-
<li><strong>Use the environment:</strong> You can use the environment to your advantage by shooting explosive barrels, gas tanks, or other objects that can cause damage to your enemies. You can also use the wind direction and speed to adjust your aim and trajectory.</li>
|
81 |
-
</ul>
|
82 |
-
<h3>Upgrade Your Weapons and Gear</h3>
|
83 |
-
<p>To be a more effective sniper, you need to upgrade your weapons and gear. Here are some tips to help you do that:</p>
|
84 |
-
<ul>
|
85 |
-
<li><strong>Buy new weapons:</strong> You can buy new weapons with coins or diamonds in the game. There are different types of weapons, such as sniper rifles, assault rifles, shotguns, and pistols. Each weapon has its own stats, such as damage, range, stability, zoom, and clip size. You can compare the stats of different weapons and choose the one that suits your style and preference.</li>
|
86 |
-
<li><strong>Upgrade your weapons:</strong> You can upgrade your weapons with coins or diamonds in the game. You can upgrade different aspects of your weapons, such as muzzle, ammo, body, grip, scope, and clip. Each upgrade will improve the performance of your weapon and make it more powerful and accurate.</li>
|
87 |
-
<li><strong>Buy new gear:</strong> You can buy new gear with coins or diamonds in the game. There are different types of gear, such as helmets, vests, gloves, boots, and masks. Each gear has its own stats, such as armor, health, speed, and stealth. You can compare the stats of different gear and choose the one that suits your needs and preference.</li>
|
88 |
-
<li><strong>Upgrade your gear:</strong> You can upgrade your gear with coins or diamonds in the game. You can upgrade different aspects of your gear, such as durability, protection, agility, and camouflage. Each upgrade will improve the performance of your gear and make it more durable and effective.</li>
|
89 |
-
</ul>
|
90 |
-
<h3>Complete Missions and Challenges</h3>
|
91 |
-
<p>To progress in the game and earn more coins and diamonds, you need to complete missions and challenges. Here are some tips to help you do that:</p>
|
92 |
-
<ul>
|
93 |
-
<li><strong>Missions:</strong> There are different types of missions in the game, such as primary missions, wanted missions, special ops missions, daily missions, and contract missions. Each mission has its own objectives, rewards, and difficulty level. You can choose the mission that matches your skill level and interest. You can also replay the missions to improve your score and earn more coins and diamonds.</li>
|
94 |
-
<li><strong>Challenges:</strong> There are different types of challenges in the game, such as sniper duels, arena battles, zombie mode, deathmatch mode, and survival mode. Each challenge has its own rules, rewards, and leaderboards. You can choose the challenge that matches your mood and preference. You can also compete with other players from around the world and show off your sniping skills.</li>
|
95 |
-
</ul>
|
96 |
-
<h3>Play in Different Modes and Locations</h3>
|
97 |
-
<p>To have more fun and variety in the game, you can play in different modes and locations. Here are some tips to help you do that:</p>
|
98 |
-
<ul>
|
99 |
-
<li><strong>Modes:</strong> There are different modes in the game, such as offline mode, PVE mode, and PVP mode. Offline mode allows you to play without an internet connection. PVE mode allows you to play against AI enemies. PVP mode allows you to play against real players online.</li>
|
100 |
-
<li><strong>Locations:</strong> There are different locations in the game, such as New York City, Rio de Janeiro, Shanghai, Paris, London, Tokyo, Dubai, Rome, Berlin, Moscow, etc. Each location has its own scenery, atmosphere, and targets. You can travel to different locations and experience different cultures and challenges.</li>
|
101 |
-
</ul>
|
102 |
-
<h2>Alternatives to Sniper 3D Full Hack APK</h2>
|
103 |
-
<p>If you are looking for some alternatives to Sniper 3D Full Hack APK, you can try these other sniper games that are also fun and exciting:</p>
|
104 |
-
<h3>Sniper Fury</h3>
|
105 |
-
<p>Sniper Fury is another free-to-play sniper game developed by Gameloft. It features over 500 missions, stunning graphics, realistic weather effects, and a variety of weapons and gear. You can also join clans, participate in events, and compete with other players online. Sniper Fury is available on Google Play Store.</p>
|
106 |
-
<h3>Hitman: Sniper</h3>
|
107 |
-
<p>Hitman: Sniper is a premium sniper game developed by Square Enix. It is based on the popular Hitman franchise and features the iconic Agent 47 as the protagonist. You can explore different locations, use stealth and strategy, and eliminate your targets with style. You can also unlock new weapons, abilities, and contracts. Hitman: Sniper is available on Google Play Store.</p>
|
108 |
-
<h2>Conclusion</h2>
|
109 |
-
<p>Sniper 3D is one of the best sniper games on the market. It offers a thrilling and addictive gameplay that will keep you entertained for hours. However, if you want to enjoy the game without any limitations, you can download Sniper 3D Full Hack APK, a hacked version of the game that gives you unlimited coins and diamonds for free. You can also use our tips and tricks to improve your sniping skills and become a master assassin in Sniper 3D. Alternatively, you can try some other sniper games that are also fun and exciting. We hope you found this article helpful and informative. Happy sniping!</p>
|
110 |
-
<h2>FAQs</h2>
|
111 |
-
<p>Here are some frequently asked questions about Sniper 3D Full Hack APK:</p>
|
112 |
-
<ul>
|
113 |
-
<li><strong>Is Sniper 3D Full Hack APK safe to use?</strong> Yes, Sniper 3D Full Hack APK is safe to use as long as you download it from a reliable source. However, you should be aware that using a hacked version of the game may violate the terms of service of the game and may result in your account being banned or suspended.</li>
|
114 |
-
<li><strong>Is Sniper 3D Full Hack APK compatible with my device?</strong> Sniper 3D Full Hack APK is compatible with most Android devices that run on Android 4.4 or higher. However, some devices may not support the game or may experience some glitches or errors.</li>
|
115 |
-
<li><strong>How can I update Sniper 3D Full Hack APK?</strong> To update Sniper 3D Full Hack APK, you need to download the latest version of the APK file from the same source where you downloaded the previous version. Then, you need to uninstall the old version of the game and install the new version of the game.</li>
|
116 |
-
<li><strong>Can I play Sniper 3D Full Hack APK offline?</strong> Yes, you can play Sniper 3D Full Hack APK offline without an internet connection. However, some features of the game may not work properly or may require an internet connection to function.</li>
|
117 |
-
<li><strong>Can I play Sniper 3D Full Hack APK with my friends?</strong> Yes, you can play Sniper 3D Full Hack APK with your friends online. You can join clans, chat with other players, and compete with them in PVP mode.</li>
|
118 |
-
</ul></p> 197e85843d<br />
|
119 |
-
<br />
|
120 |
-
<br />
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
spaces/A1draw-12196y/anime-ai-detect/README.md
DELETED
@@ -1,13 +0,0 @@
|
|
1 |
-
---
|
2 |
-
title: Anime Ai Detect
|
3 |
-
emoji: 🤖
|
4 |
-
colorFrom: green
|
5 |
-
colorTo: purple
|
6 |
-
sdk: gradio
|
7 |
-
sdk_version: 3.15.0
|
8 |
-
app_file: app.py
|
9 |
-
pinned: true
|
10 |
-
duplicated_from: saltacc/anime-ai-detect
|
11 |
-
---
|
12 |
-
|
13 |
-
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
spaces/ADOPLE/Multi-Doc-Virtual-Chatbot/README.md
DELETED
@@ -1,13 +0,0 @@
|
|
1 |
-
---
|
2 |
-
title: Multi Doc Chatbot
|
3 |
-
emoji: 🏃
|
4 |
-
colorFrom: green
|
5 |
-
colorTo: blue
|
6 |
-
sdk: gradio
|
7 |
-
sdk_version: 3.38.0
|
8 |
-
app_file: app.py
|
9 |
-
pinned: false
|
10 |
-
duplicated_from: hudsonhayes/Multi-Doc-Virtual-Chatbot
|
11 |
-
---
|
12 |
-
|
13 |
-
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
spaces/AI-Zero-to-Hero/09-SL-Live-RealTime-Dashboard/README.md
DELETED
@@ -1,13 +0,0 @@
|
|
1 |
-
---
|
2 |
-
title: 09 SL Live Real Time Dashboard Timeseries
|
3 |
-
emoji: 😻
|
4 |
-
colorFrom: gray
|
5 |
-
colorTo: yellow
|
6 |
-
sdk: streamlit
|
7 |
-
sdk_version: 1.10.0
|
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/AIConsultant/MusicGen/audiocraft/modules/rope.py
DELETED
@@ -1,121 +0,0 @@
|
|
1 |
-
# Copyright (c) Meta Platforms, Inc. and affiliates.
|
2 |
-
# All rights reserved.
|
3 |
-
#
|
4 |
-
# This source code is licensed under the license found in the
|
5 |
-
# LICENSE file in the root directory of this source tree.
|
6 |
-
|
7 |
-
import typing as tp
|
8 |
-
|
9 |
-
from torch import nn
|
10 |
-
import torch
|
11 |
-
|
12 |
-
|
13 |
-
class XPos(nn.Module):
|
14 |
-
"""Length-extrapolatable positional embedding (xPos) from [Sun et al 2022](https://arxiv.org/abs/2212.10554v1).
|
15 |
-
This applies an exponential decay to the RoPE rotation matrix.
|
16 |
-
|
17 |
-
Args:
|
18 |
-
dim (int): Embedding dimension.
|
19 |
-
smoothing (float): Smoothing factor applied to the decay rates.
|
20 |
-
base_scale (int): Base decay rate, given in terms of scaling time.
|
21 |
-
device (torch.device, optional): Device on which to initialize the module.
|
22 |
-
dtype (torch.dtype): dtype to use to generate the embedding.
|
23 |
-
"""
|
24 |
-
def __init__(self, dim: int, smoothing: float = 0.4, base_scale: int = 512,
|
25 |
-
device=None, dtype: torch.dtype = torch.float32):
|
26 |
-
super().__init__()
|
27 |
-
assert dim % 2 == 0
|
28 |
-
assert dtype in [torch.float64, torch.float32]
|
29 |
-
self.dtype = dtype
|
30 |
-
self.base_scale = base_scale
|
31 |
-
|
32 |
-
half_dim = dim // 2
|
33 |
-
adim = torch.arange(half_dim, device=device, dtype=dtype)
|
34 |
-
decay_rates = (adim / half_dim + smoothing) / (1.0 + smoothing)
|
35 |
-
self.register_buffer("decay_rates", decay_rates)
|
36 |
-
self.decay: tp.Optional[torch.Tensor] = None
|
37 |
-
|
38 |
-
def get_decay(self, start: int, end: int):
|
39 |
-
"""Create complex decay tensor, cache values for fast computation."""
|
40 |
-
if self.decay is None or end > self.decay.shape[0]:
|
41 |
-
assert isinstance(self.decay_rates, torch.Tensor) # Satisfy type checker.
|
42 |
-
idx = torch.arange(end, device=self.decay_rates.device, dtype=self.dtype)
|
43 |
-
power = idx / self.base_scale
|
44 |
-
scale = self.decay_rates ** power.unsqueeze(-1)
|
45 |
-
self.decay = torch.polar(scale, torch.zeros_like(scale))
|
46 |
-
return self.decay[start:end] # [T, C/2]
|
47 |
-
|
48 |
-
|
49 |
-
class RotaryEmbedding(nn.Module):
|
50 |
-
"""Rotary positional embedding (RoPE) from [Su et al 2022](https://arxiv.org/abs/2104.09864).
|
51 |
-
|
52 |
-
Args:
|
53 |
-
dim (int): Embedding dimension (twice the number of frequencies).
|
54 |
-
max_period (float): Maximum period of the rotation frequencies.
|
55 |
-
xpos (bool): Use xPos, applies an exponential decay to rotation matrix.
|
56 |
-
scale (float): Scale of positional embedding, set to 0 to deactivate.
|
57 |
-
device (torch.device, optional): Device on which to initialize the module.
|
58 |
-
dtype (torch.dtype): dtype to use to generate the embedding.
|
59 |
-
"""
|
60 |
-
def __init__(self, dim: int, max_period: float = 10000.0, xpos: bool = False,
|
61 |
-
scale: float = 1.0, device=None, dtype: torch.dtype = torch.float32):
|
62 |
-
super().__init__()
|
63 |
-
assert dim % 2 == 0
|
64 |
-
self.scale = scale
|
65 |
-
assert dtype in [torch.float64, torch.float32]
|
66 |
-
self.dtype = dtype
|
67 |
-
|
68 |
-
adim = torch.arange(0, dim, 2, device=device, dtype=dtype)[: (dim // 2)]
|
69 |
-
frequencies = 1.0 / (max_period ** (adim / dim))
|
70 |
-
self.register_buffer("frequencies", frequencies)
|
71 |
-
self.rotation: tp.Optional[torch.Tensor] = None
|
72 |
-
|
73 |
-
self.xpos = XPos(dim, device=device, dtype=dtype) if xpos else None
|
74 |
-
|
75 |
-
def get_rotation(self, start: int, end: int):
|
76 |
-
"""Create complex rotation tensor, cache values for fast computation."""
|
77 |
-
if self.rotation is None or end > self.rotation.shape[0]:
|
78 |
-
assert isinstance(self.frequencies, torch.Tensor) # Satisfy type checker.
|
79 |
-
idx = torch.arange(end, device=self.frequencies.device, dtype=self.dtype)
|
80 |
-
angles = torch.outer(idx, self.frequencies)
|
81 |
-
self.rotation = torch.polar(torch.ones_like(angles), angles)
|
82 |
-
return self.rotation[start:end]
|
83 |
-
|
84 |
-
def rotate(self, x: torch.Tensor, start: int = 0, invert_decay: bool = False):
|
85 |
-
"""Apply rope rotation to query or key tensor."""
|
86 |
-
T = x.shape[1]
|
87 |
-
rotation = self.get_rotation(start, start + T).unsqueeze(0).unsqueeze(2)
|
88 |
-
|
89 |
-
if self.xpos:
|
90 |
-
decay = self.xpos.get_decay(start, start + T).unsqueeze(0).unsqueeze(2)
|
91 |
-
else:
|
92 |
-
decay = 1.0
|
93 |
-
|
94 |
-
if invert_decay:
|
95 |
-
decay = decay ** -1
|
96 |
-
|
97 |
-
x_complex = torch.view_as_complex(x.to(self.dtype).reshape(*x.shape[:-1], -1, 2))
|
98 |
-
scaled_rotation = (rotation * decay) * self.scale + (1.0 - self.scale)
|
99 |
-
x_out = torch.view_as_real(x_complex * scaled_rotation).flatten(-2)
|
100 |
-
|
101 |
-
return x_out.type_as(x)
|
102 |
-
|
103 |
-
def rotate_qk(self, query: torch.Tensor, key: torch.Tensor, start: int = 0):
|
104 |
-
""" Apply rope rotation to both query and key tensors.
|
105 |
-
Supports streaming mode, in which query and key are not expected to have the same shape.
|
106 |
-
In streaming mode, key will be of length [P + C] with P the cached past timesteps, but
|
107 |
-
query will be [C] (typically C == 1).
|
108 |
-
|
109 |
-
Args:
|
110 |
-
query (torch.Tensor): Query to rotate.
|
111 |
-
key (torch.Tensor): Key to rotate.
|
112 |
-
start (int): Start index of the sequence for time offset.
|
113 |
-
"""
|
114 |
-
query_timesteps = query.shape[1]
|
115 |
-
key_timesteps = key.shape[1]
|
116 |
-
streaming_offset = key_timesteps - query_timesteps
|
117 |
-
|
118 |
-
query_out = self.rotate(query, start + streaming_offset)
|
119 |
-
key_out = self.rotate(key, start, invert_decay=True)
|
120 |
-
|
121 |
-
return query_out, key_out
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
spaces/AIGC-Audio/AudioGPT/NeuralSeq/egs/datasets/audio/vctk/pre_align.py
DELETED
@@ -1,22 +0,0 @@
|
|
1 |
-
import os
|
2 |
-
|
3 |
-
from data_gen.tts.base_pre_align import BasePreAlign
|
4 |
-
import glob
|
5 |
-
|
6 |
-
|
7 |
-
class VCTKPreAlign(BasePreAlign):
|
8 |
-
def meta_data(self):
|
9 |
-
wav_fns = glob.glob(f'{self.raw_data_dir}/wav48/*/*.wav')
|
10 |
-
for wav_fn in wav_fns:
|
11 |
-
item_name = os.path.basename(wav_fn)[:-4]
|
12 |
-
spk = item_name.split("_")[0]
|
13 |
-
txt_fn = wav_fn.split("/")
|
14 |
-
txt_fn[-1] = f'{item_name}.txt'
|
15 |
-
txt_fn[-3] = f'txt'
|
16 |
-
txt_fn = "/".join(txt_fn)
|
17 |
-
if os.path.exists(txt_fn) and os.path.exists(wav_fn):
|
18 |
-
yield item_name, wav_fn, (self.load_txt, txt_fn), spk
|
19 |
-
|
20 |
-
|
21 |
-
if __name__ == "__main__":
|
22 |
-
VCTKPreAlign().process()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
spaces/AIGC-Audio/AudioGPT/text_to_speech/modules/tts/fs.py
DELETED
@@ -1,183 +0,0 @@
|
|
1 |
-
from copy import deepcopy
|
2 |
-
|
3 |
-
import torch
|
4 |
-
from torch import nn
|
5 |
-
import torch.nn.functional as F
|
6 |
-
from text_to_speech.modules.commons.conv import TextConvEncoder, ConvBlocks
|
7 |
-
from text_to_speech.modules.commons.layers import Embedding
|
8 |
-
from text_to_speech.modules.commons.nar_tts_modules import PitchPredictor, DurationPredictor, LengthRegulator
|
9 |
-
from text_to_speech.modules.commons.rel_transformer import RelTransformerEncoder, BERTRelTransformerEncoder
|
10 |
-
from text_to_speech.modules.commons.rnn import TacotronEncoder, RNNEncoder, DecoderRNN
|
11 |
-
from text_to_speech.modules.commons.transformer import FastSpeechEncoder, FastSpeechDecoder
|
12 |
-
from text_to_speech.modules.commons.wavenet import WN
|
13 |
-
from text_to_speech.modules.tts.commons.align_ops import clip_mel2token_to_multiple, expand_states
|
14 |
-
from text_to_speech.utils.audio.pitch.utils import denorm_f0, f0_to_coarse
|
15 |
-
|
16 |
-
FS_ENCODERS = {
|
17 |
-
'fft': lambda hp, dict_size: FastSpeechEncoder(
|
18 |
-
dict_size, hp['hidden_size'], hp['enc_layers'], hp['enc_ffn_kernel_size'],
|
19 |
-
num_heads=hp['num_heads']),
|
20 |
-
'tacotron': lambda hp, dict_size: TacotronEncoder(
|
21 |
-
hp['hidden_size'], dict_size, hp['hidden_size'],
|
22 |
-
K=hp['encoder_K'], num_highways=4, dropout=hp['dropout']),
|
23 |
-
'tacotron2': lambda hp, dict_size: RNNEncoder(dict_size, hp['hidden_size']),
|
24 |
-
'conv': lambda hp, dict_size: TextConvEncoder(dict_size, hp['hidden_size'], hp['hidden_size'],
|
25 |
-
hp['enc_dilations'], hp['enc_kernel_size'],
|
26 |
-
layers_in_block=hp['layers_in_block'],
|
27 |
-
norm_type=hp['enc_dec_norm'],
|
28 |
-
post_net_kernel=hp.get('enc_post_net_kernel', 3)),
|
29 |
-
'rel_fft': lambda hp, dict_size: RelTransformerEncoder(
|
30 |
-
dict_size, hp['hidden_size'], hp['hidden_size'],
|
31 |
-
hp['ffn_hidden_size'], hp['num_heads'], hp['enc_layers'],
|
32 |
-
hp['enc_ffn_kernel_size'], hp['dropout'], prenet=hp['enc_prenet'], pre_ln=hp['enc_pre_ln']),
|
33 |
-
}
|
34 |
-
|
35 |
-
FS_DECODERS = {
|
36 |
-
'fft': lambda hp: FastSpeechDecoder(
|
37 |
-
hp['hidden_size'], hp['dec_layers'], hp['dec_ffn_kernel_size'], hp['num_heads']),
|
38 |
-
'rnn': lambda hp: DecoderRNN(hp['hidden_size'], hp['decoder_rnn_dim'], hp['dropout']),
|
39 |
-
'conv': lambda hp: ConvBlocks(hp['hidden_size'], hp['hidden_size'], hp['dec_dilations'],
|
40 |
-
hp['dec_kernel_size'], layers_in_block=hp['layers_in_block'],
|
41 |
-
norm_type=hp['enc_dec_norm'], dropout=hp['dropout'],
|
42 |
-
post_net_kernel=hp.get('dec_post_net_kernel', 3)),
|
43 |
-
'wn': lambda hp: WN(hp['hidden_size'], kernel_size=5, dilation_rate=1, n_layers=hp['dec_layers'],
|
44 |
-
is_BTC=True),
|
45 |
-
}
|
46 |
-
|
47 |
-
|
48 |
-
class FastSpeech(nn.Module):
|
49 |
-
def __init__(self, dict_size, hparams, out_dims=None):
|
50 |
-
super().__init__()
|
51 |
-
self.hparams = deepcopy(hparams)
|
52 |
-
self.enc_layers = hparams['enc_layers']
|
53 |
-
self.dec_layers = hparams['dec_layers']
|
54 |
-
self.hidden_size = hparams['hidden_size']
|
55 |
-
if hparams.get("use_bert") is True:
|
56 |
-
self.ph_encoder = BERTRelTransformerEncoder(dict_size, hparams['hidden_size'], hparams['hidden_size'],
|
57 |
-
hparams['ffn_hidden_size'], hparams['num_heads'], hparams['enc_layers'],
|
58 |
-
hparams['enc_ffn_kernel_size'], hparams['dropout'], prenet=hparams['enc_prenet'], pre_ln=hparams['enc_pre_ln'])
|
59 |
-
else:
|
60 |
-
self.ph_encoder = FS_ENCODERS[hparams['encoder_type']](hparams, dict_size)
|
61 |
-
self.decoder = FS_DECODERS[hparams['decoder_type']](hparams)
|
62 |
-
self.out_dims = hparams['audio_num_mel_bins'] if out_dims is None else out_dims
|
63 |
-
self.mel_out = nn.Linear(self.hidden_size, self.out_dims, bias=True)
|
64 |
-
if hparams['use_spk_id']:
|
65 |
-
self.spk_id_proj = Embedding(hparams['num_spk'], self.hidden_size)
|
66 |
-
if hparams['use_spk_embed']:
|
67 |
-
self.spk_embed_proj = nn.Linear(256, self.hidden_size, bias=True)
|
68 |
-
predictor_hidden = hparams['predictor_hidden'] if hparams['predictor_hidden'] > 0 else self.hidden_size
|
69 |
-
self.dur_predictor = DurationPredictor(
|
70 |
-
self.hidden_size,
|
71 |
-
n_chans=predictor_hidden,
|
72 |
-
n_layers=hparams['dur_predictor_layers'],
|
73 |
-
dropout_rate=hparams['predictor_dropout'],
|
74 |
-
kernel_size=hparams['dur_predictor_kernel'])
|
75 |
-
self.length_regulator = LengthRegulator()
|
76 |
-
if hparams['use_pitch_embed']:
|
77 |
-
self.pitch_embed = Embedding(300, self.hidden_size, 0)
|
78 |
-
self.pitch_predictor = PitchPredictor(
|
79 |
-
self.hidden_size, n_chans=predictor_hidden,
|
80 |
-
n_layers=5, dropout_rate=0.1, odim=2,
|
81 |
-
kernel_size=hparams['predictor_kernel'])
|
82 |
-
if hparams['dec_inp_add_noise']:
|
83 |
-
self.z_channels = hparams['z_channels']
|
84 |
-
self.dec_inp_noise_proj = nn.Linear(self.hidden_size + self.z_channels, self.hidden_size)
|
85 |
-
|
86 |
-
def forward(self, txt_tokens, mel2ph=None, spk_embed=None, spk_id=None,
|
87 |
-
f0=None, uv=None, infer=False, **kwargs):
|
88 |
-
ret = {}
|
89 |
-
src_nonpadding = (txt_tokens > 0).float()[:, :, None]
|
90 |
-
style_embed = self.forward_style_embed(spk_embed, spk_id)
|
91 |
-
|
92 |
-
use_bert = self.hparams.get("use_bert") is True
|
93 |
-
if use_bert:
|
94 |
-
encoder_out = self.encoder(txt_tokens, bert_feats=kwargs['bert_feats'], ph2word=kwargs['ph2word'],
|
95 |
-
ret=ret) * src_nonpadding + style_embed
|
96 |
-
else:
|
97 |
-
encoder_out = self.encoder(txt_tokens) * src_nonpadding + style_embed
|
98 |
-
|
99 |
-
# add dur
|
100 |
-
dur_inp = (encoder_out + style_embed) * src_nonpadding
|
101 |
-
mel2ph = self.forward_dur(dur_inp, mel2ph, txt_tokens, ret)
|
102 |
-
tgt_nonpadding = (mel2ph > 0).float()[:, :, None]
|
103 |
-
decoder_inp = expand_states(encoder_out, mel2ph)
|
104 |
-
|
105 |
-
# add pitch embed
|
106 |
-
if self.hparams['use_pitch_embed']:
|
107 |
-
pitch_inp = (decoder_inp + style_embed) * tgt_nonpadding
|
108 |
-
decoder_inp = decoder_inp + self.forward_pitch(pitch_inp, f0, uv, mel2ph, ret, encoder_out)
|
109 |
-
|
110 |
-
# decoder input
|
111 |
-
ret['decoder_inp'] = decoder_inp = (decoder_inp + style_embed) * tgt_nonpadding
|
112 |
-
if self.hparams['dec_inp_add_noise']:
|
113 |
-
B, T, _ = decoder_inp.shape
|
114 |
-
z = kwargs.get('adv_z', torch.randn([B, T, self.z_channels])).to(decoder_inp.device)
|
115 |
-
ret['adv_z'] = z
|
116 |
-
decoder_inp = torch.cat([decoder_inp, z], -1)
|
117 |
-
decoder_inp = self.dec_inp_noise_proj(decoder_inp) * tgt_nonpadding
|
118 |
-
ret['mel_out'] = self.forward_decoder(decoder_inp, tgt_nonpadding, ret, infer=infer, **kwargs)
|
119 |
-
return ret
|
120 |
-
|
121 |
-
def forward_style_embed(self, spk_embed=None, spk_id=None):
|
122 |
-
# add spk embed
|
123 |
-
style_embed = 0
|
124 |
-
if self.hparams['use_spk_embed']:
|
125 |
-
style_embed = style_embed + self.spk_embed_proj(spk_embed)[:, None, :]
|
126 |
-
if self.hparams['use_spk_id']:
|
127 |
-
style_embed = style_embed + self.spk_id_proj(spk_id)[:, None, :]
|
128 |
-
return style_embed
|
129 |
-
|
130 |
-
def forward_dur(self, dur_input, mel2ph, txt_tokens, ret):
|
131 |
-
"""
|
132 |
-
|
133 |
-
:param dur_input: [B, T_txt, H]
|
134 |
-
:param mel2ph: [B, T_mel]
|
135 |
-
:param txt_tokens: [B, T_txt]
|
136 |
-
:param ret:
|
137 |
-
:return:
|
138 |
-
"""
|
139 |
-
src_padding = txt_tokens == 0
|
140 |
-
if self.hparams['predictor_grad'] != 1:
|
141 |
-
dur_input = dur_input.detach() + self.hparams['predictor_grad'] * (dur_input - dur_input.detach())
|
142 |
-
dur = self.dur_predictor(dur_input, src_padding)
|
143 |
-
ret['dur'] = dur
|
144 |
-
if mel2ph is None:
|
145 |
-
mel2ph = self.length_regulator(dur, src_padding).detach()
|
146 |
-
ret['mel2ph'] = mel2ph = clip_mel2token_to_multiple(mel2ph, self.hparams['frames_multiple'])
|
147 |
-
return mel2ph
|
148 |
-
|
149 |
-
def forward_pitch(self, decoder_inp, f0, uv, mel2ph, ret, encoder_out=None):
|
150 |
-
if self.hparams['pitch_type'] == 'frame':
|
151 |
-
pitch_pred_inp = decoder_inp
|
152 |
-
pitch_padding = mel2ph == 0
|
153 |
-
else:
|
154 |
-
pitch_pred_inp = encoder_out
|
155 |
-
pitch_padding = encoder_out.abs().sum(-1) == 0
|
156 |
-
uv = None
|
157 |
-
if self.hparams['predictor_grad'] != 1:
|
158 |
-
pitch_pred_inp = pitch_pred_inp.detach() + \
|
159 |
-
self.hparams['predictor_grad'] * (pitch_pred_inp - pitch_pred_inp.detach())
|
160 |
-
ret['pitch_pred'] = pitch_pred = self.pitch_predictor(pitch_pred_inp)
|
161 |
-
use_uv = self.hparams['pitch_type'] == 'frame' and self.hparams['use_uv']
|
162 |
-
if f0 is None:
|
163 |
-
f0 = pitch_pred[:, :, 0]
|
164 |
-
if use_uv:
|
165 |
-
uv = pitch_pred[:, :, 1] > 0
|
166 |
-
f0_denorm = denorm_f0(f0, uv if use_uv else None, pitch_padding=pitch_padding)
|
167 |
-
pitch = f0_to_coarse(f0_denorm) # start from 0 [B, T_txt]
|
168 |
-
ret['f0_denorm'] = f0_denorm
|
169 |
-
ret['f0_denorm_pred'] = denorm_f0(
|
170 |
-
pitch_pred[:, :, 0], (pitch_pred[:, :, 1] > 0) if use_uv else None,
|
171 |
-
pitch_padding=pitch_padding)
|
172 |
-
if self.hparams['pitch_type'] == 'ph':
|
173 |
-
pitch = torch.gather(F.pad(pitch, [1, 0]), 1, mel2ph)
|
174 |
-
ret['f0_denorm'] = torch.gather(F.pad(ret['f0_denorm'], [1, 0]), 1, mel2ph)
|
175 |
-
ret['f0_denorm_pred'] = torch.gather(F.pad(ret['f0_denorm_pred'], [1, 0]), 1, mel2ph)
|
176 |
-
pitch_embed = self.pitch_embed(pitch)
|
177 |
-
return pitch_embed
|
178 |
-
|
179 |
-
def forward_decoder(self, decoder_inp, tgt_nonpadding, ret, infer, **kwargs):
|
180 |
-
x = decoder_inp # [B, T, H]
|
181 |
-
x = self.decoder(x)
|
182 |
-
x = self.mel_out(x)
|
183 |
-
return x * tgt_nonpadding
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
spaces/AISuperheroes/09SL-AI-Image-Music-Video-AIUIUX/README.md
DELETED
@@ -1,13 +0,0 @@
|
|
1 |
-
---
|
2 |
-
title: 09SL AI Image Music Video AIUIUX
|
3 |
-
emoji: 🏃
|
4 |
-
colorFrom: pink
|
5 |
-
colorTo: yellow
|
6 |
-
sdk: streamlit
|
7 |
-
sdk_version: 1.10.0
|
8 |
-
app_file: app.py
|
9 |
-
pinned: false
|
10 |
-
license: mit
|
11 |
-
---
|
12 |
-
|
13 |
-
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
spaces/AIZerotoHero-Health4All/01-Speech2Text2Speech/README.md
DELETED
@@ -1,13 +0,0 @@
|
|
1 |
-
---
|
2 |
-
title: 01 Speech2Text2Speech
|
3 |
-
emoji: 🗣️
|
4 |
-
colorFrom: purple
|
5 |
-
colorTo: yellow
|
6 |
-
sdk: gradio
|
7 |
-
sdk_version: 3.9.1
|
8 |
-
app_file: app.py
|
9 |
-
pinned: false
|
10 |
-
license: mit
|
11 |
-
---
|
12 |
-
|
13 |
-
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
spaces/AONYLMR/anime-ai-detect/README.md
DELETED
@@ -1,13 +0,0 @@
|
|
1 |
-
---
|
2 |
-
title: Anime Ai Detect
|
3 |
-
emoji: 🤖
|
4 |
-
colorFrom: green
|
5 |
-
colorTo: purple
|
6 |
-
sdk: gradio
|
7 |
-
sdk_version: 3.15.0
|
8 |
-
app_file: app.py
|
9 |
-
pinned: true
|
10 |
-
duplicated_from: saltacc/anime-ai-detect
|
11 |
-
---
|
12 |
-
|
13 |
-
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
spaces/Ababababababbababa/Ashaar/poetry_diacritizer/models/tacotron_based.py
DELETED
@@ -1,47 +0,0 @@
|
|
1 |
-
from typing import List
|
2 |
-
from poetry_diacritizer.models.seq2seq import Seq2Seq, Decoder as Seq2SeqDecoder
|
3 |
-
from poetry_diacritizer.modules.tacotron_modules import CBHG, Prenet
|
4 |
-
from torch import nn
|
5 |
-
|
6 |
-
|
7 |
-
class Tacotron(Seq2Seq):
|
8 |
-
pass
|
9 |
-
|
10 |
-
|
11 |
-
class Encoder(nn.Module):
|
12 |
-
def __init__(
|
13 |
-
self,
|
14 |
-
inp_vocab_size: int,
|
15 |
-
embedding_dim: int = 512,
|
16 |
-
use_prenet: bool = True,
|
17 |
-
prenet_sizes: List[int] = [256, 128],
|
18 |
-
cbhg_gru_units: int = 128,
|
19 |
-
cbhg_filters: int = 16,
|
20 |
-
cbhg_projections: List[int] = [128, 128],
|
21 |
-
padding_idx: int = 0,
|
22 |
-
):
|
23 |
-
super().__init__()
|
24 |
-
self.use_prenet = use_prenet
|
25 |
-
|
26 |
-
self.embedding = nn.Embedding(
|
27 |
-
inp_vocab_size, embedding_dim, padding_idx=padding_idx
|
28 |
-
)
|
29 |
-
if use_prenet:
|
30 |
-
self.prenet = Prenet(embedding_dim, prenet_depth=prenet_sizes)
|
31 |
-
self.cbhg = CBHG(
|
32 |
-
prenet_sizes[-1] if use_prenet else embedding_dim,
|
33 |
-
cbhg_gru_units,
|
34 |
-
K=cbhg_filters,
|
35 |
-
projections=cbhg_projections,
|
36 |
-
)
|
37 |
-
|
38 |
-
def forward(self, inputs, input_lengths=None):
|
39 |
-
|
40 |
-
outputs = self.embedding(inputs)
|
41 |
-
if self.use_prenet:
|
42 |
-
outputs = self.prenet(outputs)
|
43 |
-
return self.cbhg(outputs, input_lengths)
|
44 |
-
|
45 |
-
|
46 |
-
class Decoder(Seq2SeqDecoder):
|
47 |
-
pass
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
spaces/Abhilashvj/planogram-compliance/utils/triton.py
DELETED
@@ -1,105 +0,0 @@
|
|
1 |
-
# YOLOv5 🚀 by Ultralytics, GPL-3.0 license
|
2 |
-
""" Utils to interact with the Triton Inference Server
|
3 |
-
"""
|
4 |
-
|
5 |
-
import typing
|
6 |
-
from urllib.parse import urlparse
|
7 |
-
|
8 |
-
import torch
|
9 |
-
|
10 |
-
|
11 |
-
class TritonRemoteModel:
|
12 |
-
"""A wrapper over a model served by the Triton Inference Server. It can
|
13 |
-
be configured to communicate over GRPC or HTTP. It accepts Torch Tensors
|
14 |
-
as input and returns them as outputs.
|
15 |
-
"""
|
16 |
-
|
17 |
-
def __init__(self, url: str):
|
18 |
-
"""
|
19 |
-
Keyword arguments:
|
20 |
-
url: Fully qualified address of the Triton server - for e.g. grpc://localhost:8000
|
21 |
-
"""
|
22 |
-
|
23 |
-
parsed_url = urlparse(url)
|
24 |
-
if parsed_url.scheme == "grpc":
|
25 |
-
from tritonclient.grpc import InferenceServerClient, InferInput
|
26 |
-
|
27 |
-
self.client = InferenceServerClient(
|
28 |
-
parsed_url.netloc
|
29 |
-
) # Triton GRPC client
|
30 |
-
model_repository = self.client.get_model_repository_index()
|
31 |
-
self.model_name = model_repository.models[0].name
|
32 |
-
self.metadata = self.client.get_model_metadata(
|
33 |
-
self.model_name, as_json=True
|
34 |
-
)
|
35 |
-
|
36 |
-
def create_input_placeholders() -> typing.List[InferInput]:
|
37 |
-
return [
|
38 |
-
InferInput(
|
39 |
-
i["name"], [int(s) for s in i["shape"]], i["datatype"]
|
40 |
-
)
|
41 |
-
for i in self.metadata["inputs"]
|
42 |
-
]
|
43 |
-
|
44 |
-
else:
|
45 |
-
from tritonclient.http import InferenceServerClient, InferInput
|
46 |
-
|
47 |
-
self.client = InferenceServerClient(
|
48 |
-
parsed_url.netloc
|
49 |
-
) # Triton HTTP client
|
50 |
-
model_repository = self.client.get_model_repository_index()
|
51 |
-
self.model_name = model_repository[0]["name"]
|
52 |
-
self.metadata = self.client.get_model_metadata(self.model_name)
|
53 |
-
|
54 |
-
def create_input_placeholders() -> typing.List[InferInput]:
|
55 |
-
return [
|
56 |
-
InferInput(
|
57 |
-
i["name"], [int(s) for s in i["shape"]], i["datatype"]
|
58 |
-
)
|
59 |
-
for i in self.metadata["inputs"]
|
60 |
-
]
|
61 |
-
|
62 |
-
self._create_input_placeholders_fn = create_input_placeholders
|
63 |
-
|
64 |
-
@property
|
65 |
-
def runtime(self):
|
66 |
-
"""Returns the model runtime"""
|
67 |
-
return self.metadata.get("backend", self.metadata.get("platform"))
|
68 |
-
|
69 |
-
def __call__(
|
70 |
-
self, *args, **kwargs
|
71 |
-
) -> typing.Union[torch.Tensor, typing.Tuple[torch.Tensor, ...]]:
|
72 |
-
"""Invokes the model. Parameters can be provided via args or kwargs.
|
73 |
-
args, if provided, are assumed to match the order of inputs of the model.
|
74 |
-
kwargs are matched with the model input names.
|
75 |
-
"""
|
76 |
-
inputs = self._create_inputs(*args, **kwargs)
|
77 |
-
response = self.client.infer(model_name=self.model_name, inputs=inputs)
|
78 |
-
result = []
|
79 |
-
for output in self.metadata["outputs"]:
|
80 |
-
tensor = torch.as_tensor(response.as_numpy(output["name"]))
|
81 |
-
result.append(tensor)
|
82 |
-
return result[0] if len(result) == 1 else result
|
83 |
-
|
84 |
-
def _create_inputs(self, *args, **kwargs):
|
85 |
-
args_len, kwargs_len = len(args), len(kwargs)
|
86 |
-
if not args_len and not kwargs_len:
|
87 |
-
raise RuntimeError("No inputs provided.")
|
88 |
-
if args_len and kwargs_len:
|
89 |
-
raise RuntimeError(
|
90 |
-
"Cannot specify args and kwargs at the same time"
|
91 |
-
)
|
92 |
-
|
93 |
-
placeholders = self._create_input_placeholders_fn()
|
94 |
-
if args_len:
|
95 |
-
if args_len != len(placeholders):
|
96 |
-
raise RuntimeError(
|
97 |
-
f"Expected {len(placeholders)} inputs, got {args_len}."
|
98 |
-
)
|
99 |
-
for input, value in zip(placeholders, args):
|
100 |
-
input.set_data_from_numpy(value.cpu().numpy())
|
101 |
-
else:
|
102 |
-
for input in placeholders:
|
103 |
-
value = kwargs[input.name]
|
104 |
-
input.set_data_from_numpy(value.cpu().numpy())
|
105 |
-
return placeholders
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
spaces/AgentVerse/agentVerse/ui/src/phaser3-rex-plugins/templates/ui/gridsizer/GridSizer.js
DELETED
@@ -1,171 +0,0 @@
|
|
1 |
-
import BaseSizer from '../basesizer/BaseSizer.js';
|
2 |
-
import Methods from './Methods.js';
|
3 |
-
import GetTotalColumnProportions from './GetTotalColumnProportions.js';
|
4 |
-
import GetTotalRowProportions from './GetTotalRowProportions.js';
|
5 |
-
|
6 |
-
const IsPlainObject = Phaser.Utils.Objects.IsPlainObject;
|
7 |
-
const GetValue = Phaser.Utils.Objects.GetValue;
|
8 |
-
|
9 |
-
class GridSizer extends BaseSizer {
|
10 |
-
constructor(scene, x, y, minWidth, minHeight, columnCount, rowCount, columnProportions, rowProportions, config) {
|
11 |
-
if (IsPlainObject(x)) {
|
12 |
-
config = x;
|
13 |
-
x = GetValue(config, 'x', 0);
|
14 |
-
y = GetValue(config, 'y', 0);
|
15 |
-
minWidth = GetValue(config, 'width', undefined);
|
16 |
-
minHeight = GetValue(config, 'height', undefined);
|
17 |
-
columnCount = GetValue(config, 'column', (config.col || 0));
|
18 |
-
rowCount = GetValue(config, 'row', 0);
|
19 |
-
columnProportions = GetValue(config, 'columnProportions', 0);
|
20 |
-
rowProportions = GetValue(config, 'rowProportions', 0);
|
21 |
-
} else if (IsPlainObject(minWidth)) {
|
22 |
-
config = minWidth;
|
23 |
-
minWidth = GetValue(config, 'width', undefined);
|
24 |
-
minHeight = GetValue(config, 'height', undefined);
|
25 |
-
columnCount = GetValue(config, 'column', (config.col || 0));
|
26 |
-
rowCount = GetValue(config, 'row', 0);
|
27 |
-
columnProportions = GetValue(config, 'columnProportions', 0);
|
28 |
-
rowProportions = GetValue(config, 'rowProportions', 0);
|
29 |
-
} else if (IsPlainObject(columnCount)) {
|
30 |
-
config = columnCount;
|
31 |
-
columnCount = GetValue(config, 'column', (config.col || 0));
|
32 |
-
rowCount = GetValue(config, 'row', 0);
|
33 |
-
columnProportions = GetValue(config, 'columnProportions', 0);
|
34 |
-
rowProportions = GetValue(config, 'rowProportions', 0);
|
35 |
-
} else if (IsPlainObject(columnProportions)) {
|
36 |
-
config = columnProportions;
|
37 |
-
columnProportions = GetValue(config, 'columnProportions', 0);
|
38 |
-
rowProportions = GetValue(config, 'rowProportions', 0);
|
39 |
-
}
|
40 |
-
super(scene, x, y, minWidth, minHeight, config);
|
41 |
-
|
42 |
-
this.type = 'rexGridSizer';
|
43 |
-
this.resetGrid(
|
44 |
-
columnCount, rowCount,
|
45 |
-
columnProportions, rowProportions,
|
46 |
-
GetValue(config, 'space', undefined)
|
47 |
-
);
|
48 |
-
|
49 |
-
this.setIndentLeft(
|
50 |
-
GetValue(config, 'space.indentLeftOdd', 0),
|
51 |
-
GetValue(config, 'space.indentLeftEven', 0)
|
52 |
-
);
|
53 |
-
this.setIndentTop(
|
54 |
-
GetValue(config, 'space.indentTopOdd', 0),
|
55 |
-
GetValue(config, 'space.indentTopEven', 0)
|
56 |
-
);
|
57 |
-
|
58 |
-
this.addChildrenMap('items', this.sizerChildren);
|
59 |
-
|
60 |
-
var createCellContainerCallback = GetValue(config, 'createCellContainerCallback');
|
61 |
-
if (createCellContainerCallback) {
|
62 |
-
for (var y = 0, ycnt = this.rowCount; y < ycnt; y++) {
|
63 |
-
for (var x = 0, xcnt = this.columnCount; x < xcnt; x++) {
|
64 |
-
var addConfig = { column: x, row: y };
|
65 |
-
var child = createCellContainerCallback(scene, x, y, addConfig);
|
66 |
-
if (child) {
|
67 |
-
this.add(child, addConfig);
|
68 |
-
}
|
69 |
-
}
|
70 |
-
}
|
71 |
-
}
|
72 |
-
}
|
73 |
-
|
74 |
-
destroy(fromScene) {
|
75 |
-
// This Game Object has already been destroyed
|
76 |
-
if (!this.scene || this.ignoreDestroy) {
|
77 |
-
return;
|
78 |
-
}
|
79 |
-
|
80 |
-
super.destroy(fromScene);
|
81 |
-
|
82 |
-
// More free resources
|
83 |
-
this.columnProportions = undefined;
|
84 |
-
this.rowProportions = undefined;
|
85 |
-
this.columnWidth = undefined;
|
86 |
-
this.rowHeight = undefined;
|
87 |
-
}
|
88 |
-
|
89 |
-
setIndentLeft(odd, even) {
|
90 |
-
this.space.indentLeftOdd = odd;
|
91 |
-
this.space.indentLeftEven = even;
|
92 |
-
return this;
|
93 |
-
}
|
94 |
-
|
95 |
-
setIndentTop(odd, even) {
|
96 |
-
this.space.indentTopOdd = odd;
|
97 |
-
this.space.indentTopEven = even;
|
98 |
-
return this;
|
99 |
-
}
|
100 |
-
|
101 |
-
setColumnProportion(columnIndex, proportion) {
|
102 |
-
if (columnIndex >= this.columnProportions.length) {
|
103 |
-
return this;
|
104 |
-
}
|
105 |
-
this.columnProportions[columnIndex] = proportion;
|
106 |
-
return this;
|
107 |
-
}
|
108 |
-
|
109 |
-
setRowProportion(rowIndex, proportion) {
|
110 |
-
if (rowIndex >= this.rowProportions.length) {
|
111 |
-
return this;
|
112 |
-
}
|
113 |
-
this.rowProportions[rowIndex] = proportion;
|
114 |
-
return this;
|
115 |
-
}
|
116 |
-
|
117 |
-
get totalColumnProportions() {
|
118 |
-
if (this._totalColumnProportions === undefined) {
|
119 |
-
this._totalColumnProportions = GetTotalColumnProportions.call(this);
|
120 |
-
}
|
121 |
-
return this._totalColumnProportions;
|
122 |
-
}
|
123 |
-
|
124 |
-
get totalRowProportions() {
|
125 |
-
if (this._totalRowProportions === undefined) {
|
126 |
-
this._totalRowProportions = GetTotalRowProportions.call(this);
|
127 |
-
}
|
128 |
-
return this._totalRowProportions;
|
129 |
-
}
|
130 |
-
|
131 |
-
getChildAt(columnIndex, rowIndex) {
|
132 |
-
return this.sizerChildren[(rowIndex * this.columnCount) + columnIndex];
|
133 |
-
}
|
134 |
-
|
135 |
-
childToGridIndex(child, out) {
|
136 |
-
if (!child) {
|
137 |
-
return null;
|
138 |
-
}
|
139 |
-
|
140 |
-
var index = this.sizerChildren.indexOf(child);
|
141 |
-
if (index === -1) {
|
142 |
-
return null;
|
143 |
-
}
|
144 |
-
|
145 |
-
if (out === undefined) {
|
146 |
-
out = {};
|
147 |
-
}
|
148 |
-
out.x = index % this.columnCount;
|
149 |
-
out.y = Math.floor(index / this.columnCount);
|
150 |
-
return out;
|
151 |
-
}
|
152 |
-
|
153 |
-
getColumnWidth(columnIndex) {
|
154 |
-
var colProportion = this.columnProportions[columnIndex];
|
155 |
-
var colWidth = (colProportion === 0) ? this.columnWidth[columnIndex] : (colProportion * this.proportionWidthLength);
|
156 |
-
return colWidth;
|
157 |
-
}
|
158 |
-
|
159 |
-
getRowHeight(rowIndex) {
|
160 |
-
var rowProportion = this.rowProportions[rowIndex];
|
161 |
-
var rowHeight = (rowProportion === 0) ? this.rowHeight[rowIndex] : (rowProportion * this.proportionHeightLength);
|
162 |
-
return rowHeight;
|
163 |
-
}
|
164 |
-
}
|
165 |
-
|
166 |
-
Object.assign(
|
167 |
-
GridSizer.prototype,
|
168 |
-
Methods
|
169 |
-
);
|
170 |
-
|
171 |
-
export default GridSizer;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
spaces/AlekseyKorshuk/thin-plate-spline-motion-model/demo.py
DELETED
@@ -1,176 +0,0 @@
|
|
1 |
-
import matplotlib
|
2 |
-
matplotlib.use('Agg')
|
3 |
-
import sys
|
4 |
-
import yaml
|
5 |
-
from argparse import ArgumentParser
|
6 |
-
from tqdm import tqdm
|
7 |
-
from scipy.spatial import ConvexHull
|
8 |
-
import numpy as np
|
9 |
-
import imageio
|
10 |
-
from skimage.transform import resize
|
11 |
-
from skimage import img_as_ubyte
|
12 |
-
import torch
|
13 |
-
from modules.inpainting_network import InpaintingNetwork
|
14 |
-
from modules.keypoint_detector import KPDetector
|
15 |
-
from modules.dense_motion import DenseMotionNetwork
|
16 |
-
from modules.avd_network import AVDNetwork
|
17 |
-
|
18 |
-
if sys.version_info[0] < 3:
|
19 |
-
raise Exception("You must use Python 3 or higher. Recommended version is Python 3.9")
|
20 |
-
|
21 |
-
def relative_kp(kp_source, kp_driving, kp_driving_initial):
|
22 |
-
|
23 |
-
source_area = ConvexHull(kp_source['fg_kp'][0].data.cpu().numpy()).volume
|
24 |
-
driving_area = ConvexHull(kp_driving_initial['fg_kp'][0].data.cpu().numpy()).volume
|
25 |
-
adapt_movement_scale = np.sqrt(source_area) / np.sqrt(driving_area)
|
26 |
-
|
27 |
-
kp_new = {k: v for k, v in kp_driving.items()}
|
28 |
-
|
29 |
-
kp_value_diff = (kp_driving['fg_kp'] - kp_driving_initial['fg_kp'])
|
30 |
-
kp_value_diff *= adapt_movement_scale
|
31 |
-
kp_new['fg_kp'] = kp_value_diff + kp_source['fg_kp']
|
32 |
-
|
33 |
-
return kp_new
|
34 |
-
|
35 |
-
def load_checkpoints(config_path, checkpoint_path, device):
|
36 |
-
with open(config_path) as f:
|
37 |
-
config = yaml.load(f)
|
38 |
-
|
39 |
-
inpainting = InpaintingNetwork(**config['model_params']['generator_params'],
|
40 |
-
**config['model_params']['common_params'])
|
41 |
-
kp_detector = KPDetector(**config['model_params']['common_params'])
|
42 |
-
dense_motion_network = DenseMotionNetwork(**config['model_params']['common_params'],
|
43 |
-
**config['model_params']['dense_motion_params'])
|
44 |
-
avd_network = AVDNetwork(num_tps=config['model_params']['common_params']['num_tps'],
|
45 |
-
**config['model_params']['avd_network_params'])
|
46 |
-
kp_detector.to(device)
|
47 |
-
dense_motion_network.to(device)
|
48 |
-
inpainting.to(device)
|
49 |
-
avd_network.to(device)
|
50 |
-
|
51 |
-
checkpoint = torch.load(checkpoint_path, map_location=device)
|
52 |
-
|
53 |
-
inpainting.load_state_dict(checkpoint['inpainting_network'])
|
54 |
-
kp_detector.load_state_dict(checkpoint['kp_detector'])
|
55 |
-
dense_motion_network.load_state_dict(checkpoint['dense_motion_network'])
|
56 |
-
if 'avd_network' in checkpoint:
|
57 |
-
avd_network.load_state_dict(checkpoint['avd_network'])
|
58 |
-
|
59 |
-
inpainting.eval()
|
60 |
-
kp_detector.eval()
|
61 |
-
dense_motion_network.eval()
|
62 |
-
avd_network.eval()
|
63 |
-
|
64 |
-
return inpainting, kp_detector, dense_motion_network, avd_network
|
65 |
-
|
66 |
-
|
67 |
-
def make_animation(source_image, driving_video, inpainting_network, kp_detector, dense_motion_network, avd_network, device, mode = 'relative'):
|
68 |
-
assert mode in ['standard', 'relative', 'avd']
|
69 |
-
with torch.no_grad():
|
70 |
-
predictions = []
|
71 |
-
source = torch.tensor(source_image[np.newaxis].astype(np.float32)).permute(0, 3, 1, 2)
|
72 |
-
source = source.to(device)
|
73 |
-
driving = torch.tensor(np.array(driving_video)[np.newaxis].astype(np.float32)).permute(0, 4, 1, 2, 3).to(device)
|
74 |
-
kp_source = kp_detector(source)
|
75 |
-
kp_driving_initial = kp_detector(driving[:, :, 0])
|
76 |
-
|
77 |
-
for frame_idx in tqdm(range(driving.shape[2])):
|
78 |
-
driving_frame = driving[:, :, frame_idx]
|
79 |
-
driving_frame = driving_frame.to(device)
|
80 |
-
kp_driving = kp_detector(driving_frame)
|
81 |
-
if mode == 'standard':
|
82 |
-
kp_norm = kp_driving
|
83 |
-
elif mode=='relative':
|
84 |
-
kp_norm = relative_kp(kp_source=kp_source, kp_driving=kp_driving,
|
85 |
-
kp_driving_initial=kp_driving_initial)
|
86 |
-
elif mode == 'avd':
|
87 |
-
kp_norm = avd_network(kp_source, kp_driving)
|
88 |
-
dense_motion = dense_motion_network(source_image=source, kp_driving=kp_norm,
|
89 |
-
kp_source=kp_source, bg_param = None,
|
90 |
-
dropout_flag = False)
|
91 |
-
out = inpainting_network(source, dense_motion)
|
92 |
-
|
93 |
-
predictions.append(np.transpose(out['prediction'].data.cpu().numpy(), [0, 2, 3, 1])[0])
|
94 |
-
return predictions
|
95 |
-
|
96 |
-
|
97 |
-
def find_best_frame(source, driving, cpu):
|
98 |
-
import face_alignment
|
99 |
-
|
100 |
-
def normalize_kp(kp):
|
101 |
-
kp = kp - kp.mean(axis=0, keepdims=True)
|
102 |
-
area = ConvexHull(kp[:, :2]).volume
|
103 |
-
area = np.sqrt(area)
|
104 |
-
kp[:, :2] = kp[:, :2] / area
|
105 |
-
return kp
|
106 |
-
|
107 |
-
fa = face_alignment.FaceAlignment(face_alignment.LandmarksType._2D, flip_input=True,
|
108 |
-
device= 'cpu' if cpu else 'cuda')
|
109 |
-
kp_source = fa.get_landmarks(255 * source)[0]
|
110 |
-
kp_source = normalize_kp(kp_source)
|
111 |
-
norm = float('inf')
|
112 |
-
frame_num = 0
|
113 |
-
for i, image in tqdm(enumerate(driving)):
|
114 |
-
kp_driving = fa.get_landmarks(255 * image)[0]
|
115 |
-
kp_driving = normalize_kp(kp_driving)
|
116 |
-
new_norm = (np.abs(kp_source - kp_driving) ** 2).sum()
|
117 |
-
if new_norm < norm:
|
118 |
-
norm = new_norm
|
119 |
-
frame_num = i
|
120 |
-
return frame_num
|
121 |
-
|
122 |
-
|
123 |
-
if __name__ == "__main__":
|
124 |
-
parser = ArgumentParser()
|
125 |
-
parser.add_argument("--config", required=True, help="path to config")
|
126 |
-
parser.add_argument("--checkpoint", default='checkpoints/vox.pth.tar', help="path to checkpoint to restore")
|
127 |
-
|
128 |
-
parser.add_argument("--source_image", default='./assets/source.png', help="path to source image")
|
129 |
-
parser.add_argument("--driving_video", default='./assets/driving.mp4', help="path to driving video")
|
130 |
-
parser.add_argument("--result_video", default='./result.mp4', help="path to output")
|
131 |
-
|
132 |
-
parser.add_argument("--img_shape", default="256,256", type=lambda x: list(map(int, x.split(','))),
|
133 |
-
help='Shape of image, that the model was trained on.')
|
134 |
-
|
135 |
-
parser.add_argument("--mode", default='relative', choices=['standard', 'relative', 'avd'], help="Animate mode: ['standard', 'relative', 'avd'], when use the relative mode to animate a face, use '--find_best_frame' can get better quality result")
|
136 |
-
|
137 |
-
parser.add_argument("--find_best_frame", dest="find_best_frame", action="store_true",
|
138 |
-
help="Generate from the frame that is the most alligned with source. (Only for faces, requires face_aligment lib)")
|
139 |
-
|
140 |
-
parser.add_argument("--cpu", dest="cpu", action="store_true", help="cpu mode.")
|
141 |
-
|
142 |
-
opt = parser.parse_args()
|
143 |
-
|
144 |
-
source_image = imageio.imread(opt.source_image)
|
145 |
-
reader = imageio.get_reader(opt.driving_video)
|
146 |
-
fps = reader.get_meta_data()['fps']
|
147 |
-
driving_video = []
|
148 |
-
try:
|
149 |
-
for im in reader:
|
150 |
-
driving_video.append(im)
|
151 |
-
except RuntimeError:
|
152 |
-
pass
|
153 |
-
reader.close()
|
154 |
-
|
155 |
-
if opt.cpu:
|
156 |
-
device = torch.device('cpu')
|
157 |
-
else:
|
158 |
-
device = torch.device('cuda')
|
159 |
-
|
160 |
-
source_image = resize(source_image, opt.img_shape)[..., :3]
|
161 |
-
driving_video = [resize(frame, opt.img_shape)[..., :3] for frame in driving_video]
|
162 |
-
inpainting, kp_detector, dense_motion_network, avd_network = load_checkpoints(config_path = opt.config, checkpoint_path = opt.checkpoint, device = device)
|
163 |
-
|
164 |
-
if opt.find_best_frame:
|
165 |
-
i = find_best_frame(source_image, driving_video, opt.cpu)
|
166 |
-
print ("Best frame: " + str(i))
|
167 |
-
driving_forward = driving_video[i:]
|
168 |
-
driving_backward = driving_video[:(i+1)][::-1]
|
169 |
-
predictions_forward = make_animation(source_image, driving_forward, inpainting, kp_detector, dense_motion_network, avd_network, device = device, mode = opt.mode)
|
170 |
-
predictions_backward = make_animation(source_image, driving_backward, inpainting, kp_detector, dense_motion_network, avd_network, device = device, mode = opt.mode)
|
171 |
-
predictions = predictions_backward[::-1] + predictions_forward[1:]
|
172 |
-
else:
|
173 |
-
predictions = make_animation(source_image, driving_video, inpainting, kp_detector, dense_motion_network, avd_network, device = device, mode = opt.mode)
|
174 |
-
|
175 |
-
imageio.mimsave(opt.result_video, [img_as_ubyte(frame) for frame in predictions], fps=fps)
|
176 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
spaces/Alfasign/chat-llm-streaming/app.py
DELETED
@@ -1,319 +0,0 @@
|
|
1 |
-
import os
|
2 |
-
|
3 |
-
import gradio as gr
|
4 |
-
|
5 |
-
from text_generation import Client, InferenceAPIClient
|
6 |
-
|
7 |
-
openchat_preprompt = (
|
8 |
-
"\n<human>: Hi!\n<bot>: My name is Bot, model version is 0.15, part of an open-source kit for "
|
9 |
-
"fine-tuning new bots! I was created by Together, LAION, and Ontocord.ai and the open-source "
|
10 |
-
"community. I am not human, not evil and not alive, and thus have no thoughts and feelings, "
|
11 |
-
"but I am programmed to be helpful, polite, honest, and friendly.\n"
|
12 |
-
)
|
13 |
-
|
14 |
-
|
15 |
-
def get_client(model: str):
|
16 |
-
if model == "togethercomputer/GPT-NeoXT-Chat-Base-20B":
|
17 |
-
return Client(os.getenv("OPENCHAT_API_URL"))
|
18 |
-
return InferenceAPIClient(model, token=os.getenv("HF_TOKEN", None))
|
19 |
-
|
20 |
-
|
21 |
-
def get_usernames(model: str):
|
22 |
-
"""
|
23 |
-
Returns:
|
24 |
-
(str, str, str, str): pre-prompt, username, bot name, separator
|
25 |
-
"""
|
26 |
-
if model in ("OpenAssistant/oasst-sft-1-pythia-12b", "OpenAssistant/oasst-sft-4-pythia-12b-epoch-3.5"):
|
27 |
-
return "", "<|prompter|>", "<|assistant|>", "<|endoftext|>"
|
28 |
-
if model == "togethercomputer/GPT-NeoXT-Chat-Base-20B":
|
29 |
-
return openchat_preprompt, "<human>: ", "<bot>: ", "\n"
|
30 |
-
return "", "User: ", "Assistant: ", "\n"
|
31 |
-
|
32 |
-
|
33 |
-
def predict(
|
34 |
-
model: str,
|
35 |
-
inputs: str,
|
36 |
-
typical_p: float,
|
37 |
-
top_p: float,
|
38 |
-
temperature: float,
|
39 |
-
top_k: int,
|
40 |
-
repetition_penalty: float,
|
41 |
-
watermark: bool,
|
42 |
-
chatbot,
|
43 |
-
history,
|
44 |
-
):
|
45 |
-
client = get_client(model)
|
46 |
-
preprompt, user_name, assistant_name, sep = get_usernames(model)
|
47 |
-
|
48 |
-
history.append(inputs)
|
49 |
-
|
50 |
-
past = []
|
51 |
-
for data in chatbot:
|
52 |
-
user_data, model_data = data
|
53 |
-
|
54 |
-
if not user_data.startswith(user_name):
|
55 |
-
user_data = user_name + user_data
|
56 |
-
if not model_data.startswith(sep + assistant_name):
|
57 |
-
model_data = sep + assistant_name + model_data
|
58 |
-
|
59 |
-
past.append(user_data + model_data.rstrip() + sep)
|
60 |
-
|
61 |
-
if not inputs.startswith(user_name):
|
62 |
-
inputs = user_name + inputs
|
63 |
-
|
64 |
-
total_inputs = preprompt + "".join(past) + inputs + sep + assistant_name.rstrip()
|
65 |
-
|
66 |
-
partial_words = ""
|
67 |
-
|
68 |
-
if model in ("OpenAssistant/oasst-sft-1-pythia-12b", "OpenAssistant/oasst-sft-4-pythia-12b-epoch-3.5"):
|
69 |
-
iterator = client.generate_stream(
|
70 |
-
total_inputs,
|
71 |
-
typical_p=typical_p,
|
72 |
-
truncate=1000,
|
73 |
-
watermark=watermark,
|
74 |
-
max_new_tokens=500,
|
75 |
-
)
|
76 |
-
else:
|
77 |
-
iterator = client.generate_stream(
|
78 |
-
total_inputs,
|
79 |
-
top_p=top_p if top_p < 1.0 else None,
|
80 |
-
top_k=top_k,
|
81 |
-
truncate=1000,
|
82 |
-
repetition_penalty=repetition_penalty,
|
83 |
-
watermark=watermark,
|
84 |
-
temperature=temperature,
|
85 |
-
max_new_tokens=500,
|
86 |
-
stop_sequences=[user_name.rstrip(), assistant_name.rstrip()],
|
87 |
-
)
|
88 |
-
|
89 |
-
for i, response in enumerate(iterator):
|
90 |
-
if response.token.special:
|
91 |
-
continue
|
92 |
-
|
93 |
-
partial_words = partial_words + response.token.text
|
94 |
-
if partial_words.endswith(user_name.rstrip()):
|
95 |
-
partial_words = partial_words.rstrip(user_name.rstrip())
|
96 |
-
if partial_words.endswith(assistant_name.rstrip()):
|
97 |
-
partial_words = partial_words.rstrip(assistant_name.rstrip())
|
98 |
-
|
99 |
-
if i == 0:
|
100 |
-
history.append(" " + partial_words)
|
101 |
-
elif response.token.text not in user_name:
|
102 |
-
history[-1] = partial_words
|
103 |
-
|
104 |
-
chat = [
|
105 |
-
(history[i].strip(), history[i + 1].strip())
|
106 |
-
for i in range(0, len(history) - 1, 2)
|
107 |
-
]
|
108 |
-
yield chat, history
|
109 |
-
|
110 |
-
|
111 |
-
def reset_textbox():
|
112 |
-
return gr.update(value="")
|
113 |
-
|
114 |
-
|
115 |
-
def radio_on_change(
|
116 |
-
value: str,
|
117 |
-
disclaimer,
|
118 |
-
typical_p,
|
119 |
-
top_p,
|
120 |
-
top_k,
|
121 |
-
temperature,
|
122 |
-
repetition_penalty,
|
123 |
-
watermark,
|
124 |
-
):
|
125 |
-
if value in ("OpenAssistant/oasst-sft-1-pythia-12b", "OpenAssistant/oasst-sft-4-pythia-12b-epoch-3.5"):
|
126 |
-
typical_p = typical_p.update(value=0.2, visible=True)
|
127 |
-
top_p = top_p.update(visible=False)
|
128 |
-
top_k = top_k.update(visible=False)
|
129 |
-
temperature = temperature.update(visible=False)
|
130 |
-
disclaimer = disclaimer.update(visible=False)
|
131 |
-
repetition_penalty = repetition_penalty.update(visible=False)
|
132 |
-
watermark = watermark.update(False)
|
133 |
-
elif value == "togethercomputer/GPT-NeoXT-Chat-Base-20B":
|
134 |
-
typical_p = typical_p.update(visible=False)
|
135 |
-
top_p = top_p.update(value=0.25, visible=True)
|
136 |
-
top_k = top_k.update(value=50, visible=True)
|
137 |
-
temperature = temperature.update(value=0.6, visible=True)
|
138 |
-
repetition_penalty = repetition_penalty.update(value=1.01, visible=True)
|
139 |
-
watermark = watermark.update(False)
|
140 |
-
disclaimer = disclaimer.update(visible=True)
|
141 |
-
else:
|
142 |
-
typical_p = typical_p.update(visible=False)
|
143 |
-
top_p = top_p.update(value=0.95, visible=True)
|
144 |
-
top_k = top_k.update(value=4, visible=True)
|
145 |
-
temperature = temperature.update(value=0.5, visible=True)
|
146 |
-
repetition_penalty = repetition_penalty.update(value=1.03, visible=True)
|
147 |
-
watermark = watermark.update(True)
|
148 |
-
disclaimer = disclaimer.update(visible=False)
|
149 |
-
return (
|
150 |
-
disclaimer,
|
151 |
-
typical_p,
|
152 |
-
top_p,
|
153 |
-
top_k,
|
154 |
-
temperature,
|
155 |
-
repetition_penalty,
|
156 |
-
watermark,
|
157 |
-
)
|
158 |
-
|
159 |
-
|
160 |
-
title = """<h1 align="center">Large Language Model Chat API</h1>"""
|
161 |
-
description = """Language models can be conditioned to act like dialogue agents through a conversational prompt that typically takes the form:
|
162 |
-
|
163 |
-
```
|
164 |
-
User: <utterance>
|
165 |
-
Assistant: <utterance>
|
166 |
-
User: <utterance>
|
167 |
-
Assistant: <utterance>
|
168 |
-
...
|
169 |
-
```
|
170 |
-
|
171 |
-
In this app, you can explore the outputs of multiple LLMs when prompted in this way.
|
172 |
-
"""
|
173 |
-
|
174 |
-
text_generation_inference = """
|
175 |
-
<div align="center">Powered by: <a href=https://github.com/huggingface/text-generation-inference>Text Generation Inference</a></div>
|
176 |
-
"""
|
177 |
-
|
178 |
-
openchat_disclaimer = """
|
179 |
-
<div align="center">Checkout the official <a href=https://huggingface.co/spaces/togethercomputer/OpenChatKit>OpenChatKit feedback app</a> for the full experience.</div>
|
180 |
-
"""
|
181 |
-
|
182 |
-
with gr.Blocks(
|
183 |
-
css="""#col_container {margin-left: auto; margin-right: auto;}
|
184 |
-
#chatbot {height: 520px; overflow: auto;}"""
|
185 |
-
) as demo:
|
186 |
-
gr.HTML(title)
|
187 |
-
gr.Markdown(text_generation_inference, visible=True)
|
188 |
-
with gr.Column(elem_id="col_container"):
|
189 |
-
model = gr.Radio(
|
190 |
-
value="OpenAssistant/oasst-sft-4-pythia-12b-epoch-3.5",
|
191 |
-
choices=[
|
192 |
-
"OpenAssistant/oasst-sft-4-pythia-12b-epoch-3.5",
|
193 |
-
"OpenAssistant/oasst-sft-1-pythia-12b",
|
194 |
-
# "togethercomputer/GPT-NeoXT-Chat-Base-20B",
|
195 |
-
"google/flan-t5-xxl",
|
196 |
-
"google/flan-ul2",
|
197 |
-
"bigscience/bloom",
|
198 |
-
"bigscience/bloomz",
|
199 |
-
"EleutherAI/gpt-neox-20b",
|
200 |
-
],
|
201 |
-
label="Model",
|
202 |
-
interactive=True,
|
203 |
-
)
|
204 |
-
|
205 |
-
chatbot = gr.Chatbot(elem_id="chatbot")
|
206 |
-
inputs = gr.Textbox(
|
207 |
-
placeholder="Hi there!", label="Type an input and press Enter"
|
208 |
-
)
|
209 |
-
disclaimer = gr.Markdown(openchat_disclaimer, visible=False)
|
210 |
-
state = gr.State([])
|
211 |
-
b1 = gr.Button()
|
212 |
-
|
213 |
-
with gr.Accordion("Parameters", open=False):
|
214 |
-
typical_p = gr.Slider(
|
215 |
-
minimum=-0,
|
216 |
-
maximum=1.0,
|
217 |
-
value=0.2,
|
218 |
-
step=0.05,
|
219 |
-
interactive=True,
|
220 |
-
label="Typical P mass",
|
221 |
-
)
|
222 |
-
top_p = gr.Slider(
|
223 |
-
minimum=-0,
|
224 |
-
maximum=1.0,
|
225 |
-
value=0.25,
|
226 |
-
step=0.05,
|
227 |
-
interactive=True,
|
228 |
-
label="Top-p (nucleus sampling)",
|
229 |
-
visible=False,
|
230 |
-
)
|
231 |
-
temperature = gr.Slider(
|
232 |
-
minimum=-0,
|
233 |
-
maximum=5.0,
|
234 |
-
value=0.6,
|
235 |
-
step=0.1,
|
236 |
-
interactive=True,
|
237 |
-
label="Temperature",
|
238 |
-
visible=False,
|
239 |
-
)
|
240 |
-
top_k = gr.Slider(
|
241 |
-
minimum=1,
|
242 |
-
maximum=50,
|
243 |
-
value=50,
|
244 |
-
step=1,
|
245 |
-
interactive=True,
|
246 |
-
label="Top-k",
|
247 |
-
visible=False,
|
248 |
-
)
|
249 |
-
repetition_penalty = gr.Slider(
|
250 |
-
minimum=0.1,
|
251 |
-
maximum=3.0,
|
252 |
-
value=1.03,
|
253 |
-
step=0.01,
|
254 |
-
interactive=True,
|
255 |
-
label="Repetition Penalty",
|
256 |
-
visible=False,
|
257 |
-
)
|
258 |
-
watermark = gr.Checkbox(value=False, label="Text watermarking")
|
259 |
-
|
260 |
-
model.change(
|
261 |
-
lambda value: radio_on_change(
|
262 |
-
value,
|
263 |
-
disclaimer,
|
264 |
-
typical_p,
|
265 |
-
top_p,
|
266 |
-
top_k,
|
267 |
-
temperature,
|
268 |
-
repetition_penalty,
|
269 |
-
watermark,
|
270 |
-
),
|
271 |
-
inputs=model,
|
272 |
-
outputs=[
|
273 |
-
disclaimer,
|
274 |
-
typical_p,
|
275 |
-
top_p,
|
276 |
-
top_k,
|
277 |
-
temperature,
|
278 |
-
repetition_penalty,
|
279 |
-
watermark,
|
280 |
-
],
|
281 |
-
)
|
282 |
-
|
283 |
-
inputs.submit(
|
284 |
-
predict,
|
285 |
-
[
|
286 |
-
model,
|
287 |
-
inputs,
|
288 |
-
typical_p,
|
289 |
-
top_p,
|
290 |
-
temperature,
|
291 |
-
top_k,
|
292 |
-
repetition_penalty,
|
293 |
-
watermark,
|
294 |
-
chatbot,
|
295 |
-
state,
|
296 |
-
],
|
297 |
-
[chatbot, state],
|
298 |
-
)
|
299 |
-
b1.click(
|
300 |
-
predict,
|
301 |
-
[
|
302 |
-
model,
|
303 |
-
inputs,
|
304 |
-
typical_p,
|
305 |
-
top_p,
|
306 |
-
temperature,
|
307 |
-
top_k,
|
308 |
-
repetition_penalty,
|
309 |
-
watermark,
|
310 |
-
chatbot,
|
311 |
-
state,
|
312 |
-
],
|
313 |
-
[chatbot, state],
|
314 |
-
)
|
315 |
-
b1.click(reset_textbox, [], [inputs])
|
316 |
-
inputs.submit(reset_textbox, [], [inputs])
|
317 |
-
|
318 |
-
gr.Markdown(description)
|
319 |
-
demo.queue(concurrency_count=16).launch(debug=True)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
spaces/Alican/pixera/data/image_folder.py
DELETED
@@ -1,65 +0,0 @@
|
|
1 |
-
"""A modified image folder class
|
2 |
-
|
3 |
-
We modify the official PyTorch image folder (https://github.com/pytorch/vision/blob/master/torchvision/datasets/folder.py)
|
4 |
-
so that this class can load images from both current directory and its subdirectories.
|
5 |
-
"""
|
6 |
-
|
7 |
-
import torch.utils.data as data
|
8 |
-
|
9 |
-
from PIL import Image
|
10 |
-
import os
|
11 |
-
|
12 |
-
IMG_EXTENSIONS = [
|
13 |
-
'.jpg', '.JPG', '.jpeg', '.JPEG',
|
14 |
-
'.png', '.PNG', '.ppm', '.PPM', '.bmp', '.BMP',
|
15 |
-
'.tif', '.TIF', '.tiff', '.TIFF',
|
16 |
-
]
|
17 |
-
|
18 |
-
|
19 |
-
def is_image_file(filename):
|
20 |
-
return any(filename.endswith(extension) for extension in IMG_EXTENSIONS)
|
21 |
-
|
22 |
-
|
23 |
-
def make_dataset(dir, max_dataset_size=float("inf")):
|
24 |
-
images = []
|
25 |
-
assert os.path.isdir(dir), '%s is not a valid directory' % dir
|
26 |
-
|
27 |
-
for root, _, fnames in sorted(os.walk(dir)):
|
28 |
-
for fname in fnames:
|
29 |
-
if is_image_file(fname):
|
30 |
-
path = os.path.join(root, fname)
|
31 |
-
images.append(path)
|
32 |
-
return images[:min(max_dataset_size, len(images))]
|
33 |
-
|
34 |
-
|
35 |
-
def default_loader(path):
|
36 |
-
return Image.open(path).convert('RGB')
|
37 |
-
|
38 |
-
|
39 |
-
class ImageFolder(data.Dataset):
|
40 |
-
|
41 |
-
def __init__(self, root, transform=None, return_paths=False,
|
42 |
-
loader=default_loader):
|
43 |
-
imgs = make_dataset(root)
|
44 |
-
if len(imgs) == 0:
|
45 |
-
raise(RuntimeError("Found 0 images in: " + root + "\n"
|
46 |
-
"Supported image extensions are: " + ",".join(IMG_EXTENSIONS)))
|
47 |
-
|
48 |
-
self.root = root
|
49 |
-
self.imgs = imgs
|
50 |
-
self.transform = transform
|
51 |
-
self.return_paths = return_paths
|
52 |
-
self.loader = loader
|
53 |
-
|
54 |
-
def __getitem__(self, index):
|
55 |
-
path = self.imgs[index]
|
56 |
-
img = self.loader(path)
|
57 |
-
if self.transform is not None:
|
58 |
-
img = self.transform(img)
|
59 |
-
if self.return_paths:
|
60 |
-
return img, path
|
61 |
-
else:
|
62 |
-
return img
|
63 |
-
|
64 |
-
def __len__(self):
|
65 |
-
return len(self.imgs)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
spaces/Alycer/VITS-Umamusume-voice-synthesizer/text/ngu_dialect.py
DELETED
@@ -1,30 +0,0 @@
|
|
1 |
-
import re
|
2 |
-
import opencc
|
3 |
-
|
4 |
-
|
5 |
-
dialects = {'SZ': 'suzhou', 'WX': 'wuxi', 'CZ': 'changzhou', 'HZ': 'hangzhou',
|
6 |
-
'SX': 'shaoxing', 'NB': 'ningbo', 'JJ': 'jingjiang', 'YX': 'yixing',
|
7 |
-
'JD': 'jiading', 'ZR': 'zhenru', 'PH': 'pinghu', 'TX': 'tongxiang',
|
8 |
-
'JS': 'jiashan', 'HN': 'xiashi', 'LP': 'linping', 'XS': 'xiaoshan',
|
9 |
-
'FY': 'fuyang', 'RA': 'ruao', 'CX': 'cixi', 'SM': 'sanmen',
|
10 |
-
'TT': 'tiantai', 'WZ': 'wenzhou', 'SC': 'suichang', 'YB': 'youbu'}
|
11 |
-
|
12 |
-
converters = {}
|
13 |
-
|
14 |
-
for dialect in dialects.values():
|
15 |
-
try:
|
16 |
-
converters[dialect] = opencc.OpenCC(dialect)
|
17 |
-
except:
|
18 |
-
pass
|
19 |
-
|
20 |
-
|
21 |
-
def ngu_dialect_to_ipa(text, dialect):
|
22 |
-
dialect = dialects[dialect]
|
23 |
-
text = converters[dialect].convert(text).replace('-','').replace('$',' ')
|
24 |
-
text = re.sub(r'[、;:]', ',', text)
|
25 |
-
text = re.sub(r'\s*,\s*', ', ', text)
|
26 |
-
text = re.sub(r'\s*。\s*', '. ', text)
|
27 |
-
text = re.sub(r'\s*?\s*', '? ', text)
|
28 |
-
text = re.sub(r'\s*!\s*', '! ', text)
|
29 |
-
text = re.sub(r'\s*$', '', text)
|
30 |
-
return text
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
spaces/Amrrs/yt-shorts-video-captioning/app.py
DELETED
@@ -1,72 +0,0 @@
|
|
1 |
-
|
2 |
-
import gradio as gr
|
3 |
-
import os
|
4 |
-
import sys
|
5 |
-
import subprocess
|
6 |
-
#from moviepy.editor import VideoFileClip
|
7 |
-
|
8 |
-
import whisper
|
9 |
-
from whisper.utils import write_vtt
|
10 |
-
|
11 |
-
model = whisper.load_model("medium")
|
12 |
-
|
13 |
-
title = "Add Text/Caption to your YouTube Shorts - MultiLingual"
|
14 |
-
|
15 |
-
def video2mp3(video_file, output_ext="mp3"):
|
16 |
-
filename, ext = os.path.splitext(video_file)
|
17 |
-
subprocess.call(["ffmpeg", "-y", "-i", video_file, f"{filename}.{output_ext}"],
|
18 |
-
stdout=subprocess.DEVNULL,
|
19 |
-
stderr=subprocess.STDOUT)
|
20 |
-
return f"{filename}.{output_ext}"
|
21 |
-
|
22 |
-
|
23 |
-
def translate(input_video):
|
24 |
-
|
25 |
-
audio_file = video2mp3(input_video)
|
26 |
-
|
27 |
-
options = dict(beam_size=5, best_of=5, fp16 = False)
|
28 |
-
translate_options = dict(task="translate", **options)
|
29 |
-
result = model.transcribe(audio_file,**translate_options)
|
30 |
-
|
31 |
-
output_dir = ''
|
32 |
-
audio_path = audio_file.split(".")[0]
|
33 |
-
|
34 |
-
with open(os.path.join(output_dir, audio_path + ".vtt"), "w") as vtt:
|
35 |
-
write_vtt(result["segments"], file=vtt)
|
36 |
-
|
37 |
-
subtitle = audio_path + ".vtt"
|
38 |
-
output_video = audio_path + "_subtitled.mp4"
|
39 |
-
|
40 |
-
os.system(f"ffmpeg -i {input_video} -vf subtitles={subtitle} {output_video}")
|
41 |
-
|
42 |
-
return output_video
|
43 |
-
|
44 |
-
block = gr.Blocks()
|
45 |
-
with block:
|
46 |
-
|
47 |
-
with gr.Group():
|
48 |
-
with gr.Box():
|
49 |
-
with gr.Row().style():
|
50 |
-
inp_video = gr.Video(
|
51 |
-
label="Input Video",
|
52 |
-
type="filepath",
|
53 |
-
mirror_webcam = False
|
54 |
-
)
|
55 |
-
op_video = gr.Video()
|
56 |
-
btn = gr.Button("Generate Subtitle Video")
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
btn.click(translate, inputs=[inp_video], outputs=[op_video])
|
64 |
-
|
65 |
-
gr.HTML('''
|
66 |
-
<div class="footer">
|
67 |
-
<p>Model by <a href="https://github.com/openai/whisper" style="text-decoration: underline;" target="_blank">OpenAI</a> - Gradio App by <a href="https://twitter.com/1littlecoder" style="text-decoration: underline;" target="_blank">1littlecoder</a>
|
68 |
-
</p>
|
69 |
-
</div>
|
70 |
-
''')
|
71 |
-
|
72 |
-
block.launch(enable_queue = True)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
spaces/Androidonnxfork/CivitAi-to-Diffusers/diffusers/tests/pipelines/ddpm/test_ddpm.py
DELETED
@@ -1,111 +0,0 @@
|
|
1 |
-
# coding=utf-8
|
2 |
-
# Copyright 2023 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 unittest
|
17 |
-
|
18 |
-
import numpy as np
|
19 |
-
import torch
|
20 |
-
|
21 |
-
from diffusers import DDPMPipeline, DDPMScheduler, UNet2DModel
|
22 |
-
from diffusers.utils.testing_utils import enable_full_determinism, require_torch_gpu, slow, torch_device
|
23 |
-
|
24 |
-
|
25 |
-
enable_full_determinism()
|
26 |
-
|
27 |
-
|
28 |
-
class DDPMPipelineFastTests(unittest.TestCase):
|
29 |
-
@property
|
30 |
-
def dummy_uncond_unet(self):
|
31 |
-
torch.manual_seed(0)
|
32 |
-
model = UNet2DModel(
|
33 |
-
block_out_channels=(32, 64),
|
34 |
-
layers_per_block=2,
|
35 |
-
sample_size=32,
|
36 |
-
in_channels=3,
|
37 |
-
out_channels=3,
|
38 |
-
down_block_types=("DownBlock2D", "AttnDownBlock2D"),
|
39 |
-
up_block_types=("AttnUpBlock2D", "UpBlock2D"),
|
40 |
-
)
|
41 |
-
return model
|
42 |
-
|
43 |
-
def test_fast_inference(self):
|
44 |
-
device = "cpu"
|
45 |
-
unet = self.dummy_uncond_unet
|
46 |
-
scheduler = DDPMScheduler()
|
47 |
-
|
48 |
-
ddpm = DDPMPipeline(unet=unet, scheduler=scheduler)
|
49 |
-
ddpm.to(device)
|
50 |
-
ddpm.set_progress_bar_config(disable=None)
|
51 |
-
|
52 |
-
generator = torch.Generator(device=device).manual_seed(0)
|
53 |
-
image = ddpm(generator=generator, num_inference_steps=2, output_type="numpy").images
|
54 |
-
|
55 |
-
generator = torch.Generator(device=device).manual_seed(0)
|
56 |
-
image_from_tuple = ddpm(generator=generator, num_inference_steps=2, output_type="numpy", return_dict=False)[0]
|
57 |
-
|
58 |
-
image_slice = image[0, -3:, -3:, -1]
|
59 |
-
image_from_tuple_slice = image_from_tuple[0, -3:, -3:, -1]
|
60 |
-
|
61 |
-
assert image.shape == (1, 32, 32, 3)
|
62 |
-
expected_slice = np.array(
|
63 |
-
[9.956e-01, 5.785e-01, 4.675e-01, 9.930e-01, 0.0, 1.000, 1.199e-03, 2.648e-04, 5.101e-04]
|
64 |
-
)
|
65 |
-
|
66 |
-
assert np.abs(image_slice.flatten() - expected_slice).max() < 1e-2
|
67 |
-
assert np.abs(image_from_tuple_slice.flatten() - expected_slice).max() < 1e-2
|
68 |
-
|
69 |
-
def test_inference_predict_sample(self):
|
70 |
-
unet = self.dummy_uncond_unet
|
71 |
-
scheduler = DDPMScheduler(prediction_type="sample")
|
72 |
-
|
73 |
-
ddpm = DDPMPipeline(unet=unet, scheduler=scheduler)
|
74 |
-
ddpm.to(torch_device)
|
75 |
-
ddpm.set_progress_bar_config(disable=None)
|
76 |
-
|
77 |
-
generator = torch.manual_seed(0)
|
78 |
-
image = ddpm(generator=generator, num_inference_steps=2, output_type="numpy").images
|
79 |
-
|
80 |
-
generator = torch.manual_seed(0)
|
81 |
-
image_eps = ddpm(generator=generator, num_inference_steps=2, output_type="numpy")[0]
|
82 |
-
|
83 |
-
image_slice = image[0, -3:, -3:, -1]
|
84 |
-
image_eps_slice = image_eps[0, -3:, -3:, -1]
|
85 |
-
|
86 |
-
assert image.shape == (1, 32, 32, 3)
|
87 |
-
tolerance = 1e-2 if torch_device != "mps" else 3e-2
|
88 |
-
assert np.abs(image_slice.flatten() - image_eps_slice.flatten()).max() < tolerance
|
89 |
-
|
90 |
-
|
91 |
-
@slow
|
92 |
-
@require_torch_gpu
|
93 |
-
class DDPMPipelineIntegrationTests(unittest.TestCase):
|
94 |
-
def test_inference_cifar10(self):
|
95 |
-
model_id = "google/ddpm-cifar10-32"
|
96 |
-
|
97 |
-
unet = UNet2DModel.from_pretrained(model_id)
|
98 |
-
scheduler = DDPMScheduler.from_pretrained(model_id)
|
99 |
-
|
100 |
-
ddpm = DDPMPipeline(unet=unet, scheduler=scheduler)
|
101 |
-
ddpm.to(torch_device)
|
102 |
-
ddpm.set_progress_bar_config(disable=None)
|
103 |
-
|
104 |
-
generator = torch.manual_seed(0)
|
105 |
-
image = ddpm(generator=generator, output_type="numpy").images
|
106 |
-
|
107 |
-
image_slice = image[0, -3:, -3:, -1]
|
108 |
-
|
109 |
-
assert image.shape == (1, 32, 32, 3)
|
110 |
-
expected_slice = np.array([0.4200, 0.3588, 0.1939, 0.3847, 0.3382, 0.2647, 0.4155, 0.3582, 0.3385])
|
111 |
-
assert np.abs(image_slice.flatten() - expected_slice).max() < 1e-2
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
spaces/Anonymous-sub/Rerender/ControlNet/annotator/uniformer/mmcv/__init__.py
DELETED
@@ -1,15 +0,0 @@
|
|
1 |
-
# Copyright (c) OpenMMLab. All rights reserved.
|
2 |
-
# flake8: noqa
|
3 |
-
from .arraymisc import *
|
4 |
-
from .fileio import *
|
5 |
-
from .image import *
|
6 |
-
from .utils import *
|
7 |
-
from .version import *
|
8 |
-
from .video import *
|
9 |
-
from .visualization import *
|
10 |
-
|
11 |
-
# The following modules are not imported to this level, so mmcv may be used
|
12 |
-
# without PyTorch.
|
13 |
-
# - runner
|
14 |
-
# - parallel
|
15 |
-
# - op
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
spaces/Anonymous-sub/Rerender/ControlNet/annotator/uniformer/mmcv/ops/correlation.py
DELETED
@@ -1,196 +0,0 @@
|
|
1 |
-
# Copyright (c) OpenMMLab. All rights reserved.
|
2 |
-
import torch
|
3 |
-
from torch import Tensor, nn
|
4 |
-
from torch.autograd import Function
|
5 |
-
from torch.autograd.function import once_differentiable
|
6 |
-
from torch.nn.modules.utils import _pair
|
7 |
-
|
8 |
-
from ..utils import ext_loader
|
9 |
-
|
10 |
-
ext_module = ext_loader.load_ext(
|
11 |
-
'_ext', ['correlation_forward', 'correlation_backward'])
|
12 |
-
|
13 |
-
|
14 |
-
class CorrelationFunction(Function):
|
15 |
-
|
16 |
-
@staticmethod
|
17 |
-
def forward(ctx,
|
18 |
-
input1,
|
19 |
-
input2,
|
20 |
-
kernel_size=1,
|
21 |
-
max_displacement=1,
|
22 |
-
stride=1,
|
23 |
-
padding=1,
|
24 |
-
dilation=1,
|
25 |
-
dilation_patch=1):
|
26 |
-
|
27 |
-
ctx.save_for_backward(input1, input2)
|
28 |
-
|
29 |
-
kH, kW = ctx.kernel_size = _pair(kernel_size)
|
30 |
-
patch_size = max_displacement * 2 + 1
|
31 |
-
ctx.patch_size = patch_size
|
32 |
-
dH, dW = ctx.stride = _pair(stride)
|
33 |
-
padH, padW = ctx.padding = _pair(padding)
|
34 |
-
dilationH, dilationW = ctx.dilation = _pair(dilation)
|
35 |
-
dilation_patchH, dilation_patchW = ctx.dilation_patch = _pair(
|
36 |
-
dilation_patch)
|
37 |
-
|
38 |
-
output_size = CorrelationFunction._output_size(ctx, input1)
|
39 |
-
|
40 |
-
output = input1.new_zeros(output_size)
|
41 |
-
|
42 |
-
ext_module.correlation_forward(
|
43 |
-
input1,
|
44 |
-
input2,
|
45 |
-
output,
|
46 |
-
kH=kH,
|
47 |
-
kW=kW,
|
48 |
-
patchH=patch_size,
|
49 |
-
patchW=patch_size,
|
50 |
-
padH=padH,
|
51 |
-
padW=padW,
|
52 |
-
dilationH=dilationH,
|
53 |
-
dilationW=dilationW,
|
54 |
-
dilation_patchH=dilation_patchH,
|
55 |
-
dilation_patchW=dilation_patchW,
|
56 |
-
dH=dH,
|
57 |
-
dW=dW)
|
58 |
-
|
59 |
-
return output
|
60 |
-
|
61 |
-
@staticmethod
|
62 |
-
@once_differentiable
|
63 |
-
def backward(ctx, grad_output):
|
64 |
-
input1, input2 = ctx.saved_tensors
|
65 |
-
|
66 |
-
kH, kW = ctx.kernel_size
|
67 |
-
patch_size = ctx.patch_size
|
68 |
-
padH, padW = ctx.padding
|
69 |
-
dilationH, dilationW = ctx.dilation
|
70 |
-
dilation_patchH, dilation_patchW = ctx.dilation_patch
|
71 |
-
dH, dW = ctx.stride
|
72 |
-
grad_input1 = torch.zeros_like(input1)
|
73 |
-
grad_input2 = torch.zeros_like(input2)
|
74 |
-
|
75 |
-
ext_module.correlation_backward(
|
76 |
-
grad_output,
|
77 |
-
input1,
|
78 |
-
input2,
|
79 |
-
grad_input1,
|
80 |
-
grad_input2,
|
81 |
-
kH=kH,
|
82 |
-
kW=kW,
|
83 |
-
patchH=patch_size,
|
84 |
-
patchW=patch_size,
|
85 |
-
padH=padH,
|
86 |
-
padW=padW,
|
87 |
-
dilationH=dilationH,
|
88 |
-
dilationW=dilationW,
|
89 |
-
dilation_patchH=dilation_patchH,
|
90 |
-
dilation_patchW=dilation_patchW,
|
91 |
-
dH=dH,
|
92 |
-
dW=dW)
|
93 |
-
return grad_input1, grad_input2, None, None, None, None, None, None
|
94 |
-
|
95 |
-
@staticmethod
|
96 |
-
def _output_size(ctx, input1):
|
97 |
-
iH, iW = input1.size(2), input1.size(3)
|
98 |
-
batch_size = input1.size(0)
|
99 |
-
kH, kW = ctx.kernel_size
|
100 |
-
patch_size = ctx.patch_size
|
101 |
-
dH, dW = ctx.stride
|
102 |
-
padH, padW = ctx.padding
|
103 |
-
dilationH, dilationW = ctx.dilation
|
104 |
-
dilatedKH = (kH - 1) * dilationH + 1
|
105 |
-
dilatedKW = (kW - 1) * dilationW + 1
|
106 |
-
|
107 |
-
oH = int((iH + 2 * padH - dilatedKH) / dH + 1)
|
108 |
-
oW = int((iW + 2 * padW - dilatedKW) / dW + 1)
|
109 |
-
|
110 |
-
output_size = (batch_size, patch_size, patch_size, oH, oW)
|
111 |
-
return output_size
|
112 |
-
|
113 |
-
|
114 |
-
class Correlation(nn.Module):
|
115 |
-
r"""Correlation operator
|
116 |
-
|
117 |
-
This correlation operator works for optical flow correlation computation.
|
118 |
-
|
119 |
-
There are two batched tensors with shape :math:`(N, C, H, W)`,
|
120 |
-
and the correlation output's shape is :math:`(N, max\_displacement \times
|
121 |
-
2 + 1, max\_displacement * 2 + 1, H_{out}, W_{out})`
|
122 |
-
|
123 |
-
where
|
124 |
-
|
125 |
-
.. math::
|
126 |
-
H_{out} = \left\lfloor\frac{H_{in} + 2 \times padding -
|
127 |
-
dilation \times (kernel\_size - 1) - 1}
|
128 |
-
{stride} + 1\right\rfloor
|
129 |
-
|
130 |
-
.. math::
|
131 |
-
W_{out} = \left\lfloor\frac{W_{in} + 2 \times padding - dilation
|
132 |
-
\times (kernel\_size - 1) - 1}
|
133 |
-
{stride} + 1\right\rfloor
|
134 |
-
|
135 |
-
the correlation item :math:`(N_i, dy, dx)` is formed by taking the sliding
|
136 |
-
window convolution between input1 and shifted input2,
|
137 |
-
|
138 |
-
.. math::
|
139 |
-
Corr(N_i, dx, dy) =
|
140 |
-
\sum_{c=0}^{C-1}
|
141 |
-
input1(N_i, c) \star
|
142 |
-
\mathcal{S}(input2(N_i, c), dy, dx)
|
143 |
-
|
144 |
-
where :math:`\star` is the valid 2d sliding window convolution operator,
|
145 |
-
and :math:`\mathcal{S}` means shifting the input features (auto-complete
|
146 |
-
zero marginal), and :math:`dx, dy` are shifting distance, :math:`dx, dy \in
|
147 |
-
[-max\_displacement \times dilation\_patch, max\_displacement \times
|
148 |
-
dilation\_patch]`.
|
149 |
-
|
150 |
-
Args:
|
151 |
-
kernel_size (int): The size of sliding window i.e. local neighborhood
|
152 |
-
representing the center points and involved in correlation
|
153 |
-
computation. Defaults to 1.
|
154 |
-
max_displacement (int): The radius for computing correlation volume,
|
155 |
-
but the actual working space can be dilated by dilation_patch.
|
156 |
-
Defaults to 1.
|
157 |
-
stride (int): The stride of the sliding blocks in the input spatial
|
158 |
-
dimensions. Defaults to 1.
|
159 |
-
padding (int): Zero padding added to all four sides of the input1.
|
160 |
-
Defaults to 0.
|
161 |
-
dilation (int): The spacing of local neighborhood that will involved
|
162 |
-
in correlation. Defaults to 1.
|
163 |
-
dilation_patch (int): The spacing between position need to compute
|
164 |
-
correlation. Defaults to 1.
|
165 |
-
"""
|
166 |
-
|
167 |
-
def __init__(self,
|
168 |
-
kernel_size: int = 1,
|
169 |
-
max_displacement: int = 1,
|
170 |
-
stride: int = 1,
|
171 |
-
padding: int = 0,
|
172 |
-
dilation: int = 1,
|
173 |
-
dilation_patch: int = 1) -> None:
|
174 |
-
super().__init__()
|
175 |
-
self.kernel_size = kernel_size
|
176 |
-
self.max_displacement = max_displacement
|
177 |
-
self.stride = stride
|
178 |
-
self.padding = padding
|
179 |
-
self.dilation = dilation
|
180 |
-
self.dilation_patch = dilation_patch
|
181 |
-
|
182 |
-
def forward(self, input1: Tensor, input2: Tensor) -> Tensor:
|
183 |
-
return CorrelationFunction.apply(input1, input2, self.kernel_size,
|
184 |
-
self.max_displacement, self.stride,
|
185 |
-
self.padding, self.dilation,
|
186 |
-
self.dilation_patch)
|
187 |
-
|
188 |
-
def __repr__(self) -> str:
|
189 |
-
s = self.__class__.__name__
|
190 |
-
s += f'(kernel_size={self.kernel_size}, '
|
191 |
-
s += f'max_displacement={self.max_displacement}, '
|
192 |
-
s += f'stride={self.stride}, '
|
193 |
-
s += f'padding={self.padding}, '
|
194 |
-
s += f'dilation={self.dilation}, '
|
195 |
-
s += f'dilation_patch={self.dilation_patch})'
|
196 |
-
return s
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
spaces/Anonymous-sub/Rerender/ControlNet/annotator/uniformer/mmcv/runner/base_runner.py
DELETED
@@ -1,542 +0,0 @@
|
|
1 |
-
# Copyright (c) OpenMMLab. All rights reserved.
|
2 |
-
import copy
|
3 |
-
import logging
|
4 |
-
import os.path as osp
|
5 |
-
import warnings
|
6 |
-
from abc import ABCMeta, abstractmethod
|
7 |
-
|
8 |
-
import torch
|
9 |
-
from torch.optim import Optimizer
|
10 |
-
|
11 |
-
import annotator.uniformer.mmcv as mmcv
|
12 |
-
from ..parallel import is_module_wrapper
|
13 |
-
from .checkpoint import load_checkpoint
|
14 |
-
from .dist_utils import get_dist_info
|
15 |
-
from .hooks import HOOKS, Hook
|
16 |
-
from .log_buffer import LogBuffer
|
17 |
-
from .priority import Priority, get_priority
|
18 |
-
from .utils import get_time_str
|
19 |
-
|
20 |
-
|
21 |
-
class BaseRunner(metaclass=ABCMeta):
|
22 |
-
"""The base class of Runner, a training helper for PyTorch.
|
23 |
-
|
24 |
-
All subclasses should implement the following APIs:
|
25 |
-
|
26 |
-
- ``run()``
|
27 |
-
- ``train()``
|
28 |
-
- ``val()``
|
29 |
-
- ``save_checkpoint()``
|
30 |
-
|
31 |
-
Args:
|
32 |
-
model (:obj:`torch.nn.Module`): The model to be run.
|
33 |
-
batch_processor (callable): A callable method that process a data
|
34 |
-
batch. The interface of this method should be
|
35 |
-
`batch_processor(model, data, train_mode) -> dict`
|
36 |
-
optimizer (dict or :obj:`torch.optim.Optimizer`): It can be either an
|
37 |
-
optimizer (in most cases) or a dict of optimizers (in models that
|
38 |
-
requires more than one optimizer, e.g., GAN).
|
39 |
-
work_dir (str, optional): The working directory to save checkpoints
|
40 |
-
and logs. Defaults to None.
|
41 |
-
logger (:obj:`logging.Logger`): Logger used during training.
|
42 |
-
Defaults to None. (The default value is just for backward
|
43 |
-
compatibility)
|
44 |
-
meta (dict | None): A dict records some import information such as
|
45 |
-
environment info and seed, which will be logged in logger hook.
|
46 |
-
Defaults to None.
|
47 |
-
max_epochs (int, optional): Total training epochs.
|
48 |
-
max_iters (int, optional): Total training iterations.
|
49 |
-
"""
|
50 |
-
|
51 |
-
def __init__(self,
|
52 |
-
model,
|
53 |
-
batch_processor=None,
|
54 |
-
optimizer=None,
|
55 |
-
work_dir=None,
|
56 |
-
logger=None,
|
57 |
-
meta=None,
|
58 |
-
max_iters=None,
|
59 |
-
max_epochs=None):
|
60 |
-
if batch_processor is not None:
|
61 |
-
if not callable(batch_processor):
|
62 |
-
raise TypeError('batch_processor must be callable, '
|
63 |
-
f'but got {type(batch_processor)}')
|
64 |
-
warnings.warn('batch_processor is deprecated, please implement '
|
65 |
-
'train_step() and val_step() in the model instead.')
|
66 |
-
# raise an error is `batch_processor` is not None and
|
67 |
-
# `model.train_step()` exists.
|
68 |
-
if is_module_wrapper(model):
|
69 |
-
_model = model.module
|
70 |
-
else:
|
71 |
-
_model = model
|
72 |
-
if hasattr(_model, 'train_step') or hasattr(_model, 'val_step'):
|
73 |
-
raise RuntimeError(
|
74 |
-
'batch_processor and model.train_step()/model.val_step() '
|
75 |
-
'cannot be both available.')
|
76 |
-
else:
|
77 |
-
assert hasattr(model, 'train_step')
|
78 |
-
|
79 |
-
# check the type of `optimizer`
|
80 |
-
if isinstance(optimizer, dict):
|
81 |
-
for name, optim in optimizer.items():
|
82 |
-
if not isinstance(optim, Optimizer):
|
83 |
-
raise TypeError(
|
84 |
-
f'optimizer must be a dict of torch.optim.Optimizers, '
|
85 |
-
f'but optimizer["{name}"] is a {type(optim)}')
|
86 |
-
elif not isinstance(optimizer, Optimizer) and optimizer is not None:
|
87 |
-
raise TypeError(
|
88 |
-
f'optimizer must be a torch.optim.Optimizer object '
|
89 |
-
f'or dict or None, but got {type(optimizer)}')
|
90 |
-
|
91 |
-
# check the type of `logger`
|
92 |
-
if not isinstance(logger, logging.Logger):
|
93 |
-
raise TypeError(f'logger must be a logging.Logger object, '
|
94 |
-
f'but got {type(logger)}')
|
95 |
-
|
96 |
-
# check the type of `meta`
|
97 |
-
if meta is not None and not isinstance(meta, dict):
|
98 |
-
raise TypeError(
|
99 |
-
f'meta must be a dict or None, but got {type(meta)}')
|
100 |
-
|
101 |
-
self.model = model
|
102 |
-
self.batch_processor = batch_processor
|
103 |
-
self.optimizer = optimizer
|
104 |
-
self.logger = logger
|
105 |
-
self.meta = meta
|
106 |
-
# create work_dir
|
107 |
-
if mmcv.is_str(work_dir):
|
108 |
-
self.work_dir = osp.abspath(work_dir)
|
109 |
-
mmcv.mkdir_or_exist(self.work_dir)
|
110 |
-
elif work_dir is None:
|
111 |
-
self.work_dir = None
|
112 |
-
else:
|
113 |
-
raise TypeError('"work_dir" must be a str or None')
|
114 |
-
|
115 |
-
# get model name from the model class
|
116 |
-
if hasattr(self.model, 'module'):
|
117 |
-
self._model_name = self.model.module.__class__.__name__
|
118 |
-
else:
|
119 |
-
self._model_name = self.model.__class__.__name__
|
120 |
-
|
121 |
-
self._rank, self._world_size = get_dist_info()
|
122 |
-
self.timestamp = get_time_str()
|
123 |
-
self.mode = None
|
124 |
-
self._hooks = []
|
125 |
-
self._epoch = 0
|
126 |
-
self._iter = 0
|
127 |
-
self._inner_iter = 0
|
128 |
-
|
129 |
-
if max_epochs is not None and max_iters is not None:
|
130 |
-
raise ValueError(
|
131 |
-
'Only one of `max_epochs` or `max_iters` can be set.')
|
132 |
-
|
133 |
-
self._max_epochs = max_epochs
|
134 |
-
self._max_iters = max_iters
|
135 |
-
# TODO: Redesign LogBuffer, it is not flexible and elegant enough
|
136 |
-
self.log_buffer = LogBuffer()
|
137 |
-
|
138 |
-
@property
|
139 |
-
def model_name(self):
|
140 |
-
"""str: Name of the model, usually the module class name."""
|
141 |
-
return self._model_name
|
142 |
-
|
143 |
-
@property
|
144 |
-
def rank(self):
|
145 |
-
"""int: Rank of current process. (distributed training)"""
|
146 |
-
return self._rank
|
147 |
-
|
148 |
-
@property
|
149 |
-
def world_size(self):
|
150 |
-
"""int: Number of processes participating in the job.
|
151 |
-
(distributed training)"""
|
152 |
-
return self._world_size
|
153 |
-
|
154 |
-
@property
|
155 |
-
def hooks(self):
|
156 |
-
"""list[:obj:`Hook`]: A list of registered hooks."""
|
157 |
-
return self._hooks
|
158 |
-
|
159 |
-
@property
|
160 |
-
def epoch(self):
|
161 |
-
"""int: Current epoch."""
|
162 |
-
return self._epoch
|
163 |
-
|
164 |
-
@property
|
165 |
-
def iter(self):
|
166 |
-
"""int: Current iteration."""
|
167 |
-
return self._iter
|
168 |
-
|
169 |
-
@property
|
170 |
-
def inner_iter(self):
|
171 |
-
"""int: Iteration in an epoch."""
|
172 |
-
return self._inner_iter
|
173 |
-
|
174 |
-
@property
|
175 |
-
def max_epochs(self):
|
176 |
-
"""int: Maximum training epochs."""
|
177 |
-
return self._max_epochs
|
178 |
-
|
179 |
-
@property
|
180 |
-
def max_iters(self):
|
181 |
-
"""int: Maximum training iterations."""
|
182 |
-
return self._max_iters
|
183 |
-
|
184 |
-
@abstractmethod
|
185 |
-
def train(self):
|
186 |
-
pass
|
187 |
-
|
188 |
-
@abstractmethod
|
189 |
-
def val(self):
|
190 |
-
pass
|
191 |
-
|
192 |
-
@abstractmethod
|
193 |
-
def run(self, data_loaders, workflow, **kwargs):
|
194 |
-
pass
|
195 |
-
|
196 |
-
@abstractmethod
|
197 |
-
def save_checkpoint(self,
|
198 |
-
out_dir,
|
199 |
-
filename_tmpl,
|
200 |
-
save_optimizer=True,
|
201 |
-
meta=None,
|
202 |
-
create_symlink=True):
|
203 |
-
pass
|
204 |
-
|
205 |
-
def current_lr(self):
|
206 |
-
"""Get current learning rates.
|
207 |
-
|
208 |
-
Returns:
|
209 |
-
list[float] | dict[str, list[float]]: Current learning rates of all
|
210 |
-
param groups. If the runner has a dict of optimizers, this
|
211 |
-
method will return a dict.
|
212 |
-
"""
|
213 |
-
if isinstance(self.optimizer, torch.optim.Optimizer):
|
214 |
-
lr = [group['lr'] for group in self.optimizer.param_groups]
|
215 |
-
elif isinstance(self.optimizer, dict):
|
216 |
-
lr = dict()
|
217 |
-
for name, optim in self.optimizer.items():
|
218 |
-
lr[name] = [group['lr'] for group in optim.param_groups]
|
219 |
-
else:
|
220 |
-
raise RuntimeError(
|
221 |
-
'lr is not applicable because optimizer does not exist.')
|
222 |
-
return lr
|
223 |
-
|
224 |
-
def current_momentum(self):
|
225 |
-
"""Get current momentums.
|
226 |
-
|
227 |
-
Returns:
|
228 |
-
list[float] | dict[str, list[float]]: Current momentums of all
|
229 |
-
param groups. If the runner has a dict of optimizers, this
|
230 |
-
method will return a dict.
|
231 |
-
"""
|
232 |
-
|
233 |
-
def _get_momentum(optimizer):
|
234 |
-
momentums = []
|
235 |
-
for group in optimizer.param_groups:
|
236 |
-
if 'momentum' in group.keys():
|
237 |
-
momentums.append(group['momentum'])
|
238 |
-
elif 'betas' in group.keys():
|
239 |
-
momentums.append(group['betas'][0])
|
240 |
-
else:
|
241 |
-
momentums.append(0)
|
242 |
-
return momentums
|
243 |
-
|
244 |
-
if self.optimizer is None:
|
245 |
-
raise RuntimeError(
|
246 |
-
'momentum is not applicable because optimizer does not exist.')
|
247 |
-
elif isinstance(self.optimizer, torch.optim.Optimizer):
|
248 |
-
momentums = _get_momentum(self.optimizer)
|
249 |
-
elif isinstance(self.optimizer, dict):
|
250 |
-
momentums = dict()
|
251 |
-
for name, optim in self.optimizer.items():
|
252 |
-
momentums[name] = _get_momentum(optim)
|
253 |
-
return momentums
|
254 |
-
|
255 |
-
def register_hook(self, hook, priority='NORMAL'):
|
256 |
-
"""Register a hook into the hook list.
|
257 |
-
|
258 |
-
The hook will be inserted into a priority queue, with the specified
|
259 |
-
priority (See :class:`Priority` for details of priorities).
|
260 |
-
For hooks with the same priority, they will be triggered in the same
|
261 |
-
order as they are registered.
|
262 |
-
|
263 |
-
Args:
|
264 |
-
hook (:obj:`Hook`): The hook to be registered.
|
265 |
-
priority (int or str or :obj:`Priority`): Hook priority.
|
266 |
-
Lower value means higher priority.
|
267 |
-
"""
|
268 |
-
assert isinstance(hook, Hook)
|
269 |
-
if hasattr(hook, 'priority'):
|
270 |
-
raise ValueError('"priority" is a reserved attribute for hooks')
|
271 |
-
priority = get_priority(priority)
|
272 |
-
hook.priority = priority
|
273 |
-
# insert the hook to a sorted list
|
274 |
-
inserted = False
|
275 |
-
for i in range(len(self._hooks) - 1, -1, -1):
|
276 |
-
if priority >= self._hooks[i].priority:
|
277 |
-
self._hooks.insert(i + 1, hook)
|
278 |
-
inserted = True
|
279 |
-
break
|
280 |
-
if not inserted:
|
281 |
-
self._hooks.insert(0, hook)
|
282 |
-
|
283 |
-
def register_hook_from_cfg(self, hook_cfg):
|
284 |
-
"""Register a hook from its cfg.
|
285 |
-
|
286 |
-
Args:
|
287 |
-
hook_cfg (dict): Hook config. It should have at least keys 'type'
|
288 |
-
and 'priority' indicating its type and priority.
|
289 |
-
|
290 |
-
Notes:
|
291 |
-
The specific hook class to register should not use 'type' and
|
292 |
-
'priority' arguments during initialization.
|
293 |
-
"""
|
294 |
-
hook_cfg = hook_cfg.copy()
|
295 |
-
priority = hook_cfg.pop('priority', 'NORMAL')
|
296 |
-
hook = mmcv.build_from_cfg(hook_cfg, HOOKS)
|
297 |
-
self.register_hook(hook, priority=priority)
|
298 |
-
|
299 |
-
def call_hook(self, fn_name):
|
300 |
-
"""Call all hooks.
|
301 |
-
|
302 |
-
Args:
|
303 |
-
fn_name (str): The function name in each hook to be called, such as
|
304 |
-
"before_train_epoch".
|
305 |
-
"""
|
306 |
-
for hook in self._hooks:
|
307 |
-
getattr(hook, fn_name)(self)
|
308 |
-
|
309 |
-
def get_hook_info(self):
|
310 |
-
# Get hooks info in each stage
|
311 |
-
stage_hook_map = {stage: [] for stage in Hook.stages}
|
312 |
-
for hook in self.hooks:
|
313 |
-
try:
|
314 |
-
priority = Priority(hook.priority).name
|
315 |
-
except ValueError:
|
316 |
-
priority = hook.priority
|
317 |
-
classname = hook.__class__.__name__
|
318 |
-
hook_info = f'({priority:<12}) {classname:<35}'
|
319 |
-
for trigger_stage in hook.get_triggered_stages():
|
320 |
-
stage_hook_map[trigger_stage].append(hook_info)
|
321 |
-
|
322 |
-
stage_hook_infos = []
|
323 |
-
for stage in Hook.stages:
|
324 |
-
hook_infos = stage_hook_map[stage]
|
325 |
-
if len(hook_infos) > 0:
|
326 |
-
info = f'{stage}:\n'
|
327 |
-
info += '\n'.join(hook_infos)
|
328 |
-
info += '\n -------------------- '
|
329 |
-
stage_hook_infos.append(info)
|
330 |
-
return '\n'.join(stage_hook_infos)
|
331 |
-
|
332 |
-
def load_checkpoint(self,
|
333 |
-
filename,
|
334 |
-
map_location='cpu',
|
335 |
-
strict=False,
|
336 |
-
revise_keys=[(r'^module.', '')]):
|
337 |
-
return load_checkpoint(
|
338 |
-
self.model,
|
339 |
-
filename,
|
340 |
-
map_location,
|
341 |
-
strict,
|
342 |
-
self.logger,
|
343 |
-
revise_keys=revise_keys)
|
344 |
-
|
345 |
-
def resume(self,
|
346 |
-
checkpoint,
|
347 |
-
resume_optimizer=True,
|
348 |
-
map_location='default'):
|
349 |
-
if map_location == 'default':
|
350 |
-
if torch.cuda.is_available():
|
351 |
-
device_id = torch.cuda.current_device()
|
352 |
-
checkpoint = self.load_checkpoint(
|
353 |
-
checkpoint,
|
354 |
-
map_location=lambda storage, loc: storage.cuda(device_id))
|
355 |
-
else:
|
356 |
-
checkpoint = self.load_checkpoint(checkpoint)
|
357 |
-
else:
|
358 |
-
checkpoint = self.load_checkpoint(
|
359 |
-
checkpoint, map_location=map_location)
|
360 |
-
|
361 |
-
self._epoch = checkpoint['meta']['epoch']
|
362 |
-
self._iter = checkpoint['meta']['iter']
|
363 |
-
if self.meta is None:
|
364 |
-
self.meta = {}
|
365 |
-
self.meta.setdefault('hook_msgs', {})
|
366 |
-
# load `last_ckpt`, `best_score`, `best_ckpt`, etc. for hook messages
|
367 |
-
self.meta['hook_msgs'].update(checkpoint['meta'].get('hook_msgs', {}))
|
368 |
-
|
369 |
-
# Re-calculate the number of iterations when resuming
|
370 |
-
# models with different number of GPUs
|
371 |
-
if 'config' in checkpoint['meta']:
|
372 |
-
config = mmcv.Config.fromstring(
|
373 |
-
checkpoint['meta']['config'], file_format='.py')
|
374 |
-
previous_gpu_ids = config.get('gpu_ids', None)
|
375 |
-
if previous_gpu_ids and len(previous_gpu_ids) > 0 and len(
|
376 |
-
previous_gpu_ids) != self.world_size:
|
377 |
-
self._iter = int(self._iter * len(previous_gpu_ids) /
|
378 |
-
self.world_size)
|
379 |
-
self.logger.info('the iteration number is changed due to '
|
380 |
-
'change of GPU number')
|
381 |
-
|
382 |
-
# resume meta information meta
|
383 |
-
self.meta = checkpoint['meta']
|
384 |
-
|
385 |
-
if 'optimizer' in checkpoint and resume_optimizer:
|
386 |
-
if isinstance(self.optimizer, Optimizer):
|
387 |
-
self.optimizer.load_state_dict(checkpoint['optimizer'])
|
388 |
-
elif isinstance(self.optimizer, dict):
|
389 |
-
for k in self.optimizer.keys():
|
390 |
-
self.optimizer[k].load_state_dict(
|
391 |
-
checkpoint['optimizer'][k])
|
392 |
-
else:
|
393 |
-
raise TypeError(
|
394 |
-
'Optimizer should be dict or torch.optim.Optimizer '
|
395 |
-
f'but got {type(self.optimizer)}')
|
396 |
-
|
397 |
-
self.logger.info('resumed epoch %d, iter %d', self.epoch, self.iter)
|
398 |
-
|
399 |
-
def register_lr_hook(self, lr_config):
|
400 |
-
if lr_config is None:
|
401 |
-
return
|
402 |
-
elif isinstance(lr_config, dict):
|
403 |
-
assert 'policy' in lr_config
|
404 |
-
policy_type = lr_config.pop('policy')
|
405 |
-
# If the type of policy is all in lower case, e.g., 'cyclic',
|
406 |
-
# then its first letter will be capitalized, e.g., to be 'Cyclic'.
|
407 |
-
# This is for the convenient usage of Lr updater.
|
408 |
-
# Since this is not applicable for `
|
409 |
-
# CosineAnnealingLrUpdater`,
|
410 |
-
# the string will not be changed if it contains capital letters.
|
411 |
-
if policy_type == policy_type.lower():
|
412 |
-
policy_type = policy_type.title()
|
413 |
-
hook_type = policy_type + 'LrUpdaterHook'
|
414 |
-
lr_config['type'] = hook_type
|
415 |
-
hook = mmcv.build_from_cfg(lr_config, HOOKS)
|
416 |
-
else:
|
417 |
-
hook = lr_config
|
418 |
-
self.register_hook(hook, priority='VERY_HIGH')
|
419 |
-
|
420 |
-
def register_momentum_hook(self, momentum_config):
|
421 |
-
if momentum_config is None:
|
422 |
-
return
|
423 |
-
if isinstance(momentum_config, dict):
|
424 |
-
assert 'policy' in momentum_config
|
425 |
-
policy_type = momentum_config.pop('policy')
|
426 |
-
# If the type of policy is all in lower case, e.g., 'cyclic',
|
427 |
-
# then its first letter will be capitalized, e.g., to be 'Cyclic'.
|
428 |
-
# This is for the convenient usage of momentum updater.
|
429 |
-
# Since this is not applicable for
|
430 |
-
# `CosineAnnealingMomentumUpdater`,
|
431 |
-
# the string will not be changed if it contains capital letters.
|
432 |
-
if policy_type == policy_type.lower():
|
433 |
-
policy_type = policy_type.title()
|
434 |
-
hook_type = policy_type + 'MomentumUpdaterHook'
|
435 |
-
momentum_config['type'] = hook_type
|
436 |
-
hook = mmcv.build_from_cfg(momentum_config, HOOKS)
|
437 |
-
else:
|
438 |
-
hook = momentum_config
|
439 |
-
self.register_hook(hook, priority='HIGH')
|
440 |
-
|
441 |
-
def register_optimizer_hook(self, optimizer_config):
|
442 |
-
if optimizer_config is None:
|
443 |
-
return
|
444 |
-
if isinstance(optimizer_config, dict):
|
445 |
-
optimizer_config.setdefault('type', 'OptimizerHook')
|
446 |
-
hook = mmcv.build_from_cfg(optimizer_config, HOOKS)
|
447 |
-
else:
|
448 |
-
hook = optimizer_config
|
449 |
-
self.register_hook(hook, priority='ABOVE_NORMAL')
|
450 |
-
|
451 |
-
def register_checkpoint_hook(self, checkpoint_config):
|
452 |
-
if checkpoint_config is None:
|
453 |
-
return
|
454 |
-
if isinstance(checkpoint_config, dict):
|
455 |
-
checkpoint_config.setdefault('type', 'CheckpointHook')
|
456 |
-
hook = mmcv.build_from_cfg(checkpoint_config, HOOKS)
|
457 |
-
else:
|
458 |
-
hook = checkpoint_config
|
459 |
-
self.register_hook(hook, priority='NORMAL')
|
460 |
-
|
461 |
-
def register_logger_hooks(self, log_config):
|
462 |
-
if log_config is None:
|
463 |
-
return
|
464 |
-
log_interval = log_config['interval']
|
465 |
-
for info in log_config['hooks']:
|
466 |
-
logger_hook = mmcv.build_from_cfg(
|
467 |
-
info, HOOKS, default_args=dict(interval=log_interval))
|
468 |
-
self.register_hook(logger_hook, priority='VERY_LOW')
|
469 |
-
|
470 |
-
def register_timer_hook(self, timer_config):
|
471 |
-
if timer_config is None:
|
472 |
-
return
|
473 |
-
if isinstance(timer_config, dict):
|
474 |
-
timer_config_ = copy.deepcopy(timer_config)
|
475 |
-
hook = mmcv.build_from_cfg(timer_config_, HOOKS)
|
476 |
-
else:
|
477 |
-
hook = timer_config
|
478 |
-
self.register_hook(hook, priority='LOW')
|
479 |
-
|
480 |
-
def register_custom_hooks(self, custom_config):
|
481 |
-
if custom_config is None:
|
482 |
-
return
|
483 |
-
|
484 |
-
if not isinstance(custom_config, list):
|
485 |
-
custom_config = [custom_config]
|
486 |
-
|
487 |
-
for item in custom_config:
|
488 |
-
if isinstance(item, dict):
|
489 |
-
self.register_hook_from_cfg(item)
|
490 |
-
else:
|
491 |
-
self.register_hook(item, priority='NORMAL')
|
492 |
-
|
493 |
-
def register_profiler_hook(self, profiler_config):
|
494 |
-
if profiler_config is None:
|
495 |
-
return
|
496 |
-
if isinstance(profiler_config, dict):
|
497 |
-
profiler_config.setdefault('type', 'ProfilerHook')
|
498 |
-
hook = mmcv.build_from_cfg(profiler_config, HOOKS)
|
499 |
-
else:
|
500 |
-
hook = profiler_config
|
501 |
-
self.register_hook(hook)
|
502 |
-
|
503 |
-
def register_training_hooks(self,
|
504 |
-
lr_config,
|
505 |
-
optimizer_config=None,
|
506 |
-
checkpoint_config=None,
|
507 |
-
log_config=None,
|
508 |
-
momentum_config=None,
|
509 |
-
timer_config=dict(type='IterTimerHook'),
|
510 |
-
custom_hooks_config=None):
|
511 |
-
"""Register default and custom hooks for training.
|
512 |
-
|
513 |
-
Default and custom hooks include:
|
514 |
-
|
515 |
-
+----------------------+-------------------------+
|
516 |
-
| Hooks | Priority |
|
517 |
-
+======================+=========================+
|
518 |
-
| LrUpdaterHook | VERY_HIGH (10) |
|
519 |
-
+----------------------+-------------------------+
|
520 |
-
| MomentumUpdaterHook | HIGH (30) |
|
521 |
-
+----------------------+-------------------------+
|
522 |
-
| OptimizerStepperHook | ABOVE_NORMAL (40) |
|
523 |
-
+----------------------+-------------------------+
|
524 |
-
| CheckpointSaverHook | NORMAL (50) |
|
525 |
-
+----------------------+-------------------------+
|
526 |
-
| IterTimerHook | LOW (70) |
|
527 |
-
+----------------------+-------------------------+
|
528 |
-
| LoggerHook(s) | VERY_LOW (90) |
|
529 |
-
+----------------------+-------------------------+
|
530 |
-
| CustomHook(s) | defaults to NORMAL (50) |
|
531 |
-
+----------------------+-------------------------+
|
532 |
-
|
533 |
-
If custom hooks have same priority with default hooks, custom hooks
|
534 |
-
will be triggered after default hooks.
|
535 |
-
"""
|
536 |
-
self.register_lr_hook(lr_config)
|
537 |
-
self.register_momentum_hook(momentum_config)
|
538 |
-
self.register_optimizer_hook(optimizer_config)
|
539 |
-
self.register_checkpoint_hook(checkpoint_config)
|
540 |
-
self.register_timer_hook(timer_config)
|
541 |
-
self.register_logger_hooks(log_config)
|
542 |
-
self.register_custom_hooks(custom_hooks_config)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
spaces/Anthony7906/MengHuiMXD_GPT/modules/overwrites.py
DELETED
@@ -1,94 +0,0 @@
|
|
1 |
-
from __future__ import annotations
|
2 |
-
import logging
|
3 |
-
|
4 |
-
from llama_index import Prompt
|
5 |
-
from typing import List, Tuple
|
6 |
-
import mdtex2html
|
7 |
-
from gradio_client import utils as client_utils
|
8 |
-
|
9 |
-
from modules.presets import *
|
10 |
-
from modules.llama_func import *
|
11 |
-
|
12 |
-
|
13 |
-
def compact_text_chunks(self, prompt: Prompt, text_chunks: List[str]) -> List[str]:
|
14 |
-
logging.debug("Compacting text chunks...🚀🚀🚀")
|
15 |
-
combined_str = [c.strip() for c in text_chunks if c.strip()]
|
16 |
-
combined_str = [f"[{index+1}] {c}" for index, c in enumerate(combined_str)]
|
17 |
-
combined_str = "\n\n".join(combined_str)
|
18 |
-
# resplit based on self.max_chunk_overlap
|
19 |
-
text_splitter = self.get_text_splitter_given_prompt(prompt, 1, padding=1)
|
20 |
-
return text_splitter.split_text(combined_str)
|
21 |
-
|
22 |
-
|
23 |
-
def postprocess(
|
24 |
-
self,
|
25 |
-
y: List[List[str | Tuple[str] | Tuple[str, str] | None] | Tuple],
|
26 |
-
) -> List[List[str | Dict | None]]:
|
27 |
-
"""
|
28 |
-
Parameters:
|
29 |
-
y: List of lists representing the message and response pairs. Each message and response should be a string, which may be in Markdown format. It can also be a tuple whose first element is a string filepath or URL to an image/video/audio, and second (optional) element is the alt text, in which case the media file is displayed. It can also be None, in which case that message is not displayed.
|
30 |
-
Returns:
|
31 |
-
List of lists representing the message and response. Each message and response will be a string of HTML, or a dictionary with media information. Or None if the message is not to be displayed.
|
32 |
-
"""
|
33 |
-
if y is None:
|
34 |
-
return []
|
35 |
-
processed_messages = []
|
36 |
-
for message_pair in y:
|
37 |
-
assert isinstance(
|
38 |
-
message_pair, (tuple, list)
|
39 |
-
), f"Expected a list of lists or list of tuples. Received: {message_pair}"
|
40 |
-
assert (
|
41 |
-
len(message_pair) == 2
|
42 |
-
), f"Expected a list of lists of length 2 or list of tuples of length 2. Received: {message_pair}"
|
43 |
-
|
44 |
-
processed_messages.append(
|
45 |
-
[
|
46 |
-
self._postprocess_chat_messages(message_pair[0], "user"),
|
47 |
-
self._postprocess_chat_messages(message_pair[1], "bot"),
|
48 |
-
]
|
49 |
-
)
|
50 |
-
return processed_messages
|
51 |
-
|
52 |
-
def postprocess_chat_messages(
|
53 |
-
self, chat_message: str | Tuple | List | None, message_type: str
|
54 |
-
) -> str | Dict | None:
|
55 |
-
if chat_message is None:
|
56 |
-
return None
|
57 |
-
elif isinstance(chat_message, (tuple, list)):
|
58 |
-
filepath = chat_message[0]
|
59 |
-
mime_type = client_utils.get_mimetype(filepath)
|
60 |
-
filepath = self.make_temp_copy_if_needed(filepath)
|
61 |
-
return {
|
62 |
-
"name": filepath,
|
63 |
-
"mime_type": mime_type,
|
64 |
-
"alt_text": chat_message[1] if len(chat_message) > 1 else None,
|
65 |
-
"data": None, # These last two fields are filled in by the frontend
|
66 |
-
"is_file": True,
|
67 |
-
}
|
68 |
-
elif isinstance(chat_message, str):
|
69 |
-
if message_type == "bot":
|
70 |
-
if not detect_converted_mark(chat_message):
|
71 |
-
chat_message = convert_mdtext(chat_message)
|
72 |
-
elif message_type == "user":
|
73 |
-
if not detect_converted_mark(chat_message):
|
74 |
-
chat_message = convert_asis(chat_message)
|
75 |
-
return chat_message
|
76 |
-
else:
|
77 |
-
raise ValueError(f"Invalid message for Chatbot component: {chat_message}")
|
78 |
-
|
79 |
-
with open("./assets/custom.js", "r", encoding="utf-8") as f, open("./assets/Kelpy-Codos.js", "r", encoding="utf-8") as f2:
|
80 |
-
customJS = f.read()
|
81 |
-
kelpyCodos = f2.read()
|
82 |
-
|
83 |
-
def reload_javascript():
|
84 |
-
print("Reloading javascript...")
|
85 |
-
js = f'<script>{customJS}</script><script>{kelpyCodos}</script>'
|
86 |
-
def template_response(*args, **kwargs):
|
87 |
-
res = GradioTemplateResponseOriginal(*args, **kwargs)
|
88 |
-
res.body = res.body.replace(b'</html>', f'{js}</html>'.encode("utf8"))
|
89 |
-
res.init_headers()
|
90 |
-
return res
|
91 |
-
|
92 |
-
gr.routes.templates.TemplateResponse = template_response
|
93 |
-
|
94 |
-
GradioTemplateResponseOriginal = gr.routes.templates.TemplateResponse
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
spaces/Apex-X/nono/roop/globals.py
DELETED
@@ -1,22 +0,0 @@
|
|
1 |
-
from typing import List, Optional
|
2 |
-
|
3 |
-
source_path: Optional[str] = None
|
4 |
-
target_path: Optional[str] = None
|
5 |
-
output_path: Optional[str] = None
|
6 |
-
headless: Optional[bool] = None
|
7 |
-
frame_processors: List[str] = []
|
8 |
-
keep_fps: Optional[bool] = None
|
9 |
-
keep_frames: Optional[bool] = None
|
10 |
-
skip_audio: Optional[bool] = None
|
11 |
-
many_faces: Optional[bool] = None
|
12 |
-
reference_face_position: Optional[int] = None
|
13 |
-
reference_frame_number: Optional[int] = None
|
14 |
-
similar_face_distance: Optional[float] = None
|
15 |
-
temp_frame_format: Optional[str] = None
|
16 |
-
temp_frame_quality: Optional[int] = None
|
17 |
-
output_video_encoder: Optional[str] = None
|
18 |
-
output_video_quality: Optional[int] = None
|
19 |
-
max_memory: Optional[int] = None
|
20 |
-
execution_providers: List[str] = []
|
21 |
-
execution_threads: Optional[int] = None
|
22 |
-
log_level: str = 'error'
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
spaces/Ashrafb/Tesseract-OCR/app_interface.py
DELETED
@@ -1,37 +0,0 @@
|
|
1 |
-
from typing import List
|
2 |
-
|
3 |
-
import pytesseract
|
4 |
-
from PIL import Image
|
5 |
-
|
6 |
-
import gradio as gr
|
7 |
-
|
8 |
-
def tesseract_ocr(filepath: str, languages: List[str]):
|
9 |
-
image = Image.open(filepath)
|
10 |
-
return pytesseract.image_to_string(image=image, lang=', '.join(languages))
|
11 |
-
|
12 |
-
title = "Tesseract OCR"
|
13 |
-
description = "Gradio demo for Tesseract. Tesseract is an open source text recognition (OCR) Engine."
|
14 |
-
article = "<p style='text-align: center'><a href='https://tesseract-ocr.github.io/' target='_blank'>Tesseract documentation</a> | <a href='https://github.com/tesseract-ocr/tesseract' target='_blank'>Github Repo</a></p>"
|
15 |
-
examples = [
|
16 |
-
['examples/eurotext.png', ['eng']],
|
17 |
-
['examples/tesseract_sample.png', ['jpn', 'eng']],
|
18 |
-
['examples/chi.jpg', ['HanS', 'HanT']]
|
19 |
-
]
|
20 |
-
|
21 |
-
language_choices = pytesseract.get_languages()
|
22 |
-
|
23 |
-
demo = gr.Interface(
|
24 |
-
fn=tesseract_ocr,
|
25 |
-
inputs=[
|
26 |
-
gr.Image(type="filepath", label="Input"),
|
27 |
-
gr.CheckboxGroup(language_choices, type="value", value=['eng'], label='language')
|
28 |
-
],
|
29 |
-
outputs='text',
|
30 |
-
title=title,
|
31 |
-
description=description,
|
32 |
-
article=article,
|
33 |
-
examples=examples,
|
34 |
-
)
|
35 |
-
|
36 |
-
if __name__ == '__main__':
|
37 |
-
demo.launch()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
spaces/Ataturk-Chatbot/HuggingFaceChat/venv/lib/python3.11/site-packages/pip/_internal/cli/status_codes.py
DELETED
@@ -1,6 +0,0 @@
|
|
1 |
-
SUCCESS = 0
|
2 |
-
ERROR = 1
|
3 |
-
UNKNOWN_ERROR = 2
|
4 |
-
VIRTUALENV_NOT_FOUND = 3
|
5 |
-
PREVIOUS_BUILD_DIR_ERROR = 4
|
6 |
-
NO_MATCHES_FOUND = 23
|
|
|
|
|
|
|
|
|
|
|
|
|
|
spaces/Ataturk-Chatbot/HuggingFaceChat/venv/lib/python3.11/site-packages/pip/_internal/metadata/importlib/_dists.py
DELETED
@@ -1,224 +0,0 @@
|
|
1 |
-
import email.message
|
2 |
-
import importlib.metadata
|
3 |
-
import os
|
4 |
-
import pathlib
|
5 |
-
import zipfile
|
6 |
-
from typing import (
|
7 |
-
Collection,
|
8 |
-
Dict,
|
9 |
-
Iterable,
|
10 |
-
Iterator,
|
11 |
-
Mapping,
|
12 |
-
Optional,
|
13 |
-
Sequence,
|
14 |
-
cast,
|
15 |
-
)
|
16 |
-
|
17 |
-
from pip._vendor.packaging.requirements import Requirement
|
18 |
-
from pip._vendor.packaging.utils import NormalizedName, canonicalize_name
|
19 |
-
from pip._vendor.packaging.version import parse as parse_version
|
20 |
-
|
21 |
-
from pip._internal.exceptions import InvalidWheel, UnsupportedWheel
|
22 |
-
from pip._internal.metadata.base import (
|
23 |
-
BaseDistribution,
|
24 |
-
BaseEntryPoint,
|
25 |
-
DistributionVersion,
|
26 |
-
InfoPath,
|
27 |
-
Wheel,
|
28 |
-
)
|
29 |
-
from pip._internal.utils.misc import normalize_path
|
30 |
-
from pip._internal.utils.packaging import safe_extra
|
31 |
-
from pip._internal.utils.temp_dir import TempDirectory
|
32 |
-
from pip._internal.utils.wheel import parse_wheel, read_wheel_metadata_file
|
33 |
-
|
34 |
-
from ._compat import BasePath, get_dist_name
|
35 |
-
|
36 |
-
|
37 |
-
class WheelDistribution(importlib.metadata.Distribution):
|
38 |
-
"""An ``importlib.metadata.Distribution`` read from a wheel.
|
39 |
-
|
40 |
-
Although ``importlib.metadata.PathDistribution`` accepts ``zipfile.Path``,
|
41 |
-
its implementation is too "lazy" for pip's needs (we can't keep the ZipFile
|
42 |
-
handle open for the entire lifetime of the distribution object).
|
43 |
-
|
44 |
-
This implementation eagerly reads the entire metadata directory into the
|
45 |
-
memory instead, and operates from that.
|
46 |
-
"""
|
47 |
-
|
48 |
-
def __init__(
|
49 |
-
self,
|
50 |
-
files: Mapping[pathlib.PurePosixPath, bytes],
|
51 |
-
info_location: pathlib.PurePosixPath,
|
52 |
-
) -> None:
|
53 |
-
self._files = files
|
54 |
-
self.info_location = info_location
|
55 |
-
|
56 |
-
@classmethod
|
57 |
-
def from_zipfile(
|
58 |
-
cls,
|
59 |
-
zf: zipfile.ZipFile,
|
60 |
-
name: str,
|
61 |
-
location: str,
|
62 |
-
) -> "WheelDistribution":
|
63 |
-
info_dir, _ = parse_wheel(zf, name)
|
64 |
-
paths = (
|
65 |
-
(name, pathlib.PurePosixPath(name.split("/", 1)[-1]))
|
66 |
-
for name in zf.namelist()
|
67 |
-
if name.startswith(f"{info_dir}/")
|
68 |
-
)
|
69 |
-
files = {
|
70 |
-
relpath: read_wheel_metadata_file(zf, fullpath)
|
71 |
-
for fullpath, relpath in paths
|
72 |
-
}
|
73 |
-
info_location = pathlib.PurePosixPath(location, info_dir)
|
74 |
-
return cls(files, info_location)
|
75 |
-
|
76 |
-
def iterdir(self, path: InfoPath) -> Iterator[pathlib.PurePosixPath]:
|
77 |
-
# Only allow iterating through the metadata directory.
|
78 |
-
if pathlib.PurePosixPath(str(path)) in self._files:
|
79 |
-
return iter(self._files)
|
80 |
-
raise FileNotFoundError(path)
|
81 |
-
|
82 |
-
def read_text(self, filename: str) -> Optional[str]:
|
83 |
-
try:
|
84 |
-
data = self._files[pathlib.PurePosixPath(filename)]
|
85 |
-
except KeyError:
|
86 |
-
return None
|
87 |
-
try:
|
88 |
-
text = data.decode("utf-8")
|
89 |
-
except UnicodeDecodeError as e:
|
90 |
-
wheel = self.info_location.parent
|
91 |
-
error = f"Error decoding metadata for {wheel}: {e} in {filename} file"
|
92 |
-
raise UnsupportedWheel(error)
|
93 |
-
return text
|
94 |
-
|
95 |
-
|
96 |
-
class Distribution(BaseDistribution):
|
97 |
-
def __init__(
|
98 |
-
self,
|
99 |
-
dist: importlib.metadata.Distribution,
|
100 |
-
info_location: Optional[BasePath],
|
101 |
-
installed_location: Optional[BasePath],
|
102 |
-
) -> None:
|
103 |
-
self._dist = dist
|
104 |
-
self._info_location = info_location
|
105 |
-
self._installed_location = installed_location
|
106 |
-
|
107 |
-
@classmethod
|
108 |
-
def from_directory(cls, directory: str) -> BaseDistribution:
|
109 |
-
info_location = pathlib.Path(directory)
|
110 |
-
dist = importlib.metadata.Distribution.at(info_location)
|
111 |
-
return cls(dist, info_location, info_location.parent)
|
112 |
-
|
113 |
-
@classmethod
|
114 |
-
def from_metadata_file_contents(
|
115 |
-
cls,
|
116 |
-
metadata_contents: bytes,
|
117 |
-
filename: str,
|
118 |
-
project_name: str,
|
119 |
-
) -> BaseDistribution:
|
120 |
-
# Generate temp dir to contain the metadata file, and write the file contents.
|
121 |
-
temp_dir = pathlib.Path(
|
122 |
-
TempDirectory(kind="metadata", globally_managed=True).path
|
123 |
-
)
|
124 |
-
metadata_path = temp_dir / "METADATA"
|
125 |
-
metadata_path.write_bytes(metadata_contents)
|
126 |
-
# Construct dist pointing to the newly created directory.
|
127 |
-
dist = importlib.metadata.Distribution.at(metadata_path.parent)
|
128 |
-
return cls(dist, metadata_path.parent, None)
|
129 |
-
|
130 |
-
@classmethod
|
131 |
-
def from_wheel(cls, wheel: Wheel, name: str) -> BaseDistribution:
|
132 |
-
try:
|
133 |
-
with wheel.as_zipfile() as zf:
|
134 |
-
dist = WheelDistribution.from_zipfile(zf, name, wheel.location)
|
135 |
-
except zipfile.BadZipFile as e:
|
136 |
-
raise InvalidWheel(wheel.location, name) from e
|
137 |
-
except UnsupportedWheel as e:
|
138 |
-
raise UnsupportedWheel(f"{name} has an invalid wheel, {e}")
|
139 |
-
return cls(dist, dist.info_location, pathlib.PurePosixPath(wheel.location))
|
140 |
-
|
141 |
-
@property
|
142 |
-
def location(self) -> Optional[str]:
|
143 |
-
if self._info_location is None:
|
144 |
-
return None
|
145 |
-
return str(self._info_location.parent)
|
146 |
-
|
147 |
-
@property
|
148 |
-
def info_location(self) -> Optional[str]:
|
149 |
-
if self._info_location is None:
|
150 |
-
return None
|
151 |
-
return str(self._info_location)
|
152 |
-
|
153 |
-
@property
|
154 |
-
def installed_location(self) -> Optional[str]:
|
155 |
-
if self._installed_location is None:
|
156 |
-
return None
|
157 |
-
return normalize_path(str(self._installed_location))
|
158 |
-
|
159 |
-
def _get_dist_name_from_location(self) -> Optional[str]:
|
160 |
-
"""Try to get the name from the metadata directory name.
|
161 |
-
|
162 |
-
This is much faster than reading metadata.
|
163 |
-
"""
|
164 |
-
if self._info_location is None:
|
165 |
-
return None
|
166 |
-
stem, suffix = os.path.splitext(self._info_location.name)
|
167 |
-
if suffix not in (".dist-info", ".egg-info"):
|
168 |
-
return None
|
169 |
-
return stem.split("-", 1)[0]
|
170 |
-
|
171 |
-
@property
|
172 |
-
def canonical_name(self) -> NormalizedName:
|
173 |
-
name = self._get_dist_name_from_location() or get_dist_name(self._dist)
|
174 |
-
return canonicalize_name(name)
|
175 |
-
|
176 |
-
@property
|
177 |
-
def version(self) -> DistributionVersion:
|
178 |
-
return parse_version(self._dist.version)
|
179 |
-
|
180 |
-
def is_file(self, path: InfoPath) -> bool:
|
181 |
-
return self._dist.read_text(str(path)) is not None
|
182 |
-
|
183 |
-
def iter_distutils_script_names(self) -> Iterator[str]:
|
184 |
-
# A distutils installation is always "flat" (not in e.g. egg form), so
|
185 |
-
# if this distribution's info location is NOT a pathlib.Path (but e.g.
|
186 |
-
# zipfile.Path), it can never contain any distutils scripts.
|
187 |
-
if not isinstance(self._info_location, pathlib.Path):
|
188 |
-
return
|
189 |
-
for child in self._info_location.joinpath("scripts").iterdir():
|
190 |
-
yield child.name
|
191 |
-
|
192 |
-
def read_text(self, path: InfoPath) -> str:
|
193 |
-
content = self._dist.read_text(str(path))
|
194 |
-
if content is None:
|
195 |
-
raise FileNotFoundError(path)
|
196 |
-
return content
|
197 |
-
|
198 |
-
def iter_entry_points(self) -> Iterable[BaseEntryPoint]:
|
199 |
-
# importlib.metadata's EntryPoint structure sasitfies BaseEntryPoint.
|
200 |
-
return self._dist.entry_points
|
201 |
-
|
202 |
-
def _metadata_impl(self) -> email.message.Message:
|
203 |
-
# From Python 3.10+, importlib.metadata declares PackageMetadata as the
|
204 |
-
# return type. This protocol is unfortunately a disaster now and misses
|
205 |
-
# a ton of fields that we need, including get() and get_payload(). We
|
206 |
-
# rely on the implementation that the object is actually a Message now,
|
207 |
-
# until upstream can improve the protocol. (python/cpython#94952)
|
208 |
-
return cast(email.message.Message, self._dist.metadata)
|
209 |
-
|
210 |
-
def iter_provided_extras(self) -> Iterable[str]:
|
211 |
-
return (
|
212 |
-
safe_extra(extra) for extra in self.metadata.get_all("Provides-Extra", [])
|
213 |
-
)
|
214 |
-
|
215 |
-
def iter_dependencies(self, extras: Collection[str] = ()) -> Iterable[Requirement]:
|
216 |
-
contexts: Sequence[Dict[str, str]] = [{"extra": safe_extra(e)} for e in extras]
|
217 |
-
for req_string in self.metadata.get_all("Requires-Dist", []):
|
218 |
-
req = Requirement(req_string)
|
219 |
-
if not req.marker:
|
220 |
-
yield req
|
221 |
-
elif not extras and req.marker.evaluate({"extra": ""}):
|
222 |
-
yield req
|
223 |
-
elif any(req.marker.evaluate(context) for context in contexts):
|
224 |
-
yield req
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
spaces/Ataturk-Chatbot/HuggingFaceChat/venv/lib/python3.11/site-packages/pip/_vendor/chardet/cli/chardetect.py
DELETED
@@ -1,112 +0,0 @@
|
|
1 |
-
"""
|
2 |
-
Script which takes one or more file paths and reports on their detected
|
3 |
-
encodings
|
4 |
-
|
5 |
-
Example::
|
6 |
-
|
7 |
-
% chardetect somefile someotherfile
|
8 |
-
somefile: windows-1252 with confidence 0.5
|
9 |
-
someotherfile: ascii with confidence 1.0
|
10 |
-
|
11 |
-
If no paths are provided, it takes its input from stdin.
|
12 |
-
|
13 |
-
"""
|
14 |
-
|
15 |
-
|
16 |
-
import argparse
|
17 |
-
import sys
|
18 |
-
from typing import Iterable, List, Optional
|
19 |
-
|
20 |
-
from .. import __version__
|
21 |
-
from ..universaldetector import UniversalDetector
|
22 |
-
|
23 |
-
|
24 |
-
def description_of(
|
25 |
-
lines: Iterable[bytes],
|
26 |
-
name: str = "stdin",
|
27 |
-
minimal: bool = False,
|
28 |
-
should_rename_legacy: bool = False,
|
29 |
-
) -> Optional[str]:
|
30 |
-
"""
|
31 |
-
Return a string describing the probable encoding of a file or
|
32 |
-
list of strings.
|
33 |
-
|
34 |
-
:param lines: The lines to get the encoding of.
|
35 |
-
:type lines: Iterable of bytes
|
36 |
-
:param name: Name of file or collection of lines
|
37 |
-
:type name: str
|
38 |
-
:param should_rename_legacy: Should we rename legacy encodings to
|
39 |
-
their more modern equivalents?
|
40 |
-
:type should_rename_legacy: ``bool``
|
41 |
-
"""
|
42 |
-
u = UniversalDetector(should_rename_legacy=should_rename_legacy)
|
43 |
-
for line in lines:
|
44 |
-
line = bytearray(line)
|
45 |
-
u.feed(line)
|
46 |
-
# shortcut out of the loop to save reading further - particularly useful if we read a BOM.
|
47 |
-
if u.done:
|
48 |
-
break
|
49 |
-
u.close()
|
50 |
-
result = u.result
|
51 |
-
if minimal:
|
52 |
-
return result["encoding"]
|
53 |
-
if result["encoding"]:
|
54 |
-
return f'{name}: {result["encoding"]} with confidence {result["confidence"]}'
|
55 |
-
return f"{name}: no result"
|
56 |
-
|
57 |
-
|
58 |
-
def main(argv: Optional[List[str]] = None) -> None:
|
59 |
-
"""
|
60 |
-
Handles command line arguments and gets things started.
|
61 |
-
|
62 |
-
:param argv: List of arguments, as if specified on the command-line.
|
63 |
-
If None, ``sys.argv[1:]`` is used instead.
|
64 |
-
:type argv: list of str
|
65 |
-
"""
|
66 |
-
# Get command line arguments
|
67 |
-
parser = argparse.ArgumentParser(
|
68 |
-
description=(
|
69 |
-
"Takes one or more file paths and reports their detected encodings"
|
70 |
-
)
|
71 |
-
)
|
72 |
-
parser.add_argument(
|
73 |
-
"input",
|
74 |
-
help="File whose encoding we would like to determine. (default: stdin)",
|
75 |
-
type=argparse.FileType("rb"),
|
76 |
-
nargs="*",
|
77 |
-
default=[sys.stdin.buffer],
|
78 |
-
)
|
79 |
-
parser.add_argument(
|
80 |
-
"--minimal",
|
81 |
-
help="Print only the encoding to standard output",
|
82 |
-
action="store_true",
|
83 |
-
)
|
84 |
-
parser.add_argument(
|
85 |
-
"-l",
|
86 |
-
"--legacy",
|
87 |
-
help="Rename legacy encodings to more modern ones.",
|
88 |
-
action="store_true",
|
89 |
-
)
|
90 |
-
parser.add_argument(
|
91 |
-
"--version", action="version", version=f"%(prog)s {__version__}"
|
92 |
-
)
|
93 |
-
args = parser.parse_args(argv)
|
94 |
-
|
95 |
-
for f in args.input:
|
96 |
-
if f.isatty():
|
97 |
-
print(
|
98 |
-
"You are running chardetect interactively. Press "
|
99 |
-
"CTRL-D twice at the start of a blank line to signal the "
|
100 |
-
"end of your input. If you want help, run chardetect "
|
101 |
-
"--help\n",
|
102 |
-
file=sys.stderr,
|
103 |
-
)
|
104 |
-
print(
|
105 |
-
description_of(
|
106 |
-
f, f.name, minimal=args.minimal, should_rename_legacy=args.legacy
|
107 |
-
)
|
108 |
-
)
|
109 |
-
|
110 |
-
|
111 |
-
if __name__ == "__main__":
|
112 |
-
main()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
spaces/Awiny/Image2Paragraph/models/grit_src/grit/data/datasets/vg.py
DELETED
@@ -1,98 +0,0 @@
|
|
1 |
-
import logging
|
2 |
-
import os
|
3 |
-
from fvcore.common.timer import Timer
|
4 |
-
from detectron2.structures import BoxMode
|
5 |
-
from fvcore.common.file_io import PathManager
|
6 |
-
from detectron2.data import DatasetCatalog, MetadataCatalog
|
7 |
-
from lvis import LVIS
|
8 |
-
|
9 |
-
logger = logging.getLogger(__name__)
|
10 |
-
|
11 |
-
__all__ = ["load_vg_json", "register_vg_instances"]
|
12 |
-
|
13 |
-
|
14 |
-
def register_vg_instances(name, metadata, json_file, image_root):
|
15 |
-
"""
|
16 |
-
"""
|
17 |
-
DatasetCatalog.register(name, lambda: load_vg_json(
|
18 |
-
json_file, image_root, name))
|
19 |
-
MetadataCatalog.get(name).set(
|
20 |
-
json_file=json_file, image_root=image_root,
|
21 |
-
evaluator_type="vg", **metadata
|
22 |
-
)
|
23 |
-
|
24 |
-
|
25 |
-
def get_vg_meta():
|
26 |
-
categories = [{'supercategory': 'object', 'id': 1, 'name': 'object'}]
|
27 |
-
vg_categories = sorted(categories, key=lambda x: x["id"])
|
28 |
-
thing_classes = [k["name"] for k in vg_categories]
|
29 |
-
meta = {"thing_classes": thing_classes}
|
30 |
-
return meta
|
31 |
-
|
32 |
-
|
33 |
-
def load_vg_json(json_file, image_root, dataset_name=None):
|
34 |
-
|
35 |
-
json_file = PathManager.get_local_path(json_file)
|
36 |
-
|
37 |
-
timer = Timer()
|
38 |
-
lvis_api = LVIS(json_file)
|
39 |
-
if timer.seconds() > 1:
|
40 |
-
logger.info("Loading {} takes {:.2f} seconds.".format(
|
41 |
-
json_file, timer.seconds()))
|
42 |
-
|
43 |
-
img_ids = sorted(lvis_api.imgs.keys())
|
44 |
-
imgs = lvis_api.load_imgs(img_ids)
|
45 |
-
anns = [lvis_api.img_ann_map[img_id] for img_id in img_ids]
|
46 |
-
|
47 |
-
ann_ids = [ann["id"] for anns_per_image in anns for ann in anns_per_image]
|
48 |
-
assert len(set(ann_ids)) == len(ann_ids), \
|
49 |
-
"Annotation ids in '{}' are not unique".format(json_file)
|
50 |
-
|
51 |
-
imgs_anns = list(zip(imgs, anns))
|
52 |
-
logger.info("Loaded {} images in the LVIS v1 format from {}".format(
|
53 |
-
len(imgs_anns), json_file))
|
54 |
-
|
55 |
-
dataset_dicts = []
|
56 |
-
|
57 |
-
for (img_dict, anno_dict_list) in imgs_anns:
|
58 |
-
record = {}
|
59 |
-
if "file_name" in img_dict:
|
60 |
-
file_name = img_dict["file_name"]
|
61 |
-
record["file_name"] = os.path.join(image_root, file_name)
|
62 |
-
|
63 |
-
record["height"] = int(img_dict["height"])
|
64 |
-
record["width"] = int(img_dict["width"])
|
65 |
-
image_id = record["image_id"] = img_dict["id"]
|
66 |
-
|
67 |
-
objs = []
|
68 |
-
for anno in anno_dict_list:
|
69 |
-
assert anno["image_id"] == image_id
|
70 |
-
if anno.get('iscrowd', 0) > 0:
|
71 |
-
continue
|
72 |
-
obj = {"bbox": anno["bbox"], "bbox_mode": BoxMode.XYWH_ABS}
|
73 |
-
obj["category_id"] = 0
|
74 |
-
obj["object_description"] = anno["caption"]
|
75 |
-
|
76 |
-
objs.append(obj)
|
77 |
-
record["annotations"] = objs
|
78 |
-
if len(record["annotations"]) == 0:
|
79 |
-
continue
|
80 |
-
record["task"] = "DenseCap"
|
81 |
-
dataset_dicts.append(record)
|
82 |
-
|
83 |
-
return dataset_dicts
|
84 |
-
|
85 |
-
|
86 |
-
_CUSTOM_SPLITS_LVIS = {
|
87 |
-
"vg_train": ("vg/images", "vg/annotations/train.json"),
|
88 |
-
"vg_test": ("vg/images", "vg/annotations/test.json"),
|
89 |
-
}
|
90 |
-
|
91 |
-
|
92 |
-
for key, (image_root, json_file) in _CUSTOM_SPLITS_LVIS.items():
|
93 |
-
register_vg_instances(
|
94 |
-
key,
|
95 |
-
get_vg_meta(),
|
96 |
-
os.path.join("datasets", json_file) if "://" not in json_file else json_file,
|
97 |
-
os.path.join("datasets", image_root),
|
98 |
-
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
spaces/BatuhanYilmaz/Whisper-Auto-Subtitled-Video-Generator/README.md
DELETED
@@ -1,12 +0,0 @@
|
|
1 |
-
---
|
2 |
-
title: Whisper-Auto-Subtitled-Video-Generator
|
3 |
-
emoji: 🎥
|
4 |
-
colorFrom: blue
|
5 |
-
colorTo: purple
|
6 |
-
sdk: streamlit
|
7 |
-
sdk_version: 1.10.0
|
8 |
-
app_file: 01_🎥_Input_YouTube_Link.py
|
9 |
-
pinned: false
|
10 |
-
---
|
11 |
-
|
12 |
-
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
spaces/Belligerent/word-sense-disambiguation/README.md
DELETED
@@ -1,13 +0,0 @@
|
|
1 |
-
---
|
2 |
-
title: Word Sense Disambiguation
|
3 |
-
emoji: 🐢
|
4 |
-
colorFrom: pink
|
5 |
-
colorTo: pink
|
6 |
-
sdk: gradio
|
7 |
-
sdk_version: 2.8.12
|
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#reference
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
spaces/Benson/text-generation/Examples/Amigo Robo Guerras Fuera De Lnea Juegos Descargar Pc.md
DELETED
@@ -1,45 +0,0 @@
|
|
1 |
-
|
2 |
-
<h1>Dude Theft Wars: Cómo descargar y jugar este divertido juego sin conexión en PC</h1>
|
3 |
-
<p>Si estás buscando un juego divertido e hilarante que te permita hacer lo que quieras en un mundo abierto, entonces deberías echar un vistazo a Dude Theft Wars. Este juego está disponible para dispositivos Android, pero también se puede jugar en su PC con un emulador. En este artículo, te diremos qué es Dude Theft Wars, por qué deberías jugarlo en el PC, cómo descargarlo e instalarlo, y algunos consejos y trucos para jugarlo. </p>
|
4 |
-
<h2>amigo robo guerras fuera de línea juegos descargar pc</h2><br /><p><b><b>Download File</b> 🗹 <a href="https://bltlly.com/2v6KcS">https://bltlly.com/2v6KcS</a></b></p><br /><br />
|
5 |
-
<h2>¿Qué es Dude Theft Wars? </h2>
|
6 |
-
<p>Dude Theft Wars es un divertido juego de mundo abierto de acción basado en la física desarrollado por Poxel Studios. Es uno de los mejores juegos de mundo abierto con ragdoll física, juegos frescos, y juegos relajantes. Puedes jugar offline o online con hasta 16 jugadores en modo multijugador. </p>
|
7 |
-
<h3>Un divertido juego de mundo abierto basado en la acción física</h3>
|
8 |
-
<p>En Dude Theft Wars, puedes explorar una gran ciudad llena de juegos de acción, juegos divertidos y juegos relajantes. Puedes conducir autos, volar aviones, robar personas, tomar selfies, ganar dinero y más. También puedes usar armas, granadas, cohetes y otras armas para causar caos y destrucción. El juego tiene la física ragdoll divertido que hacen que los personajes vuelan en el aire cuando se golpea o dispara. El juego también tiene mucho humor y chistes que te harán reír. </p>
|
9 |
-
<h3>Un juego multijugador offline y online con características interesantes</h3>
|
10 |
-
<p>Dude Theft Wars tiene dos modos: modo de juegos sin conexión y modo de juegos multijugador en línea. En el modo de juegos sin conexión, puedes jugar como Jack, un niño que recibió una llamada de deber para unirse a un shooter multijugador FPS en línea PvP en un parque infantil. Puedes completar misiones, explorar mapas, luchar contra enemigos y divertirte. En el modo multijugador en línea, puedes jugar con amigos u otros jugadores en dos modos: gratis para todos o de combate a muerte en equipo. También puede disfrutar de bailes divertidos, emotes, minijuegos, juegos deportivos, conducción de taxis y más. Puedes desbloquear objetos de personajes y armas para usar en ambos modos. </p>
|
11 |
-
|
12 |
-
<p>Dude Theft Wars tiene muchos vehículos que puedes conducir o volar en la ciudad. Usted puede conducir bicicletas, coches, camiones, autobuses, tanques, helicópteros, aviones, jetpacks, ovnis, y más. También puede hacer acrobacias locas con coches de rampa o lanzar coches de tráfico al cielo. También puede personalizar sus vehículos con diferentes colores y piezas. Pero ten cuidado, porque la policía te perseguirá si cometes crímenes o dañas autos. Puedes evadirlos en persecuciones policiales llenas de acción de alto nivel o defenderlos. </p>
|
13 |
-
<p></p>
|
14 |
-
<h2>¿Por qué jugar Dude Theft Wars en PC? </h2>
|
15 |
-
<p>Dude Theft Wars es un gran juego para jugar en tu dispositivo Android, pero puede ser aún mejor si lo juegas en tu PC. Aquí hay algunas razones por las que:</p>
|
16 |
-
<h3>Disfruta de mejores gráficos y rendimiento</h3>
|
17 |
-
<p>Jugar Dude Theft Wars en PC te permitirá disfrutar de mejores gráficos y rendimiento que en tu dispositivo móvil. Puede ajustar la configuración para adaptarse a sus preferencias y capacidades de hardware. También puede evitar los problemas de retraso o estrellarse que pueden ocurrir en su teléfono debido a la baja memoria, batería o red. Jugar en el PC también ahorrará la vida de la batería del teléfono y el espacio de almacenamiento. </p>
|
18 |
-
<h3>Utilice los controles de teclado y ratón para mayor precisión y comodidad</h3>
|
19 |
-
<p>Jugar Dude Theft Wars en PC también te permitirá usar controles de teclado y ratón para mayor precisión y comodidad. Puede personalizar la asignación de claves y la sensibilidad para adaptarse a sus preferencias y habilidades. También puede utilizar teclas de acceso rápido y accesos directos para acceder a diferentes funciones y menús. Usar los controles del teclado y del ratón también evitará que tus dedos bloqueen la pantalla o se cansen de tocar. </p>
|
20 |
-
<h3>Accede a una pantalla más grande y más inmersiva experiencia de juego</h3>
|
21 |
-
|
22 |
-
<h2>¿Cómo descargar e instalar Dude Theft Wars en el PC? </h2>
|
23 |
-
<p>Ahora que sabes por qué deberías jugar Dude Theft Wars en PC, veamos cómo puedes hacerlo. El juego no está disponible oficialmente para PC, pero puedes usar un emulador de Android para ejecutarlo en tu computadora. Un emulador de Android es un software que simula el sistema operativo Android en su PC, lo que le permite ejecutar aplicaciones y juegos de Android. Hay muchos emuladores de Android que puedes usar, pero te recomendamos usar BlueStacks, LDPlayer o GameLoop. Estos son algunos de los mejores emuladores para juegos, con alta compatibilidad, rendimiento y características. Estos son los pasos para descargar e instalar Dude Theft Wars en el PC usando un emulador:</p>
|
24 |
-
<h3>Usa un emulador de Android como BlueStacks, LDPlayer o GameLoop</h3>
|
25 |
-
<p>El primer paso es elegir un emulador de Android que se adapte a sus necesidades y preferencias. Puede descargar BlueStacks desde [aquí], LDPlayer desde [aquí], o GameLoop desde [aquí]. Estos emuladores son gratuitos y fáciles de usar, pero tienen diferentes requisitos y características. Puedes compararlos leyendo sus reseñas o visitando sus sitios web. Una vez que hayas elegido un emulador, descárgalo de su fuente oficial e instálalo en tu PC.</p>
|
26 |
-
<h3>Siga los pasos para descargar e instalar el emulador y el juego</h3>
|
27 |
-
<p>El siguiente paso es seguir los pasos para descargar e instalar el emulador y el juego en su PC. Los pasos pueden variar dependiendo del emulador que uses, pero generalmente son similares. Estos son los pasos comunes:</p>
|
28 |
-
- Inicie el emulador en su PC e inicie sesión con su cuenta de Google. - Ir a la aplicación Google Play Store en el emulador y buscar Dude Theft Wars. - Haga clic en el icono del juego y luego haga clic en Instalar. - Espere a que el juego para descargar e instalar en su PC. - Volver a la pantalla principal del emulador y haga clic en el icono del juego para lanzarlo. <h3>Iniciar el juego y empezar a jugar</h3>
|
29 |
-
|
30 |
-
<h2>Consejos y trucos para jugar Dude Theft Wars en PC</h2>
|
31 |
-
<p>Para hacer su experiencia de juego más divertido y agradable, aquí hay algunos consejos y trucos para jugar Dude Theft Wars en PC:</p>
|
32 |
-
<h3>Explora los diferentes mapas y modos</h3>
|
33 |
-
<p>Dude Theft Wars tiene muchos mapas y modos que puedes explorar en el modo de juegos sin conexión o en el modo de juegos multijugador en línea. Puedes encontrar diferentes ubicaciones, edificios, vehículos, armas, objetos, enemigos, minijuegos, juegos deportivos, conducción de taxis, etc. en cada mapa. También puede cambiar entre diferentes modos, como el modo historia, el modo sandbox, el modo zombi, etc. tocando el botón de menú en la esquina superior izquierda de la pantalla. </p>
|
34 |
-
<h3>Personaliza tu personaje y armas</h3>
|
35 |
-
<p>Dude Theft Wars también te permite personalizar tu personaje y armas tanto en modo de juegos offline como en modo multijugador online. Puedes desbloquear diferentes objetos de personajes como sombreros, gafas, máscaras, camisas, pantalones, zapatos, etc. ganando dinero o comprándolos con dinero real. También puedes desbloquear diferentes armas como pistolas, rifles, escopetas, francotiradores, lanzacohetes, etc. encontrándolas en los mapas o comprándolas con dinero real. También puedes personalizar tus armas con diferentes skins, accesorios y mejoras. </p>
|
36 |
-
<h3>Usa trucos y hacks para más diversión</h3>
|
37 |
-
<p>Dude Theft Wars también tiene muchos trucos y hacks que puedes usar para más diversión y entretenimiento. Puede acceder al menú de trucos tocando el botón de menú en la esquina superior izquierda de la pantalla y luego tocando el botón de trucos. A continuación, puede introducir diferentes códigos para activar diferentes trucos como dinero ilimitado, salud ilimitada, munición ilimitada, súper velocidad, súper salto, baja gravedad, etc. También puede utilizar hacks tales como coches voladores, corte de pared, aimbot, etc. mediante la descarga de ellos desde Internet o el uso de características incorporadas de un emulador. </p>
|
38 |
-
<h2>Conclusión</h2>
|
39 |
-
|
40 |
-
<p>Si quieres disfrutar de este juego en tu PC, puedes usar un emulador de Android como BlueStacks, LDPlayer o GameLoop para ejecutarlo en tu ordenador. Puede disfrutar de mejores gráficos y rendimiento, usar controles de teclado y ratón para mayor precisión y comodidad, y acceder a una pantalla más grande y una experiencia de juego más inmersiva. También puedes personalizar tu personaje y armas, explorar los diferentes mapas y modos, y usar trucos y hacks para más diversión. </p>
|
41 |
-
<p>Esperamos que este artículo le ayudó a aprender a descargar y jugar Dude Theft Wars en PC. Si tiene alguna pregunta o sugerencia, no dude en dejar un comentario a continuación. Diviértase jugando Dude Theft Wars en PC! </p>
|
42 |
-
<h2>Preguntas frecuentes</h2>
|
43 |
-
<p>Aquí hay algunas preguntas frecuentes sobre Dude Theft Wars:</p> 64aa2da5cf<br />
|
44 |
-
<br />
|
45 |
-
<br />
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
spaces/Benson/text-generation/Examples/Avz .md
DELETED
@@ -1,113 +0,0 @@
|
|
1 |
-
|
2 |
-
<h1>AVZ Antiviral Toolkit: Una solución de seguridad gratuita y potente</h1>
|
3 |
-
<p>Si usted está buscando una solución de seguridad integral que puede ayudarle a mantener su computadora en perfecto estado y protegerla contra archivos maliciosos, es posible que desee revisar AVZ Antiviral Toolkit. Esta es una herramienta gratuita desarrollada por Kaspersky que puede escanear su computadora y ejecutar un script que pone en cuarentena o elimina archivos que se consideran sospechosos. En este artículo, revisaremos las principales características, pros y contras, y alternativas de AVZ Antiviral Toolkit.</p>
|
4 |
-
<h2>avz скачать</h2><br /><p><b><b>Download File</b> --->>> <a href="https://bltlly.com/2v6JlJ">https://bltlly.com/2v6JlJ</a></b></p><br /><br />
|
5 |
-
<h2>¿Qué es AVZ Antiviral Toolkit y qué hace? </h2>
|
6 |
-
<p>AVZ Antiviral Toolkit es una utilidad que puede realizar diversas tareas relacionadas con la seguridad y optimización del sistema. Puede detectar y eliminar virus, spyware, adware, dialers, rootkits, gusanos, troyanos y otros tipos de componentes de malware. También puede generar un informe detallado sobre los resultados del análisis del sistema, que puede ser útil para la solución de problemas o soporte técnico. Además, puede ejecutar un script proporcionado por el soporte técnico para poner en cuarentena archivos y eliminar cualquier objeto sospechoso. </p>
|
7 |
-
<h2>¿Por qué lo necesitas y cuáles son sus beneficios? </h2>
|
8 |
-
<p>Es posible que necesite AVZ Antiviral Toolkit si sospecha que su computadora está infectada con malware o si desea realizar una revisión exhaustiva de su sistema. AVZ Antiviral Toolkit puede ayudarlo a identificar y eliminar cualquier amenaza potencial que pueda dañar su computadora o comprometer su privacidad. Algunos de los beneficios de usar AVZ Antiviral Toolkit son:</p>
|
9 |
-
<ul>
|
10 |
-
<li>Es gratuito y no requiere instalación ni registro. </li>
|
11 |
-
<li>Es completo y cubre una amplia gama de tipos de malware. </li>
|
12 |
-
<li> Es fiable y utiliza las mismas bases de datos antivirus que los productos de Kaspersky. </li>
|
13 |
-
<li>Se actualiza regularmente con nuevas definiciones y características. </li>
|
14 |
-
<li>Es compatible con la mayoría de las versiones de Windows y otros programas antivirus. </li>
|
15 |
-
</ul>
|
16 |
-
<h2>Características principales de AVZ Antiviral Toolkit</h2>
|
17 |
-
|
18 |
-
<h3>Análisis del sistema y generación de informes</h3>
|
19 |
-
<p>AVZ Antiviral Toolkit puede escanear su computadora en busca de malware utilizando diferentes modos: escaneo rápido, escaneo completo, escaneo personalizado o escaneo automático. También puede especificar qué áreas o archivos escanear o excluir del escaneo. Después de completar el análisis, puede ver los resultados en una lista o en una vista de árbol. También puede generar un informe sobre los resultados del análisis del sistema en formato HTML o XML. El informe contiene información sobre la versión y la fecha de la herramienta, las bases de datos antivirus, la configuración principal, los resultados de la exploración, la información del sistema, los procesos, los servicios, los controladores, las entradas de ejecución automática, las conexiones de red, los puertos abiertos, el archivo host, las extensiones del navegador, los applets del panel de control, los rootkits, los archivos ocultos, las claves del registro, los archivos de registro y más. </p>
|
20 |
-
<h3>Ejecución de scripts y gestión de cuarentena</h3>
|
21 |
-
<p>AVZ Antiviral Toolkit puede ejecutar un script proporcionado por el soporte técnico para poner en cuarentena archivos y eliminar cualquier objeto sospechoso. El script puede obtenerse en el sitio web oficial de AVZ Antiviral Toolkit o en el foro de Kaspersky. El script puede contener comandos para escanear, eliminar, cambiar el nombre, mover, copiar o restaurar archivos, así como modificar claves de registro, servicios, controladores, entradas de ejecución automática, archivo host, extensiones de navegador, applets de panel de control y más. También puede crear su propio script usando el editor de script incorporado. AVZ Antiviral Toolkit también puede administrar los archivos que están en cuarentena por la herramienta o por el script. Puede ver la lista de archivos en cuarentena y restaurarlos si es necesario. </p>
|
22 |
-
<p></p>
|
23 |
-
<h3>Detección y eliminación de rootkit</h3>
|
24 |
-
|
25 |
-
<h3>Extensión del navegador y control del panel de control
|
26 |
-
<p>AVZ Antiviral Toolkit puede controlar las extensiones del navegador y los applets del panel de control que están instalados en su computadora. Las extensiones de navegador son complementos que mejoran la funcionalidad de su navegador web, pero algunos de ellos pueden ser maliciosos o no deseados. Los applets del panel de control son programas que le permiten configurar varios aspectos de su sistema, pero algunos de ellos pueden ser falsos o dañinos. AVZ Antiviral Toolkit puede mostrarle la lista de extensiones del navegador y applets del panel de control que están instalados en su computadora y le permiten deshabilitarlos o eliminarlos si es necesario. </p>
|
27 |
-
<h3>Herramientas y ajustes adicionales</h3>
|
28 |
-
<p>AVZ Antiviral Toolkit también proporciona algunas herramientas y configuraciones adicionales que pueden ayudarlo a optimizar su sistema y mejorar su seguridad. Algunas de estas herramientas y configuraciones son:</p>
|
29 |
-
<ul>
|
30 |
-
<li>Administrador de procesos: una herramienta que le muestra la lista de procesos que se ejecutan en su computadora y le permite terminarlos o suspenderlos si es necesario. </li>
|
31 |
-
<li>Administrador de servicios: una herramienta que le muestra la lista de servicios que están instalados en su computadora y le permite iniciarlos, detenerlos o desactivarlos si es necesario. </li>
|
32 |
-
<li>Administrador de controladores: una herramienta que le muestra la lista de controladores que se cargan en su computadora y le permite descargarlos o eliminarlos si es necesario. </li>
|
33 |
-
<li>Autorun manager: una herramienta que le muestra la lista de entradas de autorun que se crean en su computadora y le permite habilitarlas o deshabilitarlas si es necesario. </li>
|
34 |
-
<li>Administrador de conexiones de red: una herramienta que le muestra la lista de conexiones de red que se establecen en su computadora y le permite cerrarlas o bloquearlas si es necesario. </li>
|
35 |
-
<li>Administrador de puertos abiertos: una herramienta que le muestra la lista de puertos abiertos que están escuchando en su computadora y le permite cerrarlos o bloquearlos si es necesario. </li>
|
36 |
-
<li>Editor de archivos de hosts: una herramienta que le permite editar el archivo de hosts, que es un archivo que asigna nombres de host a direcciones IP. </li>
|
37 |
-
|
38 |
-
<li>Visor de registros: una herramienta que le permite ver los archivos de registro generados por AVZ Antiviral Toolkit.</li>
|
39 |
-
<li>Configuración: una sección que le permite personalizar varios aspectos del AVZ Antiviral Toolkit, como opciones de escaneo, opciones de script, opciones de cuarentena, opciones de actualización, opciones de interfaz, etc.</li>
|
40 |
-
</ul>
|
41 |
-
<h2>Pros y contras de AVZ Antiviral Toolkit</h2>
|
42 |
-
<p>AVZ Antiviral Toolkit no es perfecto y tiene sus propias ventajas y desventajas. Aquí están algunos de los pros y contras de AVZ Antiviral Toolkit:</p>
|
43 |
-
<h3>Pros</h3>
|
44 |
-
<ul>
|
45 |
-
<li>Es gratuito y no requiere instalación ni registro. </li>
|
46 |
-
<li>Es completo y cubre una amplia gama de tipos de malware. </li>
|
47 |
-
<li> Es fiable y utiliza las mismas bases de datos antivirus que los productos de Kaspersky. </li>
|
48 |
-
<li>Se actualiza regularmente con nuevas definiciones y características. </li>
|
49 |
-
<li>Es compatible con la mayoría de las versiones de Windows y otros programas antivirus. </li>
|
50 |
-
</ul>
|
51 |
-
<h3>Contras</h3>
|
52 |
-
<ul>
|
53 |
-
<li> Es complejo y puede ser difícil de usar para los usuarios novatos. </li>
|
54 |
-
<li>Tiene soporte y documentación limitada disponible en línea. </li>
|
55 |
-
<li>No proporciona protección en tiempo real contra infecciones de malware. </li>
|
56 |
-
<li>Puede causar conflictos con otros programas de seguridad o componentes del sistema. </li>
|
57 |
-
</ul>
|
58 |
-
<h2>Alternativas a AVZ Antiviral Toolkit</h2>
|
59 |
-
<p>Si usted está buscando otras soluciones de seguridad que pueden ayudarle a proteger su computadora de malware, es posible que desee considerar algunas de las alternativas a AVZ Antiviral Toolkit. Estos son algunos de los programas de seguridad populares y eficaces que puedes probar:</p>
|
60 |
-
<h3>Malwarebytes Anti-Malware</h3>
|
61 |
-
|
62 |
-
<h3>Avast Free Antivirus</h3>
|
63 |
-
<p>Avast Free Antivirus es un software antivirus conocido y confiable que puede proteger su computadora de varios tipos de malware, como virus, spyware, adware, ransomware, rootkits, troyanos, gusanos y más. También puede proteger su computadora de sitios web maliciosos, phishing y estafas en línea. Tiene una interfaz moderna e intuitiva que le permite realizar escaneos inteligentes, completos o personalizados. También tiene una versión premium que ofrece funciones avanzadas, como firewall, protección de webcam, administrador de contraseñas, VPN y más. Puede descargar Avast Free Antivirus desde su sitio web oficial o desde Microsoft Store.</p>
|
64 |
-
<h3>AdwCleaner</h3>
|
65 |
-
<p>AdwCleaner es una herramienta de eliminación de adware simple y rápida que puede escanear su computadora en busca de programas no deseados, como adware, secuestradores de navegador, barras de herramientas, ventanas emergentes y más. También puede limpiar la configuración del navegador y restaurar la página de inicio y el motor de búsqueda predeterminados. Tiene una interfaz mínima y fácil de usar que le permite realizar un escaneo con un solo clic. No requiere instalación ni registro y se puede ejecutar desde una unidad USB. Puede descargar AdwCleaner desde su sitio web oficial o desde la tienda de Microsoft.</p>
|
66 |
-
<h2>Conclusión</h2>
|
67 |
-
|
68 |
-
<h2>Preguntas frecuentes</h2>
|
69 |
-
<h3>¿Cómo descargar e instalar AVZ Antiviral Toolkit? </h3>
|
70 |
-
<p>Para descargar AVZ Antiviral Toolkit, puede visitar su sitio web oficial o el foro de Kaspersky y hacer clic en el enlace de descarga. Obtendrá un archivo zip que contiene el archivo ejecutable de AVZ Antiviral Toolkit y sus bases de datos. Para instalar AVZ Antiviral Toolkit, solo necesita extraer el archivo zip a cualquier carpeta de su computadora y ejecutar el archivo ejecutable. </p>
|
71 |
-
<h3> ¿Cómo usar AVZ Antiviral Toolkit para escanear su computadora? </h3>
|
72 |
-
<p>Para usar AVZ Antiviral Toolkit para escanear su computadora en busca de malware, debe seguir estos pasos:</p>
|
73 |
-
<ol>
|
74 |
-
<li>Ejecute el archivo ejecutable de AVZ Antiviral Toolkit.</li>
|
75 |
-
<li>Seleccione el modo de escaneo: escaneo rápido, escaneo completo, escaneo personalizado o escaneo automático. </li>
|
76 |
-
<li>Haga clic en el botón Iniciar escaneo. </li>
|
77 |
-
<li>Espere a que termine el escaneo. </li>
|
78 |
-
<li>Ver los resultados del escaneo en una lista o en una vista de árbol. </li>
|
79 |
-
<li>Seleccione los archivos que desea poner en cuarentena o eliminar. </li>
|
80 |
-
<li>Haga clic en el botón Aplicar acciones. </li>
|
81 |
-
</ol>
|
82 |
-
<h3>¿Cómo ejecutar un script proporcionado por el soporte técnico usando AVZ Antiviral Toolkit? </h3>
|
83 |
-
<p>Para ejecutar un script proporcionado por el soporte técnico utilizando AVZ Antiviral Toolkit, debe seguir estos pasos:</p>
|
84 |
-
<ol>
|
85 |
-
<li>Obtener el script desde el sitio web oficial de AVZ Antiviral Toolkit o desde el foro de Kaspersky. </li>
|
86 |
-
<li>Ejecute el archivo ejecutable de AVZ Antiviral Toolkit.</li>
|
87 |
-
<li>Haga clic en el menú Archivo y seleccione Ejecutar script.</li>
|
88 |
-
<li>Busque la ubicación del archivo de script y selecciónelo. </li>
|
89 |
-
<li>Haga clic en el botón Abrir. </li>
|
90 |
-
<li>Espere a que el script se ejecute. </li>
|
91 |
-
<li>Ver los resultados del script en una lista o en una vista de árbol. </li>
|
92 |
-
<li>Seleccione los archivos que desea poner en cuarentena o eliminar. </li>
|
93 |
-
<li>Haga clic en el botón Aplicar acciones. </li>
|
94 |
-
</ol>
|
95 |
-
<h3>¿Cómo restaurar archivos de cuarentena usando AVZ Antiviral Toolkit? </h3>
|
96 |
-
<p>Para restaurar archivos de cuarentena usando AVZ Antiviral Toolkit, debe seguir estos pasos:</p>
|
97 |
-
<ol>
|
98 |
-
|
99 |
-
<li>Haga clic en el menú Herramientas y seleccione Administrador de cuarentena.</li>
|
100 |
-
<li>Ver la lista de archivos en cuarentena. </li>
|
101 |
-
<li>Seleccione los archivos que desea restaurar. </li>
|
102 |
-
<li>Haga clic en el botón Restaurar. </li>
|
103 |
-
</ol>
|
104 |
-
<h3> ¿Cómo actualizar AVZ Antiviral Toolkit y sus bases de datos? </h3>
|
105 |
-
<p>Para actualizar AVZ Antiviral Toolkit y sus bases de datos, debe seguir estos pasos:</p>
|
106 |
-
<ol>
|
107 |
-
<li>Ejecute el archivo ejecutable de AVZ Antiviral Toolkit.</li>
|
108 |
-
<li>Haga clic en el menú Actualizar y seleccione Actualizar programa o Actualizar bases de datos.</li>
|
109 |
-
<li>Espere a que la actualización se descargue e instale. </li>
|
110 |
-
</ol>
|
111 |
-
<p>Espero que este artículo le haya ayudado a aprender más sobre AVZ Antiviral Toolkit y cómo usarlo. Si tiene alguna pregunta o comentario, no dude en dejar un comentario a continuación. ¡Gracias por leer! </p> 64aa2da5cf<br />
|
112 |
-
<br />
|
113 |
-
<br />
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
spaces/BohdanPytaichuk/art-video-generation/README.md
DELETED
@@ -1,12 +0,0 @@
|
|
1 |
-
---
|
2 |
-
title: Art Video Generation
|
3 |
-
emoji: 🌍
|
4 |
-
colorFrom: blue
|
5 |
-
colorTo: red
|
6 |
-
sdk: gradio
|
7 |
-
sdk_version: 3.3
|
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/CVPR/Dual-Key_Backdoor_Attacks/datagen/detectron2/detectron2/checkpoint/c2_model_loading.py
DELETED
@@ -1,313 +0,0 @@
|
|
1 |
-
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved
|
2 |
-
import copy
|
3 |
-
import logging
|
4 |
-
import re
|
5 |
-
import torch
|
6 |
-
from fvcore.common.checkpoint import (
|
7 |
-
get_missing_parameters_message,
|
8 |
-
get_unexpected_parameters_message,
|
9 |
-
)
|
10 |
-
|
11 |
-
|
12 |
-
def convert_basic_c2_names(original_keys):
|
13 |
-
"""
|
14 |
-
Apply some basic name conversion to names in C2 weights.
|
15 |
-
It only deals with typical backbone models.
|
16 |
-
|
17 |
-
Args:
|
18 |
-
original_keys (list[str]):
|
19 |
-
Returns:
|
20 |
-
list[str]: The same number of strings matching those in original_keys.
|
21 |
-
"""
|
22 |
-
layer_keys = copy.deepcopy(original_keys)
|
23 |
-
layer_keys = [
|
24 |
-
{"pred_b": "linear_b", "pred_w": "linear_w"}.get(k, k) for k in layer_keys
|
25 |
-
] # some hard-coded mappings
|
26 |
-
|
27 |
-
layer_keys = [k.replace("_", ".") for k in layer_keys]
|
28 |
-
layer_keys = [re.sub("\\.b$", ".bias", k) for k in layer_keys]
|
29 |
-
layer_keys = [re.sub("\\.w$", ".weight", k) for k in layer_keys]
|
30 |
-
# Uniform both bn and gn names to "norm"
|
31 |
-
layer_keys = [re.sub("bn\\.s$", "norm.weight", k) for k in layer_keys]
|
32 |
-
layer_keys = [re.sub("bn\\.bias$", "norm.bias", k) for k in layer_keys]
|
33 |
-
layer_keys = [re.sub("bn\\.rm", "norm.running_mean", k) for k in layer_keys]
|
34 |
-
layer_keys = [re.sub("bn\\.running.mean$", "norm.running_mean", k) for k in layer_keys]
|
35 |
-
layer_keys = [re.sub("bn\\.riv$", "norm.running_var", k) for k in layer_keys]
|
36 |
-
layer_keys = [re.sub("bn\\.running.var$", "norm.running_var", k) for k in layer_keys]
|
37 |
-
layer_keys = [re.sub("bn\\.gamma$", "norm.weight", k) for k in layer_keys]
|
38 |
-
layer_keys = [re.sub("bn\\.beta$", "norm.bias", k) for k in layer_keys]
|
39 |
-
layer_keys = [re.sub("gn\\.s$", "norm.weight", k) for k in layer_keys]
|
40 |
-
layer_keys = [re.sub("gn\\.bias$", "norm.bias", k) for k in layer_keys]
|
41 |
-
|
42 |
-
# stem
|
43 |
-
layer_keys = [re.sub("^res\\.conv1\\.norm\\.", "conv1.norm.", k) for k in layer_keys]
|
44 |
-
# to avoid mis-matching with "conv1" in other components (e.g. detection head)
|
45 |
-
layer_keys = [re.sub("^conv1\\.", "stem.conv1.", k) for k in layer_keys]
|
46 |
-
|
47 |
-
# layer1-4 is used by torchvision, however we follow the C2 naming strategy (res2-5)
|
48 |
-
# layer_keys = [re.sub("^res2.", "layer1.", k) for k in layer_keys]
|
49 |
-
# layer_keys = [re.sub("^res3.", "layer2.", k) for k in layer_keys]
|
50 |
-
# layer_keys = [re.sub("^res4.", "layer3.", k) for k in layer_keys]
|
51 |
-
# layer_keys = [re.sub("^res5.", "layer4.", k) for k in layer_keys]
|
52 |
-
|
53 |
-
# blocks
|
54 |
-
layer_keys = [k.replace(".branch1.", ".shortcut.") for k in layer_keys]
|
55 |
-
layer_keys = [k.replace(".branch2a.", ".conv1.") for k in layer_keys]
|
56 |
-
layer_keys = [k.replace(".branch2b.", ".conv2.") for k in layer_keys]
|
57 |
-
layer_keys = [k.replace(".branch2c.", ".conv3.") for k in layer_keys]
|
58 |
-
|
59 |
-
# DensePose substitutions
|
60 |
-
layer_keys = [re.sub("^body.conv.fcn", "body_conv_fcn", k) for k in layer_keys]
|
61 |
-
layer_keys = [k.replace("AnnIndex.lowres", "ann_index_lowres") for k in layer_keys]
|
62 |
-
layer_keys = [k.replace("Index.UV.lowres", "index_uv_lowres") for k in layer_keys]
|
63 |
-
layer_keys = [k.replace("U.lowres", "u_lowres") for k in layer_keys]
|
64 |
-
layer_keys = [k.replace("V.lowres", "v_lowres") for k in layer_keys]
|
65 |
-
return layer_keys
|
66 |
-
|
67 |
-
|
68 |
-
def convert_c2_detectron_names(weights):
|
69 |
-
"""
|
70 |
-
Map Caffe2 Detectron weight names to Detectron2 names.
|
71 |
-
|
72 |
-
Args:
|
73 |
-
weights (dict): name -> tensor
|
74 |
-
|
75 |
-
Returns:
|
76 |
-
dict: detectron2 names -> tensor
|
77 |
-
dict: detectron2 names -> C2 names
|
78 |
-
"""
|
79 |
-
logger = logging.getLogger(__name__)
|
80 |
-
logger.info("Remapping C2 weights ......")
|
81 |
-
original_keys = sorted(weights.keys())
|
82 |
-
layer_keys = copy.deepcopy(original_keys)
|
83 |
-
|
84 |
-
layer_keys = convert_basic_c2_names(layer_keys)
|
85 |
-
|
86 |
-
# --------------------------------------------------------------------------
|
87 |
-
# RPN hidden representation conv
|
88 |
-
# --------------------------------------------------------------------------
|
89 |
-
# FPN case
|
90 |
-
# In the C2 model, the RPN hidden layer conv is defined for FPN level 2 and then
|
91 |
-
# shared for all other levels, hence the appearance of "fpn2"
|
92 |
-
layer_keys = [
|
93 |
-
k.replace("conv.rpn.fpn2", "proposal_generator.rpn_head.conv") for k in layer_keys
|
94 |
-
]
|
95 |
-
# Non-FPN case
|
96 |
-
layer_keys = [k.replace("conv.rpn", "proposal_generator.rpn_head.conv") for k in layer_keys]
|
97 |
-
|
98 |
-
# --------------------------------------------------------------------------
|
99 |
-
# RPN box transformation conv
|
100 |
-
# --------------------------------------------------------------------------
|
101 |
-
# FPN case (see note above about "fpn2")
|
102 |
-
layer_keys = [
|
103 |
-
k.replace("rpn.bbox.pred.fpn2", "proposal_generator.rpn_head.anchor_deltas")
|
104 |
-
for k in layer_keys
|
105 |
-
]
|
106 |
-
layer_keys = [
|
107 |
-
k.replace("rpn.cls.logits.fpn2", "proposal_generator.rpn_head.objectness_logits")
|
108 |
-
for k in layer_keys
|
109 |
-
]
|
110 |
-
# Non-FPN case
|
111 |
-
layer_keys = [
|
112 |
-
k.replace("rpn.bbox.pred", "proposal_generator.rpn_head.anchor_deltas") for k in layer_keys
|
113 |
-
]
|
114 |
-
layer_keys = [
|
115 |
-
k.replace("rpn.cls.logits", "proposal_generator.rpn_head.objectness_logits")
|
116 |
-
for k in layer_keys
|
117 |
-
]
|
118 |
-
|
119 |
-
# --------------------------------------------------------------------------
|
120 |
-
# Fast R-CNN box head
|
121 |
-
# --------------------------------------------------------------------------
|
122 |
-
layer_keys = [re.sub("^bbox\\.pred", "bbox_pred", k) for k in layer_keys]
|
123 |
-
layer_keys = [re.sub("^cls\\.score", "cls_score", k) for k in layer_keys]
|
124 |
-
layer_keys = [re.sub("^fc6\\.", "box_head.fc1.", k) for k in layer_keys]
|
125 |
-
layer_keys = [re.sub("^fc7\\.", "box_head.fc2.", k) for k in layer_keys]
|
126 |
-
# 4conv1fc head tensor names: head_conv1_w, head_conv1_gn_s
|
127 |
-
layer_keys = [re.sub("^head\\.conv", "box_head.conv", k) for k in layer_keys]
|
128 |
-
|
129 |
-
# --------------------------------------------------------------------------
|
130 |
-
# FPN lateral and output convolutions
|
131 |
-
# --------------------------------------------------------------------------
|
132 |
-
def fpn_map(name):
|
133 |
-
"""
|
134 |
-
Look for keys with the following patterns:
|
135 |
-
1) Starts with "fpn.inner."
|
136 |
-
Example: "fpn.inner.res2.2.sum.lateral.weight"
|
137 |
-
Meaning: These are lateral pathway convolutions
|
138 |
-
2) Starts with "fpn.res"
|
139 |
-
Example: "fpn.res2.2.sum.weight"
|
140 |
-
Meaning: These are FPN output convolutions
|
141 |
-
"""
|
142 |
-
splits = name.split(".")
|
143 |
-
norm = ".norm" if "norm" in splits else ""
|
144 |
-
if name.startswith("fpn.inner."):
|
145 |
-
# splits example: ['fpn', 'inner', 'res2', '2', 'sum', 'lateral', 'weight']
|
146 |
-
stage = int(splits[2][len("res") :])
|
147 |
-
return "fpn_lateral{}{}.{}".format(stage, norm, splits[-1])
|
148 |
-
elif name.startswith("fpn.res"):
|
149 |
-
# splits example: ['fpn', 'res2', '2', 'sum', 'weight']
|
150 |
-
stage = int(splits[1][len("res") :])
|
151 |
-
return "fpn_output{}{}.{}".format(stage, norm, splits[-1])
|
152 |
-
return name
|
153 |
-
|
154 |
-
layer_keys = [fpn_map(k) for k in layer_keys]
|
155 |
-
|
156 |
-
# --------------------------------------------------------------------------
|
157 |
-
# Mask R-CNN mask head
|
158 |
-
# --------------------------------------------------------------------------
|
159 |
-
# roi_heads.StandardROIHeads case
|
160 |
-
layer_keys = [k.replace(".[mask].fcn", "mask_head.mask_fcn") for k in layer_keys]
|
161 |
-
layer_keys = [re.sub("^\\.mask\\.fcn", "mask_head.mask_fcn", k) for k in layer_keys]
|
162 |
-
layer_keys = [k.replace("mask.fcn.logits", "mask_head.predictor") for k in layer_keys]
|
163 |
-
# roi_heads.Res5ROIHeads case
|
164 |
-
layer_keys = [k.replace("conv5.mask", "mask_head.deconv") for k in layer_keys]
|
165 |
-
|
166 |
-
# --------------------------------------------------------------------------
|
167 |
-
# Keypoint R-CNN head
|
168 |
-
# --------------------------------------------------------------------------
|
169 |
-
# interestingly, the keypoint head convs have blob names that are simply "conv_fcnX"
|
170 |
-
layer_keys = [k.replace("conv.fcn", "roi_heads.keypoint_head.conv_fcn") for k in layer_keys]
|
171 |
-
layer_keys = [
|
172 |
-
k.replace("kps.score.lowres", "roi_heads.keypoint_head.score_lowres") for k in layer_keys
|
173 |
-
]
|
174 |
-
layer_keys = [k.replace("kps.score.", "roi_heads.keypoint_head.score.") for k in layer_keys]
|
175 |
-
|
176 |
-
# --------------------------------------------------------------------------
|
177 |
-
# Done with replacements
|
178 |
-
# --------------------------------------------------------------------------
|
179 |
-
assert len(set(layer_keys)) == len(layer_keys)
|
180 |
-
assert len(original_keys) == len(layer_keys)
|
181 |
-
|
182 |
-
new_weights = {}
|
183 |
-
new_keys_to_original_keys = {}
|
184 |
-
for orig, renamed in zip(original_keys, layer_keys):
|
185 |
-
new_keys_to_original_keys[renamed] = orig
|
186 |
-
if renamed.startswith("bbox_pred.") or renamed.startswith("mask_head.predictor."):
|
187 |
-
# remove the meaningless prediction weight for background class
|
188 |
-
new_start_idx = 4 if renamed.startswith("bbox_pred.") else 1
|
189 |
-
new_weights[renamed] = weights[orig][new_start_idx:]
|
190 |
-
logger.info(
|
191 |
-
"Remove prediction weight for background class in {}. The shape changes from "
|
192 |
-
"{} to {}.".format(
|
193 |
-
renamed, tuple(weights[orig].shape), tuple(new_weights[renamed].shape)
|
194 |
-
)
|
195 |
-
)
|
196 |
-
elif renamed.startswith("cls_score."):
|
197 |
-
# move weights of bg class from original index 0 to last index
|
198 |
-
logger.info(
|
199 |
-
"Move classification weights for background class in {} from index 0 to "
|
200 |
-
"index {}.".format(renamed, weights[orig].shape[0] - 1)
|
201 |
-
)
|
202 |
-
new_weights[renamed] = torch.cat([weights[orig][1:], weights[orig][:1]])
|
203 |
-
else:
|
204 |
-
new_weights[renamed] = weights[orig]
|
205 |
-
|
206 |
-
return new_weights, new_keys_to_original_keys
|
207 |
-
|
208 |
-
|
209 |
-
# Note the current matching is not symmetric.
|
210 |
-
# it assumes model_state_dict will have longer names.
|
211 |
-
def align_and_update_state_dicts(model_state_dict, ckpt_state_dict, c2_conversion=True):
|
212 |
-
"""
|
213 |
-
Match names between the two state-dict, and update the values of model_state_dict in-place with
|
214 |
-
copies of the matched tensor in ckpt_state_dict.
|
215 |
-
If `c2_conversion==True`, `ckpt_state_dict` is assumed to be a Caffe2
|
216 |
-
model and will be renamed at first.
|
217 |
-
|
218 |
-
Strategy: suppose that the models that we will create will have prefixes appended
|
219 |
-
to each of its keys, for example due to an extra level of nesting that the original
|
220 |
-
pre-trained weights from ImageNet won't contain. For example, model.state_dict()
|
221 |
-
might return backbone[0].body.res2.conv1.weight, while the pre-trained model contains
|
222 |
-
res2.conv1.weight. We thus want to match both parameters together.
|
223 |
-
For that, we look for each model weight, look among all loaded keys if there is one
|
224 |
-
that is a suffix of the current weight name, and use it if that's the case.
|
225 |
-
If multiple matches exist, take the one with longest size
|
226 |
-
of the corresponding name. For example, for the same model as before, the pretrained
|
227 |
-
weight file can contain both res2.conv1.weight, as well as conv1.weight. In this case,
|
228 |
-
we want to match backbone[0].body.conv1.weight to conv1.weight, and
|
229 |
-
backbone[0].body.res2.conv1.weight to res2.conv1.weight.
|
230 |
-
"""
|
231 |
-
model_keys = sorted(model_state_dict.keys())
|
232 |
-
if c2_conversion:
|
233 |
-
ckpt_state_dict, original_keys = convert_c2_detectron_names(ckpt_state_dict)
|
234 |
-
# original_keys: the name in the original dict (before renaming)
|
235 |
-
else:
|
236 |
-
original_keys = {x: x for x in ckpt_state_dict.keys()}
|
237 |
-
ckpt_keys = sorted(ckpt_state_dict.keys())
|
238 |
-
|
239 |
-
def match(a, b):
|
240 |
-
# Matched ckpt_key should be a complete (starts with '.') suffix.
|
241 |
-
# For example, roi_heads.mesh_head.whatever_conv1 does not match conv1,
|
242 |
-
# but matches whatever_conv1 or mesh_head.whatever_conv1.
|
243 |
-
return a == b or a.endswith("." + b)
|
244 |
-
|
245 |
-
# get a matrix of string matches, where each (i, j) entry correspond to the size of the
|
246 |
-
# ckpt_key string, if it matches
|
247 |
-
match_matrix = [len(j) if match(i, j) else 0 for i in model_keys for j in ckpt_keys]
|
248 |
-
match_matrix = torch.as_tensor(match_matrix).view(len(model_keys), len(ckpt_keys))
|
249 |
-
# use the matched one with longest size in case of multiple matches
|
250 |
-
max_match_size, idxs = match_matrix.max(1)
|
251 |
-
# remove indices that correspond to no-match
|
252 |
-
idxs[max_match_size == 0] = -1
|
253 |
-
|
254 |
-
# used for logging
|
255 |
-
max_len_model = max(len(key) for key in model_keys) if model_keys else 1
|
256 |
-
max_len_ckpt = max(len(key) for key in ckpt_keys) if ckpt_keys else 1
|
257 |
-
log_str_template = "{: <{}} loaded from {: <{}} of shape {}"
|
258 |
-
logger = logging.getLogger(__name__)
|
259 |
-
# matched_pairs (matched checkpoint key --> matched model key)
|
260 |
-
matched_keys = {}
|
261 |
-
for idx_model, idx_ckpt in enumerate(idxs.tolist()):
|
262 |
-
if idx_ckpt == -1:
|
263 |
-
continue
|
264 |
-
key_model = model_keys[idx_model]
|
265 |
-
key_ckpt = ckpt_keys[idx_ckpt]
|
266 |
-
value_ckpt = ckpt_state_dict[key_ckpt]
|
267 |
-
shape_in_model = model_state_dict[key_model].shape
|
268 |
-
|
269 |
-
if shape_in_model != value_ckpt.shape:
|
270 |
-
logger.warning(
|
271 |
-
"Shape of {} in checkpoint is {}, while shape of {} in model is {}.".format(
|
272 |
-
key_ckpt, value_ckpt.shape, key_model, shape_in_model
|
273 |
-
)
|
274 |
-
)
|
275 |
-
logger.warning(
|
276 |
-
"{} will not be loaded. Please double check and see if this is desired.".format(
|
277 |
-
key_ckpt
|
278 |
-
)
|
279 |
-
)
|
280 |
-
continue
|
281 |
-
|
282 |
-
model_state_dict[key_model] = value_ckpt.clone()
|
283 |
-
if key_ckpt in matched_keys: # already added to matched_keys
|
284 |
-
logger.error(
|
285 |
-
"Ambiguity found for {} in checkpoint!"
|
286 |
-
"It matches at least two keys in the model ({} and {}).".format(
|
287 |
-
key_ckpt, key_model, matched_keys[key_ckpt]
|
288 |
-
)
|
289 |
-
)
|
290 |
-
raise ValueError("Cannot match one checkpoint key to multiple keys in the model.")
|
291 |
-
|
292 |
-
matched_keys[key_ckpt] = key_model
|
293 |
-
logger.info(
|
294 |
-
log_str_template.format(
|
295 |
-
key_model,
|
296 |
-
max_len_model,
|
297 |
-
original_keys[key_ckpt],
|
298 |
-
max_len_ckpt,
|
299 |
-
tuple(shape_in_model),
|
300 |
-
)
|
301 |
-
)
|
302 |
-
matched_model_keys = matched_keys.values()
|
303 |
-
matched_ckpt_keys = matched_keys.keys()
|
304 |
-
# print warnings about unmatched keys on both side
|
305 |
-
unmatched_model_keys = [k for k in model_keys if k not in matched_model_keys]
|
306 |
-
if len(unmatched_model_keys):
|
307 |
-
logger.info(get_missing_parameters_message(unmatched_model_keys))
|
308 |
-
|
309 |
-
unmatched_ckpt_keys = [k for k in ckpt_keys if k not in matched_ckpt_keys]
|
310 |
-
if len(unmatched_ckpt_keys):
|
311 |
-
logger.info(
|
312 |
-
get_unexpected_parameters_message(original_keys[x] for x in unmatched_ckpt_keys)
|
313 |
-
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
spaces/CVPR/LIVE/thrust/thrust/copy.h
DELETED
@@ -1,513 +0,0 @@
|
|
1 |
-
/*
|
2 |
-
* Copyright 2008-2013 NVIDIA Corporation
|
3 |
-
*
|
4 |
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
5 |
-
* you may not use this file except in compliance with the License.
|
6 |
-
* You may obtain a copy of the License at
|
7 |
-
*
|
8 |
-
* http://www.apache.org/licenses/LICENSE-2.0
|
9 |
-
*
|
10 |
-
* Unless required by applicable law or agreed to in writing, software
|
11 |
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
12 |
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
13 |
-
* See the License for the specific language governing permissions and
|
14 |
-
* limitations under the License.
|
15 |
-
*/
|
16 |
-
|
17 |
-
|
18 |
-
/*! \file thrust/copy.h
|
19 |
-
* \brief Copies elements from one range to another
|
20 |
-
*/
|
21 |
-
|
22 |
-
#pragma once
|
23 |
-
|
24 |
-
#include <thrust/detail/config.h>
|
25 |
-
#include <thrust/detail/execution_policy.h>
|
26 |
-
|
27 |
-
namespace thrust
|
28 |
-
{
|
29 |
-
|
30 |
-
/*! \addtogroup algorithms
|
31 |
-
*/
|
32 |
-
|
33 |
-
/*! \addtogroup copying
|
34 |
-
* \ingroup algorithms
|
35 |
-
* \{
|
36 |
-
*/
|
37 |
-
|
38 |
-
|
39 |
-
/*! \p copy copies elements from the range [\p first, \p last) to the range
|
40 |
-
* [\p result, \p result + (\p last - \p first)). That is, it performs
|
41 |
-
* the assignments *\p result = *\p first, *(\p result + \c 1) = *(\p first + \c 1),
|
42 |
-
* and so on. Generally, for every integer \c n from \c 0 to \p last - \p first, \p copy
|
43 |
-
* performs the assignment *(\p result + \c n) = *(\p first + \c n). Unlike
|
44 |
-
* \c std::copy, \p copy offers no guarantee on order of operation. As a result,
|
45 |
-
* calling \p copy with overlapping source and destination ranges has undefined
|
46 |
-
* behavior.
|
47 |
-
*
|
48 |
-
* The return value is \p result + (\p last - \p first).
|
49 |
-
*
|
50 |
-
* The algorithm's execution is parallelized as determined by \p exec.
|
51 |
-
*
|
52 |
-
* \param exec The execution policy to use for parallelization.
|
53 |
-
* \param first The beginning of the sequence to copy.
|
54 |
-
* \param last The end of the sequence to copy.
|
55 |
-
* \param result The destination sequence.
|
56 |
-
* \return The end of the destination sequence.
|
57 |
-
* \see http://www.sgi.com/tech/stl/copy.html
|
58 |
-
*
|
59 |
-
* \tparam DerivedPolicy The name of the derived execution policy.
|
60 |
-
* \tparam InputIterator must be a model of <a href="http://www.sgi.com/tech/stl/InputIterator.html">Input Iterator</a> and \c InputIterator's \c value_type must be convertible to \c OutputIterator's \c value_type.
|
61 |
-
* \tparam OutputIterator must be a model of <a href="http://www.sgi.com/tech/stl/OutputIterator.html">Output Iterator</a>.
|
62 |
-
*
|
63 |
-
* \pre \p result may be equal to \p first, but \p result shall not be in the range <tt>[first, last)</tt> otherwise.
|
64 |
-
*
|
65 |
-
* The following code snippet demonstrates how to use \p copy
|
66 |
-
* to copy from one range to another using the \p thrust::device parallelization policy:
|
67 |
-
*
|
68 |
-
* \code
|
69 |
-
* #include <thrust/copy.h>
|
70 |
-
* #include <thrust/device_vector.h>
|
71 |
-
* #include <thrust/execution_policy.h>
|
72 |
-
* ...
|
73 |
-
*
|
74 |
-
* thrust::device_vector<int> vec0(100);
|
75 |
-
* thrust::device_vector<int> vec1(100);
|
76 |
-
* ...
|
77 |
-
*
|
78 |
-
* thrust::copy(thrust::device, vec0.begin(), vec0.end(), vec1.begin());
|
79 |
-
*
|
80 |
-
* // vec1 is now a copy of vec0
|
81 |
-
* \endcode
|
82 |
-
*/
|
83 |
-
template<typename DerivedPolicy, typename InputIterator, typename OutputIterator>
|
84 |
-
__host__ __device__
|
85 |
-
OutputIterator copy(const thrust::detail::execution_policy_base<DerivedPolicy> &exec,
|
86 |
-
InputIterator first,
|
87 |
-
InputIterator last,
|
88 |
-
OutputIterator result);
|
89 |
-
|
90 |
-
|
91 |
-
/*! \p copy_n copies elements from the range <tt>[first, first + n)</tt> to the range
|
92 |
-
* <tt>[result, result + n)</tt>. That is, it performs the assignments <tt>*result = *first, *(result + 1) = *(first + 1)</tt>,
|
93 |
-
* and so on. Generally, for every integer \c i from \c 0 to \c n, \p copy
|
94 |
-
* performs the assignment *(\p result + \c i) = *(\p first + \c i). Unlike
|
95 |
-
* \c std::copy_n, \p copy_n offers no guarantee on order of operation. As a result,
|
96 |
-
* calling \p copy_n with overlapping source and destination ranges has undefined
|
97 |
-
* behavior.
|
98 |
-
*
|
99 |
-
* The return value is \p result + \p n.
|
100 |
-
*
|
101 |
-
* The algorithm's execution is parallelized as determined by \p exec.
|
102 |
-
*
|
103 |
-
* \param exec The execution policy to use for parallelization.
|
104 |
-
* \param first The beginning of the range to copy.
|
105 |
-
* \param n The number of elements to copy.
|
106 |
-
* \param result The beginning destination range.
|
107 |
-
* \return The end of the destination range.
|
108 |
-
*
|
109 |
-
* \tparam DerivedPolicy The name of the derived execution policy.
|
110 |
-
* \tparam InputIterator must be a model of <a href="http://www.sgi.com/tech/stl/InputIterator.html">Input Iterator</a> and \c InputIterator's \c value_type must be convertible to \c OutputIterator's \c value_type.
|
111 |
-
* \tparam Size is an integral type.
|
112 |
-
* \tparam OutputIterator must be a model of <a href="http://www.sgi.com/tech/stl/OutputIterator.html">Output Iterator</a>.
|
113 |
-
*
|
114 |
-
* \pre \p result may be equal to \p first, but \p result shall not be in the range <tt>[first, first + n)</tt> otherwise.
|
115 |
-
*
|
116 |
-
* The following code snippet demonstrates how to use \p copy
|
117 |
-
* to copy from one range to another using the \p thrust::device parallelization policy:
|
118 |
-
*
|
119 |
-
* \code
|
120 |
-
* #include <thrust/copy.h>
|
121 |
-
* #include <thrust/device_vector.h>
|
122 |
-
* #include <thrust/execution_policy.h>
|
123 |
-
* ...
|
124 |
-
* size_t n = 100;
|
125 |
-
* thrust::device_vector<int> vec0(n);
|
126 |
-
* thrust::device_vector<int> vec1(n);
|
127 |
-
* ...
|
128 |
-
* thrust::copy_n(thrust::device, vec0.begin(), n, vec1.begin());
|
129 |
-
*
|
130 |
-
* // vec1 is now a copy of vec0
|
131 |
-
* \endcode
|
132 |
-
*
|
133 |
-
* \see http://www.sgi.com/tech/stl/copy_n.html
|
134 |
-
* \see thrust::copy
|
135 |
-
*/
|
136 |
-
template<typename DerivedPolicy, typename InputIterator, typename Size, typename OutputIterator>
|
137 |
-
__host__ __device__
|
138 |
-
OutputIterator copy_n(const thrust::detail::execution_policy_base<DerivedPolicy> &exec,
|
139 |
-
InputIterator first,
|
140 |
-
Size n,
|
141 |
-
OutputIterator result);
|
142 |
-
|
143 |
-
|
144 |
-
|
145 |
-
/*! \p copy copies elements from the range [\p first, \p last) to the range
|
146 |
-
* [\p result, \p result + (\p last - \p first)). That is, it performs
|
147 |
-
* the assignments *\p result = *\p first, *(\p result + \c 1) = *(\p first + \c 1),
|
148 |
-
* and so on. Generally, for every integer \c n from \c 0 to \p last - \p first, \p copy
|
149 |
-
* performs the assignment *(\p result + \c n) = *(\p first + \c n). Unlike
|
150 |
-
* \c std::copy, \p copy offers no guarantee on order of operation. As a result,
|
151 |
-
* calling \p copy with overlapping source and destination ranges has undefined
|
152 |
-
* behavior.
|
153 |
-
*
|
154 |
-
* The return value is \p result + (\p last - \p first).
|
155 |
-
*
|
156 |
-
* \param first The beginning of the sequence to copy.
|
157 |
-
* \param last The end of the sequence to copy.
|
158 |
-
* \param result The destination sequence.
|
159 |
-
* \return The end of the destination sequence.
|
160 |
-
* \see http://www.sgi.com/tech/stl/copy.html
|
161 |
-
*
|
162 |
-
* \tparam InputIterator must be a model of <a href="http://www.sgi.com/tech/stl/InputIterator.html">Input Iterator</a> and \c InputIterator's \c value_type must be convertible to \c OutputIterator's \c value_type.
|
163 |
-
* \tparam OutputIterator must be a model of <a href="http://www.sgi.com/tech/stl/OutputIterator.html">Output Iterator</a>.
|
164 |
-
*
|
165 |
-
* \pre \p result may be equal to \p first, but \p result shall not be in the range <tt>[first, last)</tt> otherwise.
|
166 |
-
*
|
167 |
-
* The following code snippet demonstrates how to use \p copy
|
168 |
-
* to copy from one range to another.
|
169 |
-
*
|
170 |
-
* \code
|
171 |
-
* #include <thrust/copy.h>
|
172 |
-
* #include <thrust/device_vector.h>
|
173 |
-
* ...
|
174 |
-
*
|
175 |
-
* thrust::device_vector<int> vec0(100);
|
176 |
-
* thrust::device_vector<int> vec1(100);
|
177 |
-
* ...
|
178 |
-
*
|
179 |
-
* thrust::copy(vec0.begin(), vec0.end(),
|
180 |
-
* vec1.begin());
|
181 |
-
*
|
182 |
-
* // vec1 is now a copy of vec0
|
183 |
-
* \endcode
|
184 |
-
*/
|
185 |
-
template<typename InputIterator, typename OutputIterator>
|
186 |
-
OutputIterator copy(InputIterator first,
|
187 |
-
InputIterator last,
|
188 |
-
OutputIterator result);
|
189 |
-
|
190 |
-
/*! \p copy_n copies elements from the range <tt>[first, first + n)</tt> to the range
|
191 |
-
* <tt>[result, result + n)</tt>. That is, it performs the assignments <tt>*result = *first, *(result + 1) = *(first + 1)</tt>,
|
192 |
-
* and so on. Generally, for every integer \c i from \c 0 to \c n, \p copy
|
193 |
-
* performs the assignment *(\p result + \c i) = *(\p first + \c i). Unlike
|
194 |
-
* \c std::copy_n, \p copy_n offers no guarantee on order of operation. As a result,
|
195 |
-
* calling \p copy_n with overlapping source and destination ranges has undefined
|
196 |
-
* behavior.
|
197 |
-
*
|
198 |
-
* The return value is \p result + \p n.
|
199 |
-
*
|
200 |
-
* \param first The beginning of the range to copy.
|
201 |
-
* \param n The number of elements to copy.
|
202 |
-
* \param result The beginning destination range.
|
203 |
-
* \return The end of the destination range.
|
204 |
-
*
|
205 |
-
* \tparam InputIterator must be a model of <a href="http://www.sgi.com/tech/stl/InputIterator.html">Input Iterator</a> and \c InputIterator's \c value_type must be convertible to \c OutputIterator's \c value_type.
|
206 |
-
* \tparam Size is an integral type.
|
207 |
-
* \tparam OutputIterator must be a model of <a href="http://www.sgi.com/tech/stl/OutputIterator.html">Output Iterator</a>.
|
208 |
-
*
|
209 |
-
* \pre \p result may be equal to \p first, but \p result shall not be in the range <tt>[first, first + n)</tt> otherwise.
|
210 |
-
*
|
211 |
-
* The following code snippet demonstrates how to use \p copy
|
212 |
-
* to copy from one range to another.
|
213 |
-
*
|
214 |
-
* \code
|
215 |
-
* #include <thrust/copy.h>
|
216 |
-
* #include <thrust/device_vector.h>
|
217 |
-
* ...
|
218 |
-
* size_t n = 100;
|
219 |
-
* thrust::device_vector<int> vec0(n);
|
220 |
-
* thrust::device_vector<int> vec1(n);
|
221 |
-
* ...
|
222 |
-
* thrust::copy_n(vec0.begin(), n, vec1.begin());
|
223 |
-
*
|
224 |
-
* // vec1 is now a copy of vec0
|
225 |
-
* \endcode
|
226 |
-
*
|
227 |
-
* \see http://www.sgi.com/tech/stl/copy_n.html
|
228 |
-
* \see thrust::copy
|
229 |
-
*/
|
230 |
-
template<typename InputIterator, typename Size, typename OutputIterator>
|
231 |
-
OutputIterator copy_n(InputIterator first,
|
232 |
-
Size n,
|
233 |
-
OutputIterator result);
|
234 |
-
|
235 |
-
/*! \} // end copying
|
236 |
-
*/
|
237 |
-
|
238 |
-
/*! \addtogroup stream_compaction
|
239 |
-
* \{
|
240 |
-
*/
|
241 |
-
|
242 |
-
|
243 |
-
/*! This version of \p copy_if copies elements from the range <tt>[first,last)</tt>
|
244 |
-
* to a range beginning at \p result, except that any element which causes \p pred
|
245 |
-
* to be \c false is not copied. \p copy_if is stable, meaning that the relative
|
246 |
-
* order of elements that are copied is unchanged.
|
247 |
-
*
|
248 |
-
* More precisely, for every integer \c n such that <tt>0 <= n < last-first</tt>,
|
249 |
-
* \p copy_if performs the assignment <tt>*result = *(first+n)</tt> and \p result
|
250 |
-
* is advanced one position if <tt>pred(*(first+n))</tt>. Otherwise, no assignment
|
251 |
-
* occurs and \p result is not advanced.
|
252 |
-
*
|
253 |
-
* The algorithm's execution is parallelized as determined by \p system.
|
254 |
-
*
|
255 |
-
* \param exec The execution policy to use for parallelization.
|
256 |
-
* \param first The beginning of the sequence from which to copy.
|
257 |
-
* \param last The end of the sequence from which to copy.
|
258 |
-
* \param result The beginning of the sequence into which to copy.
|
259 |
-
* \param pred The predicate to test on every value of the range <tt>[first, last)</tt>.
|
260 |
-
* \return <tt>result + n</tt>, where \c n is equal to the number of times \p pred
|
261 |
-
* evaluated to \c true in the range <tt>[first, last)</tt>.
|
262 |
-
*
|
263 |
-
* \tparam DerivedPolicy The name of the derived execution policy.
|
264 |
-
* \tparam InputIterator is a model of <a href="http://www.sgi.com/tech/stl/InputIterator.html">Input Iterator</a>,
|
265 |
-
* and \p InputIterator's \c value_type is convertible to \p Predicate's \c argument_type.
|
266 |
-
* \tparam OutputIterator is a model of <a href="http://www.sgi.com/tech/stl/OutputIterator.html">Output Iterator</a>.
|
267 |
-
* \tparam Predicate is a model of <a href="http://www.sgi.com/tech/stl/Predicate.html">Predicate</a>.
|
268 |
-
*
|
269 |
-
* \pre The ranges <tt>[first, last)</tt> and <tt>[result, result + (last - first))</tt> shall not overlap.
|
270 |
-
*
|
271 |
-
* The following code snippet demonstrates how to use \p copy_if to perform stream compaction
|
272 |
-
* to copy even numbers to an output range using the \p thrust::host parallelization policy:
|
273 |
-
*
|
274 |
-
* \code
|
275 |
-
* #include <thrust/copy.h>
|
276 |
-
* #include <thrust/execution_policy.h>
|
277 |
-
* ...
|
278 |
-
* struct is_even
|
279 |
-
* {
|
280 |
-
* __host__ __device__
|
281 |
-
* bool operator()(const int x)
|
282 |
-
* {
|
283 |
-
* return (x % 2) == 0;
|
284 |
-
* }
|
285 |
-
* };
|
286 |
-
* ...
|
287 |
-
* const int N = 6;
|
288 |
-
* int V[N] = {-2, 0, -1, 0, 1, 2};
|
289 |
-
* int result[4];
|
290 |
-
*
|
291 |
-
* thrust::copy_if(thrust::host, V, V + N, result, is_even());
|
292 |
-
*
|
293 |
-
* // V remains {-2, 0, -1, 0, 1, 2}
|
294 |
-
* // result is now {-2, 0, 0, 2}
|
295 |
-
* \endcode
|
296 |
-
*
|
297 |
-
* \see \c remove_copy_if
|
298 |
-
*/
|
299 |
-
template<typename DerivedPolicy, typename InputIterator, typename OutputIterator, typename Predicate>
|
300 |
-
__host__ __device__
|
301 |
-
OutputIterator copy_if(const thrust::detail::execution_policy_base<DerivedPolicy> &exec,
|
302 |
-
InputIterator first,
|
303 |
-
InputIterator last,
|
304 |
-
OutputIterator result,
|
305 |
-
Predicate pred);
|
306 |
-
|
307 |
-
|
308 |
-
|
309 |
-
/*! This version of \p copy_if copies elements from the range <tt>[first,last)</tt>
|
310 |
-
* to a range beginning at \p result, except that any element which causes \p pred
|
311 |
-
* to \c false is not copied. \p copy_if is stable, meaning that the relative
|
312 |
-
* order of elements that are copied is unchanged.
|
313 |
-
*
|
314 |
-
* More precisely, for every integer \c n such that <tt>0 <= n < last-first</tt>,
|
315 |
-
* \p copy_if performs the assignment <tt>*result = *(first+n)</tt> and \p result
|
316 |
-
* is advanced one position if <tt>pred(*(first+n))</tt>. Otherwise, no assignment
|
317 |
-
* occurs and \p result is not advanced.
|
318 |
-
*
|
319 |
-
* \param first The beginning of the sequence from which to copy.
|
320 |
-
* \param last The end of the sequence from which to copy.
|
321 |
-
* \param result The beginning of the sequence into which to copy.
|
322 |
-
* \param pred The predicate to test on every value of the range <tt>[first, last)</tt>.
|
323 |
-
* \return <tt>result + n</tt>, where \c n is equal to the number of times \p pred
|
324 |
-
* evaluated to \c true in the range <tt>[first, last)</tt>.
|
325 |
-
*
|
326 |
-
* \tparam InputIterator is a model of <a href="http://www.sgi.com/tech/stl/InputIterator.html">Input Iterator</a>,
|
327 |
-
* and \p InputIterator's \c value_type is convertible to \p Predicate's \c argument_type.
|
328 |
-
* \tparam OutputIterator is a model of <a href="http://www.sgi.com/tech/stl/OutputIterator.html">Output Iterator</a>.
|
329 |
-
* \tparam Predicate is a model of <a href="http://www.sgi.com/tech/stl/Predicate.html">Predicate</a>.
|
330 |
-
*
|
331 |
-
* \pre The ranges <tt>[first, last)</tt> and <tt>[result, result + (last - first))</tt> shall not overlap.
|
332 |
-
*
|
333 |
-
* The following code snippet demonstrates how to use \p copy_if to perform stream compaction
|
334 |
-
* to copy even numbers to an output range.
|
335 |
-
*
|
336 |
-
* \code
|
337 |
-
* #include <thrust/copy.h>
|
338 |
-
* ...
|
339 |
-
* struct is_even
|
340 |
-
* {
|
341 |
-
* __host__ __device__
|
342 |
-
* bool operator()(const int x)
|
343 |
-
* {
|
344 |
-
* return (x % 2) == 0;
|
345 |
-
* }
|
346 |
-
* };
|
347 |
-
* ...
|
348 |
-
* const int N = 6;
|
349 |
-
* int V[N] = {-2, 0, -1, 0, 1, 2};
|
350 |
-
* int result[4];
|
351 |
-
*
|
352 |
-
* thrust::copy_if(V, V + N, result, is_even());
|
353 |
-
*
|
354 |
-
* // V remains {-2, 0, -1, 0, 1, 2}
|
355 |
-
* // result is now {-2, 0, 0, 2}
|
356 |
-
* \endcode
|
357 |
-
*
|
358 |
-
* \see \c remove_copy_if
|
359 |
-
*/
|
360 |
-
template<typename InputIterator,
|
361 |
-
typename OutputIterator,
|
362 |
-
typename Predicate>
|
363 |
-
OutputIterator copy_if(InputIterator first,
|
364 |
-
InputIterator last,
|
365 |
-
OutputIterator result,
|
366 |
-
Predicate pred);
|
367 |
-
|
368 |
-
|
369 |
-
/*! This version of \p copy_if copies elements from the range <tt>[first,last)</tt>
|
370 |
-
* to a range beginning at \p result, except that any element whose corresponding stencil
|
371 |
-
* element causes \p pred to be \c false is not copied. \p copy_if is stable, meaning
|
372 |
-
* that the relative order of elements that are copied is unchanged.
|
373 |
-
*
|
374 |
-
* More precisely, for every integer \c n such that <tt>0 <= n < last-first</tt>,
|
375 |
-
* \p copy_if performs the assignment <tt>*result = *(first+n)</tt> and \p result
|
376 |
-
* is advanced one position if <tt>pred(*(stencil+n))</tt>. Otherwise, no assignment
|
377 |
-
* occurs and \p result is not advanced.
|
378 |
-
*
|
379 |
-
* The algorithm's execution is parallelized as determined by \p exec.
|
380 |
-
*
|
381 |
-
* \param exec The execution policy to use for parallelization.
|
382 |
-
* \param first The beginning of the sequence from which to copy.
|
383 |
-
* \param last The end of the sequence from which to copy.
|
384 |
-
* \param stencil The beginning of the stencil sequence.
|
385 |
-
* \param result The beginning of the sequence into which to copy.
|
386 |
-
* \param pred The predicate to test on every value of the range <tt>[stencil, stencil + (last-first))</tt>.
|
387 |
-
* \return <tt>result + n</tt>, where \c n is equal to the number of times \p pred
|
388 |
-
* evaluated to \c true in the range <tt>[stencil, stencil + (last-first))</tt>.
|
389 |
-
*
|
390 |
-
* \tparam DerivedPolicy The name of the derived execution policy.
|
391 |
-
* \tparam InputIterator1 is a model of <a href="http://www.sgi.com/tech/stl/InputIterator.html">Input Iterator</a>.
|
392 |
-
* \tparam InputIterator2 is a model of <a href="http://www.sgi.com/tech/stl/InputIterator.html">Input Iterator</a>,
|
393 |
-
* and \p InputIterator2's \c value_type is convertible to \p Predicate's \c argument_type.
|
394 |
-
* \tparam OutputIterator is a model of <a href="http://www.sgi.com/tech/stl/OutputIterator">Output Iterator</a>.
|
395 |
-
* \tparam Predicate is a model of <a href="http://www.sgi.com/tech/stl/Predicate.html">Predicate</a>.
|
396 |
-
*
|
397 |
-
* \pre The ranges <tt>[first, last)</tt> and <tt>[result, result + (last - first))</tt> shall not overlap.
|
398 |
-
* \pre The ranges <tt>[stencil, stencil + (last - first))</tt> and <tt>[result, result + (last - first))</tt> shall not overlap.
|
399 |
-
*
|
400 |
-
* The following code snippet demonstrates how to use \p copy_if to perform stream compaction
|
401 |
-
* to copy numbers to an output range when corresponding stencil elements are even using the \p thrust::host execution policy:
|
402 |
-
*
|
403 |
-
* \code
|
404 |
-
* #include <thrust/copy.h>
|
405 |
-
* #include <thrust/execution_policy.h>
|
406 |
-
* ...
|
407 |
-
* struct is_even
|
408 |
-
* {
|
409 |
-
* __host__ __device__
|
410 |
-
* bool operator()(const int x)
|
411 |
-
* {
|
412 |
-
* return (x % 2) == 0;
|
413 |
-
* }
|
414 |
-
* };
|
415 |
-
* ...
|
416 |
-
* int N = 6;
|
417 |
-
* int data[N] = { 0, 1, 2, 3, 4, 5};
|
418 |
-
* int stencil[N] = {-2, 0, -1, 0, 1, 2};
|
419 |
-
* int result[4];
|
420 |
-
*
|
421 |
-
* thrust::copy_if(thrust::host, data, data + N, stencil, result, is_even());
|
422 |
-
*
|
423 |
-
* // data remains = { 0, 1, 2, 3, 4, 5};
|
424 |
-
* // stencil remains = {-2, 0, -1, 0, 1, 2};
|
425 |
-
* // result is now { 0, 1, 3, 5}
|
426 |
-
* \endcode
|
427 |
-
*
|
428 |
-
* \see \c remove_copy_if
|
429 |
-
*/
|
430 |
-
template<typename DerivedPolicy, typename InputIterator1, typename InputIterator2, typename OutputIterator, typename Predicate>
|
431 |
-
__host__ __device__
|
432 |
-
OutputIterator copy_if(const thrust::detail::execution_policy_base<DerivedPolicy> &exec,
|
433 |
-
InputIterator1 first,
|
434 |
-
InputIterator1 last,
|
435 |
-
InputIterator2 stencil,
|
436 |
-
OutputIterator result,
|
437 |
-
Predicate pred);
|
438 |
-
|
439 |
-
|
440 |
-
/*! This version of \p copy_if copies elements from the range <tt>[first,last)</tt>
|
441 |
-
* to a range beginning at \p result, except that any element whose corresponding stencil
|
442 |
-
* element causes \p pred to be \c false is not copied. \p copy_if is stable, meaning
|
443 |
-
* that the relative order of elements that are copied is unchanged.
|
444 |
-
*
|
445 |
-
* More precisely, for every integer \c n such that <tt>0 <= n < last-first</tt>,
|
446 |
-
* \p copy_if performs the assignment <tt>*result = *(first+n)</tt> and \p result
|
447 |
-
* is advanced one position if <tt>pred(*(stencil+n))</tt>. Otherwise, no assignment
|
448 |
-
* occurs and \p result is not advanced.
|
449 |
-
*
|
450 |
-
* \param first The beginning of the sequence from which to copy.
|
451 |
-
* \param last The end of the sequence from which to copy.
|
452 |
-
* \param stencil The beginning of the stencil sequence.
|
453 |
-
* \param result The beginning of the sequence into which to copy.
|
454 |
-
* \param pred The predicate to test on every value of the range <tt>[stencil, stencil + (last-first))</tt>.
|
455 |
-
* \return <tt>result + n</tt>, where \c n is equal to the number of times \p pred
|
456 |
-
* evaluated to \c true in the range <tt>[stencil, stencil + (last-first))</tt>.
|
457 |
-
*
|
458 |
-
* \tparam InputIterator1 is a model of <a href="http://www.sgi.com/tech/stl/InputIterator.html">Input Iterator</a>.
|
459 |
-
* \tparam InputIterator2 is a model of <a href="http://www.sgi.com/tech/stl/InputIterator.html">Input Iterator</a>,
|
460 |
-
* and \p InputIterator2's \c value_type is convertible to \p Predicate's \c argument_type.
|
461 |
-
* \tparam OutputIterator is a model of <a href="http://www.sgi.com/tech/stl/OutputIterator">Output Iterator</a>.
|
462 |
-
* \tparam Predicate is a model of <a href="http://www.sgi.com/tech/stl/Predicate.html">Predicate</a>.
|
463 |
-
*
|
464 |
-
* \pre The ranges <tt>[first, last)</tt> and <tt>[result, result + (last - first))</tt> shall not overlap.
|
465 |
-
* \pre The ranges <tt>[stencil, stencil + (last - first))</tt> and <tt>[result, result + (last - first))</tt> shall not overlap.
|
466 |
-
*
|
467 |
-
* The following code snippet demonstrates how to use \p copy_if to perform stream compaction
|
468 |
-
* to copy numbers to an output range when corresponding stencil elements are even:
|
469 |
-
*
|
470 |
-
* \code
|
471 |
-
* #include <thrust/copy.h>
|
472 |
-
* ...
|
473 |
-
* struct is_even
|
474 |
-
* {
|
475 |
-
* __host__ __device__
|
476 |
-
* bool operator()(const int x)
|
477 |
-
* {
|
478 |
-
* return (x % 2) == 0;
|
479 |
-
* }
|
480 |
-
* };
|
481 |
-
* ...
|
482 |
-
* int N = 6;
|
483 |
-
* int data[N] = { 0, 1, 2, 3, 4, 5};
|
484 |
-
* int stencil[N] = {-2, 0, -1, 0, 1, 2};
|
485 |
-
* int result[4];
|
486 |
-
*
|
487 |
-
* thrust::copy_if(data, data + N, stencil, result, is_even());
|
488 |
-
*
|
489 |
-
* // data remains = { 0, 1, 2, 3, 4, 5};
|
490 |
-
* // stencil remains = {-2, 0, -1, 0, 1, 2};
|
491 |
-
* // result is now { 0, 1, 3, 5}
|
492 |
-
* \endcode
|
493 |
-
*
|
494 |
-
* \see \c remove_copy_if
|
495 |
-
*/
|
496 |
-
template<typename InputIterator1,
|
497 |
-
typename InputIterator2,
|
498 |
-
typename OutputIterator,
|
499 |
-
typename Predicate>
|
500 |
-
OutputIterator copy_if(InputIterator1 first,
|
501 |
-
InputIterator1 last,
|
502 |
-
InputIterator2 stencil,
|
503 |
-
OutputIterator result,
|
504 |
-
Predicate pred);
|
505 |
-
|
506 |
-
/*! \} // end stream_compaction
|
507 |
-
*/
|
508 |
-
|
509 |
-
} // end namespace thrust
|
510 |
-
|
511 |
-
#include <thrust/detail/copy.h>
|
512 |
-
#include <thrust/detail/copy_if.h>
|
513 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
spaces/CVPR/WALT/configs/_base_/models/occ_mask_rcnn_swin_fpn.py
DELETED
@@ -1,127 +0,0 @@
|
|
1 |
-
# model settings
|
2 |
-
model = dict(
|
3 |
-
type='MaskRCNN',
|
4 |
-
pretrained=None,
|
5 |
-
backbone=dict(
|
6 |
-
type='SwinTransformer',
|
7 |
-
embed_dim=96,
|
8 |
-
depths=[2, 2, 6, 2],
|
9 |
-
num_heads=[3, 6, 12, 24],
|
10 |
-
window_size=7,
|
11 |
-
mlp_ratio=4.,
|
12 |
-
qkv_bias=True,
|
13 |
-
qk_scale=None,
|
14 |
-
drop_rate=0.,
|
15 |
-
attn_drop_rate=0.,
|
16 |
-
drop_path_rate=0.2,
|
17 |
-
ape=False,
|
18 |
-
patch_norm=True,
|
19 |
-
out_indices=(0, 1, 2, 3),
|
20 |
-
use_checkpoint=False),
|
21 |
-
neck=dict(
|
22 |
-
type='FPN',
|
23 |
-
in_channels=[96, 192, 384, 768],
|
24 |
-
out_channels=256,
|
25 |
-
num_outs=5),
|
26 |
-
rpn_head=dict(
|
27 |
-
type='RPNHead',
|
28 |
-
in_channels=256,
|
29 |
-
feat_channels=256,
|
30 |
-
anchor_generator=dict(
|
31 |
-
type='AnchorGenerator',
|
32 |
-
scales=[8],
|
33 |
-
ratios=[0.5, 1.0, 2.0],
|
34 |
-
strides=[4, 8, 16, 32, 64]),
|
35 |
-
bbox_coder=dict(
|
36 |
-
type='DeltaXYWHBBoxCoder',
|
37 |
-
target_means=[.0, .0, .0, .0],
|
38 |
-
target_stds=[1.0, 1.0, 1.0, 1.0]),
|
39 |
-
loss_cls=dict(
|
40 |
-
type='CrossEntropyLoss', use_sigmoid=True, loss_weight=1.0),
|
41 |
-
loss_bbox=dict(type='L1Loss', loss_weight=1.0)),
|
42 |
-
roi_head=dict(
|
43 |
-
type='StandardRoIHead',
|
44 |
-
bbox_roi_extractor=dict(
|
45 |
-
type='SingleRoIExtractor',
|
46 |
-
roi_layer=dict(type='RoIAlign', output_size=7, sampling_ratio=0),
|
47 |
-
out_channels=256,
|
48 |
-
featmap_strides=[4, 8, 16, 32]),
|
49 |
-
bbox_head=dict(
|
50 |
-
type='Shared2FCBBoxHead',
|
51 |
-
in_channels=256,
|
52 |
-
fc_out_channels=1024,
|
53 |
-
roi_feat_size=7,
|
54 |
-
num_classes=80,
|
55 |
-
bbox_coder=dict(
|
56 |
-
type='DeltaXYWHBBoxCoder',
|
57 |
-
target_means=[0., 0., 0., 0.],
|
58 |
-
target_stds=[0.1, 0.1, 0.2, 0.2]),
|
59 |
-
reg_class_agnostic=False,
|
60 |
-
loss_cls=dict(
|
61 |
-
type='CrossEntropyLoss', use_sigmoid=False, loss_weight=1.0),
|
62 |
-
loss_bbox=dict(type='L1Loss', loss_weight=1.0)),
|
63 |
-
mask_roi_extractor=dict(
|
64 |
-
type='SingleRoIExtractor',
|
65 |
-
roi_layer=dict(type='RoIAlign', output_size=14, sampling_ratio=0),
|
66 |
-
out_channels=256,
|
67 |
-
featmap_strides=[4, 8, 16, 32]),
|
68 |
-
mask_head=dict(
|
69 |
-
type='FCNOccMaskHead',
|
70 |
-
num_convs=4,
|
71 |
-
in_channels=256,
|
72 |
-
conv_out_channels=256,
|
73 |
-
num_classes=80,
|
74 |
-
loss_mask=dict(
|
75 |
-
type='CrossEntropyLoss', use_mask=True, loss_weight=1.0))),
|
76 |
-
# model training and testing settings
|
77 |
-
train_cfg=dict(
|
78 |
-
rpn=dict(
|
79 |
-
assigner=dict(
|
80 |
-
type='MaxIoUAssigner',
|
81 |
-
pos_iou_thr=0.7,
|
82 |
-
neg_iou_thr=0.3,
|
83 |
-
min_pos_iou=0.3,
|
84 |
-
match_low_quality=True,
|
85 |
-
ignore_iof_thr=-1),
|
86 |
-
sampler=dict(
|
87 |
-
type='RandomSampler',
|
88 |
-
num=256,
|
89 |
-
pos_fraction=0.5,
|
90 |
-
neg_pos_ub=-1,
|
91 |
-
add_gt_as_proposals=False),
|
92 |
-
allowed_border=-1,
|
93 |
-
pos_weight=-1,
|
94 |
-
debug=False),
|
95 |
-
rpn_proposal=dict(
|
96 |
-
nms_pre=2000,
|
97 |
-
max_per_img=1000,
|
98 |
-
nms=dict(type='nms', iou_threshold=0.7),
|
99 |
-
min_bbox_size=0),
|
100 |
-
rcnn=dict(
|
101 |
-
assigner=dict(
|
102 |
-
type='MaxIoUAssigner',
|
103 |
-
pos_iou_thr=0.5,
|
104 |
-
neg_iou_thr=0.5,
|
105 |
-
min_pos_iou=0.5,
|
106 |
-
match_low_quality=True,
|
107 |
-
ignore_iof_thr=-1),
|
108 |
-
sampler=dict(
|
109 |
-
type='RandomSampler',
|
110 |
-
num=512,
|
111 |
-
pos_fraction=0.25,
|
112 |
-
neg_pos_ub=-1,
|
113 |
-
add_gt_as_proposals=True),
|
114 |
-
mask_size=28,
|
115 |
-
pos_weight=-1,
|
116 |
-
debug=False)),
|
117 |
-
test_cfg=dict(
|
118 |
-
rpn=dict(
|
119 |
-
nms_pre=1000,
|
120 |
-
max_per_img=1000,
|
121 |
-
nms=dict(type='nms', iou_threshold=0.7),
|
122 |
-
min_bbox_size=0),
|
123 |
-
rcnn=dict(
|
124 |
-
score_thr=0.05,
|
125 |
-
nms=dict(type='nms', iou_threshold=0.5),
|
126 |
-
max_per_img=100,
|
127 |
-
mask_thr_binary=0.5)))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
spaces/CVPR/lama-example/saicinpainting/evaluation/losses/ssim.py
DELETED
@@ -1,74 +0,0 @@
|
|
1 |
-
import numpy as np
|
2 |
-
import torch
|
3 |
-
import torch.nn.functional as F
|
4 |
-
|
5 |
-
|
6 |
-
class SSIM(torch.nn.Module):
|
7 |
-
"""SSIM. Modified from:
|
8 |
-
https://github.com/Po-Hsun-Su/pytorch-ssim/blob/master/pytorch_ssim/__init__.py
|
9 |
-
"""
|
10 |
-
|
11 |
-
def __init__(self, window_size=11, size_average=True):
|
12 |
-
super().__init__()
|
13 |
-
self.window_size = window_size
|
14 |
-
self.size_average = size_average
|
15 |
-
self.channel = 1
|
16 |
-
self.register_buffer('window', self._create_window(window_size, self.channel))
|
17 |
-
|
18 |
-
def forward(self, img1, img2):
|
19 |
-
assert len(img1.shape) == 4
|
20 |
-
|
21 |
-
channel = img1.size()[1]
|
22 |
-
|
23 |
-
if channel == self.channel and self.window.data.type() == img1.data.type():
|
24 |
-
window = self.window
|
25 |
-
else:
|
26 |
-
window = self._create_window(self.window_size, channel)
|
27 |
-
|
28 |
-
# window = window.to(img1.get_device())
|
29 |
-
window = window.type_as(img1)
|
30 |
-
|
31 |
-
self.window = window
|
32 |
-
self.channel = channel
|
33 |
-
|
34 |
-
return self._ssim(img1, img2, window, self.window_size, channel, self.size_average)
|
35 |
-
|
36 |
-
def _gaussian(self, window_size, sigma):
|
37 |
-
gauss = torch.Tensor([
|
38 |
-
np.exp(-(x - (window_size // 2)) ** 2 / float(2 * sigma ** 2)) for x in range(window_size)
|
39 |
-
])
|
40 |
-
return gauss / gauss.sum()
|
41 |
-
|
42 |
-
def _create_window(self, window_size, channel):
|
43 |
-
_1D_window = self._gaussian(window_size, 1.5).unsqueeze(1)
|
44 |
-
_2D_window = _1D_window.mm(_1D_window.t()).float().unsqueeze(0).unsqueeze(0)
|
45 |
-
return _2D_window.expand(channel, 1, window_size, window_size).contiguous()
|
46 |
-
|
47 |
-
def _ssim(self, img1, img2, window, window_size, channel, size_average=True):
|
48 |
-
mu1 = F.conv2d(img1, window, padding=(window_size // 2), groups=channel)
|
49 |
-
mu2 = F.conv2d(img2, window, padding=(window_size // 2), groups=channel)
|
50 |
-
|
51 |
-
mu1_sq = mu1.pow(2)
|
52 |
-
mu2_sq = mu2.pow(2)
|
53 |
-
mu1_mu2 = mu1 * mu2
|
54 |
-
|
55 |
-
sigma1_sq = F.conv2d(
|
56 |
-
img1 * img1, window, padding=(window_size // 2), groups=channel) - mu1_sq
|
57 |
-
sigma2_sq = F.conv2d(
|
58 |
-
img2 * img2, window, padding=(window_size // 2), groups=channel) - mu2_sq
|
59 |
-
sigma12 = F.conv2d(
|
60 |
-
img1 * img2, window, padding=(window_size // 2), groups=channel) - mu1_mu2
|
61 |
-
|
62 |
-
C1 = 0.01 ** 2
|
63 |
-
C2 = 0.03 ** 2
|
64 |
-
|
65 |
-
ssim_map = ((2 * mu1_mu2 + C1) * (2 * sigma12 + C2)) / \
|
66 |
-
((mu1_sq + mu2_sq + C1) * (sigma1_sq + sigma2_sq + C2))
|
67 |
-
|
68 |
-
if size_average:
|
69 |
-
return ssim_map.mean()
|
70 |
-
|
71 |
-
return ssim_map.mean(1).mean(1).mean(1)
|
72 |
-
|
73 |
-
def _load_from_state_dict(self, state_dict, prefix, local_metadata, strict, missing_keys, unexpected_keys, error_msgs):
|
74 |
-
return
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
spaces/Candeloro/DeepDanbooru_string/README.md
DELETED
@@ -1,39 +0,0 @@
|
|
1 |
-
---
|
2 |
-
title: DeepDanbooru String
|
3 |
-
emoji: 💬
|
4 |
-
colorFrom: blue
|
5 |
-
colorTo: red
|
6 |
-
sdk: gradio
|
7 |
-
sdk_version: 3.6
|
8 |
-
app_file: app.py
|
9 |
-
pinned: false
|
10 |
-
duplicated_from: NoCrypt/DeepDanbooru_string
|
11 |
-
---
|
12 |
-
|
13 |
-
# Configuration
|
14 |
-
|
15 |
-
`title`: _string_
|
16 |
-
Display title for the Space
|
17 |
-
|
18 |
-
`emoji`: _string_
|
19 |
-
Space emoji (emoji-only character allowed)
|
20 |
-
|
21 |
-
`colorFrom`: _string_
|
22 |
-
Color for Thumbnail gradient (red, yellow, green, blue, indigo, purple, pink, gray)
|
23 |
-
|
24 |
-
`colorTo`: _string_
|
25 |
-
Color for Thumbnail gradient (red, yellow, green, blue, indigo, purple, pink, gray)
|
26 |
-
|
27 |
-
`sdk`: _string_
|
28 |
-
Can be either `gradio`, `streamlit`, or `static`
|
29 |
-
|
30 |
-
`sdk_version` : _string_
|
31 |
-
Only applicable for `streamlit` SDK.
|
32 |
-
See [doc](https://hf.co/docs/hub/spaces) for more info on supported versions.
|
33 |
-
|
34 |
-
`app_file`: _string_
|
35 |
-
Path to your main application file (which contains either `gradio` or `streamlit` Python code, or `static` html code).
|
36 |
-
Path is relative to the root of the repository.
|
37 |
-
|
38 |
-
`pinned`: _boolean_
|
39 |
-
Whether the Space stays on top of your list.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
spaces/DEVINKofficial/Onodofthenorth-SD_PixelArt_SpriteSheet_Generator/README.md
DELETED
@@ -1,12 +0,0 @@
|
|
1 |
-
---
|
2 |
-
title: Onodofthenorth-SD PixelArt SpriteSheet Generator
|
3 |
-
emoji: 🚀
|
4 |
-
colorFrom: red
|
5 |
-
colorTo: indigo
|
6 |
-
sdk: gradio
|
7 |
-
sdk_version: 3.39.0
|
8 |
-
app_file: app.py
|
9 |
-
pinned: false
|
10 |
-
---
|
11 |
-
|
12 |
-
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
spaces/DQChoi/gpt-demo/venv/lib/python3.11/site-packages/fastapi/logger.py
DELETED
@@ -1,3 +0,0 @@
|
|
1 |
-
import logging
|
2 |
-
|
3 |
-
logger = logging.getLogger("fastapi")
|
|
|
|
|
|
|
|
spaces/DQChoi/gpt-demo/venv/lib/python3.11/site-packages/ffmpy.py
DELETED
@@ -1,203 +0,0 @@
|
|
1 |
-
import errno
|
2 |
-
import shlex
|
3 |
-
import subprocess
|
4 |
-
|
5 |
-
__version__ = "0.3.1"
|
6 |
-
|
7 |
-
|
8 |
-
class FFmpeg(object):
|
9 |
-
"""Wrapper for various `FFmpeg <https://www.ffmpeg.org/>`_ related applications (ffmpeg,
|
10 |
-
ffprobe).
|
11 |
-
"""
|
12 |
-
|
13 |
-
def __init__(
|
14 |
-
self, executable="ffmpeg", global_options=None, inputs=None, outputs=None
|
15 |
-
):
|
16 |
-
"""Initialize FFmpeg command line wrapper.
|
17 |
-
|
18 |
-
Compiles FFmpeg command line from passed arguments (executable path, options, inputs and
|
19 |
-
outputs). ``inputs`` and ``outputs`` are dictionares containing inputs/outputs as keys and
|
20 |
-
their respective options as values. One dictionary value (set of options) must be either a
|
21 |
-
single space separated string, or a list or strings without spaces (i.e. each part of the
|
22 |
-
option is a separate item of the list, the result of calling ``split()`` on the options
|
23 |
-
string). If the value is a list, it cannot be mixed, i.e. cannot contain items with spaces.
|
24 |
-
An exception are complex FFmpeg command lines that contain quotes: the quoted part must be
|
25 |
-
one string, even if it contains spaces (see *Examples* for more info).
|
26 |
-
For more info about FFmpeg command line format see `here
|
27 |
-
<https://ffmpeg.org/ffmpeg.html#Synopsis>`_.
|
28 |
-
|
29 |
-
:param str executable: path to ffmpeg executable; by default the ``ffmpeg`` command will be
|
30 |
-
searched for in the ``PATH``, but can be overridden with an absolute path to ``ffmpeg``
|
31 |
-
executable
|
32 |
-
:param iterable global_options: global options passed to ``ffmpeg`` executable (e.g.
|
33 |
-
``-y``, ``-v`` etc.); can be specified either as a list/tuple/set of strings, or one
|
34 |
-
space-separated string; by default no global options are passed
|
35 |
-
:param dict inputs: a dictionary specifying one or more input arguments as keys with their
|
36 |
-
corresponding options (either as a list of strings or a single space separated string) as
|
37 |
-
values
|
38 |
-
:param dict outputs: a dictionary specifying one or more output arguments as keys with their
|
39 |
-
corresponding options (either as a list of strings or a single space separated string) as
|
40 |
-
values
|
41 |
-
"""
|
42 |
-
self.executable = executable
|
43 |
-
self._cmd = [executable]
|
44 |
-
|
45 |
-
global_options = global_options or []
|
46 |
-
if _is_sequence(global_options):
|
47 |
-
normalized_global_options = []
|
48 |
-
for opt in global_options:
|
49 |
-
normalized_global_options += shlex.split(opt)
|
50 |
-
else:
|
51 |
-
normalized_global_options = shlex.split(global_options)
|
52 |
-
|
53 |
-
self._cmd += normalized_global_options
|
54 |
-
self._cmd += _merge_args_opts(inputs, add_input_option=True)
|
55 |
-
self._cmd += _merge_args_opts(outputs)
|
56 |
-
|
57 |
-
self.cmd = subprocess.list2cmdline(self._cmd)
|
58 |
-
self.process = None
|
59 |
-
|
60 |
-
def __repr__(self):
|
61 |
-
return "<{0!r} {1!r}>".format(self.__class__.__name__, self.cmd)
|
62 |
-
|
63 |
-
def run(self, input_data=None, stdout=None, stderr=None, env=None, **kwargs):
|
64 |
-
"""Execute FFmpeg command line.
|
65 |
-
|
66 |
-
``input_data`` can contain input for FFmpeg in case ``pipe`` protocol is used for input.
|
67 |
-
``stdout`` and ``stderr`` specify where to redirect the ``stdout`` and ``stderr`` of the
|
68 |
-
process. By default no redirection is done, which means all output goes to running shell
|
69 |
-
(this mode should normally only be used for debugging purposes). If FFmpeg ``pipe`` protocol
|
70 |
-
is used for output, ``stdout`` must be redirected to a pipe by passing `subprocess.PIPE` as
|
71 |
-
``stdout`` argument. You can pass custom environment to ffmpeg process with ``env``.
|
72 |
-
|
73 |
-
Returns a 2-tuple containing ``stdout`` and ``stderr`` of the process. If there was no
|
74 |
-
redirection or if the output was redirected to e.g. `os.devnull`, the value returned will
|
75 |
-
be a tuple of two `None` values, otherwise it will contain the actual ``stdout`` and
|
76 |
-
``stderr`` data returned by ffmpeg process.
|
77 |
-
|
78 |
-
More info about ``pipe`` protocol `here <https://ffmpeg.org/ffmpeg-protocols.html#pipe>`_.
|
79 |
-
|
80 |
-
:param str input_data: input data for FFmpeg to deal with (audio, video etc.) as bytes (e.g.
|
81 |
-
the result of reading a file in binary mode)
|
82 |
-
:param stdout: redirect FFmpeg ``stdout`` there (default is `None` which means no
|
83 |
-
redirection)
|
84 |
-
:param stderr: redirect FFmpeg ``stderr`` there (default is `None` which means no
|
85 |
-
redirection)
|
86 |
-
:param env: custom environment for ffmpeg process
|
87 |
-
:param kwargs: any other keyword arguments to be forwarded to `subprocess.Popen
|
88 |
-
<https://docs.python.org/3/library/subprocess.html#subprocess.Popen>`_
|
89 |
-
:return: a 2-tuple containing ``stdout`` and ``stderr`` of the process
|
90 |
-
:rtype: tuple
|
91 |
-
:raise: `FFRuntimeError` in case FFmpeg command exits with a non-zero code;
|
92 |
-
`FFExecutableNotFoundError` in case the executable path passed was not valid
|
93 |
-
"""
|
94 |
-
try:
|
95 |
-
self.process = subprocess.Popen(
|
96 |
-
self._cmd,
|
97 |
-
stdin=subprocess.PIPE,
|
98 |
-
stdout=stdout,
|
99 |
-
stderr=stderr,
|
100 |
-
env=env,
|
101 |
-
**kwargs
|
102 |
-
)
|
103 |
-
except OSError as e:
|
104 |
-
if e.errno == errno.ENOENT:
|
105 |
-
raise FFExecutableNotFoundError(
|
106 |
-
"Executable '{0}' not found".format(self.executable)
|
107 |
-
)
|
108 |
-
else:
|
109 |
-
raise
|
110 |
-
|
111 |
-
out = self.process.communicate(input=input_data)
|
112 |
-
if self.process.returncode != 0:
|
113 |
-
raise FFRuntimeError(self.cmd, self.process.returncode, out[0], out[1])
|
114 |
-
|
115 |
-
return out
|
116 |
-
|
117 |
-
|
118 |
-
class FFprobe(FFmpeg):
|
119 |
-
"""Wrapper for `ffprobe <https://www.ffmpeg.org/ffprobe.html>`_."""
|
120 |
-
|
121 |
-
def __init__(self, executable="ffprobe", global_options="", inputs=None):
|
122 |
-
"""Create an instance of FFprobe.
|
123 |
-
|
124 |
-
Compiles FFprobe command line from passed arguments (executable path, options, inputs).
|
125 |
-
FFprobe executable by default is taken from ``PATH`` but can be overridden with an
|
126 |
-
absolute path. For more info about FFprobe command line format see
|
127 |
-
`here <https://ffmpeg.org/ffprobe.html#Synopsis>`_.
|
128 |
-
|
129 |
-
:param str executable: absolute path to ffprobe executable
|
130 |
-
:param iterable global_options: global options passed to ffmpeg executable; can be specified
|
131 |
-
either as a list/tuple of strings or a space-separated string
|
132 |
-
:param dict inputs: a dictionary specifying one or more inputs as keys with their
|
133 |
-
corresponding options as values
|
134 |
-
"""
|
135 |
-
super(FFprobe, self).__init__(
|
136 |
-
executable=executable, global_options=global_options, inputs=inputs
|
137 |
-
)
|
138 |
-
|
139 |
-
|
140 |
-
class FFExecutableNotFoundError(Exception):
|
141 |
-
"""Raise when FFmpeg/FFprobe executable was not found."""
|
142 |
-
|
143 |
-
|
144 |
-
class FFRuntimeError(Exception):
|
145 |
-
"""Raise when FFmpeg/FFprobe command line execution returns a non-zero exit code.
|
146 |
-
|
147 |
-
The resulting exception object will contain the attributes relates to command line execution:
|
148 |
-
``cmd``, ``exit_code``, ``stdout``, ``stderr``.
|
149 |
-
"""
|
150 |
-
|
151 |
-
def __init__(self, cmd, exit_code, stdout, stderr):
|
152 |
-
self.cmd = cmd
|
153 |
-
self.exit_code = exit_code
|
154 |
-
self.stdout = stdout
|
155 |
-
self.stderr = stderr
|
156 |
-
|
157 |
-
message = "`{0}` exited with status {1}\n\nSTDOUT:\n{2}\n\nSTDERR:\n{3}".format(
|
158 |
-
self.cmd, exit_code, (stdout or b"").decode(), (stderr or b"").decode()
|
159 |
-
)
|
160 |
-
|
161 |
-
super(FFRuntimeError, self).__init__(message)
|
162 |
-
|
163 |
-
|
164 |
-
def _is_sequence(obj):
|
165 |
-
"""Check if the object is a sequence (list, tuple etc.).
|
166 |
-
|
167 |
-
:param object obj: an object to be checked
|
168 |
-
:return: True if the object is iterable but is not a string, False otherwise
|
169 |
-
:rtype: bool
|
170 |
-
"""
|
171 |
-
return hasattr(obj, "__iter__") and not isinstance(obj, str)
|
172 |
-
|
173 |
-
|
174 |
-
def _merge_args_opts(args_opts_dict, **kwargs):
|
175 |
-
"""Merge options with their corresponding arguments.
|
176 |
-
|
177 |
-
Iterates over the dictionary holding arguments (keys) and options (values). Merges each
|
178 |
-
options string with its corresponding argument.
|
179 |
-
|
180 |
-
:param dict args_opts_dict: a dictionary of arguments and options
|
181 |
-
:param dict kwargs: *input_option* - if specified prepends ``-i`` to input argument
|
182 |
-
:return: merged list of strings with arguments and their corresponding options
|
183 |
-
:rtype: list
|
184 |
-
"""
|
185 |
-
merged = []
|
186 |
-
|
187 |
-
if not args_opts_dict:
|
188 |
-
return merged
|
189 |
-
|
190 |
-
for arg, opt in args_opts_dict.items():
|
191 |
-
if not _is_sequence(opt):
|
192 |
-
opt = shlex.split(opt or "")
|
193 |
-
merged += opt
|
194 |
-
|
195 |
-
if not arg:
|
196 |
-
continue
|
197 |
-
|
198 |
-
if "add_input_option" in kwargs:
|
199 |
-
merged.append("-i")
|
200 |
-
|
201 |
-
merged.append(arg)
|
202 |
-
|
203 |
-
return merged
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|