Commit
·
efed207
1
Parent(s):
c19f181
Update parquet files (step 93 of 121)
Browse filesThis view is limited to 50 files because it contains too many changes.
See raw diff
- spaces/0xSynapse/PixelFusion/app.py +0 -85
- spaces/0xcyborg/minter_latest/app.py +0 -137
- spaces/1acneusushi/gradio-2dmoleculeeditor/data/Discover the Power of Trading Price Action Trends with this Ebook Pdf Download.md +0 -119
- spaces/1acneusushi/gradio-2dmoleculeeditor/data/Download Primavera P6 with Crack in 6 Easy Steps.md +0 -35
- spaces/1gistliPinn/ChatGPT4/Examples/Connectify 31021402 ((BETTER)) Keygen.md +0 -23
- spaces/1phancelerku/anime-remove-background/Brawl Stars APK Indir Join Millions of Players in the Fun and Fast-Paced Mobile Game from APKPure.md +0 -98
- spaces/1phancelerku/anime-remove-background/Download TikTok Unban APK and Access All the Features of the App (Even in Banned Countries).md +0 -25
- spaces/1phancelerku/anime-remove-background/Download Traffic Rider 2 Mod APK with Unlimited Money and No Ads.md +0 -102
- spaces/1phancelerku/anime-remove-background/FIFA 23 APK - How to Play the Latest EA SPORTS FIFA Game on Your Android Device with APKRabi.md +0 -124
- spaces/AI-ZTH-03-23/6.AI.Dashboard.Wiki.Chat.Cognitive.HTML5/style.css +0 -28
- spaces/AIFILMS/generate_human_motion/pyrender/tests/conftest.py +0 -0
- spaces/AIZerotoHero-Health4All/03-BiomedNER-1117-Gradio/README.md +0 -12
- spaces/AchyuthGamer/ImMagician-Image-Generator/previewer/modules.py +0 -36
- spaces/AlekseyKorshuk/huggingartists/README.md +0 -33
- spaces/AlhitawiMohammed22/E2E_OCR/det2rec.py +0 -390
- spaces/Androidonnxfork/CivitAi-to-Diffusers/diffusers/docs/source/en/training/create_dataset.md +0 -90
- spaces/Androidonnxfork/CivitAi-to-Diffusers/diffusers/docs/source/en/using-diffusers/using_safetensors.md +0 -70
- spaces/Androidonnxfork/CivitAi-to-Diffusers/diffusers/tests/models/test_activations.py +0 -48
- spaces/Androidonnxfork/CivitAi-to-Diffusers/diffusers/utils/check_doc_toc.py +0 -158
- spaces/Andy1621/uniformer_image_detection/configs/_base_/datasets/voc0712.py +0 -55
- spaces/Andy1621/uniformer_image_detection/configs/gn/mask_rcnn_r101_fpn_gn-all_2x_coco.py +0 -3
- spaces/Andy1621/uniformer_image_segmentation/configs/deeplabv3plus/deeplabv3plus_r50-d8_512x512_40k_voc12aug.py +0 -7
- spaces/Ataturk-Chatbot/HuggingFaceChat/venv/lib/python3.11/site-packages/pip/_internal/cli/autocompletion.py +0 -171
- spaces/Ataturk-Chatbot/HuggingFaceChat/venv/lib/python3.11/site-packages/pip/_internal/exceptions.py +0 -733
- spaces/Ataturk-Chatbot/HuggingFaceChat/venv/lib/python3.11/site-packages/setuptools/_vendor/importlib_metadata/__init__.py +0 -1047
- spaces/AutoLLM/AutoAgents/autoagents/tools/__init__.py +0 -0
- spaces/Bakar31/PotterQuest/README.md +0 -13
- spaces/Bart92/RVC_HF/Applio-RVC-Fork/utils/i18n.py +0 -28
- spaces/Big-Web/MMSD/env/Lib/site-packages/pip/_internal/pyproject.py +0 -179
- spaces/Big-Web/MMSD/env/Lib/site-packages/pip/_vendor/distro/__init__.py +0 -54
- spaces/Bonp/B/README.md +0 -10
- spaces/CVPR/LIVE/thrust/thrust/system/cuda/detail/managed_memory_pointer.h +0 -195
- spaces/CVPR/regionclip-demo/detectron2/config/defaults.py +0 -786
- spaces/CVPR/regionclip-demo/detectron2/export/__init__.py +0 -7
- spaces/Cletrason/Cletrason-toad-mario-movie/README.md +0 -12
- spaces/CobaltZvc/Hyper_Bot/index.html +0 -29
- spaces/CompVis/stable-diffusion-license/index.html +0 -0
- spaces/Cropinky/hana_hanak_houses/realesrgan/models/__init__.py +0 -10
- spaces/DQChoi/gpt-demo/venv/lib/python3.11/site-packages/fontTools/svgLib/path/parser.py +0 -321
- spaces/DQChoi/gpt-demo/venv/lib/python3.11/site-packages/fontTools/ttLib/tables/C_B_D_T_.py +0 -105
- spaces/Devaholic/fruit-demo/utils/__init__.py +0 -54
- spaces/Dorado607/ChuanhuChatGPT/modules/index_func.py +0 -149
- spaces/DragGan/DragGan-Inversion/PTI/utils/ImagesDataset.py +0 -43
- spaces/Dusan/clickbaitonator/fudge/constants.py +0 -32
- spaces/EXPOSUREEE/Ai-Image-Enhancer/tests/test_utils.py +0 -87
- spaces/Eddycrack864/Applio-Inference/infer/modules/train/extract_feature_print.py +0 -137
- spaces/Felix123456/bingo/src/components/providers.tsx +0 -15
- spaces/Fernando22/freegpt-webui/g4f/utils.py +0 -49
- spaces/FredZhang7/paint-journey-demo/README.md +0 -13
- spaces/FridaZuley/RVC_HFKawaii/infer/modules/ipex/__init__.py.py +0 -165
spaces/0xSynapse/PixelFusion/app.py
DELETED
@@ -1,85 +0,0 @@
|
|
1 |
-
'''
|
2 |
-
Neural Style Transfer using TensorFlow's Pretrained Style Transfer Model
|
3 |
-
https://tfhub.dev/google/magenta/arbitrary-image-stylization-v1-256/2
|
4 |
-
|
5 |
-
'''
|
6 |
-
|
7 |
-
|
8 |
-
import gradio as gr
|
9 |
-
import tensorflow as tf
|
10 |
-
import tensorflow_hub as hub
|
11 |
-
from PIL import Image
|
12 |
-
import numpy as np
|
13 |
-
import cv2
|
14 |
-
import os
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
model = hub.load("https://tfhub.dev/google/magenta/arbitrary-image-stylization-v1-256/2")
|
19 |
-
|
20 |
-
|
21 |
-
# source: https://stackoverflow.com/questions/4993082/how-can-i-sharpen-an-image-in-opencv
|
22 |
-
def unsharp_mask(image, kernel_size=(5, 5), sigma=1.0, amount=1.0, threshold=0):
|
23 |
-
"""Return a sharpened version of the image, using an unsharp mask."""
|
24 |
-
blurred = cv2.GaussianBlur(image, kernel_size, sigma)
|
25 |
-
sharpened = float(amount + 1) * image - float(amount) * blurred
|
26 |
-
sharpened = np.maximum(sharpened, np.zeros(sharpened.shape))
|
27 |
-
sharpened = np.minimum(sharpened, 255 * np.ones(sharpened.shape))
|
28 |
-
sharpened = sharpened.round().astype(np.uint8)
|
29 |
-
if threshold > 0:
|
30 |
-
low_contrast_mask = np.absolute(image - blurred) < threshold
|
31 |
-
np.copyto(sharpened, image, where=low_contrast_mask)
|
32 |
-
return sharpened
|
33 |
-
|
34 |
-
|
35 |
-
def style_transfer(content_img,style_image, style_weight = 1, content_weight = 1, style_blur=False):
|
36 |
-
content_img = unsharp_mask(content_img,amount=1)
|
37 |
-
content_img = tf.image.resize(tf.convert_to_tensor(content_img,tf.float32)[tf.newaxis,...] / 255.,(512,512),preserve_aspect_ratio=True)
|
38 |
-
style_img = tf.convert_to_tensor(style_image,tf.float32)[tf.newaxis,...] / 255.
|
39 |
-
if style_blur:
|
40 |
-
style_img= tf.nn.avg_pool(style_img, [3,3], [1,1], "VALID")
|
41 |
-
style_img = tf.image.adjust_contrast(style_img, style_weight)
|
42 |
-
content_img = tf.image.adjust_contrast(content_img,content_weight)
|
43 |
-
content_img = tf.image.adjust_saturation(content_img, 2)
|
44 |
-
content_img = tf.image.adjust_contrast(content_img,1.5)
|
45 |
-
stylized_img = model(content_img, style_img)[0]
|
46 |
-
|
47 |
-
return Image.fromarray(np.uint8(stylized_img[0]*255))
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
title = "PixelFusion🧬"
|
53 |
-
description = "Gradio Demo for Artistic Neural Style Transfer. To use it, simply upload a content image and a style image. [Learn More](https://www.tensorflow.org/tutorials/generative/style_transfer)."
|
54 |
-
article = "</br><p style='text-align: center'><a href='https://github.com/0xsynapse' target='_blank'>GitHub</a></p> "
|
55 |
-
|
56 |
-
|
57 |
-
content_input = gr.inputs.Image(label="Upload Your Image ",)
|
58 |
-
style_input = gr.inputs.Image( label="Upload Style Image ",shape= (256,256), )
|
59 |
-
style_slider = gr.inputs.Slider(0,2,label="Adjust Style Density" ,default=1,)
|
60 |
-
content_slider = gr.inputs.Slider(1,5,label="Content Sharpness" ,default=1,)
|
61 |
-
# style_checkbox = gr.Checkbox(value=False,label="Tune Style(experimental)")
|
62 |
-
|
63 |
-
|
64 |
-
examples = [
|
65 |
-
["Content/content_1.jpg","Styles/style_1.jpg",1.20,1.70,"style_checkbox"],
|
66 |
-
["Content/content_2.jpg","Styles/style_2.jpg",0.91,2.54,"style_checkbox"],
|
67 |
-
["Content/content_3.png","Styles/style_3.jpg",1.02,2.47,"style_checkbox"]
|
68 |
-
]
|
69 |
-
interface = gr.Interface(fn=style_transfer,
|
70 |
-
inputs=[content_input,
|
71 |
-
style_input,
|
72 |
-
style_slider ,
|
73 |
-
content_slider,
|
74 |
-
# style_checkbox
|
75 |
-
],
|
76 |
-
outputs=gr.outputs.Image(type="pil"),
|
77 |
-
title=title,
|
78 |
-
description=description,
|
79 |
-
article=article,
|
80 |
-
examples=examples,
|
81 |
-
enable_queue=True
|
82 |
-
)
|
83 |
-
|
84 |
-
|
85 |
-
interface.launch()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
spaces/0xcyborg/minter_latest/app.py
DELETED
@@ -1,137 +0,0 @@
|
|
1 |
-
import gradio as gr
|
2 |
-
import random
|
3 |
-
import time
|
4 |
-
import requests
|
5 |
-
import io
|
6 |
-
from PIL import Image
|
7 |
-
import traceback
|
8 |
-
|
9 |
-
from base64 import b64decode,b64encode
|
10 |
-
from io import BytesIO
|
11 |
-
from better_profanity import profanity
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
with gr.Blocks(theme="darkdefault") as demo:
|
16 |
-
|
17 |
-
def welcome(name):
|
18 |
-
return f"Welcome to AIXRPL.com Minter, {name}!"
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
def profanityCheck(prompt):
|
24 |
-
prompt = prompt.replace('+',' ').replace('|',' ')
|
25 |
-
if profanity.contains_profanity(prompt):
|
26 |
-
return True
|
27 |
-
else:
|
28 |
-
return False
|
29 |
-
|
30 |
-
|
31 |
-
def inference(_prompt,_token):
|
32 |
-
try:
|
33 |
-
from PIL import Image
|
34 |
-
import uuid
|
35 |
-
import os
|
36 |
-
print(_prompt,_token)
|
37 |
-
|
38 |
-
if profanityCheck(_prompt):
|
39 |
-
img = Image.open('unsafe.png')
|
40 |
-
return img,'unsafe','','',''
|
41 |
-
|
42 |
-
r = requests.post(url='https://aixrplart-5czkww5hsa-uc.a.run.app/create',data={"prompt":_prompt,"token":_token})
|
43 |
-
all_data = r.json()
|
44 |
-
print(all_data.keys())
|
45 |
-
|
46 |
-
import base64
|
47 |
-
from io import BytesIO
|
48 |
-
from PIL import Image
|
49 |
-
|
50 |
-
im_bytes = base64.b64decode(all_data['img_data']) # im_bytes is a binary image
|
51 |
-
im_file = BytesIO(im_bytes) # convert image to file-like object
|
52 |
-
img = Image.open(im_file) # img is now PIL Image object
|
53 |
-
|
54 |
-
|
55 |
-
return(img,all_data['description'],all_data['image_url'],all_data['keywords'],all_data['keywords_string'])
|
56 |
-
except Exception as e:
|
57 |
-
print('exception:',e)
|
58 |
-
traceback.print_exc()
|
59 |
-
return '','','','',''
|
60 |
-
# img.save('/tmp/data.png')
|
61 |
-
#return '/tmp/data.png'
|
62 |
-
|
63 |
-
|
64 |
-
with gr.Group():
|
65 |
-
generate_progress = gr.StatusTracker(cover_container=True)
|
66 |
-
|
67 |
-
with gr.Row():
|
68 |
-
with gr.Column():
|
69 |
-
with gr.Tab("Create"):
|
70 |
-
|
71 |
-
gr.Markdown(
|
72 |
-
"""
|
73 |
-
Create AI generated artworks by using prompt engineering.
|
74 |
-
"""
|
75 |
-
)
|
76 |
-
|
77 |
-
text = gr.Textbox(
|
78 |
-
label="Enter Prompt", show_label=True, max_lines=5
|
79 |
-
).style(
|
80 |
-
border=(True, False, True, True),
|
81 |
-
rounded=(True, False, False, True),
|
82 |
-
container=True,
|
83 |
-
)
|
84 |
-
|
85 |
-
btn = gr.Button("Create").style(
|
86 |
-
margin=True,
|
87 |
-
rounded=(False, True, True, False),
|
88 |
-
)
|
89 |
-
|
90 |
-
gr.Markdown(
|
91 |
-
"""
|
92 |
-
AI generated metadata.
|
93 |
-
"""
|
94 |
-
)
|
95 |
-
|
96 |
-
description = gr.Textbox(
|
97 |
-
label="AI Generated Description", interactive=True, show_label=True, max_lines=1, elem_id="descData"
|
98 |
-
).style(
|
99 |
-
border=(True, False, True, True),
|
100 |
-
rounded=(True, False, False, True),
|
101 |
-
container=True,
|
102 |
-
)
|
103 |
-
|
104 |
-
traits = gr.HighlightedText(label="Auto Traits",interactive=True, show_label=True)
|
105 |
-
# build_result = gr.Gallery()#gr.Image(interactive=False, shape=(320,320))
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
with gr.Column():
|
110 |
-
with gr.Tab("Artwork"):
|
111 |
-
|
112 |
-
build_result = gr.Image(type="pil", shape=(512,None),show_label=True,label="Artwork Preview",interactive=False,)
|
113 |
-
|
114 |
-
walletToken = gr.Textbox(
|
115 |
-
visible=False, interactive=True, elem_id="walletToken", max_lines=1
|
116 |
-
)
|
117 |
-
|
118 |
-
imageData = gr.Textbox(
|
119 |
-
visible=False, interactive=False, elem_id="imageData", max_lines=1
|
120 |
-
)
|
121 |
-
|
122 |
-
attribData = gr.Textbox(
|
123 |
-
visible=False, interactive=False, elem_id="attribData", max_lines=1
|
124 |
-
)
|
125 |
-
|
126 |
-
|
127 |
-
btn.click(
|
128 |
-
inference,
|
129 |
-
inputs=[text,walletToken],
|
130 |
-
outputs=[build_result,description,imageData, traits, attribData],
|
131 |
-
status_tracker=generate_progress,
|
132 |
-
api_name="generate"
|
133 |
-
)
|
134 |
-
|
135 |
-
|
136 |
-
if __name__ == "__main__":
|
137 |
-
demo.launch(show_api=False, debug=True, enable_queue=True)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
spaces/1acneusushi/gradio-2dmoleculeeditor/data/Discover the Power of Trading Price Action Trends with this Ebook Pdf Download.md
DELETED
@@ -1,119 +0,0 @@
|
|
1 |
-
|
2 |
-
<h1>Trading Price Action Trends: A Practical Guide for Traders</h1>
|
3 |
-
<p>Are you interested in learning how to trade using price action techniques? Do you want to know how to profit from institutional trading trends without using indicators or other tools? If so, you may want to read this article.</p>
|
4 |
-
<p>In this article, we will review the ebook "Trading Price Action Trends" by Al Brooks and explain how it can help you master the art of price action trading.</p>
|
5 |
-
<h2>Trading Price Action Trends Ebook Pdf Download</h2><br /><p><b><b>Download Zip</b> --->>> <a href="https://byltly.com/2uKzLr">https://byltly.com/2uKzLr</a></b></p><br /><br />
|
6 |
-
<p>Price action trading is a form of technical analysis that relies on reading and interpreting the movements of price bars on a chart. It can help you identify trends, reversals, support and resistance levels, chart patterns, candlestick patterns, and trading opportunities without using indicators or other tools.</p>
|
7 |
-
<p>However, price action trading is not easy. It requires a lot of practice, patience, discipline, and a solid understanding of market psychology and price behavior.</p>
|
8 |
-
<p>How to trade price action trends ebook pdf download<br />
|
9 |
-
Trading price action trends book pdf free download<br />
|
10 |
-
Download trading price action trends ebook pdf online<br />
|
11 |
-
Trading price action trends by Al Brooks pdf download<br />
|
12 |
-
Trading price action trends ebook pdf download review<br />
|
13 |
-
Trading price action trends ebook pdf download for beginners<br />
|
14 |
-
Trading price action trends ebook pdf download link<br />
|
15 |
-
Trading price action trends ebook pdf download torrent<br />
|
16 |
-
Trading price action trends ebook pdf download reddit<br />
|
17 |
-
Trading price action trends ebook pdf download zip<br />
|
18 |
-
Trading price action trends ebook pdf download full<br />
|
19 |
-
Trading price action trends ebook pdf download site<br />
|
20 |
-
Trading price action trends ebook pdf download blog<br />
|
21 |
-
Trading price action trends ebook pdf download course<br />
|
22 |
-
Trading price action trends ebook pdf download guide<br />
|
23 |
-
Trading price action trends ebook pdf download free trial<br />
|
24 |
-
Trading price action trends ebook pdf download discount code<br />
|
25 |
-
Trading price action trends ebook pdf download bonus<br />
|
26 |
-
Trading price action trends ebook pdf download testimonials<br />
|
27 |
-
Trading price action trends ebook pdf download examples<br />
|
28 |
-
Trading price action trends ebook pdf download tips<br />
|
29 |
-
Trading price action trends ebook pdf download tricks<br />
|
30 |
-
Trading price action trends ebook pdf download secrets<br />
|
31 |
-
Trading price action trends ebook pdf download best practices<br />
|
32 |
-
Trading price action trends ebook pdf download case studies<br />
|
33 |
-
Trading price action trends ebook pdf download cheat sheet<br />
|
34 |
-
Trading price action trends ebook pdf download checklist<br />
|
35 |
-
Trading price action trends ebook pdf download comparison chart<br />
|
36 |
-
Trading price action trends ebook pdf download FAQ<br />
|
37 |
-
Trading price action trends ebook pdf download glossary<br />
|
38 |
-
Trading price action trends ebook pdf download infographic<br />
|
39 |
-
Trading price action trends ebook pdf download mind map<br />
|
40 |
-
Trading price action trends ebook pdf download planner<br />
|
41 |
-
Trading price action trends ebook pdf download roadmap<br />
|
42 |
-
Trading price action trends ebook pdf download summary<br />
|
43 |
-
Trading price action trends ebook pdf download table of contents<br />
|
44 |
-
Trading price action trends ebook pdf download video tutorial<br />
|
45 |
-
Trading price action trends ebook pdf download webinar replay<br />
|
46 |
-
Trading price action trends ebook pdf download workbook<br />
|
47 |
-
Learn trading price action trends ebook pdf download<br />
|
48 |
-
Buy trading price action trends ebook pdf download<br />
|
49 |
-
Sell trading price action trends ebook pdf download<br />
|
50 |
-
Trade trading price action trends ebook pdf download<br />
|
51 |
-
Profit from trading price action trends ebook pdf download<br />
|
52 |
-
Master trading price action trends ebook pdf download<br />
|
53 |
-
Improve trading price action trends ebook pdf download<br />
|
54 |
-
Optimize trading price action trends ebook pdf download<br />
|
55 |
-
Analyze trading price action trends ebook pdf download<br />
|
56 |
-
Implement trading price action trends ebook pdf download<br />
|
57 |
-
Evaluate trading price action trends ebook pdf download</p>
|
58 |
-
<p>That's why you need a good guide that can teach you the principles and techniques of price action trading.</p>
|
59 |
-
<p>"Trading Price Action Trends" by Al Brooks is one such guide.</p>
|
60 |
-
<p>"Trading Price Action Trends" is an ebook that focuses on how to profit from institutional trading trends using price action techniques.</p>
|
61 |
-
<p>It explains what individual bars and combinations of bars can tell you about what institutions are doing and how to piggyback their actions.</p>
|
62 |
-
<p>It also discusses how to identify and trade different types of trends, such as strong trends, weak trends, trend reversals, trend channels, and trend lines.</p>
|
63 |
-
<p>"Trading Price Action Trends" is part of a series of three books that cover different aspects of price action trading.</p>
|
64 |
-
<p>The other books are "Trading Price Action Trading Ranges" and "Trading Price Action Reversals".</p>
|
65 |
-
<p>The first book covers how to trade markets that are not trending or are in a trading range.</p>
|
66 |
-
<p>The second book covers how to trade transitions or reversals from one type of market condition to another.</p>
|
67 |
-
<p>In this article, we will focus on the first book in the series: "Trading Price Action Trends".</p>
|
68 |
-
<h2>What is Price Action Trading?</h2>
|
69 |
-
<p>Before we dive into the content of the ebook, let's first define what price action trading is.</p>
|
70 |
-
<p>Price action trading is a form of technical analysis that relies on reading and interpreting the movements of price bars on a chart.</p>
|
71 |
-
<p>A price bar is a graphical representation of the open, high, low, and close prices of a market during a specific period of time.</p>
|
72 |
-
<p>A chart is a collection of price bars arranged according to time frames.</p>
|
73 |
-
<p>A time frame is a unit of time that determines how often a new price bar is formed on a chart.</p>
|
74 |
-
<p>For example, a 5-minute chart means that each price bar represents 5 minutes of market activity.</p>
|
75 |
-
<p>A daily chart means that each price bar represents one day gyback their actions.</li>
|
76 |
-
<li>You will learn how to identify and trade different types of trends, such as strong trends, weak trends, trend reversals, trend channels, and trend lines.</li>
|
77 |
-
<li>You will learn how to use various price action techniques, such as trend bars, doji bars, climaxes, breakouts, tests, reversals, magnets, support and resistance levels, measured moves, major trend reversals, trading ranges, tight trading ranges, and final flags.</li>
|
78 |
-
<li>You will learn how to apply the principles of price action trading to any market condition or time frame.</li>
|
79 |
-
<li>You will learn how to improve your risk management, trade entry and exit, and trade management skills.</li>
|
80 |
-
<li>You will learn from many examples of real-life trades that illustrate the concepts and techniques discussed in the book.</li>
|
81 |
-
</ul>
|
82 |
-
<p>"Trading Price Action Trends" ebook has received many positive reviews from traders who have read it and applied its teachings to their own trading.</p>
|
83 |
-
<p>Some of the reviews are:</p>
|
84 |
-
<blockquote>
|
85 |
-
<p>"This book is a must-read for anyone who wants to learn how to trade with price action. Al Brooks explains everything in a clear and concise way that anyone can understand. He shows you how to read the market like a pro and how to take advantage of institutional trading trends. I have learned a lot from this book and I highly recommend it."</p>
|
86 |
-
<cite>- Amazon customer review</cite>
|
87 |
-
</blockquote>
|
88 |
-
<blockquote>
|
89 |
-
<p>"Al Brooks is one of the best price action traders I have ever seen. His book is a treasure trove of knowledge and wisdom that can help any trader improve their skills and results. He covers every aspect of price action trading in great detail and provides many examples of real trades that demonstrate his methods. This book is not for beginners, but for serious traders who want to take their trading to the next level."</p>
|
90 |
-
<cite>- Goodreads customer review</cite>
|
91 |
-
</blockquote>
|
92 |
-
<blockquote>
|
93 |
-
<p>"Trading Price Action Trends" is an excellent book that teaches you how to trade with the trend using price action techniques. Al Brooks is a master of price action and he shares his insights and experience in this book. He shows you how to identify and trade different types of trends and how to use various price action tools and patterns to make profitable trades. He also shows you how to manage your risk and emotions when trading. This book is a must-have for any price action trader."</p>
|
94 |
-
<cite>- Wiley Online Books customer review</cite>
|
95 |
-
</blockquote>
|
96 |
-
<h2>Conclusion</h2>
|
97 |
-
<p>Price action trading is a powerful and effective form of technical analysis that can help traders profit from institutional trading trends.</p>
|
98 |
-
<p>"Trading Price Action Trends" ebook by Al Brooks is a comprehensive and practical guide that teaches traders how to master the art of price action trading.</p>
|
99 |
-
<p>The ebook explains what individual bars and combinations of bars can tell you about what institutions are doing and how to piggyback their actions.</p>
|
100 |
-
<p>It also discusses how to identify and trade different types of trends, such as strong trends, weak trends, trend reversals, trend channels, and trend lines.</p>
|
101 |
-
<p>The ebook provides many examples of real-life trades that illustrate the concepts and techniques discussed in the book.</p>
|
102 |
-
<p>Traders who want to improve their trading performance and results should read "Trading Price Action Trends" ebook and practice the techniques explained in the book.</p>
|
103 |
-
<p>The ebook can help traders gain a deeper understanding of market psychology and price behavior and develop a profitable trading system based on price action principles.</p>
|
104 |
-
<h2>FAQs</h2>
|
105 |
-
<ul>
|
106 |
-
<li><strong>Q1: Who is Al Brooks?</strong></li>
|
107 |
-
<li><strong>A1:</strong> Al Brooks is a technical analysis contributor for Futures magazine and an independent day trader. He has been trading for over 30 years and has developed his own trading system based on price action analysis. He is also the author of three books on price action trading: "Reading Price Charts Bar by Bar", "Trading Price Action Trends", and "Trading Price Action Reversals".</li>
|
108 |
-
<li><strong>Q2: What are the other books in the series?</strong></li>
|
109 |
-
<li><strong>A2:</strong> The other books in the series are "Trading Price Action Trading Ranges" and "Trading Price Action Reversals". The first book covers how to trade markets that are not trending or are in a trading range. The second book covers how to trade transitions or reversals from one type of market condition to another.</li>
|
110 |
-
<li><strong>Q3: What are the prerequisites for reading "Trading Price Action Trends" ebook?</strong></li>
|
111 |
-
<li><strong>A3:</strong> There are no specific prerequisites for reading "Trading Price Action Trends" ebook, but it is recommended that readers have some basic knowledge of technical analysis and charting. Readers should also be familiar with the terminology used in price action trading, such as bars, candles, dojis, climaxes, breakouts, tests, reversals, magnets, support and resistance levels, measured moves, trend lines, channels , flags, etc.</li>
|
112 |
-
<li><strong>Q4: How can I download "Trading Price Action Trends" ebook?</strong></li>
|
113 |
-
<li><strong>A4:</strong> You can download "Trading Price Action Trends" ebook from various online sources . You will need a PDF reader software to open and read the ebook on your device. You may also need to pay a fee or register an account to access some of the sources.</li>
|
114 |
-
<li><strong>Q5: How can I contact Al Brooks?</strong></li>
|
115 |
-
<li><strong>A5:</strong> You can contact Al Brooks through his website www.brookspriceaction.com. His website also offers more information about his trading approach and views as well as hosts a subscription-based daily trading chat room where he talks with other traders about the market.</li>
|
116 |
-
</ul>
|
117 |
-
</p> 0a6ba089eb<br />
|
118 |
-
<br />
|
119 |
-
<br />
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
spaces/1acneusushi/gradio-2dmoleculeeditor/data/Download Primavera P6 with Crack in 6 Easy Steps.md
DELETED
@@ -1,35 +0,0 @@
|
|
1 |
-
|
2 |
-
<h1>How to Download Primavera P6 with Crack and Install It on Your PC</h1>
|
3 |
-
<p>Primavera P6 is a powerful project management software that helps you plan, schedule, and control complex projects. It is widely used by engineers, architects, construction managers, and other professionals who need to manage multiple resources and tasks efficiently.</p>
|
4 |
-
<p>However, Primavera P6 is not a cheap software. It can cost thousands of dollars to buy a license and use it legally. If you are looking for a way to download Primavera P6 with crack and install it on your PC for free, you are in the right place. In this article, we will show you how to do it step by step.</p>
|
5 |
-
<h2>primavera p6 download with crack</h2><br /><p><b><b>DOWNLOAD</b> >> <a href="https://byltly.com/2uKvp6">https://byltly.com/2uKvp6</a></b></p><br /><br />
|
6 |
-
<h2>Disclaimer</h2>
|
7 |
-
<p>Before we proceed, we want to make it clear that we do not condone or encourage piracy or illegal use of software. Downloading Primavera P6 with crack and installing it on your PC without a license is a violation of the software's terms and conditions and may result in legal consequences. We are providing this information for educational purposes only and we are not responsible for any damages or losses that may arise from following this guide.</p>
|
8 |
-
<h2>Requirements</h2>
|
9 |
-
<p>To download Primavera P6 with crack and install it on your PC, you will need the following:</p>
|
10 |
-
<ul>
|
11 |
-
<li>A PC running Windows 7 or higher.</li>
|
12 |
-
<li>A stable internet connection.</li>
|
13 |
-
<li>A torrent client such as uTorrent or BitTorrent.</li>
|
14 |
-
<li>A file extractor such as WinRAR or 7-Zip.</li>
|
15 |
-
<li>A virtual drive software such as Daemon Tools or PowerISO.</li>
|
16 |
-
<li>Antivirus software such as Avast or Norton (optional but recommended).</li>
|
17 |
-
</ul>
|
18 |
-
<h2>Steps</h2>
|
19 |
-
<p>Follow these steps to download Primavera P6 with crack and install it on your PC:</p>
|
20 |
-
<ol>
|
21 |
-
<li>Go to a torrent website such as The Pirate Bay or Kickass Torrents and search for "Primavera P6". You will see many results with different versions and sizes. Choose the one that suits your needs and has the most seeders and leechers. Click on the magnet link or download the torrent file.</li>
|
22 |
-
<li>Open your torrent client and add the torrent file or the magnet link. Wait for the download to complete. It may take some time depending on your internet speed and the number of peers.</li>
|
23 |
-
<li>Once the download is finished, you will have a folder containing several files. One of them will be an ISO file, which is an image of a CD or DVD. You will need to mount this file using a virtual drive software. Right-click on the ISO file and select "Mount" from the menu. Alternatively, you can open your virtual drive software and select the ISO file from there.</li>
|
24 |
-
<li>After mounting the ISO file, you will see a new drive appear in your computer. Open it and you will see the setup file for Primavera P6. Double-click on it and follow the instructions to install the software. You may need to enter a serial number or a product key during the installation. You can find them in the folder that you downloaded or in a text file inside the ISO file.</li>
|
25 |
-
<li>After installing Primavera P6, do not run it yet. You will need to apply the crack first. Go back to the folder that you downloaded and look for another file that has the word "crack" in its name. It may be a ZIP file, an EXE file, or a folder. Extract it if necessary and copy its contents to the installation directory of Primavera P6. This is usually located at C:\Program Files\Oracle\Primavera P6\ or C:\Program Files (x86)\Oracle\Primavera P6\. Replace any existing files if prompted.</li>
|
26 |
-
<li>Now you can run Primavera P6 from your desktop or start menu. You should be able to use it without any limitations or errors.</li>
|
27 |
-
</ol>
|
28 |
-
<h2>Tips</h2>
|
29 |
-
<p>Here are some tips to help you download Primavera P6 with crack and install it on your PC successfully:</p>
|
30 |
-
<ul>
|
31 |
-
<li>Before downloading any torrent file, make sure to check the comments and ratings of other users. This will help you avoid fake or malicious files that may harm your computer or contain viruses.</li>
|
32 |
-
<li>Before installing any software, make sure to scan it with your antivirus software. This will</p>
|
33 |
-
<p></p> ddb901b051<br />
|
34 |
-
<br />
|
35 |
-
<br />
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
spaces/1gistliPinn/ChatGPT4/Examples/Connectify 31021402 ((BETTER)) Keygen.md
DELETED
@@ -1,23 +0,0 @@
|
|
1 |
-
|
2 |
-
<h1>How to Use Connectify 31021402 Keygen to Activate Your Hotspot Pro 2023</h1>
|
3 |
-
<p>Connectify Hotspot Pro 2023 is a powerful and easy-to-use software that lets you turn your PC into a Wi-Fi hotspot and share your internet connection with other devices. You can also use it as a Wi-Fi repeater, a bridge mode, or a 3G/4G sharing mode. With Connectify Hotspot Pro 2023, you can enjoy fast and secure internet access anywhere you go.</p>
|
4 |
-
<h2>Connectify 31021402 Keygen</h2><br /><p><b><b>Download</b> ✅ <a href="https://imgfil.com/2uy1ff">https://imgfil.com/2uy1ff</a></b></p><br /><br />
|
5 |
-
<p>However, to unlock all the features and benefits of Connectify Hotspot Pro 2023, you need to activate it with a valid license key. If you don't have one, you can use Connectify 31021402 Keygen to generate one for free. Connectify 31021402 Keygen is a tool that creates random and unique license keys for Connectify Hotspot Pro 2023. You can use these keys to activate your software and enjoy its full potential.</p>
|
6 |
-
<p>In this article, we will show you how to use Connectify 31021402 Keygen to activate your Hotspot Pro 2023 in a few simple steps.</p>
|
7 |
-
<h2>Step 1: Download and Install Connectify Hotspot Pro 2023</h2>
|
8 |
-
<p>The first step is to download and install Connectify Hotspot Pro 2023 on your PC. You can get it from the official website of Connectify or from any other trusted source. Make sure you download the latest version of the software that is compatible with your operating system.</p>
|
9 |
-
<p>Once you have downloaded the setup file, run it and follow the instructions on the screen to install Connectify Hotspot Pro 2023 on your PC. You may need to restart your PC after the installation is complete.</p>
|
10 |
-
<p></p>
|
11 |
-
<h2>Step 2: Download and Run Connectify 31021402 Keygen</h2>
|
12 |
-
<p>The next step is to download and run Connectify 31021402 Keygen on your PC. You can get it from any reliable source that offers free software cracks and keygens. Make sure you scan the file with an antivirus program before opening it.</p>
|
13 |
-
<p>Once you have downloaded the keygen file, run it as an administrator and wait for it to load. You will see a window with a button that says "Generate". Click on it and wait for a few seconds until a license key appears on the screen. Copy the license key and save it somewhere safe.</p>
|
14 |
-
<h2>Step 3: Activate Connectify Hotspot Pro 2023 with the License Key</h2>
|
15 |
-
<p>The final step is to activate Connectify Hotspot Pro 2023 with the license key that you generated with Connectify 31021402 Keygen. To do this, open Connectify Hotspot Pro 2023 on your PC and click on the "Tools" menu at the top right corner. Then, select "Activate License" from the drop-down menu.</p>
|
16 |
-
<p>A new window will pop up asking you to enter your license key. Paste the license key that you copied from Connectify 31021402 Keygen and click on "Activate". Wait for a few seconds until you see a confirmation message that says "Your license has been activated successfully". Click on "OK" and close the window.</p>
|
17 |
-
<p>Congratulations! You have successfully activated Connectify Hotspot Pro 2023 with Connectify 31021402 Keygen. You can now enjoy all the features and benefits of this amazing software without any limitations.</p>
|
18 |
-
<h2>Conclusion</h2>
|
19 |
-
<p>Connectify Hotspot Pro 2023 is a great software that allows you to create a Wi-Fi hotspot and share your internet connection with other devices. It also offers many other useful features such as Wi-Fi repeater, bridge mode, and 3G/4G sharing mode. However, to use all these features, you need to activate the software with a valid license key.</p>
|
20 |
-
<p>If you don't have a license key, you can use Connectify 31021402 Keygen to generate one for free. Connectify 31021402 Keygen is a tool that creates random and unique license keys for Connectify Hotspot Pro 2023. You can use these keys to activate your software and enjoy its full potential.</p>
|
21 |
-
<p>In this article, we showed you how to use Connectify</p> d5da3c52bf<br />
|
22 |
-
<br />
|
23 |
-
<br />
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
spaces/1phancelerku/anime-remove-background/Brawl Stars APK Indir Join Millions of Players in the Fun and Fast-Paced Mobile Game from APKPure.md
DELETED
@@ -1,98 +0,0 @@
|
|
1 |
-
<br />
|
2 |
-
<h1>Brawl Stars Apk Indir Apkpure: How to Download and Play the Ultimate Mobile MOBA Game</h1>
|
3 |
-
<p>If you are looking for a fast-paced, action-packed, and fun multiplayer game for your mobile device, you should definitely check out <strong>Brawl Stars</strong>. Developed by Supercell, the creators of Clash of Clans and Clash Royale, Brawl Stars is a mobile MOBA (multiplayer online battle arena) game that offers a variety of game modes, characters, and strategies for you to enjoy. Whether you want to team up with your friends, battle solo, or compete in global tournaments, Brawl Stars has something for everyone.</p>
|
4 |
-
<h2>brawl stars apk indir apkpure</h2><br /><p><b><b>Download</b> ⇒ <a href="https://jinyurl.com/2uNT3H">https://jinyurl.com/2uNT3H</a></b></p><br /><br />
|
5 |
-
<p>In this article, we will show you how to download Brawl Stars apk from apkpure, a popular website that provides safe and fast downloads of Android apps and games. We will also give you some tips and tricks on how to play Brawl Stars like a pro. Let's get started!</p>
|
6 |
-
<h2>What is Brawl Stars and what are its main features?</h2>
|
7 |
-
<p>Brawl Stars is a mobile twin-stick shooter with a MOBA twist; including variety of Brawlers players can choose from and different game modes to play in. Players can endouge in 3 on 3 team battles to Free-for-all Battle Royale, and even Boss Battles as well! Choose from Variety of Unique Brawlers To Fight Other Players</p>
|
8 |
-
<p>Some of the main features of Brawl Stars are:</p>
|
9 |
-
<ul>
|
10 |
-
<li><strong>Battle in multiple game modes</strong>: You can choose from Gem Grab, Showdown, Bounty, Heist, Brawl Ball, Siege, Hot Zone, Knockout, Power League, Special Events, and Championship Challenge. Each game mode has its own objective, rules, and map. You can play solo or with friends in real-time matches that last under three minutes.</li>
|
11 |
-
<li><strong>Unlock and upgrade Brawlers</strong>: You can collect and upgrade over 40 different Brawlers, each with their own unique abilities, weapons, skins, and voice lines. You can also unlock powerful Star Powers and Gadgets for your Brawlers as you level them up. You can get new Brawlers from Brawl Boxes, Trophy Road, Brawl Pass, or the Shop.</li>
|
12 |
-
<li><strong>Become the star player</strong>: You can climb the local and global leaderboards, join or create a club with other players, participate in special events and tournaments, complete quests and achievements, earn rewards and trophies, and show off your skills in the Brawliverse.</li>
|
13 |
-
<li><strong>Constantly evolving</strong>: Supercell regularly updates Brawl Stars with new content, features, balance changes, bug fixes, and more. You can expect new Brawlers, skins, maps, game modes, events, and seasons every few weeks.</li>
|
14 |
-
</ul>
|
15 |
-
<h2>Why download Brawl Stars apk from apkpure?</h2>
|
16 |
-
<p>While you can download Brawl Stars from the Google Play Store or the App <p>Store, you might want to consider downloading Brawl Stars apk from apkpure instead. Here are some of the benefits of using apkpure to download Brawl Stars apk:</p>
|
17 |
-
<ul>
|
18 |
-
<li><strong>No region locking</strong>: Some apps and games are not available in certain countries or regions due to various reasons, such as licensing, censorship, or compatibility issues. If you want to play Brawl Stars but it is not available in your region, you can use apkpure to bypass the geo-restrictions and download the apk file directly.</li>
|
19 |
-
<li><strong>Access to old versions</strong>: Sometimes, you might prefer to use an older version of an app or game, either because you don't like the new updates, or because your device is not compatible with the latest version. With apkpure, you can easily find and download any previous version of Brawl Stars apk that you want.</li>
|
20 |
-
<li><strong>Get updates sooner</strong>: Sometimes, the Google Play Store might take some time to roll out the latest updates for some apps and games, depending on your device model, region, and other factors. If you want to get the newest features and bug fixes for Brawl Stars as soon as possible, you can use apkpure to download the latest version of Brawl Stars apk before it is available on the Play Store.</li>
|
21 |
-
<li><strong>Lightweight and fast</strong>: Apkpure is a lightweight and fast website that does not use too much battery or data. You can easily browse and download any app or game you want without any hassle. Apkpure also offers a customized Android experience that lets you choose the language, theme, and layout of the website.</li>
|
22 |
-
</ul>
|
23 |
-
<h2>How to download Brawl Stars apk from apkpure</h2>
|
24 |
-
<p>Downloading Brawl Stars apk from apkpure is very easy and simple. Just follow these steps:</p>
|
25 |
-
<ol>
|
26 |
-
<li><strong>Go to the apkpure website</strong>: Open your web browser and go to <a href="(^1^)">https://apkpure.com/</a>. You can also use the apkpure app if you have it installed on your device.</li>
|
27 |
-
<li><strong>Search for Brawl Stars</strong>: On the homepage, you will see a search bar at the top. Type in "Brawl Stars" and hit enter. You will see a list of results related to Brawl Stars. Click on the one that says "Brawl Stars Android latest 38.111 APK Download and Install."</li>
|
28 |
-
<li><strong>Choose the latest version and click on download</strong>: On the next page, you will see some information about Brawl Stars, such as its description, screenshots, ratings, reviews, and more. You will also see a button that says "Download APK (200.6 MB)". This is the latest version of Brawl Stars apk as of June 2023. Click on this button to start downloading the apk file.</li>
|
29 |
-
<li><strong>Enable unknown sources and install the apk file</strong>: Once the download is complete, you will need to enable unknown sources on your device settings in order to install the apk file. To do this, go to Settings > Security > Allow Unknown Sources and toggle it on. Then, go to your downloads folder and tap on the Brawl Stars apk file. Follow the instructions on the screen to install the app.</li>
|
30 |
-
<li><strong>Launch Brawl Stars and enjoy the game</strong>: After the installation is done, you can launch Brawl Stars from your app drawer or home screen. You will need an internet connection to play the game online with other players. You can also sign in with your Supercell ID or Google Play Games account to sync your progress across devices.</li>
|
31 |
-
</ol>
|
32 |
-
<h2>Tips and tricks for playing Brawl Stars</h2>
|
33 |
-
<p>Brawl Stars is a fun and addictive game that requires skill, strategy, and teamwork. Here are some tips and tricks that can help you improve your gameplay and win more matches:</p>
|
34 |
-
<ul>
|
35 |
-
<li><strong>Unlock new Brawlers and upgrade them</strong>: As you play Brawl Stars, you will earn coins, gems, tokens, star points, and boxes that you can use to unlock new Brawlers and upgrade them. Each Brawler has its own stats, abilities, strengths, and weaknesses. You should try out different Brawlers and find out which ones suit your playstyle and game mode best. You should also upgrade your Brawlers by spending coins and power points to increase their health, damage, and super charge rate.</li>
|
36 |
-
<li><strong>Choose the best Brawlers for different game modes</strong>: Depending on the game mode you are playing, some Brawlers might be more effective than others. For example, in Gem Grab, you might want to use a Brawler that can control the center area and collect gems quickly such as Penny, Pam, or Gene. In Showdown, you might want to use a Brawler that can survive and deal damage in solo or duo situations, such as Leon, Edgar, or Rosa. In Heist, you might want to use a Brawler that can attack or defend the safe effectively, such as Ash, Meg, or Colt. You can check out some online resources for more detailed guides on the best Brawlers for different game modes.</li>
|
37 |
-
<li><strong>Use obstacles, power-ups, and super abilities effectively</strong>: The maps in Brawl Stars are not just flat and empty spaces. They have various obstacles, such as walls, bushes, water, and barrels, that you can use to your advantage. You can hide behind walls and bushes to avoid enemy fire, or break them with your attacks to create new paths. You can also use water to slow down enemies or escape from them. You can also find power-ups on the map, such as power cubes in Showdown, gems in Gem Grab, bolts in Siege, and more. These power-ups can boost your stats, help you achieve the objective, or give you an edge over your opponents. You should also make good use of your super abilities, which are charged by hitting enemies with your normal attacks. Super abilities are powerful moves that can turn the tide of the battle. They can deal massive damage, heal yourself or your allies, create traps or shields, and more. You should know when to use your super abilities wisely and strategically.</li>
|
38 |
-
<li><strong>Cooperate with your teammates and communicate with them</strong>: Brawl Stars is a team-based game for most of the game modes. This means that you need to work together with your teammates and communicate with them effectively. You can use the in-game chat or voice chat to coordinate your moves, plan your strategies, warn each other of dangers, and support each other. You can also use the quick chat options to send simple messages, such as "Attack!", "Defend!", "Help!", and "Thanks!". You should also pay attention to the indicators on the screen that show your teammates' health, location, super status, and ping. You should also try to balance your team composition by choosing Brawlers that complement each other's strengths and weaknesses.</li>
|
39 |
-
</ul>
|
40 |
-
<h2>Conclusion</h2>
|
41 |
-
<p>Brawl Stars is a fun and exciting mobile game that you can download and play for free on your Android device. By downloading Brawl Stars apk from apkpure, you can enjoy the game without any region restrictions, access old versions of the game, get updates sooner, and save battery and data. You can also improve your gameplay by following some tips and tricks on how to unlock and upgrade Brawlers, choose the best Brawlers for different game modes, use obstacles, power-ups, and super abilities effectively, and cooperate with your teammates and communicate with them.</p>
|
42 |
-
<p>brawl stars android apk download apkpure<br />
|
43 |
-
brawl stars apk indir apkpure güncel sürüm<br />
|
44 |
-
brawl stars apk indir apkpure son sürüm<br />
|
45 |
-
brawl stars apk indir apkpure hileli<br />
|
46 |
-
brawl stars apk indir apkpure mod<br />
|
47 |
-
brawl stars apk indir apkpure türkçe<br />
|
48 |
-
brawl stars apk indir apkpure 2023<br />
|
49 |
-
brawl stars apk indir apkpure yeni güncelleme<br />
|
50 |
-
brawl stars apk indir apkpure ücretsiz<br />
|
51 |
-
brawl stars apk indir apkpure nasıl yapılır<br />
|
52 |
-
brawl stars apk indir apkpure oyunu<br />
|
53 |
-
brawl stars apk indir apkpure kurulumu<br />
|
54 |
-
brawl stars apk indir apkpure linki<br />
|
55 |
-
brawl stars apk indir apkpure yükleme<br />
|
56 |
-
brawl stars apk indir apkpure güvenli mi<br />
|
57 |
-
brawl stars apk indir apkpure hızlı indirme<br />
|
58 |
-
brawl stars apk indir apkpure online oyna<br />
|
59 |
-
brawl stars apk indir apkpure en iyi karakterler<br />
|
60 |
-
brawl stars apk indir apkpure oyun modları<br />
|
61 |
-
brawl stars apk indir apkpure grafik ayarları<br />
|
62 |
-
brawl stars apk indir apkpure sistem gereksinimleri<br />
|
63 |
-
brawl stars apk indir apkpure sorunsuz çalışma<br />
|
64 |
-
brawl stars apk indir apkpure güncel haberler<br />
|
65 |
-
brawl stars apk indir apkpure ipuçları ve taktikler<br />
|
66 |
-
brawl stars apk indir apkpure inceleme ve yorumlar<br />
|
67 |
-
brawl stars apk indir apkpure resmi sitesi<br />
|
68 |
-
brawl stars apk indir apkpure destek ve yardım<br />
|
69 |
-
brawl stars apk indir apkpure hata ve çözümleri<br />
|
70 |
-
brawl stars apk indir apkpure ödüller ve hediyeler<br />
|
71 |
-
brawl stars apk indir apkpure turnuva ve etkinlikler<br />
|
72 |
-
brawl stars apk indir apkpure eğlenceli videolar<br />
|
73 |
-
brawl stars apk indir apkpure canlı yayınlar<br />
|
74 |
-
brawl stars apk indir apkpure sosyal medya hesapları<br />
|
75 |
-
brawl stars apk indir apkpure fan sayfaları ve grupları<br />
|
76 |
-
brawl stars apk indir apkpure arkadaş bulma ve davet etme<br />
|
77 |
-
brawl stars apk indir apkpure klüp kurma ve katılma<br />
|
78 |
-
brawl stars apk indir apkpure rehber ve öğretici videolar<br />
|
79 |
-
brawl stars apk indir apkpure sıkça sorulan sorular<br />
|
80 |
-
brawl stars apk indir apkpure gizli özellikler ve püf noktaları<br />
|
81 |
-
brawl stars apk indir apkpure yeni güncellemede neler var</p>
|
82 |
-
<p>If you are ready to join the Brawliverse and have some epic battles with players from around the world, download Brawl Stars apk from apkpure today and start brawling! You can also visit the official website of Brawl Stars for more information about the game, watch some videos on YouTube, join the community on Reddit, or follow Brawl Stars on Twitter for the latest news and updates.</p>
|
83 |
-
<h2>FAQs</h2>
|
84 |
-
<p>Here are some frequently asked questions about Brawl Stars:</p>
|
85 |
-
<ol>
|
86 |
-
<li><strong>What are the system requirements for playing Brawl Stars?</strong></li>
|
87 |
-
<p>Brawl Stars requires Android 4.3 or higher and at least 200 MB of free space on your device. You also need a stable internet connection to play online.</p>
|
88 |
-
<li><strong>Is Brawl Stars free to play or pay to win?</strong></li>
|
89 |
-
<p>Brawl Stars is free to play and download. You can play all the game modes and unlock all the Brawlers without spending any money. However, you can also buy gems with real money to speed up your progress, get exclusive skins, or access premium features such as the Brawl Pass.</p>
|
90 |
-
<li><strong>How can I join or create a club in Brawl Stars?</strong></li>
|
91 |
-
<p>A club is a group of players who can chat, play together, and participate in club events. To join or create a club in Brawl Stars, you need to tap on the club button on the main menu. Then you can either search for an existing club by name or tag, browse through the recommended clubs based on your region and trophy level , or create your own club by choosing a name, tag, badge, description, and settings. You can also invite your friends to join your club by sharing a link or a code.</p>
|
92 |
-
<li><strong>What are the benefits of using apkpure to download Brawl Stars apk?</strong></li>
|
93 |
-
<p>Some of the benefits of using apkpure to download Brawl Stars apk are: no region locking, access to old versions, get updates sooner, and lightweight and fast.</p>
|
94 |
-
<li><strong>How can I contact Supercell for support or feedback on Brawl Stars?</strong></li>
|
95 |
-
<p>If you have any issues, questions, or suggestions regarding Brawl Stars, you can contact Supercell by tapping on the settings button on the main menu, then tapping on the help and support button. You can also visit the Supercell support website for more information and resources.</p>
|
96 |
-
</ol></p> 401be4b1e0<br />
|
97 |
-
<br />
|
98 |
-
<br />
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
spaces/1phancelerku/anime-remove-background/Download TikTok Unban APK and Access All the Features of the App (Even in Banned Countries).md
DELETED
@@ -1,25 +0,0 @@
|
|
1 |
-
|
2 |
-
<h1>TikTok Unban APK: How to Access TikTok in Banned Countries</h1>
|
3 |
-
TikTok is one of the most popular video-sharing apps in the world, with over 800 million active users. However, not everyone can enjoy the app's features and content, as some countries have banned or restricted it due to various reasons. For example, India banned TikTok in 2020 over national security concerns, while the US government has threatened to do the same unless the app's Chinese owners sell their stake in it. If you live in a country where TikTok is unavailable or limited, you might be tempted to use a modified version of the app called TikTok Unban APK. This is an unofficial app that claims to bypass geo-restrictions and allow you to access TikTok from anywhere. But is it safe and legal to use? And are there any better alternatives? In this article, we will answer these questions and more. <h2>What is TikTok Unban APK?</h2>
|
4 |
-
<h3>A modified version of TikTok that bypasses geo-restrictions</h3>
|
5 |
-
TikTok Unban APK is a third-party app that is not affiliated with or endorsed by TikTok or its parent company ByteDance. It is essentially a hacked version of the original app that has been modified to remove or change some features and settings. For example, it may have a different logo, interface, or language. The main purpose of TikTok Unban APK is to allow users to access TikTok from countries where it is banned or restricted. It does this by using proxy servers or VPNs (virtual private networks) that hide your IP address and location from the app's servers. This way, you can create an account, watch videos, and upload your own content on TikTok without any limitations. <h3>Risks and drawbacks of using TikTok Unban APK</h3>
|
6 |
-
<h4>Legal issues and potential penalties</h4>
|
7 |
-
Using TikTok Unban APK may violate the laws and regulations of your country, as well as the terms of service and privacy policy of TikTok. By downloading and installing the app, you are essentially breaking the rules and risking legal consequences. Depending on your jurisdiction, you may face fines, lawsuits, or even criminal charges for using an unauthorized app. Moreover, you may also infringe on the intellectual property rights of TikTok and its content creators. By using TikTok Unban APK, you are accessing and distributing content that is not licensed or authorized for your region. This may result in claims or complaints from the original owners or licensors of the content. <h4>Malware and security threats</h4>
|
8 |
-
Using TikTok Unban APK may expose your device and data to malware and security threats. Since the app is not verified or scanned or tested by any official authority, you cannot be sure if it is safe or trustworthy. It may contain viruses, spyware, adware, or other malicious software that can harm your device or steal your personal information. For example, it may access your camera, microphone, contacts, photos, or other sensitive data without your permission or knowledge. Furthermore, you may also compromise your online security and privacy by using TikTok Unban APK. Since the app uses proxy servers or VPNs to connect you to TikTok, you are entrusting your data and traffic to unknown third parties. They may monitor, collect, or sell your data to advertisers, hackers, or even government agencies. They may also expose you to phishing, identity theft, or cyberattacks. <h4>Poor performance and compatibility issues</h4>
|
9 |
-
Using TikTok Unban APK may result in poor performance and compatibility issues. Since the app is not optimized or updated for your device or region, you may experience glitches, bugs, crashes, or errors while using it. For example, the app may not load properly, freeze, or shut down unexpectedly. Additionally, you may also face compatibility issues with other apps or services on your device. For instance, the app may interfere with your Google Play Store, Google Services Framework, or other system apps. It may also prevent you from receiving updates or security patches for your device or other apps. <h2>How to Download and Install TikTok Unban APK</h2>
|
10 |
-
<h3>Steps to download TikTok Unban APK from a trusted source</h3>
|
11 |
-
If you still want to use TikTok Unban APK despite the risks and drawbacks, you need to download it from a trusted source. You cannot find it on the official app stores like Google Play Store or Apple App Store, as they do not allow unauthorized apps. You need to find a reliable website that offers the latest version of the app and does not contain any malware or spam. Here are some steps to download TikTok Unban APK from a trusted source: - Search for "TikTok Unban APK" on your web browser and look for a reputable website that provides the app. You can check the reviews, ratings, comments, or feedback from other users to verify the credibility of the website. - Visit the website and look for the download link or button for the app. Make sure that the link or button is not misleading or deceptive. Avoid clicking on any pop-ups, ads, or banners that may redirect you to other websites or download unwanted software. - Click on the download link or button and wait for the app file to be downloaded on your device. The file should have an .apk extension and should not be too large or too small in size. The average size of the app file is around 80 MB. - Once the download is complete, locate the app file on your device's storage and check if it is intact and not corrupted. You can use a file manager app to find and open the app file. <h3>Steps to install TikTok Unban APK on your device</h3>
|
12 |
-
After downloading TikTok Unban APK from a trusted source, you need to install it on your device. However, before you do that, you need to enable the option to install apps from unknown sources on your device's settings. This option allows you to install apps that are not from the official app stores. Here are some steps to install TikTok Unban APK on your device: - Go to your device's settings and look for the option to install apps from unknown sources. Depending on your device model and operating system version, this option may be under different menus such as Security, Privacy, Applications, Developer Options, etc. - Tap on the option and toggle it on. You may see a warning message that installing apps from unknown sources may harm your device or data. Tap on OK or Allow to proceed. - Go back to your device's storage and find the app file that you downloaded earlier. Tap on the file and follow the instructions on the screen to install the app. - Wait for the installation process to finish and then launch the app from your device's home screen or app drawer. <h3>Tips to avoid common errors and issues</h3>
|
13 |
-
While installing TikTok Unban APK on your device, you may encounter some common errors and issues that may prevent you from using the app properly. Here are some tips to avoid them: - Make sure that you have enough storage space on your device before downloading and installing the app. If your device is running low on space, you may not be able to download or install the app successfully. - Make sure that you have a stable internet connection while downloading and installing the app. If your connection is slow or unstable, you may experience interruptions or failures during the process. - Make sure that you have a compatible device and operating system version for the app. The app requires Android 4.1 or higher or iOS 9.0 or higher to run smoothly. - Make sure that you have disabled any antivirus software or firewall software that may block or interfere with the app. You may need to whitelist the app or temporarily disable the software while using the app. - Make sure that you have granted all the necessary permissions to the app. The app may need access to your camera, microphone, contacts, photos, or other data to function properly. You can check and manage the permissions on your device's settings. - Make sure that you have updated the app to the latest version available. The app may have bugs or errors that are fixed in the newer versions. You can check for updates on the app's settings or on the website where you downloaded it. <h2>How to Use TikTok Unban APK Safely and Effectively</h2>
|
14 |
-
<h3>How to create and watch videos on TikTok Unban APK</h3>
|
15 |
-
Using TikTok Unban APK is similar to using the original TikTok app. You can create and watch videos on the app with ease and fun. Here are some steps to create and watch videos on TikTok Unban APK: - To create a video, tap on the plus icon at the bottom of the screen. You can choose to record a video with your camera or upload a video from your gallery. You can also add filters, stickers, effects, music, text, or other elements to your video. - To watch a video, swipe up or down on the screen. You can see videos from different categories, such as For You, Following, Trending, or Discover. You can also search for videos by keywords, hashtags, or users. - To interact with a video, tap on the icons on the right side of the screen. You can like, comment, share, or follow the video or its creator. You can also tap on the sound icon to see more videos with the same sound or music. <h3>How to protect your privacy and data on TikTok Unban APK</h3>
|
16 |
-
Using TikTok Unban APK may pose some risks to your privacy and data, as we have discussed earlier. However, there are some ways to protect yourself and minimize these risks while using the app. Here are some tips to protect your privacy and data on TikTok Unban APK: - Use a strong and unique password for your account. Do not use the same password for other accounts or services. Change your password regularly and do not share it with anyone. - Use a fake or secondary email address for your account. Do not use your primary or personal email address that may contain sensitive or confidential information. - Use a VPN service while using the app. A VPN service can encrypt your data and traffic and hide your IP address and location from the app's servers and third parties. It can also help you access TikTok from countries where it is banned or restricted. - Adjust your privacy settings on the app. You can change your settings to limit who can see your videos, send you messages, comment on your videos, or duet with you. You can also block or report users who harass or spam you. - Delete your account and data when you are done using the app. If you no longer want to use TikTok Unban APK, you can delete your account and data from the app's settings. This will remove your profile, videos, likes, comments, messages, and other information from the app. <h3>How to update and uninstall TikTok Unban APK</h3>
|
17 |
-
To keep using TikTok Unban APK smoothly and safely, you need to update it regularly. Updating the app can fix bugs or errors, improve performance or compatibility, add new features or functions, or enhance security or privacy. Here are some steps to update TikTok Unban APK: - Go to the website where you downloaded the app and look for the latest version available. Compare it with the version you have installed on your device and see if there is any difference. - If there is a newer version available, download it from the website and install it on your device following the same steps as before. - If there is no newer version available, check back later or look for other websites that may offer updates. To stop using TikTok Unban APK completely, you need to uninstall it from your device. Uninstalling the app will remove it from your device's storage and app drawer. However, it may not remove all the traces or remnants of the app from your device's system or cache. You may need to use a cleaner app or a manual method to delete them completely. Here are some steps to uninstall TikTok Unban APK: - Go to your device's settings and look for the option to uninstall apps. Depending on your device model and operating system version, this option may be under different menus such as Apps, Applications, Manage Apps, etc. - Tap on the option and look for TikTok Unban APK on the list of apps. Tap on the app and then tap on the Uninstall button. You may see a confirmation message that asks you if you want to uninstall the app. Tap on OK or Yes to proceed. - Wait for the uninstallation process to finish and then check if the app is gone from your device's storage and app drawer. - If you want to delete the remaining files or data of the app, you can use a cleaner app or a manual method. A cleaner app is a software that can scan and delete unwanted or unnecessary files or data from your device. A manual method is a process that involves finding and deleting the files or data yourself using a file manager app or other tools. <h2>Alternatives to TikTok Unban APK</h2>
|
18 |
-
<h3>Why you might want to consider other options</h3>
|
19 |
-
As we have seen, using TikTok Unban APK may not be the best option for accessing TikTok in banned countries. The app may have some advantages, such as allowing you to enjoy TikTok's features and content without any restrictions, but it also has many disadvantages, such as posing legal, security, and performance risks. Therefore, you might want to consider other options that are safer, legal, and more reliable. <h3>The best alternatives to TikTok Unban APK</h3>
|
20 |
-
<h4>VPN services</h4>
|
21 |
-
One of the best alternatives to TikTok Unban APK is using a VPN service. A VPN service is a software that can create a secure and encrypted connection between your device and a remote server in another country. By using a VPN service, you can change your IP address and location and access TikTok from any country where it is available. Some of the benefits of using a VPN service are: - It is legal and safe to use. Unlike TikTok Unban APK, using a VPN service does not violate any laws or regulations of your country or TikTok. It also protects your data and privacy from hackers, advertisers, or government agencies. - It is easy and convenient to use. You just need to download and install a VPN app on your device and choose a server location that suits your needs. You can then access TikTok as usual without any hassle. - It is compatible and efficient to use. You can use a VPN service with any device or operating system that supports TikTok. You can also enjoy fast and stable speeds and performance while using TikTok. Some of the drawbacks of using a VPN service are: - It may cost money to use. While there are some free VPN services available, they may have limited features, servers, bandwidth, or security. You may need to pay for a premium VPN service that offers better quality and reliability. - It may not work with some apps or services on your device. Some apps or services may detect that you are using a VPN service and block or restrict your access. For example, some streaming services may not allow you to watch their content if you are using a VPN service. Some of the best VPN services that you can use to access TikTok are: - ExpressVPN: This is one of the most popular and trusted VPN services in the world. It has over 3000 servers in 94 countries and offers fast speeds, strong encryption, and excellent customer support. It also has a 30-day money-back guarantee and a 7-day free trial for mobile devices. - NordVPN: This is another leading VPN service that has over 5400 servers in 59 countries and offers advanced security features, such as double VPN, onion over VPN, and kill switch. It also has a 30-day money-back guarantee and a 7-day free trial for mobile devices. - Surfshark: This is a relatively new but promising VPN service that has over 3200 servers in 65 countries and offers unlimited simultaneous connections, split tunneling, and whitelister features. It also has a 30-day money-back guarantee and a 7-day free trial for mobile devices. <h4>Other video-sharing apps</h4>
|
22 |
-
Another alternative to TikTok Unban APK is using other video-sharing apps that are similar to TikTok but not banned or restricted in your country. These apps may offer similar features and content as TikTok, such as short videos, filters, effects, music, challenges, etc., but they may have different names, logos, interfaces, or languages. Some of the benefits of using other video-sharing you are using a VPN service. You may need to disable or uninstall TikTok Unban APK while using these apps.</p>
|
23 |
-
<h2>tiktok unban apk</h2><br /><p><b><b>Download</b> >>>>> <a href="https://jinyurl.com/2uNTOP">https://jinyurl.com/2uNTOP</a></b></p><br /><br /> 401be4b1e0<br />
|
24 |
-
<br />
|
25 |
-
<br />
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
spaces/1phancelerku/anime-remove-background/Download Traffic Rider 2 Mod APK with Unlimited Money and No Ads.md
DELETED
@@ -1,102 +0,0 @@
|
|
1 |
-
|
2 |
-
<h1>How to Download Traffic Rider 2 Mod APK for Free</h1>
|
3 |
-
<p>If you are a fan of motorcycle racing games, you might have heard of <strong>Traffic Rider 2</strong>, a popular game that lets you speed through the city streets on a futuristic bike. But did you know that you can download <strong>Traffic Rider 2 Mod APK</strong> for free and enjoy unlimited money, unlocked bikes, and more features? In this article, we will show you how to download and install Traffic Rider 2 Mod APK on your Android device and give you some tips and tricks to play the game better.</p>
|
4 |
-
<h2>download traffic rider 2 mod apk</h2><br /><p><b><b>Download Zip</b> • <a href="https://jinyurl.com/2uNNIq">https://jinyurl.com/2uNNIq</a></b></p><br /><br />
|
5 |
-
<h2>What is Traffic Rider 2?</h2>
|
6 |
-
<p>Traffic Rider 2 is a sequel to the hit game Traffic Rider, which has over 500 million downloads on Google Play. It is a racing game that puts you in the first-person view of a motorcycle rider who has to complete various missions, time trials, and challenges in a sci-fi metropolis. You can choose from different bikes, customize them, and upgrade them with system updates and hardware upgrades. You can also hack enemy vehicles on the road, use boosts and nitro, and dodge traffic and obstacles on the asphalt.</p>
|
7 |
-
<h3>Features of Traffic Rider 2</h3>
|
8 |
-
<p>Some of the features of Traffic Rider 2 are:</p>
|
9 |
-
<ul>
|
10 |
-
<li>A huge futuristic city hub to explore</li>
|
11 |
-
<li>Superb pace and gameplay</li>
|
12 |
-
<li>Unique sci-fi vehicles</li>
|
13 |
-
<li>Intuitive upgrade system</li>
|
14 |
-
<li>Hack enemy vehicles on the road</li>
|
15 |
-
<li>Full retina display support</li>
|
16 |
-
<li>Leaderboards and achievements</li>
|
17 |
-
</ul>
|
18 |
-
<h3>Benefits of Traffic Rider 2 Mod APK</h3>
|
19 |
-
<p>While Traffic Rider 2 is a free game, it contains ads and in-app purchases that can limit your enjoyment. That's why many players prefer to download Traffic Rider 2 Mod APK, which is a modified version of the game that gives you some advantages, such as:</p>
|
20 |
-
<ul>
|
21 |
-
<li>Unlimited money to buy and upgrade bikes</li>
|
22 |
-
<li>All bikes unlocked from the start</li>
|
23 |
-
<li>No ads to interrupt your gameplay</li>
|
24 |
-
<li>No root required to install the mod apk</li>
|
25 |
-
<li>100% safe and virus-free</li>
|
26 |
-
</ul>
|
27 |
-
<h2>How to Download and Install Traffic Rider 2 Mod APK</h2>
|
28 |
-
<p>If you want to download and install Traffic Rider 2 Mod APK on your Android device, you need to follow these simple steps:</p>
|
29 |
-
<p>download traffic rider 2 mod apk unlimited money<br />
|
30 |
-
download traffic rider 2 mod apk fully unlocked<br />
|
31 |
-
download traffic rider 2 mod apk latest version<br />
|
32 |
-
download traffic rider 2 mod apk for android<br />
|
33 |
-
download traffic rider 2 mod apk offline<br />
|
34 |
-
download traffic rider 2 mod apk free<br />
|
35 |
-
download traffic rider 2 mod apk no ads<br />
|
36 |
-
download traffic rider 2 mod apk with obb<br />
|
37 |
-
download traffic rider 2 mod apk revdl<br />
|
38 |
-
download traffic rider 2 mod apk rexdl<br />
|
39 |
-
download traffic rider 2 mod apk hack<br />
|
40 |
-
download traffic rider 2 mod apk android 1<br />
|
41 |
-
download traffic rider 2 mod apk online<br />
|
42 |
-
download traffic rider 2 mod apk gameplay<br />
|
43 |
-
download traffic rider 2 mod apk motorcycle game<br />
|
44 |
-
download traffic rider 2 mod apk new update<br />
|
45 |
-
download traffic rider 2 mod apk high graphics<br />
|
46 |
-
download traffic rider 2 mod apk easy install<br />
|
47 |
-
download traffic rider 2 mod apk direct link<br />
|
48 |
-
download traffic rider 2 mod apk mirror link<br />
|
49 |
-
download traffic rider 2 mod apk from mytrafficriderapk.com[^1^]<br />
|
50 |
-
download traffic rider 2 mod apk from apkpure.com<br />
|
51 |
-
download traffic rider 2 mod apk from apkmody.io<br />
|
52 |
-
download traffic rider 2 mod apk from happymod.com<br />
|
53 |
-
download traffic rider 2 mod apk from an1.com<br />
|
54 |
-
download traffic rider 2 mod apk from apknite.com<br />
|
55 |
-
download traffic rider 2 mod apk from apkmirror.com<br />
|
56 |
-
download traffic rider 2 mod apk from apksfree.com<br />
|
57 |
-
download traffic rider 2 mod apk from apktada.com<br />
|
58 |
-
download traffic rider 2 mod apk from apksfull.com<br />
|
59 |
-
how to download traffic rider 2 mod apk<br />
|
60 |
-
where to download traffic rider 2 mod apk<br />
|
61 |
-
why to download traffic rider 2 mod apk<br />
|
62 |
-
what is traffic rider 2 mod apk<br />
|
63 |
-
benefits of downloading traffic rider 2 mod apk<br />
|
64 |
-
features of downloading traffic rider 2 mod apk<br />
|
65 |
-
reviews of downloading traffic rider 2 mod apk<br />
|
66 |
-
ratings of downloading traffic rider 2 mod apk<br />
|
67 |
-
alternatives to downloading traffic rider 2 mod apk<br />
|
68 |
-
tips for downloading traffic rider 2 mod apk</p>
|
69 |
-
<h3>Step 1: Enable Unknown Sources</h3>
|
70 |
-
<p>Since Traffic Rider 2 Mod APK is not available on Google Play, you need to enable unknown sources on your device to allow the installation of third-party apps. To do this, go to Settings > Security > Unknown Sources and toggle it on.</p>
|
71 |
-
<h3>Step 2: Download Traffic Rider 2 Mod APK File</h3>
|
72 |
-
<p>Next, you need to download the Traffic Rider 2 Mod APK file from a reliable source. You can use this link to download the latest version of the mod apk file. Make sure you have enough storage space on your device before downloading.</p>
|
73 |
-
<h3>Step 3: Install Traffic Rider 2 Mod APK</h3>
|
74 |
-
<p>Once you have downloaded the mod apk file, locate it 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. You might see a warning message saying that the app is harmful or not compatible with your device, but ignore it and proceed with the installation.</p>
|
75 |
-
<h2>How to Play Traffic Rider 2 Mod APK</h2>
|
76 |
-
<p>After installing Traffic Rider 2 Mod APK, you can launch the game from your app drawer or home screen. You can start playing the game and enjoy the mod features. Here are some tips and tricks to help you play Traffic Rider 2 Mod APK better:</p>
|
77 |
-
<h3>Tips and Tricks for Traffic Rider 2 Mod APK</h3>
|
78 |
-
<p>Some of the tips and tricks for Traffic Rider 2 Mod APK are:</p>
|
79 |
-
<ul>
|
80 |
-
<li>Use the hack feature to disable enemy vehicles and clear your way</li>
|
81 |
-
<li>Use the nitro and boost to increase your speed and score</li>
|
82 |
-
<li>Avoid crashing into traffic and obstacles as it will reduce your health and time</li>
|
83 |
-
<li>Complete missions and challenges to earn more money and unlock new bikes</li>
|
84 |
-
<li>Customize your bike with system updates and hardware upgrades to improve its performance</li>
|
85 |
-
<li>Play in different modes and difficulty levels to test your skills and have more fun</li>
|
86 |
-
</ul>
|
87 |
-
<h2>Conclusion</h2>
|
88 |
-
<p>Traffic Rider 2 is a thrilling and addictive racing game that will keep you hooked for hours. With Traffic Rider 2 Mod APK, you can enjoy the game with unlimited money, unlocked bikes, and no ads. You can download and install Traffic Rider 2 Mod APK on your Android device by following the steps we have provided in this article. You can also use our tips and tricks to play the game better and have more fun. So, what are you waiting for? Download Traffic Rider 2 Mod APK now and experience the ultimate motorcycle racing game!</p>
|
89 |
-
<h2>FAQs</h2>
|
90 |
-
<p>Here are some of the frequently asked questions about Traffic Rider 2 Mod APK:</p>
|
91 |
-
<h4>Q: Is Traffic Rider 2 Mod APK safe to download and install?</h4>
|
92 |
-
<p>A: Yes, Traffic Rider 2 Mod APK is safe to download and install. It does not contain any viruses or malware that can harm your device. However, you should always download the mod apk file from a trusted source and scan it with an antivirus before installing it.</p>
|
93 |
-
<h4>Q: Do I need to root my device to install Traffic Rider 2 Mod APK?</h4>
|
94 |
-
<p>A: No, you do not need to root your device to install Traffic Rider 2 Mod APK. The mod apk file works on both rooted and non-rooted devices. However, if you have a rooted device, you might be able to access some extra features of the mod apk.</p>
|
95 |
-
<h4>Q: Will I get banned from playing Traffic Rider 2 if I use the mod apk?</h4>
|
96 |
-
<p>A: No, you will not get banned from playing Traffic Rider 2 if you use the mod apk. The mod apk file is designed to bypass the security checks of the game and prevent detection. However, you should always use the mod apk at your own risk and discretion.</p>
|
97 |
-
<h4>Q: Can I play Traffic Rider 2 Mod APK online with other players?</h4>
|
98 |
-
<p>A: Yes, you can play Traffic Rider 2 Mod APK online with other players. The mod apk file does not affect the online mode of the game. You can join or create rooms and race with other players from around the world.</p>
|
99 |
-
<h4>Q: Can I update Traffic Rider 2 Mod APK to the latest version?</h4>
|
100 |
-
<p>A: Yes, you can update Traffic Rider 2 Mod APK to the latest version. However, you might lose some of the mod features if you update the game from Google Play. To avoid this, you should always download the latest version of the mod apk file from a reliable source and install it over the existing one.</p> 401be4b1e0<br />
|
101 |
-
<br />
|
102 |
-
<br />
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
spaces/1phancelerku/anime-remove-background/FIFA 23 APK - How to Play the Latest EA SPORTS FIFA Game on Your Android Device with APKRabi.md
DELETED
@@ -1,124 +0,0 @@
|
|
1 |
-
|
2 |
-
<h1>APKRabi FIFA: How to Download and Play FIFA Mobile on Android Devices</h1>
|
3 |
-
<p>If you are a fan of soccer games, you might have heard of <strong>FIFA Mobile</strong>, the official mobile game of the FIFA World Cup 2022™. This game allows you to build your dream team of soccer stars, compete in various modes and events, and enjoy the stunning graphics and gameplay powered by HyperMotion Technology. But how can you download and play this game on your Android device? The answer is simple: <strong>APKRabi FIFA</strong>.</p>
|
4 |
-
<h2>Introduction</h2>
|
5 |
-
<p><strong>APKRabi</strong> is a website that allows you to download the most popular APK games and premium apps for free. APK stands for Android Package Kit, which is a file format that contains all the necessary components for installing an app or a game on an Android device. By downloading APK files from APKRabi, you can enjoy every notable feature of your favorite games and apps without breaking your wallet. You can also access games and apps that are not available in your region or on the Google Play Store.</p>
|
6 |
-
<h2>apkrabi fifa</h2><br /><p><b><b>Download File</b> ✺✺✺ <a href="https://jinyurl.com/2uNObv">https://jinyurl.com/2uNObv</a></b></p><br /><br />
|
7 |
-
<p>One of the games that you can download from APKRabi is <strong>FIFA Mobile</strong>, also known as FIFA Soccer. This game is developed by EA Sports, one of the leading companies in the sports gaming industry. FIFA Mobile is the only licensed FIFA World Cup 2022™ mobile game where you can replay the official tournament brackets with any of the 32 qualified nations. You can also build your Ultimate Team™ with over 19,000 players from 700+ teams, 100+ stadiums, 30+ leagues, and the world’s biggest competitions.</p>
|
8 |
-
<p>To download and install APKRabi FIFA on your Android device, you need to follow these simple steps:</p>
|
9 |
-
<ol>
|
10 |
-
<li>Go to <a href="(^1^)">APKRabi.com</a> and search for FIFA Mobile or click on this <a href="(^1^)">link</a>.</li>
|
11 |
-
<li>Click on the Download APK button and wait for the file to be downloaded on your device.</li>
|
12 |
-
<li>Go to your device settings and enable the installation of apps from unknown sources.</li>
|
13 |
-
<li>Locate the downloaded APK file in your file manager and tap on it to start the installation process.</li>
|
14 |
-
<li>Follow the instructions on the screen and wait for the installation to be completed.</li>
|
15 |
-
<li>Launch the game and enjoy playing APKRabi FIFA on your Android device.</li>
|
16 |
-
</ol>
|
17 |
-
<h2>How to Build Your Ultimate Team in FIFA Mobile</h2>
|
18 |
-
<p>One of the main features of FIFA Mobile is the Ultimate Team mode, where you can create your own squad of soccer stars from different leagues and teams. You can collect and upgrade players by opening packs, completing challenges, participating in events, or buying them from the market. You can also customize your formation, tactics, and style of play according to your preferences.</ <p>Once you have downloaded and installed APKRabi FIFA on your Android device, you can start building your Ultimate Team and enjoy the game. Here are some tips and tricks to help you get the most out of FIFA Mobile.</p>
|
19 |
-
<h2>How to Build Your Ultimate Team in FIFA Mobile</h2>
|
20 |
-
<p>One of the main features of FIFA Mobile is the Ultimate Team mode, where you can create your own squad of soccer stars from different leagues and teams. You can collect and upgrade players by opening packs, completing challenges, participating in events, or buying them from the market. You can also customize your formation, tactics, and style of play according to your preferences.</p>
|
21 |
-
<p>apkrabi fifa mobile download<br />
|
22 |
-
apkrabi fifa 23 release date<br />
|
23 |
-
apkrabi fifa world cup 2022 mode<br />
|
24 |
-
apkrabi fifa soccer apk<br />
|
25 |
-
apkrabi fifa ultimate team<br />
|
26 |
-
apkrabi fifa mobile hack<br />
|
27 |
-
apkrabi fifa 23 hypermotion<br />
|
28 |
-
apkrabi fifa mobile mod apk<br />
|
29 |
-
apkrabi fifa world cup 2022 qualifiers<br />
|
30 |
-
apkrabi fifa mobile cheats<br />
|
31 |
-
apkrabi fifa 23 demo<br />
|
32 |
-
apkrabi fifa mobile review<br />
|
33 |
-
apkrabi fifa world cup 2022 tickets<br />
|
34 |
-
apkrabi fifa soccer mod apk<br />
|
35 |
-
apkrabi fifa ultimate team coins<br />
|
36 |
-
apkrabi fifa mobile update<br />
|
37 |
-
apkrabi fifa 23 pre order<br />
|
38 |
-
apkrabi fifa mobile tips<br />
|
39 |
-
apkrabi fifa world cup 2022 schedule<br />
|
40 |
-
apkrabi fifa soccer hack apk<br />
|
41 |
-
apkrabi fifa ultimate team draft<br />
|
42 |
-
apkrabi fifa mobile gameplay<br />
|
43 |
-
apkrabi fifa 23 trailer<br />
|
44 |
-
apkrabi fifa mobile online<br />
|
45 |
-
apkrabi fifa world cup 2022 stadiums<br />
|
46 |
-
apkrabi fifa soccer online<br />
|
47 |
-
apkrabi fifa ultimate team web app<br />
|
48 |
-
apkrabi fifa mobile reddit<br />
|
49 |
-
apkrabi fifa 23 women's club football<br />
|
50 |
-
apkrabi fifa mobile season reset<br />
|
51 |
-
apkrabi fifa soccer offline<br />
|
52 |
-
apkrabi fifa ultimate team packs<br />
|
53 |
-
apkrabi fifa mobile forum<br />
|
54 |
-
apkrabi fifa 23 cross play<br />
|
55 |
-
apkrabi fifa mobile legends<br />
|
56 |
-
apkrabi fifa soccer season reset<br />
|
57 |
-
apkrabi fifa ultimate team builder<br />
|
58 |
-
apkrabi fifa mobile events<br />
|
59 |
-
apkrabi fifa 23 career mode<br />
|
60 |
-
apkrabi fifa mobile icons</p>
|
61 |
-
<p>Here are some of the things you need to know about building your Ultimate Team in FIFA Mobile:</p>
|
62 |
-
<ul>
|
63 |
-
<li>You can choose from different types of players, such as base players, campaign players, event players, icon players, and more. Each type of player has different attributes, ratings, and skills that affect their performance on the pitch.</li>
|
64 |
-
<li>You can improve your players by using training materials, such as training XP, skill boosts, rank shards, and rank up tokens. Training XP increases the overall rating (OVR) of your players, skill boosts enhance specific attributes of your players, rank shards allow you to rank up your players to unlock new skill boosts, and rank up tokens allow you to increase the maximum OVR of your players.</li>
|
65 |
-
<li>You can use different formations and tactics to suit your playstyle and strategy. You can choose from 4-4-2, 4-3-3, 3-5-2, and more. You can also adjust your attacking style (balanced, long ball, possession), defensive style (balanced, pressure, offside trap), and team shape (wide, narrow).</li>
|
66 |
-
<li>You can compete in various modes and events to earn rewards and test your skills. You can play in the World Cup mode, where you can replay the official tournament brackets with any of the 32 qualified nations. You can also play in the VS Attack mode, where you can challenge other players in real-time matches. You can also play in the Manager Mode, where you can control your team's finances, transfers, and tactics.</li>
|
67 |
-
</ul>
|
68 |
-
<h2>How to Enjoy the HyperMotion Technology in FIFA Mobile</h2>
|
69 |
-
<p>One of the most exciting features of FIFA Mobile is the HyperMotion Technology, which is a new technology that enhances the gameplay and graphics of the game. HyperMotion Technology uses machine learning and advanced 11v11 match capture data to create more realistic and responsive player animations, movements, and interactions.</p>
|
70 |
-
<p>Here are some of the things you need to know about enjoying the HyperMotion Technology in FIFA Mobile:</p>
|
71 |
-
<ul>
|
72 |
-
<li>You can access HyperMotion Technology on compatible devices and platforms. You need to have a PlayStation 5, Xbox Series X|S, PC, or Stadia version of the game to experience HyperMotion Technology. You also need to have a stable internet connection and enough storage space on your device.</li>
|
73 |
-
<li>You can adjust the settings and preferences of HyperMotion Technology to optimize your experience. You can enable or disable HyperMotion Technology in the game settings menu. You can also change the graphics quality, frame rate, resolution, and other options to suit your device's performance and capabilities.</li>
|
74 |
-
<li>You can enjoy the benefits of HyperMotion Technology in various aspects of the game. You can see more natural transitions between controlling the ball and shooting. You can also see more fluid dribbling and skill moves. You can also see more realistic defensive jockeying and tackling. You can also see more dynamic goalkeeper vs header battles.</li>
|
75 |
-
</ul>
|
76 |
-
<h2>Conclusion</h2>
|
77 |
-
<p>FIFA Mobile is a great game for soccer fans who want to enjoy the thrill of building their Ultimate Team and competing in various modes and events. With APKRabi FIFA, you can download and play this game for free on your Android device. You can also enjoy the stunning graphics and gameplay powered by HyperMotion Technology on compatible devices and platforms.</p>
|
78 |
-
<p>Here are some tips and tricks for playing FIFA Mobile:</p>
|
79 |
-
<ul>
|
80 |
-
<li>Use different types of players to create a balanced team with good chemistry. Chemistry is a measure of how well your players work together on the pitch. You can increase chemistry by using players from the same league, team, nation, or event.</li>
|
81 |
-
<li>Use skill boosts wisely to improve your players' attributes. Skill boosts are consumable items that enhance specific attributes of your players for a limited time. You can use skill boosts before a match or during a match by tapping on the boost icon on the top right corner.</li>
|
82 |
-
<li>Use different formations and tactics depending on your opponent's strategy and strength. You can change your formation and tactics before a match or during a match by tapping on the pause button on the top left corner.</li>
|
83 |
-
<li>Use HyperMotion Technology to gain <p>an advantage over your opponent. HyperMotion Technology allows you to perform more realistic and responsive actions on the pitch. You can also enjoy the enhanced graphics and animations of the game.</li>
|
84 |
-
</ul>
|
85 |
-
<p>If you are looking for a fun and exciting soccer game to play on your Android device, you should definitely try out APKRabi FIFA. You can download and install it for free from APKRabi.com and enjoy the official FIFA World Cup 2022™ mobile game. You can also share your feedback and suggestions with APKRabi or EA Sports to help them improve the game.</p>
|
86 |
-
<h2>FAQs</h2>
|
87 |
-
<p>Here are some of the frequently asked questions about APKRabi FIFA:</p>
|
88 |
-
<ol>
|
89 |
-
<li><strong>What are some of the benefits of downloading APKRabi FIFA?</strong></li>
|
90 |
-
<p>Some of the benefits of downloading APKRabi FIFA are:</p>
|
91 |
-
<ul>
|
92 |
-
<li>You can play FIFA Mobile for free without spending any money on in-app purchases or subscriptions.</li>
|
93 |
-
<li>You can access games and apps that are not available in your region or on the Google Play Store.</li>
|
94 |
-
<li>You can enjoy every notable feature of FIFA Mobile without any limitations or restrictions.</li>
|
95 |
-
</ul>
|
96 |
-
<li><strong>Is APKRabi FIFA safe and legal to use?</strong></li>
|
97 |
-
<p>APKRabi FIFA is safe and legal to use as long as you download it from the official website of APKRabi.com. APKRabi does not host any illegal or harmful files on its servers. It only provides links to the original APK files from trusted sources. However, you should always be careful when downloading and installing APK files from unknown sources, as they might contain viruses or malware that could harm your device or compromise your privacy.</p>
|
98 |
-
<li><strong>How can I update APKRabi FIFA to the latest version?</strong></li>
|
99 |
-
<p>You can update APKRabi FIFA to the latest version by following these steps:</p>
|
100 |
-
<ol>
|
101 |
-
<li>Go to <a href="">APKRabi.com</a> and search for FIFA Mobile or click on this <a href="">link</a>.</li>
|
102 |
-
<li>Click on the Download APK button and wait for the file to be downloaded on your device.</li>
|
103 |
-
<li>Go to your device settings and enable the installation of apps from unknown sources.</li>
|
104 |
-
<li>Locate the downloaded APK file in your file manager and tap on it to start the installation process.</li>
|
105 |
-
<li>Follow the instructions on the screen and wait for the installation to be completed.</li>
|
106 |
-
<li>Launch the game and enjoy playing APKRabi FIFA on your Android device.</li>
|
107 |
-
</ol>
|
108 |
-
<p>Note: You might need to uninstall the previous version of APKRabi FIFA before installing the new one.</p>
|
109 |
-
<li><strong>What are some of the challenges or issues that I might encounter while playing APKRabi FIFA?</strong></li>
|
110 |
-
<p>Some of the challenges or issues that you might encounter while playing APKRabi FIFA are:</p>
|
111 |
-
<ul>
|
112 |
-
<li>You might experience some lag or glitches in the game due to your device's performance or internet connection.</li>
|
113 |
-
<li>You might not be able to access some features or modes of the game due to regional restrictions or compatibility issues.</li>
|
114 |
-
<li>You might face some errors or bugs in the game due to technical issues or updates.</li>
|
115 |
-
</ul>
|
116 |
-
<li><strong>How can I contact the support team of APKRabi or EA Sports if I have any questions or problems?</strong></li>
|
117 |
-
<p>You can contact the support team of APKRabi or EA Sports by using these methods:</p>
|
118 |
-
<ul>
|
119 |
-
<li>You can visit the <a href="">APKRabi FAQ page</a> or <a href="">EA Sports Help page</a> for more information and solutions.</li>
|
120 |
-
<li>You can send an email to <a href="mailto:[email protected]">[email protected]</a> or <a href="mailto:[email protected]">[email protected]</a> with your query or issue.</li>
|
121 |
-
<li>You can follow and message <a href="">APKRabi on Facebook</a> or <a href="">EA Sports on Twitter</a>.</li>
|
122 |
-
</ul></p> 401be4b1e0<br />
|
123 |
-
<br />
|
124 |
-
<br />
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
spaces/AI-ZTH-03-23/6.AI.Dashboard.Wiki.Chat.Cognitive.HTML5/style.css
DELETED
@@ -1,28 +0,0 @@
|
|
1 |
-
body {
|
2 |
-
padding: 2rem;
|
3 |
-
font-family: -apple-system, BlinkMacSystemFont, "Arial", sans-serif;
|
4 |
-
}
|
5 |
-
|
6 |
-
h1 {
|
7 |
-
font-size: 16px;
|
8 |
-
margin-top: 0;
|
9 |
-
}
|
10 |
-
|
11 |
-
p {
|
12 |
-
color: rgb(107, 114, 128);
|
13 |
-
font-size: 15px;
|
14 |
-
margin-bottom: 10px;
|
15 |
-
margin-top: 5px;
|
16 |
-
}
|
17 |
-
|
18 |
-
.card {
|
19 |
-
max-width: 620px;
|
20 |
-
margin: 0 auto;
|
21 |
-
padding: 16px;
|
22 |
-
border: 1px solid lightgray;
|
23 |
-
border-radius: 16px;
|
24 |
-
}
|
25 |
-
|
26 |
-
.card p:last-child {
|
27 |
-
margin-bottom: 0;
|
28 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
spaces/AIFILMS/generate_human_motion/pyrender/tests/conftest.py
DELETED
File without changes
|
spaces/AIZerotoHero-Health4All/03-BiomedNER-1117-Gradio/README.md
DELETED
@@ -1,12 +0,0 @@
|
|
1 |
-
---
|
2 |
-
title: 03 BiomedNER 1117 Gradio
|
3 |
-
emoji: 💩
|
4 |
-
colorFrom: indigo
|
5 |
-
colorTo: red
|
6 |
-
sdk: gradio
|
7 |
-
sdk_version: 3.9.1
|
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/AchyuthGamer/ImMagician-Image-Generator/previewer/modules.py
DELETED
@@ -1,36 +0,0 @@
|
|
1 |
-
from torch import nn
|
2 |
-
|
3 |
-
# Effnet 16x16 to 64x64 previewer
|
4 |
-
class Previewer(nn.Module):
|
5 |
-
def __init__(self, c_in=16, c_hidden=512, c_out=3):
|
6 |
-
super().__init__()
|
7 |
-
self.blocks = nn.Sequential(
|
8 |
-
nn.Conv2d(c_in, c_hidden, kernel_size=1), # 36 channels to 512 channels
|
9 |
-
nn.GELU(),
|
10 |
-
nn.BatchNorm2d(c_hidden),
|
11 |
-
|
12 |
-
nn.Conv2d(c_hidden, c_hidden, kernel_size=3, padding=1),
|
13 |
-
nn.GELU(),
|
14 |
-
nn.BatchNorm2d(c_hidden),
|
15 |
-
|
16 |
-
nn.ConvTranspose2d(c_hidden, c_hidden//2, kernel_size=2, stride=2), # 16 -> 32
|
17 |
-
nn.GELU(),
|
18 |
-
nn.BatchNorm2d(c_hidden//2),
|
19 |
-
|
20 |
-
nn.Conv2d(c_hidden//2, c_hidden//2, kernel_size=3, padding=1),
|
21 |
-
nn.GELU(),
|
22 |
-
nn.BatchNorm2d(c_hidden//2),
|
23 |
-
|
24 |
-
nn.ConvTranspose2d(c_hidden//2, c_hidden//4, kernel_size=2, stride=2), # 32 -> 64
|
25 |
-
nn.GELU(),
|
26 |
-
nn.BatchNorm2d(c_hidden//4),
|
27 |
-
|
28 |
-
nn.Conv2d(c_hidden//4, c_hidden//4, kernel_size=3, padding=1),
|
29 |
-
nn.GELU(),
|
30 |
-
nn.BatchNorm2d(c_hidden//4),
|
31 |
-
|
32 |
-
nn.Conv2d(c_hidden//4, c_out, kernel_size=1),
|
33 |
-
)
|
34 |
-
|
35 |
-
def forward(self, x):
|
36 |
-
return self.blocks(x)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
spaces/AlekseyKorshuk/huggingartists/README.md
DELETED
@@ -1,33 +0,0 @@
|
|
1 |
-
---
|
2 |
-
title: Huggingartists
|
3 |
-
emoji: 🐠
|
4 |
-
colorFrom: red
|
5 |
-
colorTo: gray
|
6 |
-
sdk: streamlit
|
7 |
-
app_file: app.py
|
8 |
-
pinned: true
|
9 |
-
---
|
10 |
-
|
11 |
-
# Configuration
|
12 |
-
|
13 |
-
`title`: _string_
|
14 |
-
Display title for the Space
|
15 |
-
|
16 |
-
`emoji`: _string_
|
17 |
-
Space emoji (emoji-only character allowed)
|
18 |
-
|
19 |
-
`colorFrom`: _string_
|
20 |
-
Color for Thumbnail gradient (red, yellow, green, blue, indigo, purple, pink, gray)
|
21 |
-
|
22 |
-
`colorTo`: _string_
|
23 |
-
Color for Thumbnail gradient (red, yellow, green, blue, indigo, purple, pink, gray)
|
24 |
-
|
25 |
-
`sdk`: _string_
|
26 |
-
Can be either `gradio` or `streamlit`
|
27 |
-
|
28 |
-
`app_file`: _string_
|
29 |
-
Path to your main application file (which contains either `gradio` or `streamlit` Python code).
|
30 |
-
Path is relative to the root of the repository.
|
31 |
-
|
32 |
-
`pinned`: _boolean_
|
33 |
-
Whether the Space stays on top of your list.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
spaces/AlhitawiMohammed22/E2E_OCR/det2rec.py
DELETED
@@ -1,390 +0,0 @@
|
|
1 |
-
# -*- coding: utf-8 -*-
|
2 |
-
"""
|
3 |
-
easyocr.py - A wrapper for easyocr to convert pdf to images to text
|
4 |
-
"""
|
5 |
-
|
6 |
-
import logging
|
7 |
-
from pathlib import Path
|
8 |
-
|
9 |
-
logging.basicConfig(
|
10 |
-
level=logging.INFO,
|
11 |
-
format="%(asctime)s %(levelname)s %(message)s",
|
12 |
-
datefmt="%m/%d/%Y %I:%M:%S",
|
13 |
-
)
|
14 |
-
|
15 |
-
|
16 |
-
import os
|
17 |
-
import pprint as pp
|
18 |
-
import re
|
19 |
-
import shutil
|
20 |
-
import time
|
21 |
-
from datetime import date, datetime
|
22 |
-
from os.path import basename, dirname, join
|
23 |
-
from pathlib import Path
|
24 |
-
|
25 |
-
from cleantext import clean
|
26 |
-
from doctr.io import DocumentFile
|
27 |
-
from doctr.models import ocr_predictor
|
28 |
-
from libretranslatepy import LibreTranslateAPI
|
29 |
-
from natsort import natsorted
|
30 |
-
from spellchecker import SpellChecker
|
31 |
-
from tqdm.auto import tqdm
|
32 |
-
|
33 |
-
|
34 |
-
def simple_rename(filepath, target_ext=".txt"):
|
35 |
-
_fp = Path(filepath)
|
36 |
-
basename = _fp.stem
|
37 |
-
return f"OCR_{basename}_{target_ext}"
|
38 |
-
|
39 |
-
|
40 |
-
def rm_local_text_files(name_contains="RESULT_"):
|
41 |
-
"""
|
42 |
-
rm_local_text_files - remove local text files
|
43 |
-
Args:
|
44 |
-
name_contains (str, optional): [description]. Defaults to "OCR_".
|
45 |
-
"""
|
46 |
-
files = [
|
47 |
-
f
|
48 |
-
for f in Path.cwd().iterdir()
|
49 |
-
if f.is_file() and f.suffix == ".txt" and name_contains in f.name
|
50 |
-
]
|
51 |
-
logging.info(f"removing {len(files)} text files")
|
52 |
-
for f in files:
|
53 |
-
os.remove(f)
|
54 |
-
logging.info("done")
|
55 |
-
|
56 |
-
|
57 |
-
def corr(
|
58 |
-
s: str,
|
59 |
-
add_space_when_numerics=False,
|
60 |
-
exceptions=["e.g.", "i.e.", "etc.", "cf.", "vs.", "p."],
|
61 |
-
) -> str:
|
62 |
-
"""corrects spacing in a string
|
63 |
-
Args:
|
64 |
-
s (str): the string to correct
|
65 |
-
add_space_when_numerics (bool, optional): [add a space when a period is between two numbers, example 5.73]. Defaults to False.
|
66 |
-
exceptions (list, optional): [do not change these substrings]. Defaults to ['e.g.', 'i.e.', 'etc.', 'cf.', 'vs.', 'p.'].
|
67 |
-
Returns:
|
68 |
-
str: the corrected string
|
69 |
-
"""
|
70 |
-
if add_space_when_numerics:
|
71 |
-
s = re.sub(r"(\d)\.(\d)", r"\1. \2", s)
|
72 |
-
|
73 |
-
s = re.sub(r"\s+", " ", s)
|
74 |
-
s = re.sub(r'\s([?.!"](?:\s|$))', r"\1", s)
|
75 |
-
|
76 |
-
# fix space before apostrophe
|
77 |
-
s = re.sub(r"\s\'", r"'", s)
|
78 |
-
# fix space after apostrophe
|
79 |
-
s = re.sub(r"'\s", r"'", s)
|
80 |
-
# fix space before comma
|
81 |
-
s = re.sub(r"\s,", r",", s)
|
82 |
-
|
83 |
-
for e in exceptions:
|
84 |
-
expected_sub = re.sub(r"\s", "", e)
|
85 |
-
s = s.replace(expected_sub, e)
|
86 |
-
|
87 |
-
return s
|
88 |
-
|
89 |
-
|
90 |
-
def fix_punct_spaces(string):
|
91 |
-
"""
|
92 |
-
fix_punct_spaces - replace spaces around punctuation with punctuation. For example, "hello , there" -> "hello, there"
|
93 |
-
Parameters
|
94 |
-
----------
|
95 |
-
string : str, required, input string to be corrected
|
96 |
-
Returns
|
97 |
-
-------
|
98 |
-
str, corrected string
|
99 |
-
"""
|
100 |
-
|
101 |
-
fix_spaces = re.compile(r"\s*([?!.,]+(?:\s+[?!.,]+)*)\s*")
|
102 |
-
string = fix_spaces.sub(lambda x: "{} ".format(x.group(1).replace(" ", "")), string)
|
103 |
-
string = string.replace(" ' ", "'")
|
104 |
-
string = string.replace(' " ', '"')
|
105 |
-
return string.strip()
|
106 |
-
|
107 |
-
|
108 |
-
def clean_OCR(ugly_text: str):
|
109 |
-
"""
|
110 |
-
clean_OCR - clean the OCR text files.
|
111 |
-
Parameters
|
112 |
-
----------
|
113 |
-
ugly_text : str, required, input string to be cleaned
|
114 |
-
Returns
|
115 |
-
-------
|
116 |
-
str, cleaned string
|
117 |
-
"""
|
118 |
-
# Remove all the newlines.
|
119 |
-
cleaned_text = ugly_text.replace("\n", " ")
|
120 |
-
# Remove all the tabs.
|
121 |
-
cleaned_text = cleaned_text.replace("\t", " ")
|
122 |
-
# Remove all the double spaces.
|
123 |
-
cleaned_text = cleaned_text.replace(" ", " ")
|
124 |
-
# Remove all the spaces at the beginning of the text.
|
125 |
-
cleaned_text = cleaned_text.lstrip()
|
126 |
-
# remove all instances of "- " and " - "
|
127 |
-
cleaned_text = cleaned_text.replace("- ", "")
|
128 |
-
cleaned_text = cleaned_text.replace(" -", "")
|
129 |
-
return fix_punct_spaces(cleaned_text)
|
130 |
-
|
131 |
-
|
132 |
-
def move2completed(from_dir, filename, new_folder="completed", verbose=False):
|
133 |
-
|
134 |
-
# this is the better version
|
135 |
-
old_filepath = join(from_dir, filename)
|
136 |
-
|
137 |
-
new_filedirectory = join(from_dir, new_folder)
|
138 |
-
|
139 |
-
if not os.path.isdir(new_filedirectory):
|
140 |
-
os.mkdir(new_filedirectory)
|
141 |
-
if verbose:
|
142 |
-
print("created new directory for files at: \n", new_filedirectory)
|
143 |
-
new_filepath = join(new_filedirectory, filename)
|
144 |
-
|
145 |
-
try:
|
146 |
-
shutil.move(old_filepath, new_filepath)
|
147 |
-
logging.info("successfully moved the file {} to */completed.".format(filename))
|
148 |
-
except:
|
149 |
-
logging.info(
|
150 |
-
"ERROR! unable to move file to \n{}. Please investigate".format(
|
151 |
-
new_filepath
|
152 |
-
)
|
153 |
-
)
|
154 |
-
|
155 |
-
|
156 |
-
"""## pdf2text functions
|
157 |
-
"""
|
158 |
-
|
159 |
-
|
160 |
-
custom_replace_list = {
|
161 |
-
"t0": "to",
|
162 |
-
"'$": "'s",
|
163 |
-
",,": ", ",
|
164 |
-
"_ ": " ",
|
165 |
-
" '": "'",
|
166 |
-
}
|
167 |
-
|
168 |
-
replace_corr_exceptions = {
|
169 |
-
"i. e.": "i.e.",
|
170 |
-
"e. g.": "e.g.",
|
171 |
-
"e. g": "e.g.",
|
172 |
-
" ,": ",",
|
173 |
-
}
|
174 |
-
|
175 |
-
|
176 |
-
spell = SpellChecker()
|
177 |
-
|
178 |
-
|
179 |
-
def check_word_spelling(word: str) -> bool:
|
180 |
-
"""
|
181 |
-
check_word_spelling - check the spelling of a word
|
182 |
-
Args:
|
183 |
-
word (str): word to check
|
184 |
-
Returns:
|
185 |
-
bool: True if word is spelled correctly, False if not
|
186 |
-
"""
|
187 |
-
|
188 |
-
misspelled = spell.unknown([word])
|
189 |
-
|
190 |
-
return len(misspelled) == 0
|
191 |
-
|
192 |
-
|
193 |
-
def eval_and_replace(text: str, match_token: str = "- ") -> str:
|
194 |
-
"""
|
195 |
-
eval_and_replace - conditionally replace all instances of a substring in a string based on whether the eliminated substring results in a valid word
|
196 |
-
Args:
|
197 |
-
text (str): text to evaluate
|
198 |
-
match_token (str, optional): token to replace. Defaults to "- ".
|
199 |
-
Returns:
|
200 |
-
str: text with replaced tokens
|
201 |
-
"""
|
202 |
-
|
203 |
-
try:
|
204 |
-
if match_token not in text:
|
205 |
-
return text
|
206 |
-
else:
|
207 |
-
while True:
|
208 |
-
full_before_text = text.split(match_token, maxsplit=1)[0]
|
209 |
-
before_text = [
|
210 |
-
char for char in full_before_text.split()[-1] if char.isalpha()
|
211 |
-
]
|
212 |
-
before_text = "".join(before_text)
|
213 |
-
full_after_text = text.split(match_token, maxsplit=1)[-1]
|
214 |
-
after_text = [char for char in full_after_text.split()[0] if char.isalpha()]
|
215 |
-
after_text = "".join(after_text)
|
216 |
-
full_text = before_text + after_text
|
217 |
-
if check_word_spelling(full_text):
|
218 |
-
text = full_before_text + full_after_text
|
219 |
-
else:
|
220 |
-
text = full_before_text + " " + full_after_text
|
221 |
-
if match_token not in text:
|
222 |
-
break
|
223 |
-
except Exception as e:
|
224 |
-
logging.error(f"Error spell-checking OCR output, returning default text:\t{e}")
|
225 |
-
return text
|
226 |
-
|
227 |
-
|
228 |
-
def cleantxt_ocr(ugly_text, lower=False, lang: str = "en") -> str:
|
229 |
-
"""
|
230 |
-
cleantxt_ocr - clean text from OCR
|
231 |
-
Args:
|
232 |
-
ugly_text (str): text to clean
|
233 |
-
lower (bool, optional): _description_. Defaults to False.
|
234 |
-
lang (str, optional): _description_. Defaults to "en".
|
235 |
-
Returns:
|
236 |
-
str: cleaned text
|
237 |
-
"""
|
238 |
-
# a wrapper for clean text with options different than default
|
239 |
-
|
240 |
-
# https://pypi.org/project/clean-text/
|
241 |
-
cleaned_text = clean(
|
242 |
-
ugly_text,
|
243 |
-
fix_unicode=True, # fix various unicode errors
|
244 |
-
to_ascii=True, # transliterate to closest ASCII representation
|
245 |
-
lower=lower, # lowercase text
|
246 |
-
no_line_breaks=True, # fully strip line breaks as opposed to only normalizing them
|
247 |
-
no_urls=True, # replace all URLs with a special token
|
248 |
-
no_emails=True, # replace all email addresses with a special token
|
249 |
-
no_phone_numbers=False, # replace all phone numbers with a special token
|
250 |
-
no_numbers=False, # replace all numbers with a special token
|
251 |
-
no_digits=False, # replace all digits with a special token
|
252 |
-
no_currency_symbols=False, # replace all currency symbols with a special token
|
253 |
-
no_punct=False, # remove punctuations
|
254 |
-
replace_with_punct="", # instead of removing punctuations you may replace them
|
255 |
-
replace_with_url="<URL>",
|
256 |
-
replace_with_email="<EMAIL>",
|
257 |
-
replace_with_phone_number="<PHONE>",
|
258 |
-
replace_with_number="<NUM>",
|
259 |
-
replace_with_digit="0",
|
260 |
-
replace_with_currency_symbol="<CUR>",
|
261 |
-
lang=lang, # set to 'de' for German special handling
|
262 |
-
)
|
263 |
-
|
264 |
-
return cleaned_text
|
265 |
-
|
266 |
-
|
267 |
-
def format_ocr_out(OCR_data):
|
268 |
-
|
269 |
-
if isinstance(OCR_data, list):
|
270 |
-
text = " ".join(OCR_data)
|
271 |
-
else:
|
272 |
-
text = str(OCR_data)
|
273 |
-
_clean = cleantxt_ocr(text)
|
274 |
-
return corr(_clean)
|
275 |
-
|
276 |
-
|
277 |
-
def postprocess(text: str) -> str:
|
278 |
-
"""to be used after recombining the lines"""
|
279 |
-
|
280 |
-
proc = corr(cleantxt_ocr(text))
|
281 |
-
|
282 |
-
for k, v in custom_replace_list.items():
|
283 |
-
proc = proc.replace(str(k), str(v))
|
284 |
-
|
285 |
-
proc = corr(proc)
|
286 |
-
|
287 |
-
for k, v in replace_corr_exceptions.items():
|
288 |
-
proc = proc.replace(str(k), str(v))
|
289 |
-
|
290 |
-
return eval_and_replace(proc)
|
291 |
-
|
292 |
-
|
293 |
-
def result2text(result, as_text=False) -> str or list:
|
294 |
-
"""Convert OCR result to text"""
|
295 |
-
|
296 |
-
full_doc = []
|
297 |
-
for i, page in enumerate(result.pages, start=1):
|
298 |
-
text = ""
|
299 |
-
for block in page.blocks:
|
300 |
-
text += "\n\t"
|
301 |
-
for line in block.lines:
|
302 |
-
for word in line.words:
|
303 |
-
# print(dir(word))
|
304 |
-
text += word.value + " "
|
305 |
-
full_doc.append(text)
|
306 |
-
|
307 |
-
return "\n".join(full_doc) if as_text else full_doc
|
308 |
-
|
309 |
-
|
310 |
-
def convert_PDF_to_Text(
|
311 |
-
PDF_file,
|
312 |
-
ocr_model=None,
|
313 |
-
max_pages: int = 20,
|
314 |
-
):
|
315 |
-
|
316 |
-
st = time.perf_counter()
|
317 |
-
PDF_file = Path(PDF_file)
|
318 |
-
ocr_model = ocr_predictor(pretrained=True) if ocr_model is None else ocr_model
|
319 |
-
logging.info(f"starting OCR on {PDF_file.name}")
|
320 |
-
doc = DocumentFile.from_pdf(PDF_file)
|
321 |
-
truncated = False
|
322 |
-
if len(doc) > max_pages:
|
323 |
-
logging.warning(
|
324 |
-
f"PDF has {len(doc)} pages, which is more than {max_pages}.. truncating"
|
325 |
-
)
|
326 |
-
doc = doc[:max_pages]
|
327 |
-
truncated = True
|
328 |
-
|
329 |
-
# Analyze
|
330 |
-
logging.info(f"running OCR on {len(doc)} pages")
|
331 |
-
result = ocr_model(doc)
|
332 |
-
raw_text = result2text(result)
|
333 |
-
proc_text = [format_ocr_out(r) for r in raw_text]
|
334 |
-
fin_text = [postprocess(t) for t in proc_text]
|
335 |
-
|
336 |
-
ocr_results = "\n\n".join(fin_text)
|
337 |
-
|
338 |
-
fn_rt = time.perf_counter() - st
|
339 |
-
|
340 |
-
logging.info("OCR complete")
|
341 |
-
|
342 |
-
results_dict = {
|
343 |
-
"num_pages": len(doc),
|
344 |
-
"runtime": round(fn_rt, 2),
|
345 |
-
"date": str(date.today()),
|
346 |
-
"converted_text": ocr_results,
|
347 |
-
"truncated": truncated,
|
348 |
-
"length": len(ocr_results),
|
349 |
-
}
|
350 |
-
|
351 |
-
return results_dict
|
352 |
-
|
353 |
-
|
354 |
-
# @title translation functions
|
355 |
-
|
356 |
-
lt = LibreTranslateAPI("https://translate.astian.org/")
|
357 |
-
|
358 |
-
|
359 |
-
def translate_text(text, source_l, target_l="en"):
|
360 |
-
|
361 |
-
return str(lt.translate(text, source_l, target_l))
|
362 |
-
|
363 |
-
|
364 |
-
def translate_doc(filepath, lang_start, lang_end="en", verbose=False):
|
365 |
-
"""translate a document from lang_start to lang_end
|
366 |
-
{'code': 'en', 'name': 'English'},
|
367 |
-
{'code': 'fr', 'name': 'French'},
|
368 |
-
{'code': 'de', 'name': 'German'},
|
369 |
-
{'code': 'it', 'name': 'Italian'},"""
|
370 |
-
|
371 |
-
src_folder = dirname(filepath)
|
372 |
-
src_folder = Path(src_folder)
|
373 |
-
trgt_folder = src_folder / f"translated_{lang_end}"
|
374 |
-
trgt_folder.mkdir(exist_ok=True)
|
375 |
-
with open(filepath, "r", encoding="utf-8", errors="ignore") as f:
|
376 |
-
foreign_t = f.readlines()
|
377 |
-
in_name = basename(filepath)
|
378 |
-
translated_doc = []
|
379 |
-
for line in tqdm(
|
380 |
-
foreign_t, total=len(foreign_t), desc="translating {}...".format(in_name[:10])
|
381 |
-
):
|
382 |
-
translated_line = translate_text(line, lang_start, lang_end)
|
383 |
-
translated_doc.append(translated_line)
|
384 |
-
t_out_name = "[To {}]".format(lang_end) + simple_rename(in_name) + ".txt"
|
385 |
-
out_path = join(trgt_folder, t_out_name)
|
386 |
-
with open(out_path, "w", encoding="utf-8", errors="ignore") as f_o:
|
387 |
-
f_o.writelines(translated_doc)
|
388 |
-
if verbose:
|
389 |
-
print("finished translating the document! - ", datetime.now())
|
390 |
-
return out_path
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
spaces/Androidonnxfork/CivitAi-to-Diffusers/diffusers/docs/source/en/training/create_dataset.md
DELETED
@@ -1,90 +0,0 @@
|
|
1 |
-
# Create a dataset for training
|
2 |
-
|
3 |
-
There are many datasets on the [Hub](https://huggingface.co/datasets?task_categories=task_categories:text-to-image&sort=downloads) to train a model on, but if you can't find one you're interested in or want to use your own, you can create a dataset with the 🤗 [Datasets](hf.co/docs/datasets) library. The dataset structure depends on the task you want to train your model on. The most basic dataset structure is a directory of images for tasks like unconditional image generation. Another dataset structure may be a directory of images and a text file containing their corresponding text captions for tasks like text-to-image generation.
|
4 |
-
|
5 |
-
This guide will show you two ways to create a dataset to finetune on:
|
6 |
-
|
7 |
-
- provide a folder of images to the `--train_data_dir` argument
|
8 |
-
- upload a dataset to the Hub and pass the dataset repository id to the `--dataset_name` argument
|
9 |
-
|
10 |
-
<Tip>
|
11 |
-
|
12 |
-
💡 Learn more about how to create an image dataset for training in the [Create an image dataset](https://huggingface.co/docs/datasets/image_dataset) guide.
|
13 |
-
|
14 |
-
</Tip>
|
15 |
-
|
16 |
-
## Provide a dataset as a folder
|
17 |
-
|
18 |
-
For unconditional generation, you can provide your own dataset as a folder of images. The training script uses the [`ImageFolder`](https://huggingface.co/docs/datasets/en/image_dataset#imagefolder) builder from 🤗 Datasets to automatically build a dataset from the folder. Your directory structure should look like:
|
19 |
-
|
20 |
-
```bash
|
21 |
-
data_dir/xxx.png
|
22 |
-
data_dir/xxy.png
|
23 |
-
data_dir/[...]/xxz.png
|
24 |
-
```
|
25 |
-
|
26 |
-
Pass the path to the dataset directory to the `--train_data_dir` argument, and then you can start training:
|
27 |
-
|
28 |
-
```bash
|
29 |
-
accelerate launch train_unconditional.py \
|
30 |
-
--train_data_dir <path-to-train-directory> \
|
31 |
-
<other-arguments>
|
32 |
-
```
|
33 |
-
|
34 |
-
## Upload your data to the Hub
|
35 |
-
|
36 |
-
<Tip>
|
37 |
-
|
38 |
-
💡 For more details and context about creating and uploading a dataset to the Hub, take a look at the [Image search with 🤗 Datasets](https://huggingface.co/blog/image-search-datasets) post.
|
39 |
-
|
40 |
-
</Tip>
|
41 |
-
|
42 |
-
Start by creating a dataset with the [`ImageFolder`](https://huggingface.co/docs/datasets/image_load#imagefolder) feature, which creates an `image` column containing the PIL-encoded images.
|
43 |
-
|
44 |
-
You can use the `data_dir` or `data_files` parameters to specify the location of the dataset. The `data_files` parameter supports mapping specific files to dataset splits like `train` or `test`:
|
45 |
-
|
46 |
-
```python
|
47 |
-
from datasets import load_dataset
|
48 |
-
|
49 |
-
# example 1: local folder
|
50 |
-
dataset = load_dataset("imagefolder", data_dir="path_to_your_folder")
|
51 |
-
|
52 |
-
# example 2: local files (supported formats are tar, gzip, zip, xz, rar, zstd)
|
53 |
-
dataset = load_dataset("imagefolder", data_files="path_to_zip_file")
|
54 |
-
|
55 |
-
# example 3: remote files (supported formats are tar, gzip, zip, xz, rar, zstd)
|
56 |
-
dataset = load_dataset(
|
57 |
-
"imagefolder",
|
58 |
-
data_files="https://download.microsoft.com/download/3/E/1/3E1C3F21-ECDB-4869-8368-6DEBA77B919F/kagglecatsanddogs_3367a.zip",
|
59 |
-
)
|
60 |
-
|
61 |
-
# example 4: providing several splits
|
62 |
-
dataset = load_dataset(
|
63 |
-
"imagefolder", data_files={"train": ["path/to/file1", "path/to/file2"], "test": ["path/to/file3", "path/to/file4"]}
|
64 |
-
)
|
65 |
-
```
|
66 |
-
|
67 |
-
Then use the [`~datasets.Dataset.push_to_hub`] method to upload the dataset to the Hub:
|
68 |
-
|
69 |
-
```python
|
70 |
-
# assuming you have ran the huggingface-cli login command in a terminal
|
71 |
-
dataset.push_to_hub("name_of_your_dataset")
|
72 |
-
|
73 |
-
# if you want to push to a private repo, simply pass private=True:
|
74 |
-
dataset.push_to_hub("name_of_your_dataset", private=True)
|
75 |
-
```
|
76 |
-
|
77 |
-
Now the dataset is available for training by passing the dataset name to the `--dataset_name` argument:
|
78 |
-
|
79 |
-
```bash
|
80 |
-
accelerate launch --mixed_precision="fp16" train_text_to_image.py \
|
81 |
-
--pretrained_model_name_or_path="runwayml/stable-diffusion-v1-5" \
|
82 |
-
--dataset_name="name_of_your_dataset" \
|
83 |
-
<other-arguments>
|
84 |
-
```
|
85 |
-
|
86 |
-
## Next steps
|
87 |
-
|
88 |
-
Now that you've created a dataset, you can plug it into the `train_data_dir` (if your dataset is local) or `dataset_name` (if your dataset is on the Hub) arguments of a training script.
|
89 |
-
|
90 |
-
For your next steps, feel free to try and use your dataset to train a model for [unconditional generation](uncondtional_training) or [text-to-image generation](text2image)!
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
spaces/Androidonnxfork/CivitAi-to-Diffusers/diffusers/docs/source/en/using-diffusers/using_safetensors.md
DELETED
@@ -1,70 +0,0 @@
|
|
1 |
-
# Load safetensors
|
2 |
-
|
3 |
-
[[open-in-colab]]
|
4 |
-
|
5 |
-
[safetensors](https://github.com/huggingface/safetensors) is a safe and fast file format for storing and loading tensors. Typically, PyTorch model weights are saved or *pickled* into a `.bin` file with Python's [`pickle`](https://docs.python.org/3/library/pickle.html) utility. However, `pickle` is not secure and pickled files may contain malicious code that can be executed. safetensors is a secure alternative to `pickle`, making it ideal for sharing model weights.
|
6 |
-
|
7 |
-
This guide will show you how you load `.safetensor` files, and how to convert Stable Diffusion model weights stored in other formats to `.safetensor`. Before you start, make sure you have safetensors installed:
|
8 |
-
|
9 |
-
```py
|
10 |
-
# uncomment to install the necessary libraries in Colab
|
11 |
-
#!pip install safetensors
|
12 |
-
```
|
13 |
-
|
14 |
-
If you look at the [`runwayml/stable-diffusion-v1-5`](https://huggingface.co/runwayml/stable-diffusion-v1-5/tree/main) repository, you'll see weights inside the `text_encoder`, `unet` and `vae` subfolders are stored in the `.safetensors` format. By default, 🤗 Diffusers automatically loads these `.safetensors` files from their subfolders if they're available in the model repository.
|
15 |
-
|
16 |
-
For more explicit control, you can optionally set `use_safetensors=True` (if `safetensors` is not installed, you'll get an error message asking you to install it):
|
17 |
-
|
18 |
-
```py
|
19 |
-
from diffusers import DiffusionPipeline
|
20 |
-
|
21 |
-
pipeline = DiffusionPipeline.from_pretrained("runwayml/stable-diffusion-v1-5", use_safetensors=True)
|
22 |
-
```
|
23 |
-
|
24 |
-
However, model weights are not necessarily stored in separate subfolders like in the example above. Sometimes, all the weights are stored in a single `.safetensors` file. In this case, if the weights are Stable Diffusion weights, you can load the file directly with the [`~diffusers.loaders.FromSingleFileMixin.from_single_file`] method:
|
25 |
-
|
26 |
-
```py
|
27 |
-
from diffusers import StableDiffusionPipeline
|
28 |
-
|
29 |
-
pipeline = StableDiffusionPipeline.from_single_file(
|
30 |
-
"https://huggingface.co/WarriorMama777/OrangeMixs/blob/main/Models/AbyssOrangeMix/AbyssOrangeMix.safetensors"
|
31 |
-
)
|
32 |
-
```
|
33 |
-
|
34 |
-
## Convert to safetensors
|
35 |
-
|
36 |
-
Not all weights on the Hub are available in the `.safetensors` format, and you may encounter weights stored as `.bin`. In this case, use the [Convert Space](https://huggingface.co/spaces/diffusers/convert) to convert the weights to `.safetensors`. The Convert Space downloads the pickled weights, converts them, and opens a Pull Request to upload the newly converted `.safetensors` file on the Hub. This way, if there is any malicious code contained in the pickled files, they're uploaded to the Hub - which has a [security scanner](https://huggingface.co/docs/hub/security-pickle#hubs-security-scanner) to detect unsafe files and suspicious pickle imports - instead of your computer.
|
37 |
-
|
38 |
-
You can use the model with the new `.safetensors` weights by specifying the reference to the Pull Request in the `revision` parameter (you can also test it in this [Check PR](https://huggingface.co/spaces/diffusers/check_pr) Space on the Hub), for example `refs/pr/22`:
|
39 |
-
|
40 |
-
```py
|
41 |
-
from diffusers import DiffusionPipeline
|
42 |
-
|
43 |
-
pipeline = DiffusionPipeline.from_pretrained("stabilityai/stable-diffusion-2-1", revision="refs/pr/22")
|
44 |
-
```
|
45 |
-
|
46 |
-
## Why use safetensors?
|
47 |
-
|
48 |
-
There are several reasons for using safetensors:
|
49 |
-
|
50 |
-
- Safety is the number one reason for using safetensors. As open-source and model distribution grows, it is important to be able to trust the model weights you downloaded don't contain any malicious code. The current size of the header in safetensors prevents parsing extremely large JSON files.
|
51 |
-
- Loading speed between switching models is another reason to use safetensors, which performs zero-copy of the tensors. It is especially fast compared to `pickle` if you're loading the weights to CPU (the default case), and just as fast if not faster when directly loading the weights to GPU. You'll only notice the performance difference if the model is already loaded, and not if you're downloading the weights or loading the model for the first time.
|
52 |
-
|
53 |
-
The time it takes to load the entire pipeline:
|
54 |
-
|
55 |
-
```py
|
56 |
-
from diffusers import StableDiffusionPipeline
|
57 |
-
|
58 |
-
pipeline = StableDiffusionPipeline.from_pretrained("stabilityai/stable-diffusion-2-1")
|
59 |
-
"Loaded in safetensors 0:00:02.033658"
|
60 |
-
"Loaded in PyTorch 0:00:02.663379"
|
61 |
-
```
|
62 |
-
|
63 |
-
But the actual time it takes to load 500MB of the model weights is only:
|
64 |
-
|
65 |
-
```bash
|
66 |
-
safetensors: 3.4873ms
|
67 |
-
PyTorch: 172.7537ms
|
68 |
-
```
|
69 |
-
|
70 |
-
- Lazy loading is also supported in safetensors, which is useful in distributed settings to only load some of the tensors. This format allowed the [BLOOM](https://huggingface.co/bigscience/bloom) model to be loaded in 45 seconds on 8 GPUs instead of 10 minutes with regular PyTorch weights.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
spaces/Androidonnxfork/CivitAi-to-Diffusers/diffusers/tests/models/test_activations.py
DELETED
@@ -1,48 +0,0 @@
|
|
1 |
-
import unittest
|
2 |
-
|
3 |
-
import torch
|
4 |
-
from torch import nn
|
5 |
-
|
6 |
-
from diffusers.models.activations import get_activation
|
7 |
-
|
8 |
-
|
9 |
-
class ActivationsTests(unittest.TestCase):
|
10 |
-
def test_swish(self):
|
11 |
-
act = get_activation("swish")
|
12 |
-
|
13 |
-
self.assertIsInstance(act, nn.SiLU)
|
14 |
-
|
15 |
-
self.assertEqual(act(torch.tensor(-100, dtype=torch.float32)).item(), 0)
|
16 |
-
self.assertNotEqual(act(torch.tensor(-1, dtype=torch.float32)).item(), 0)
|
17 |
-
self.assertEqual(act(torch.tensor(0, dtype=torch.float32)).item(), 0)
|
18 |
-
self.assertEqual(act(torch.tensor(20, dtype=torch.float32)).item(), 20)
|
19 |
-
|
20 |
-
def test_silu(self):
|
21 |
-
act = get_activation("silu")
|
22 |
-
|
23 |
-
self.assertIsInstance(act, nn.SiLU)
|
24 |
-
|
25 |
-
self.assertEqual(act(torch.tensor(-100, dtype=torch.float32)).item(), 0)
|
26 |
-
self.assertNotEqual(act(torch.tensor(-1, dtype=torch.float32)).item(), 0)
|
27 |
-
self.assertEqual(act(torch.tensor(0, dtype=torch.float32)).item(), 0)
|
28 |
-
self.assertEqual(act(torch.tensor(20, dtype=torch.float32)).item(), 20)
|
29 |
-
|
30 |
-
def test_mish(self):
|
31 |
-
act = get_activation("mish")
|
32 |
-
|
33 |
-
self.assertIsInstance(act, nn.Mish)
|
34 |
-
|
35 |
-
self.assertEqual(act(torch.tensor(-200, dtype=torch.float32)).item(), 0)
|
36 |
-
self.assertNotEqual(act(torch.tensor(-1, dtype=torch.float32)).item(), 0)
|
37 |
-
self.assertEqual(act(torch.tensor(0, dtype=torch.float32)).item(), 0)
|
38 |
-
self.assertEqual(act(torch.tensor(20, dtype=torch.float32)).item(), 20)
|
39 |
-
|
40 |
-
def test_gelu(self):
|
41 |
-
act = get_activation("gelu")
|
42 |
-
|
43 |
-
self.assertIsInstance(act, nn.GELU)
|
44 |
-
|
45 |
-
self.assertEqual(act(torch.tensor(-100, dtype=torch.float32)).item(), 0)
|
46 |
-
self.assertNotEqual(act(torch.tensor(-1, dtype=torch.float32)).item(), 0)
|
47 |
-
self.assertEqual(act(torch.tensor(0, dtype=torch.float32)).item(), 0)
|
48 |
-
self.assertEqual(act(torch.tensor(20, dtype=torch.float32)).item(), 20)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
spaces/Androidonnxfork/CivitAi-to-Diffusers/diffusers/utils/check_doc_toc.py
DELETED
@@ -1,158 +0,0 @@
|
|
1 |
-
# coding=utf-8
|
2 |
-
# Copyright 2023 The HuggingFace Inc. team.
|
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 argparse
|
17 |
-
from collections import defaultdict
|
18 |
-
|
19 |
-
import yaml
|
20 |
-
|
21 |
-
|
22 |
-
PATH_TO_TOC = "docs/source/en/_toctree.yml"
|
23 |
-
|
24 |
-
|
25 |
-
def clean_doc_toc(doc_list):
|
26 |
-
"""
|
27 |
-
Cleans the table of content of the model documentation by removing duplicates and sorting models alphabetically.
|
28 |
-
"""
|
29 |
-
counts = defaultdict(int)
|
30 |
-
overview_doc = []
|
31 |
-
new_doc_list = []
|
32 |
-
for doc in doc_list:
|
33 |
-
if "local" in doc:
|
34 |
-
counts[doc["local"]] += 1
|
35 |
-
|
36 |
-
if doc["title"].lower() == "overview":
|
37 |
-
overview_doc.append({"local": doc["local"], "title": doc["title"]})
|
38 |
-
else:
|
39 |
-
new_doc_list.append(doc)
|
40 |
-
|
41 |
-
doc_list = new_doc_list
|
42 |
-
duplicates = [key for key, value in counts.items() if value > 1]
|
43 |
-
|
44 |
-
new_doc = []
|
45 |
-
for duplicate_key in duplicates:
|
46 |
-
titles = list({doc["title"] for doc in doc_list if doc["local"] == duplicate_key})
|
47 |
-
if len(titles) > 1:
|
48 |
-
raise ValueError(
|
49 |
-
f"{duplicate_key} is present several times in the documentation table of content at "
|
50 |
-
"`docs/source/en/_toctree.yml` with different *Title* values. Choose one of those and remove the "
|
51 |
-
"others."
|
52 |
-
)
|
53 |
-
# Only add this once
|
54 |
-
new_doc.append({"local": duplicate_key, "title": titles[0]})
|
55 |
-
|
56 |
-
# Add none duplicate-keys
|
57 |
-
new_doc.extend([doc for doc in doc_list if "local" not in counts or counts[doc["local"]] == 1])
|
58 |
-
new_doc = sorted(new_doc, key=lambda s: s["title"].lower())
|
59 |
-
|
60 |
-
# "overview" gets special treatment and is always first
|
61 |
-
if len(overview_doc) > 1:
|
62 |
-
raise ValueError("{doc_list} has two 'overview' docs which is not allowed.")
|
63 |
-
|
64 |
-
overview_doc.extend(new_doc)
|
65 |
-
|
66 |
-
# Sort
|
67 |
-
return overview_doc
|
68 |
-
|
69 |
-
|
70 |
-
def check_scheduler_doc(overwrite=False):
|
71 |
-
with open(PATH_TO_TOC, encoding="utf-8") as f:
|
72 |
-
content = yaml.safe_load(f.read())
|
73 |
-
|
74 |
-
# Get to the API doc
|
75 |
-
api_idx = 0
|
76 |
-
while content[api_idx]["title"] != "API":
|
77 |
-
api_idx += 1
|
78 |
-
api_doc = content[api_idx]["sections"]
|
79 |
-
|
80 |
-
# Then to the model doc
|
81 |
-
scheduler_idx = 0
|
82 |
-
while api_doc[scheduler_idx]["title"] != "Schedulers":
|
83 |
-
scheduler_idx += 1
|
84 |
-
|
85 |
-
scheduler_doc = api_doc[scheduler_idx]["sections"]
|
86 |
-
new_scheduler_doc = clean_doc_toc(scheduler_doc)
|
87 |
-
|
88 |
-
diff = False
|
89 |
-
if new_scheduler_doc != scheduler_doc:
|
90 |
-
diff = True
|
91 |
-
if overwrite:
|
92 |
-
api_doc[scheduler_idx]["sections"] = new_scheduler_doc
|
93 |
-
|
94 |
-
if diff:
|
95 |
-
if overwrite:
|
96 |
-
content[api_idx]["sections"] = api_doc
|
97 |
-
with open(PATH_TO_TOC, "w", encoding="utf-8") as f:
|
98 |
-
f.write(yaml.dump(content, allow_unicode=True))
|
99 |
-
else:
|
100 |
-
raise ValueError(
|
101 |
-
"The model doc part of the table of content is not properly sorted, run `make style` to fix this."
|
102 |
-
)
|
103 |
-
|
104 |
-
|
105 |
-
def check_pipeline_doc(overwrite=False):
|
106 |
-
with open(PATH_TO_TOC, encoding="utf-8") as f:
|
107 |
-
content = yaml.safe_load(f.read())
|
108 |
-
|
109 |
-
# Get to the API doc
|
110 |
-
api_idx = 0
|
111 |
-
while content[api_idx]["title"] != "API":
|
112 |
-
api_idx += 1
|
113 |
-
api_doc = content[api_idx]["sections"]
|
114 |
-
|
115 |
-
# Then to the model doc
|
116 |
-
pipeline_idx = 0
|
117 |
-
while api_doc[pipeline_idx]["title"] != "Pipelines":
|
118 |
-
pipeline_idx += 1
|
119 |
-
|
120 |
-
diff = False
|
121 |
-
pipeline_docs = api_doc[pipeline_idx]["sections"]
|
122 |
-
new_pipeline_docs = []
|
123 |
-
|
124 |
-
# sort sub pipeline docs
|
125 |
-
for pipeline_doc in pipeline_docs:
|
126 |
-
if "section" in pipeline_doc:
|
127 |
-
sub_pipeline_doc = pipeline_doc["section"]
|
128 |
-
new_sub_pipeline_doc = clean_doc_toc(sub_pipeline_doc)
|
129 |
-
if overwrite:
|
130 |
-
pipeline_doc["section"] = new_sub_pipeline_doc
|
131 |
-
new_pipeline_docs.append(pipeline_doc)
|
132 |
-
|
133 |
-
# sort overall pipeline doc
|
134 |
-
new_pipeline_docs = clean_doc_toc(new_pipeline_docs)
|
135 |
-
|
136 |
-
if new_pipeline_docs != pipeline_docs:
|
137 |
-
diff = True
|
138 |
-
if overwrite:
|
139 |
-
api_doc[pipeline_idx]["sections"] = new_pipeline_docs
|
140 |
-
|
141 |
-
if diff:
|
142 |
-
if overwrite:
|
143 |
-
content[api_idx]["sections"] = api_doc
|
144 |
-
with open(PATH_TO_TOC, "w", encoding="utf-8") as f:
|
145 |
-
f.write(yaml.dump(content, allow_unicode=True))
|
146 |
-
else:
|
147 |
-
raise ValueError(
|
148 |
-
"The model doc part of the table of content is not properly sorted, run `make style` to fix this."
|
149 |
-
)
|
150 |
-
|
151 |
-
|
152 |
-
if __name__ == "__main__":
|
153 |
-
parser = argparse.ArgumentParser()
|
154 |
-
parser.add_argument("--fix_and_overwrite", action="store_true", help="Whether to fix inconsistencies.")
|
155 |
-
args = parser.parse_args()
|
156 |
-
|
157 |
-
check_scheduler_doc(args.fix_and_overwrite)
|
158 |
-
check_pipeline_doc(args.fix_and_overwrite)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
spaces/Andy1621/uniformer_image_detection/configs/_base_/datasets/voc0712.py
DELETED
@@ -1,55 +0,0 @@
|
|
1 |
-
# dataset settings
|
2 |
-
dataset_type = 'VOCDataset'
|
3 |
-
data_root = 'data/VOCdevkit/'
|
4 |
-
img_norm_cfg = dict(
|
5 |
-
mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375], to_rgb=True)
|
6 |
-
train_pipeline = [
|
7 |
-
dict(type='LoadImageFromFile'),
|
8 |
-
dict(type='LoadAnnotations', with_bbox=True),
|
9 |
-
dict(type='Resize', img_scale=(1000, 600), keep_ratio=True),
|
10 |
-
dict(type='RandomFlip', flip_ratio=0.5),
|
11 |
-
dict(type='Normalize', **img_norm_cfg),
|
12 |
-
dict(type='Pad', size_divisor=32),
|
13 |
-
dict(type='DefaultFormatBundle'),
|
14 |
-
dict(type='Collect', keys=['img', 'gt_bboxes', 'gt_labels']),
|
15 |
-
]
|
16 |
-
test_pipeline = [
|
17 |
-
dict(type='LoadImageFromFile'),
|
18 |
-
dict(
|
19 |
-
type='MultiScaleFlipAug',
|
20 |
-
img_scale=(1000, 600),
|
21 |
-
flip=False,
|
22 |
-
transforms=[
|
23 |
-
dict(type='Resize', keep_ratio=True),
|
24 |
-
dict(type='RandomFlip'),
|
25 |
-
dict(type='Normalize', **img_norm_cfg),
|
26 |
-
dict(type='Pad', size_divisor=32),
|
27 |
-
dict(type='ImageToTensor', keys=['img']),
|
28 |
-
dict(type='Collect', keys=['img']),
|
29 |
-
])
|
30 |
-
]
|
31 |
-
data = dict(
|
32 |
-
samples_per_gpu=2,
|
33 |
-
workers_per_gpu=2,
|
34 |
-
train=dict(
|
35 |
-
type='RepeatDataset',
|
36 |
-
times=3,
|
37 |
-
dataset=dict(
|
38 |
-
type=dataset_type,
|
39 |
-
ann_file=[
|
40 |
-
data_root + 'VOC2007/ImageSets/Main/trainval.txt',
|
41 |
-
data_root + 'VOC2012/ImageSets/Main/trainval.txt'
|
42 |
-
],
|
43 |
-
img_prefix=[data_root + 'VOC2007/', data_root + 'VOC2012/'],
|
44 |
-
pipeline=train_pipeline)),
|
45 |
-
val=dict(
|
46 |
-
type=dataset_type,
|
47 |
-
ann_file=data_root + 'VOC2007/ImageSets/Main/test.txt',
|
48 |
-
img_prefix=data_root + 'VOC2007/',
|
49 |
-
pipeline=test_pipeline),
|
50 |
-
test=dict(
|
51 |
-
type=dataset_type,
|
52 |
-
ann_file=data_root + 'VOC2007/ImageSets/Main/test.txt',
|
53 |
-
img_prefix=data_root + 'VOC2007/',
|
54 |
-
pipeline=test_pipeline))
|
55 |
-
evaluation = dict(interval=1, metric='mAP')
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
spaces/Andy1621/uniformer_image_detection/configs/gn/mask_rcnn_r101_fpn_gn-all_2x_coco.py
DELETED
@@ -1,3 +0,0 @@
|
|
1 |
-
_base_ = './mask_rcnn_r50_fpn_gn-all_2x_coco.py'
|
2 |
-
model = dict(
|
3 |
-
pretrained='open-mmlab://detectron/resnet101_gn', backbone=dict(depth=101))
|
|
|
|
|
|
|
|
spaces/Andy1621/uniformer_image_segmentation/configs/deeplabv3plus/deeplabv3plus_r50-d8_512x512_40k_voc12aug.py
DELETED
@@ -1,7 +0,0 @@
|
|
1 |
-
_base_ = [
|
2 |
-
'../_base_/models/deeplabv3plus_r50-d8.py',
|
3 |
-
'../_base_/datasets/pascal_voc12_aug.py', '../_base_/default_runtime.py',
|
4 |
-
'../_base_/schedules/schedule_40k.py'
|
5 |
-
]
|
6 |
-
model = dict(
|
7 |
-
decode_head=dict(num_classes=21), auxiliary_head=dict(num_classes=21))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
spaces/Ataturk-Chatbot/HuggingFaceChat/venv/lib/python3.11/site-packages/pip/_internal/cli/autocompletion.py
DELETED
@@ -1,171 +0,0 @@
|
|
1 |
-
"""Logic that powers autocompletion installed by ``pip completion``.
|
2 |
-
"""
|
3 |
-
|
4 |
-
import optparse
|
5 |
-
import os
|
6 |
-
import sys
|
7 |
-
from itertools import chain
|
8 |
-
from typing import Any, Iterable, List, Optional
|
9 |
-
|
10 |
-
from pip._internal.cli.main_parser import create_main_parser
|
11 |
-
from pip._internal.commands import commands_dict, create_command
|
12 |
-
from pip._internal.metadata import get_default_environment
|
13 |
-
|
14 |
-
|
15 |
-
def autocomplete() -> None:
|
16 |
-
"""Entry Point for completion of main and subcommand options."""
|
17 |
-
# Don't complete if user hasn't sourced bash_completion file.
|
18 |
-
if "PIP_AUTO_COMPLETE" not in os.environ:
|
19 |
-
return
|
20 |
-
cwords = os.environ["COMP_WORDS"].split()[1:]
|
21 |
-
cword = int(os.environ["COMP_CWORD"])
|
22 |
-
try:
|
23 |
-
current = cwords[cword - 1]
|
24 |
-
except IndexError:
|
25 |
-
current = ""
|
26 |
-
|
27 |
-
parser = create_main_parser()
|
28 |
-
subcommands = list(commands_dict)
|
29 |
-
options = []
|
30 |
-
|
31 |
-
# subcommand
|
32 |
-
subcommand_name: Optional[str] = None
|
33 |
-
for word in cwords:
|
34 |
-
if word in subcommands:
|
35 |
-
subcommand_name = word
|
36 |
-
break
|
37 |
-
# subcommand options
|
38 |
-
if subcommand_name is not None:
|
39 |
-
# special case: 'help' subcommand has no options
|
40 |
-
if subcommand_name == "help":
|
41 |
-
sys.exit(1)
|
42 |
-
# special case: list locally installed dists for show and uninstall
|
43 |
-
should_list_installed = not current.startswith("-") and subcommand_name in [
|
44 |
-
"show",
|
45 |
-
"uninstall",
|
46 |
-
]
|
47 |
-
if should_list_installed:
|
48 |
-
env = get_default_environment()
|
49 |
-
lc = current.lower()
|
50 |
-
installed = [
|
51 |
-
dist.canonical_name
|
52 |
-
for dist in env.iter_installed_distributions(local_only=True)
|
53 |
-
if dist.canonical_name.startswith(lc)
|
54 |
-
and dist.canonical_name not in cwords[1:]
|
55 |
-
]
|
56 |
-
# if there are no dists installed, fall back to option completion
|
57 |
-
if installed:
|
58 |
-
for dist in installed:
|
59 |
-
print(dist)
|
60 |
-
sys.exit(1)
|
61 |
-
|
62 |
-
should_list_installables = (
|
63 |
-
not current.startswith("-") and subcommand_name == "install"
|
64 |
-
)
|
65 |
-
if should_list_installables:
|
66 |
-
for path in auto_complete_paths(current, "path"):
|
67 |
-
print(path)
|
68 |
-
sys.exit(1)
|
69 |
-
|
70 |
-
subcommand = create_command(subcommand_name)
|
71 |
-
|
72 |
-
for opt in subcommand.parser.option_list_all:
|
73 |
-
if opt.help != optparse.SUPPRESS_HELP:
|
74 |
-
for opt_str in opt._long_opts + opt._short_opts:
|
75 |
-
options.append((opt_str, opt.nargs))
|
76 |
-
|
77 |
-
# filter out previously specified options from available options
|
78 |
-
prev_opts = [x.split("=")[0] for x in cwords[1 : cword - 1]]
|
79 |
-
options = [(x, v) for (x, v) in options if x not in prev_opts]
|
80 |
-
# filter options by current input
|
81 |
-
options = [(k, v) for k, v in options if k.startswith(current)]
|
82 |
-
# get completion type given cwords and available subcommand options
|
83 |
-
completion_type = get_path_completion_type(
|
84 |
-
cwords,
|
85 |
-
cword,
|
86 |
-
subcommand.parser.option_list_all,
|
87 |
-
)
|
88 |
-
# get completion files and directories if ``completion_type`` is
|
89 |
-
# ``<file>``, ``<dir>`` or ``<path>``
|
90 |
-
if completion_type:
|
91 |
-
paths = auto_complete_paths(current, completion_type)
|
92 |
-
options = [(path, 0) for path in paths]
|
93 |
-
for option in options:
|
94 |
-
opt_label = option[0]
|
95 |
-
# append '=' to options which require args
|
96 |
-
if option[1] and option[0][:2] == "--":
|
97 |
-
opt_label += "="
|
98 |
-
print(opt_label)
|
99 |
-
else:
|
100 |
-
# show main parser options only when necessary
|
101 |
-
|
102 |
-
opts = [i.option_list for i in parser.option_groups]
|
103 |
-
opts.append(parser.option_list)
|
104 |
-
flattened_opts = chain.from_iterable(opts)
|
105 |
-
if current.startswith("-"):
|
106 |
-
for opt in flattened_opts:
|
107 |
-
if opt.help != optparse.SUPPRESS_HELP:
|
108 |
-
subcommands += opt._long_opts + opt._short_opts
|
109 |
-
else:
|
110 |
-
# get completion type given cwords and all available options
|
111 |
-
completion_type = get_path_completion_type(cwords, cword, flattened_opts)
|
112 |
-
if completion_type:
|
113 |
-
subcommands = list(auto_complete_paths(current, completion_type))
|
114 |
-
|
115 |
-
print(" ".join([x for x in subcommands if x.startswith(current)]))
|
116 |
-
sys.exit(1)
|
117 |
-
|
118 |
-
|
119 |
-
def get_path_completion_type(
|
120 |
-
cwords: List[str], cword: int, opts: Iterable[Any]
|
121 |
-
) -> Optional[str]:
|
122 |
-
"""Get the type of path completion (``file``, ``dir``, ``path`` or None)
|
123 |
-
|
124 |
-
:param cwords: same as the environmental variable ``COMP_WORDS``
|
125 |
-
:param cword: same as the environmental variable ``COMP_CWORD``
|
126 |
-
:param opts: The available options to check
|
127 |
-
:return: path completion type (``file``, ``dir``, ``path`` or None)
|
128 |
-
"""
|
129 |
-
if cword < 2 or not cwords[cword - 2].startswith("-"):
|
130 |
-
return None
|
131 |
-
for opt in opts:
|
132 |
-
if opt.help == optparse.SUPPRESS_HELP:
|
133 |
-
continue
|
134 |
-
for o in str(opt).split("/"):
|
135 |
-
if cwords[cword - 2].split("=")[0] == o:
|
136 |
-
if not opt.metavar or any(
|
137 |
-
x in ("path", "file", "dir") for x in opt.metavar.split("/")
|
138 |
-
):
|
139 |
-
return opt.metavar
|
140 |
-
return None
|
141 |
-
|
142 |
-
|
143 |
-
def auto_complete_paths(current: str, completion_type: str) -> Iterable[str]:
|
144 |
-
"""If ``completion_type`` is ``file`` or ``path``, list all regular files
|
145 |
-
and directories starting with ``current``; otherwise only list directories
|
146 |
-
starting with ``current``.
|
147 |
-
|
148 |
-
:param current: The word to be completed
|
149 |
-
:param completion_type: path completion type(``file``, ``path`` or ``dir``)
|
150 |
-
:return: A generator of regular files and/or directories
|
151 |
-
"""
|
152 |
-
directory, filename = os.path.split(current)
|
153 |
-
current_path = os.path.abspath(directory)
|
154 |
-
# Don't complete paths if they can't be accessed
|
155 |
-
if not os.access(current_path, os.R_OK):
|
156 |
-
return
|
157 |
-
filename = os.path.normcase(filename)
|
158 |
-
# list all files that start with ``filename``
|
159 |
-
file_list = (
|
160 |
-
x for x in os.listdir(current_path) if os.path.normcase(x).startswith(filename)
|
161 |
-
)
|
162 |
-
for f in file_list:
|
163 |
-
opt = os.path.join(current_path, f)
|
164 |
-
comp_file = os.path.normcase(os.path.join(directory, f))
|
165 |
-
# complete regular files when there is not ``<dir>`` after option
|
166 |
-
# complete directories when there is ``<file>``, ``<path>`` or
|
167 |
-
# ``<dir>``after option
|
168 |
-
if completion_type != "dir" and os.path.isfile(opt):
|
169 |
-
yield comp_file
|
170 |
-
elif os.path.isdir(opt):
|
171 |
-
yield os.path.join(comp_file, "")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
spaces/Ataturk-Chatbot/HuggingFaceChat/venv/lib/python3.11/site-packages/pip/_internal/exceptions.py
DELETED
@@ -1,733 +0,0 @@
|
|
1 |
-
"""Exceptions used throughout package.
|
2 |
-
|
3 |
-
This module MUST NOT try to import from anything within `pip._internal` to
|
4 |
-
operate. This is expected to be importable from any/all files within the
|
5 |
-
subpackage and, thus, should not depend on them.
|
6 |
-
"""
|
7 |
-
|
8 |
-
import configparser
|
9 |
-
import contextlib
|
10 |
-
import locale
|
11 |
-
import logging
|
12 |
-
import pathlib
|
13 |
-
import re
|
14 |
-
import sys
|
15 |
-
from itertools import chain, groupby, repeat
|
16 |
-
from typing import TYPE_CHECKING, Dict, Iterator, List, Optional, Union
|
17 |
-
|
18 |
-
from pip._vendor.requests.models import Request, Response
|
19 |
-
from pip._vendor.rich.console import Console, ConsoleOptions, RenderResult
|
20 |
-
from pip._vendor.rich.markup import escape
|
21 |
-
from pip._vendor.rich.text import Text
|
22 |
-
|
23 |
-
if TYPE_CHECKING:
|
24 |
-
from hashlib import _Hash
|
25 |
-
from typing import Literal
|
26 |
-
|
27 |
-
from pip._internal.metadata import BaseDistribution
|
28 |
-
from pip._internal.req.req_install import InstallRequirement
|
29 |
-
|
30 |
-
logger = logging.getLogger(__name__)
|
31 |
-
|
32 |
-
|
33 |
-
#
|
34 |
-
# Scaffolding
|
35 |
-
#
|
36 |
-
def _is_kebab_case(s: str) -> bool:
|
37 |
-
return re.match(r"^[a-z]+(-[a-z]+)*$", s) is not None
|
38 |
-
|
39 |
-
|
40 |
-
def _prefix_with_indent(
|
41 |
-
s: Union[Text, str],
|
42 |
-
console: Console,
|
43 |
-
*,
|
44 |
-
prefix: str,
|
45 |
-
indent: str,
|
46 |
-
) -> Text:
|
47 |
-
if isinstance(s, Text):
|
48 |
-
text = s
|
49 |
-
else:
|
50 |
-
text = console.render_str(s)
|
51 |
-
|
52 |
-
return console.render_str(prefix, overflow="ignore") + console.render_str(
|
53 |
-
f"\n{indent}", overflow="ignore"
|
54 |
-
).join(text.split(allow_blank=True))
|
55 |
-
|
56 |
-
|
57 |
-
class PipError(Exception):
|
58 |
-
"""The base pip error."""
|
59 |
-
|
60 |
-
|
61 |
-
class DiagnosticPipError(PipError):
|
62 |
-
"""An error, that presents diagnostic information to the user.
|
63 |
-
|
64 |
-
This contains a bunch of logic, to enable pretty presentation of our error
|
65 |
-
messages. Each error gets a unique reference. Each error can also include
|
66 |
-
additional context, a hint and/or a note -- which are presented with the
|
67 |
-
main error message in a consistent style.
|
68 |
-
|
69 |
-
This is adapted from the error output styling in `sphinx-theme-builder`.
|
70 |
-
"""
|
71 |
-
|
72 |
-
reference: str
|
73 |
-
|
74 |
-
def __init__(
|
75 |
-
self,
|
76 |
-
*,
|
77 |
-
kind: 'Literal["error", "warning"]' = "error",
|
78 |
-
reference: Optional[str] = None,
|
79 |
-
message: Union[str, Text],
|
80 |
-
context: Optional[Union[str, Text]],
|
81 |
-
hint_stmt: Optional[Union[str, Text]],
|
82 |
-
note_stmt: Optional[Union[str, Text]] = None,
|
83 |
-
link: Optional[str] = None,
|
84 |
-
) -> None:
|
85 |
-
# Ensure a proper reference is provided.
|
86 |
-
if reference is None:
|
87 |
-
assert hasattr(self, "reference"), "error reference not provided!"
|
88 |
-
reference = self.reference
|
89 |
-
assert _is_kebab_case(reference), "error reference must be kebab-case!"
|
90 |
-
|
91 |
-
self.kind = kind
|
92 |
-
self.reference = reference
|
93 |
-
|
94 |
-
self.message = message
|
95 |
-
self.context = context
|
96 |
-
|
97 |
-
self.note_stmt = note_stmt
|
98 |
-
self.hint_stmt = hint_stmt
|
99 |
-
|
100 |
-
self.link = link
|
101 |
-
|
102 |
-
super().__init__(f"<{self.__class__.__name__}: {self.reference}>")
|
103 |
-
|
104 |
-
def __repr__(self) -> str:
|
105 |
-
return (
|
106 |
-
f"<{self.__class__.__name__}("
|
107 |
-
f"reference={self.reference!r}, "
|
108 |
-
f"message={self.message!r}, "
|
109 |
-
f"context={self.context!r}, "
|
110 |
-
f"note_stmt={self.note_stmt!r}, "
|
111 |
-
f"hint_stmt={self.hint_stmt!r}"
|
112 |
-
")>"
|
113 |
-
)
|
114 |
-
|
115 |
-
def __rich_console__(
|
116 |
-
self,
|
117 |
-
console: Console,
|
118 |
-
options: ConsoleOptions,
|
119 |
-
) -> RenderResult:
|
120 |
-
colour = "red" if self.kind == "error" else "yellow"
|
121 |
-
|
122 |
-
yield f"[{colour} bold]{self.kind}[/]: [bold]{self.reference}[/]"
|
123 |
-
yield ""
|
124 |
-
|
125 |
-
if not options.ascii_only:
|
126 |
-
# Present the main message, with relevant context indented.
|
127 |
-
if self.context is not None:
|
128 |
-
yield _prefix_with_indent(
|
129 |
-
self.message,
|
130 |
-
console,
|
131 |
-
prefix=f"[{colour}]×[/] ",
|
132 |
-
indent=f"[{colour}]│[/] ",
|
133 |
-
)
|
134 |
-
yield _prefix_with_indent(
|
135 |
-
self.context,
|
136 |
-
console,
|
137 |
-
prefix=f"[{colour}]╰─>[/] ",
|
138 |
-
indent=f"[{colour}] [/] ",
|
139 |
-
)
|
140 |
-
else:
|
141 |
-
yield _prefix_with_indent(
|
142 |
-
self.message,
|
143 |
-
console,
|
144 |
-
prefix="[red]×[/] ",
|
145 |
-
indent=" ",
|
146 |
-
)
|
147 |
-
else:
|
148 |
-
yield self.message
|
149 |
-
if self.context is not None:
|
150 |
-
yield ""
|
151 |
-
yield self.context
|
152 |
-
|
153 |
-
if self.note_stmt is not None or self.hint_stmt is not None:
|
154 |
-
yield ""
|
155 |
-
|
156 |
-
if self.note_stmt is not None:
|
157 |
-
yield _prefix_with_indent(
|
158 |
-
self.note_stmt,
|
159 |
-
console,
|
160 |
-
prefix="[magenta bold]note[/]: ",
|
161 |
-
indent=" ",
|
162 |
-
)
|
163 |
-
if self.hint_stmt is not None:
|
164 |
-
yield _prefix_with_indent(
|
165 |
-
self.hint_stmt,
|
166 |
-
console,
|
167 |
-
prefix="[cyan bold]hint[/]: ",
|
168 |
-
indent=" ",
|
169 |
-
)
|
170 |
-
|
171 |
-
if self.link is not None:
|
172 |
-
yield ""
|
173 |
-
yield f"Link: {self.link}"
|
174 |
-
|
175 |
-
|
176 |
-
#
|
177 |
-
# Actual Errors
|
178 |
-
#
|
179 |
-
class ConfigurationError(PipError):
|
180 |
-
"""General exception in configuration"""
|
181 |
-
|
182 |
-
|
183 |
-
class InstallationError(PipError):
|
184 |
-
"""General exception during installation"""
|
185 |
-
|
186 |
-
|
187 |
-
class UninstallationError(PipError):
|
188 |
-
"""General exception during uninstallation"""
|
189 |
-
|
190 |
-
|
191 |
-
class MissingPyProjectBuildRequires(DiagnosticPipError):
|
192 |
-
"""Raised when pyproject.toml has `build-system`, but no `build-system.requires`."""
|
193 |
-
|
194 |
-
reference = "missing-pyproject-build-system-requires"
|
195 |
-
|
196 |
-
def __init__(self, *, package: str) -> None:
|
197 |
-
super().__init__(
|
198 |
-
message=f"Can not process {escape(package)}",
|
199 |
-
context=Text(
|
200 |
-
"This package has an invalid pyproject.toml file.\n"
|
201 |
-
"The [build-system] table is missing the mandatory `requires` key."
|
202 |
-
),
|
203 |
-
note_stmt="This is an issue with the package mentioned above, not pip.",
|
204 |
-
hint_stmt=Text("See PEP 518 for the detailed specification."),
|
205 |
-
)
|
206 |
-
|
207 |
-
|
208 |
-
class InvalidPyProjectBuildRequires(DiagnosticPipError):
|
209 |
-
"""Raised when pyproject.toml an invalid `build-system.requires`."""
|
210 |
-
|
211 |
-
reference = "invalid-pyproject-build-system-requires"
|
212 |
-
|
213 |
-
def __init__(self, *, package: str, reason: str) -> None:
|
214 |
-
super().__init__(
|
215 |
-
message=f"Can not process {escape(package)}",
|
216 |
-
context=Text(
|
217 |
-
"This package has an invalid `build-system.requires` key in "
|
218 |
-
f"pyproject.toml.\n{reason}"
|
219 |
-
),
|
220 |
-
note_stmt="This is an issue with the package mentioned above, not pip.",
|
221 |
-
hint_stmt=Text("See PEP 518 for the detailed specification."),
|
222 |
-
)
|
223 |
-
|
224 |
-
|
225 |
-
class NoneMetadataError(PipError):
|
226 |
-
"""Raised when accessing a Distribution's "METADATA" or "PKG-INFO".
|
227 |
-
|
228 |
-
This signifies an inconsistency, when the Distribution claims to have
|
229 |
-
the metadata file (if not, raise ``FileNotFoundError`` instead), but is
|
230 |
-
not actually able to produce its content. This may be due to permission
|
231 |
-
errors.
|
232 |
-
"""
|
233 |
-
|
234 |
-
def __init__(
|
235 |
-
self,
|
236 |
-
dist: "BaseDistribution",
|
237 |
-
metadata_name: str,
|
238 |
-
) -> None:
|
239 |
-
"""
|
240 |
-
:param dist: A Distribution object.
|
241 |
-
:param metadata_name: The name of the metadata being accessed
|
242 |
-
(can be "METADATA" or "PKG-INFO").
|
243 |
-
"""
|
244 |
-
self.dist = dist
|
245 |
-
self.metadata_name = metadata_name
|
246 |
-
|
247 |
-
def __str__(self) -> str:
|
248 |
-
# Use `dist` in the error message because its stringification
|
249 |
-
# includes more information, like the version and location.
|
250 |
-
return "None {} metadata found for distribution: {}".format(
|
251 |
-
self.metadata_name,
|
252 |
-
self.dist,
|
253 |
-
)
|
254 |
-
|
255 |
-
|
256 |
-
class UserInstallationInvalid(InstallationError):
|
257 |
-
"""A --user install is requested on an environment without user site."""
|
258 |
-
|
259 |
-
def __str__(self) -> str:
|
260 |
-
return "User base directory is not specified"
|
261 |
-
|
262 |
-
|
263 |
-
class InvalidSchemeCombination(InstallationError):
|
264 |
-
def __str__(self) -> str:
|
265 |
-
before = ", ".join(str(a) for a in self.args[:-1])
|
266 |
-
return f"Cannot set {before} and {self.args[-1]} together"
|
267 |
-
|
268 |
-
|
269 |
-
class DistributionNotFound(InstallationError):
|
270 |
-
"""Raised when a distribution cannot be found to satisfy a requirement"""
|
271 |
-
|
272 |
-
|
273 |
-
class RequirementsFileParseError(InstallationError):
|
274 |
-
"""Raised when a general error occurs parsing a requirements file line."""
|
275 |
-
|
276 |
-
|
277 |
-
class BestVersionAlreadyInstalled(PipError):
|
278 |
-
"""Raised when the most up-to-date version of a package is already
|
279 |
-
installed."""
|
280 |
-
|
281 |
-
|
282 |
-
class BadCommand(PipError):
|
283 |
-
"""Raised when virtualenv or a command is not found"""
|
284 |
-
|
285 |
-
|
286 |
-
class CommandError(PipError):
|
287 |
-
"""Raised when there is an error in command-line arguments"""
|
288 |
-
|
289 |
-
|
290 |
-
class PreviousBuildDirError(PipError):
|
291 |
-
"""Raised when there's a previous conflicting build directory"""
|
292 |
-
|
293 |
-
|
294 |
-
class NetworkConnectionError(PipError):
|
295 |
-
"""HTTP connection error"""
|
296 |
-
|
297 |
-
def __init__(
|
298 |
-
self,
|
299 |
-
error_msg: str,
|
300 |
-
response: Optional[Response] = None,
|
301 |
-
request: Optional[Request] = None,
|
302 |
-
) -> None:
|
303 |
-
"""
|
304 |
-
Initialize NetworkConnectionError with `request` and `response`
|
305 |
-
objects.
|
306 |
-
"""
|
307 |
-
self.response = response
|
308 |
-
self.request = request
|
309 |
-
self.error_msg = error_msg
|
310 |
-
if (
|
311 |
-
self.response is not None
|
312 |
-
and not self.request
|
313 |
-
and hasattr(response, "request")
|
314 |
-
):
|
315 |
-
self.request = self.response.request
|
316 |
-
super().__init__(error_msg, response, request)
|
317 |
-
|
318 |
-
def __str__(self) -> str:
|
319 |
-
return str(self.error_msg)
|
320 |
-
|
321 |
-
|
322 |
-
class InvalidWheelFilename(InstallationError):
|
323 |
-
"""Invalid wheel filename."""
|
324 |
-
|
325 |
-
|
326 |
-
class UnsupportedWheel(InstallationError):
|
327 |
-
"""Unsupported wheel."""
|
328 |
-
|
329 |
-
|
330 |
-
class InvalidWheel(InstallationError):
|
331 |
-
"""Invalid (e.g. corrupt) wheel."""
|
332 |
-
|
333 |
-
def __init__(self, location: str, name: str):
|
334 |
-
self.location = location
|
335 |
-
self.name = name
|
336 |
-
|
337 |
-
def __str__(self) -> str:
|
338 |
-
return f"Wheel '{self.name}' located at {self.location} is invalid."
|
339 |
-
|
340 |
-
|
341 |
-
class MetadataInconsistent(InstallationError):
|
342 |
-
"""Built metadata contains inconsistent information.
|
343 |
-
|
344 |
-
This is raised when the metadata contains values (e.g. name and version)
|
345 |
-
that do not match the information previously obtained from sdist filename,
|
346 |
-
user-supplied ``#egg=`` value, or an install requirement name.
|
347 |
-
"""
|
348 |
-
|
349 |
-
def __init__(
|
350 |
-
self, ireq: "InstallRequirement", field: str, f_val: str, m_val: str
|
351 |
-
) -> None:
|
352 |
-
self.ireq = ireq
|
353 |
-
self.field = field
|
354 |
-
self.f_val = f_val
|
355 |
-
self.m_val = m_val
|
356 |
-
|
357 |
-
def __str__(self) -> str:
|
358 |
-
return (
|
359 |
-
f"Requested {self.ireq} has inconsistent {self.field}: "
|
360 |
-
f"expected {self.f_val!r}, but metadata has {self.m_val!r}"
|
361 |
-
)
|
362 |
-
|
363 |
-
|
364 |
-
class InstallationSubprocessError(DiagnosticPipError, InstallationError):
|
365 |
-
"""A subprocess call failed."""
|
366 |
-
|
367 |
-
reference = "subprocess-exited-with-error"
|
368 |
-
|
369 |
-
def __init__(
|
370 |
-
self,
|
371 |
-
*,
|
372 |
-
command_description: str,
|
373 |
-
exit_code: int,
|
374 |
-
output_lines: Optional[List[str]],
|
375 |
-
) -> None:
|
376 |
-
if output_lines is None:
|
377 |
-
output_prompt = Text("See above for output.")
|
378 |
-
else:
|
379 |
-
output_prompt = (
|
380 |
-
Text.from_markup(f"[red][{len(output_lines)} lines of output][/]\n")
|
381 |
-
+ Text("".join(output_lines))
|
382 |
-
+ Text.from_markup(R"[red]\[end of output][/]")
|
383 |
-
)
|
384 |
-
|
385 |
-
super().__init__(
|
386 |
-
message=(
|
387 |
-
f"[green]{escape(command_description)}[/] did not run successfully.\n"
|
388 |
-
f"exit code: {exit_code}"
|
389 |
-
),
|
390 |
-
context=output_prompt,
|
391 |
-
hint_stmt=None,
|
392 |
-
note_stmt=(
|
393 |
-
"This error originates from a subprocess, and is likely not a "
|
394 |
-
"problem with pip."
|
395 |
-
),
|
396 |
-
)
|
397 |
-
|
398 |
-
self.command_description = command_description
|
399 |
-
self.exit_code = exit_code
|
400 |
-
|
401 |
-
def __str__(self) -> str:
|
402 |
-
return f"{self.command_description} exited with {self.exit_code}"
|
403 |
-
|
404 |
-
|
405 |
-
class MetadataGenerationFailed(InstallationSubprocessError, InstallationError):
|
406 |
-
reference = "metadata-generation-failed"
|
407 |
-
|
408 |
-
def __init__(
|
409 |
-
self,
|
410 |
-
*,
|
411 |
-
package_details: str,
|
412 |
-
) -> None:
|
413 |
-
super(InstallationSubprocessError, self).__init__(
|
414 |
-
message="Encountered error while generating package metadata.",
|
415 |
-
context=escape(package_details),
|
416 |
-
hint_stmt="See above for details.",
|
417 |
-
note_stmt="This is an issue with the package mentioned above, not pip.",
|
418 |
-
)
|
419 |
-
|
420 |
-
def __str__(self) -> str:
|
421 |
-
return "metadata generation failed"
|
422 |
-
|
423 |
-
|
424 |
-
class HashErrors(InstallationError):
|
425 |
-
"""Multiple HashError instances rolled into one for reporting"""
|
426 |
-
|
427 |
-
def __init__(self) -> None:
|
428 |
-
self.errors: List["HashError"] = []
|
429 |
-
|
430 |
-
def append(self, error: "HashError") -> None:
|
431 |
-
self.errors.append(error)
|
432 |
-
|
433 |
-
def __str__(self) -> str:
|
434 |
-
lines = []
|
435 |
-
self.errors.sort(key=lambda e: e.order)
|
436 |
-
for cls, errors_of_cls in groupby(self.errors, lambda e: e.__class__):
|
437 |
-
lines.append(cls.head)
|
438 |
-
lines.extend(e.body() for e in errors_of_cls)
|
439 |
-
if lines:
|
440 |
-
return "\n".join(lines)
|
441 |
-
return ""
|
442 |
-
|
443 |
-
def __bool__(self) -> bool:
|
444 |
-
return bool(self.errors)
|
445 |
-
|
446 |
-
|
447 |
-
class HashError(InstallationError):
|
448 |
-
"""
|
449 |
-
A failure to verify a package against known-good hashes
|
450 |
-
|
451 |
-
:cvar order: An int sorting hash exception classes by difficulty of
|
452 |
-
recovery (lower being harder), so the user doesn't bother fretting
|
453 |
-
about unpinned packages when he has deeper issues, like VCS
|
454 |
-
dependencies, to deal with. Also keeps error reports in a
|
455 |
-
deterministic order.
|
456 |
-
:cvar head: A section heading for display above potentially many
|
457 |
-
exceptions of this kind
|
458 |
-
:ivar req: The InstallRequirement that triggered this error. This is
|
459 |
-
pasted on after the exception is instantiated, because it's not
|
460 |
-
typically available earlier.
|
461 |
-
|
462 |
-
"""
|
463 |
-
|
464 |
-
req: Optional["InstallRequirement"] = None
|
465 |
-
head = ""
|
466 |
-
order: int = -1
|
467 |
-
|
468 |
-
def body(self) -> str:
|
469 |
-
"""Return a summary of me for display under the heading.
|
470 |
-
|
471 |
-
This default implementation simply prints a description of the
|
472 |
-
triggering requirement.
|
473 |
-
|
474 |
-
:param req: The InstallRequirement that provoked this error, with
|
475 |
-
its link already populated by the resolver's _populate_link().
|
476 |
-
|
477 |
-
"""
|
478 |
-
return f" {self._requirement_name()}"
|
479 |
-
|
480 |
-
def __str__(self) -> str:
|
481 |
-
return f"{self.head}\n{self.body()}"
|
482 |
-
|
483 |
-
def _requirement_name(self) -> str:
|
484 |
-
"""Return a description of the requirement that triggered me.
|
485 |
-
|
486 |
-
This default implementation returns long description of the req, with
|
487 |
-
line numbers
|
488 |
-
|
489 |
-
"""
|
490 |
-
return str(self.req) if self.req else "unknown package"
|
491 |
-
|
492 |
-
|
493 |
-
class VcsHashUnsupported(HashError):
|
494 |
-
"""A hash was provided for a version-control-system-based requirement, but
|
495 |
-
we don't have a method for hashing those."""
|
496 |
-
|
497 |
-
order = 0
|
498 |
-
head = (
|
499 |
-
"Can't verify hashes for these requirements because we don't "
|
500 |
-
"have a way to hash version control repositories:"
|
501 |
-
)
|
502 |
-
|
503 |
-
|
504 |
-
class DirectoryUrlHashUnsupported(HashError):
|
505 |
-
"""A hash was provided for a version-control-system-based requirement, but
|
506 |
-
we don't have a method for hashing those."""
|
507 |
-
|
508 |
-
order = 1
|
509 |
-
head = (
|
510 |
-
"Can't verify hashes for these file:// requirements because they "
|
511 |
-
"point to directories:"
|
512 |
-
)
|
513 |
-
|
514 |
-
|
515 |
-
class HashMissing(HashError):
|
516 |
-
"""A hash was needed for a requirement but is absent."""
|
517 |
-
|
518 |
-
order = 2
|
519 |
-
head = (
|
520 |
-
"Hashes are required in --require-hashes mode, but they are "
|
521 |
-
"missing from some requirements. Here is a list of those "
|
522 |
-
"requirements along with the hashes their downloaded archives "
|
523 |
-
"actually had. Add lines like these to your requirements files to "
|
524 |
-
"prevent tampering. (If you did not enable --require-hashes "
|
525 |
-
"manually, note that it turns on automatically when any package "
|
526 |
-
"has a hash.)"
|
527 |
-
)
|
528 |
-
|
529 |
-
def __init__(self, gotten_hash: str) -> None:
|
530 |
-
"""
|
531 |
-
:param gotten_hash: The hash of the (possibly malicious) archive we
|
532 |
-
just downloaded
|
533 |
-
"""
|
534 |
-
self.gotten_hash = gotten_hash
|
535 |
-
|
536 |
-
def body(self) -> str:
|
537 |
-
# Dodge circular import.
|
538 |
-
from pip._internal.utils.hashes import FAVORITE_HASH
|
539 |
-
|
540 |
-
package = None
|
541 |
-
if self.req:
|
542 |
-
# In the case of URL-based requirements, display the original URL
|
543 |
-
# seen in the requirements file rather than the package name,
|
544 |
-
# so the output can be directly copied into the requirements file.
|
545 |
-
package = (
|
546 |
-
self.req.original_link
|
547 |
-
if self.req.original_link
|
548 |
-
# In case someone feeds something downright stupid
|
549 |
-
# to InstallRequirement's constructor.
|
550 |
-
else getattr(self.req, "req", None)
|
551 |
-
)
|
552 |
-
return " {} --hash={}:{}".format(
|
553 |
-
package or "unknown package", FAVORITE_HASH, self.gotten_hash
|
554 |
-
)
|
555 |
-
|
556 |
-
|
557 |
-
class HashUnpinned(HashError):
|
558 |
-
"""A requirement had a hash specified but was not pinned to a specific
|
559 |
-
version."""
|
560 |
-
|
561 |
-
order = 3
|
562 |
-
head = (
|
563 |
-
"In --require-hashes mode, all requirements must have their "
|
564 |
-
"versions pinned with ==. These do not:"
|
565 |
-
)
|
566 |
-
|
567 |
-
|
568 |
-
class HashMismatch(HashError):
|
569 |
-
"""
|
570 |
-
Distribution file hash values don't match.
|
571 |
-
|
572 |
-
:ivar package_name: The name of the package that triggered the hash
|
573 |
-
mismatch. Feel free to write to this after the exception is raise to
|
574 |
-
improve its error message.
|
575 |
-
|
576 |
-
"""
|
577 |
-
|
578 |
-
order = 4
|
579 |
-
head = (
|
580 |
-
"THESE PACKAGES DO NOT MATCH THE HASHES FROM THE REQUIREMENTS "
|
581 |
-
"FILE. If you have updated the package versions, please update "
|
582 |
-
"the hashes. Otherwise, examine the package contents carefully; "
|
583 |
-
"someone may have tampered with them."
|
584 |
-
)
|
585 |
-
|
586 |
-
def __init__(self, allowed: Dict[str, List[str]], gots: Dict[str, "_Hash"]) -> None:
|
587 |
-
"""
|
588 |
-
:param allowed: A dict of algorithm names pointing to lists of allowed
|
589 |
-
hex digests
|
590 |
-
:param gots: A dict of algorithm names pointing to hashes we
|
591 |
-
actually got from the files under suspicion
|
592 |
-
"""
|
593 |
-
self.allowed = allowed
|
594 |
-
self.gots = gots
|
595 |
-
|
596 |
-
def body(self) -> str:
|
597 |
-
return " {}:\n{}".format(self._requirement_name(), self._hash_comparison())
|
598 |
-
|
599 |
-
def _hash_comparison(self) -> str:
|
600 |
-
"""
|
601 |
-
Return a comparison of actual and expected hash values.
|
602 |
-
|
603 |
-
Example::
|
604 |
-
|
605 |
-
Expected sha256 abcdeabcdeabcdeabcdeabcdeabcdeabcdeabcdeabcde
|
606 |
-
or 123451234512345123451234512345123451234512345
|
607 |
-
Got bcdefbcdefbcdefbcdefbcdefbcdefbcdefbcdefbcdef
|
608 |
-
|
609 |
-
"""
|
610 |
-
|
611 |
-
def hash_then_or(hash_name: str) -> "chain[str]":
|
612 |
-
# For now, all the decent hashes have 6-char names, so we can get
|
613 |
-
# away with hard-coding space literals.
|
614 |
-
return chain([hash_name], repeat(" or"))
|
615 |
-
|
616 |
-
lines: List[str] = []
|
617 |
-
for hash_name, expecteds in self.allowed.items():
|
618 |
-
prefix = hash_then_or(hash_name)
|
619 |
-
lines.extend(
|
620 |
-
(" Expected {} {}".format(next(prefix), e)) for e in expecteds
|
621 |
-
)
|
622 |
-
lines.append(
|
623 |
-
" Got {}\n".format(self.gots[hash_name].hexdigest())
|
624 |
-
)
|
625 |
-
return "\n".join(lines)
|
626 |
-
|
627 |
-
|
628 |
-
class UnsupportedPythonVersion(InstallationError):
|
629 |
-
"""Unsupported python version according to Requires-Python package
|
630 |
-
metadata."""
|
631 |
-
|
632 |
-
|
633 |
-
class ConfigurationFileCouldNotBeLoaded(ConfigurationError):
|
634 |
-
"""When there are errors while loading a configuration file"""
|
635 |
-
|
636 |
-
def __init__(
|
637 |
-
self,
|
638 |
-
reason: str = "could not be loaded",
|
639 |
-
fname: Optional[str] = None,
|
640 |
-
error: Optional[configparser.Error] = None,
|
641 |
-
) -> None:
|
642 |
-
super().__init__(error)
|
643 |
-
self.reason = reason
|
644 |
-
self.fname = fname
|
645 |
-
self.error = error
|
646 |
-
|
647 |
-
def __str__(self) -> str:
|
648 |
-
if self.fname is not None:
|
649 |
-
message_part = f" in {self.fname}."
|
650 |
-
else:
|
651 |
-
assert self.error is not None
|
652 |
-
message_part = f".\n{self.error}\n"
|
653 |
-
return f"Configuration file {self.reason}{message_part}"
|
654 |
-
|
655 |
-
|
656 |
-
_DEFAULT_EXTERNALLY_MANAGED_ERROR = f"""\
|
657 |
-
The Python environment under {sys.prefix} is managed externally, and may not be
|
658 |
-
manipulated by the user. Please use specific tooling from the distributor of
|
659 |
-
the Python installation to interact with this environment instead.
|
660 |
-
"""
|
661 |
-
|
662 |
-
|
663 |
-
class ExternallyManagedEnvironment(DiagnosticPipError):
|
664 |
-
"""The current environment is externally managed.
|
665 |
-
|
666 |
-
This is raised when the current environment is externally managed, as
|
667 |
-
defined by `PEP 668`_. The ``EXTERNALLY-MANAGED`` configuration is checked
|
668 |
-
and displayed when the error is bubbled up to the user.
|
669 |
-
|
670 |
-
:param error: The error message read from ``EXTERNALLY-MANAGED``.
|
671 |
-
"""
|
672 |
-
|
673 |
-
reference = "externally-managed-environment"
|
674 |
-
|
675 |
-
def __init__(self, error: Optional[str]) -> None:
|
676 |
-
if error is None:
|
677 |
-
context = Text(_DEFAULT_EXTERNALLY_MANAGED_ERROR)
|
678 |
-
else:
|
679 |
-
context = Text(error)
|
680 |
-
super().__init__(
|
681 |
-
message="This environment is externally managed",
|
682 |
-
context=context,
|
683 |
-
note_stmt=(
|
684 |
-
"If you believe this is a mistake, please contact your "
|
685 |
-
"Python installation or OS distribution provider. "
|
686 |
-
"You can override this, at the risk of breaking your Python "
|
687 |
-
"installation or OS, by passing --break-system-packages."
|
688 |
-
),
|
689 |
-
hint_stmt=Text("See PEP 668 for the detailed specification."),
|
690 |
-
)
|
691 |
-
|
692 |
-
@staticmethod
|
693 |
-
def _iter_externally_managed_error_keys() -> Iterator[str]:
|
694 |
-
# LC_MESSAGES is in POSIX, but not the C standard. The most common
|
695 |
-
# platform that does not implement this category is Windows, where
|
696 |
-
# using other categories for console message localization is equally
|
697 |
-
# unreliable, so we fall back to the locale-less vendor message. This
|
698 |
-
# can always be re-evaluated when a vendor proposes a new alternative.
|
699 |
-
try:
|
700 |
-
category = locale.LC_MESSAGES
|
701 |
-
except AttributeError:
|
702 |
-
lang: Optional[str] = None
|
703 |
-
else:
|
704 |
-
lang, _ = locale.getlocale(category)
|
705 |
-
if lang is not None:
|
706 |
-
yield f"Error-{lang}"
|
707 |
-
for sep in ("-", "_"):
|
708 |
-
before, found, _ = lang.partition(sep)
|
709 |
-
if not found:
|
710 |
-
continue
|
711 |
-
yield f"Error-{before}"
|
712 |
-
yield "Error"
|
713 |
-
|
714 |
-
@classmethod
|
715 |
-
def from_config(
|
716 |
-
cls,
|
717 |
-
config: Union[pathlib.Path, str],
|
718 |
-
) -> "ExternallyManagedEnvironment":
|
719 |
-
parser = configparser.ConfigParser(interpolation=None)
|
720 |
-
try:
|
721 |
-
parser.read(config, encoding="utf-8")
|
722 |
-
section = parser["externally-managed"]
|
723 |
-
for key in cls._iter_externally_managed_error_keys():
|
724 |
-
with contextlib.suppress(KeyError):
|
725 |
-
return cls(section[key])
|
726 |
-
except KeyError:
|
727 |
-
pass
|
728 |
-
except (OSError, UnicodeDecodeError, configparser.ParsingError):
|
729 |
-
from pip._internal.utils._log import VERBOSE
|
730 |
-
|
731 |
-
exc_info = logger.isEnabledFor(VERBOSE)
|
732 |
-
logger.warning("Failed to read %s", config, exc_info=exc_info)
|
733 |
-
return cls(None)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
spaces/Ataturk-Chatbot/HuggingFaceChat/venv/lib/python3.11/site-packages/setuptools/_vendor/importlib_metadata/__init__.py
DELETED
@@ -1,1047 +0,0 @@
|
|
1 |
-
import os
|
2 |
-
import re
|
3 |
-
import abc
|
4 |
-
import csv
|
5 |
-
import sys
|
6 |
-
from .. import zipp
|
7 |
-
import email
|
8 |
-
import pathlib
|
9 |
-
import operator
|
10 |
-
import textwrap
|
11 |
-
import warnings
|
12 |
-
import functools
|
13 |
-
import itertools
|
14 |
-
import posixpath
|
15 |
-
import collections
|
16 |
-
|
17 |
-
from . import _adapters, _meta
|
18 |
-
from ._collections import FreezableDefaultDict, Pair
|
19 |
-
from ._compat import (
|
20 |
-
NullFinder,
|
21 |
-
install,
|
22 |
-
pypy_partial,
|
23 |
-
)
|
24 |
-
from ._functools import method_cache, pass_none
|
25 |
-
from ._itertools import always_iterable, unique_everseen
|
26 |
-
from ._meta import PackageMetadata, SimplePath
|
27 |
-
|
28 |
-
from contextlib import suppress
|
29 |
-
from importlib import import_module
|
30 |
-
from importlib.abc import MetaPathFinder
|
31 |
-
from itertools import starmap
|
32 |
-
from typing import List, Mapping, Optional, Union
|
33 |
-
|
34 |
-
|
35 |
-
__all__ = [
|
36 |
-
'Distribution',
|
37 |
-
'DistributionFinder',
|
38 |
-
'PackageMetadata',
|
39 |
-
'PackageNotFoundError',
|
40 |
-
'distribution',
|
41 |
-
'distributions',
|
42 |
-
'entry_points',
|
43 |
-
'files',
|
44 |
-
'metadata',
|
45 |
-
'packages_distributions',
|
46 |
-
'requires',
|
47 |
-
'version',
|
48 |
-
]
|
49 |
-
|
50 |
-
|
51 |
-
class PackageNotFoundError(ModuleNotFoundError):
|
52 |
-
"""The package was not found."""
|
53 |
-
|
54 |
-
def __str__(self):
|
55 |
-
return f"No package metadata was found for {self.name}"
|
56 |
-
|
57 |
-
@property
|
58 |
-
def name(self):
|
59 |
-
(name,) = self.args
|
60 |
-
return name
|
61 |
-
|
62 |
-
|
63 |
-
class Sectioned:
|
64 |
-
"""
|
65 |
-
A simple entry point config parser for performance
|
66 |
-
|
67 |
-
>>> for item in Sectioned.read(Sectioned._sample):
|
68 |
-
... print(item)
|
69 |
-
Pair(name='sec1', value='# comments ignored')
|
70 |
-
Pair(name='sec1', value='a = 1')
|
71 |
-
Pair(name='sec1', value='b = 2')
|
72 |
-
Pair(name='sec2', value='a = 2')
|
73 |
-
|
74 |
-
>>> res = Sectioned.section_pairs(Sectioned._sample)
|
75 |
-
>>> item = next(res)
|
76 |
-
>>> item.name
|
77 |
-
'sec1'
|
78 |
-
>>> item.value
|
79 |
-
Pair(name='a', value='1')
|
80 |
-
>>> item = next(res)
|
81 |
-
>>> item.value
|
82 |
-
Pair(name='b', value='2')
|
83 |
-
>>> item = next(res)
|
84 |
-
>>> item.name
|
85 |
-
'sec2'
|
86 |
-
>>> item.value
|
87 |
-
Pair(name='a', value='2')
|
88 |
-
>>> list(res)
|
89 |
-
[]
|
90 |
-
"""
|
91 |
-
|
92 |
-
_sample = textwrap.dedent(
|
93 |
-
"""
|
94 |
-
[sec1]
|
95 |
-
# comments ignored
|
96 |
-
a = 1
|
97 |
-
b = 2
|
98 |
-
|
99 |
-
[sec2]
|
100 |
-
a = 2
|
101 |
-
"""
|
102 |
-
).lstrip()
|
103 |
-
|
104 |
-
@classmethod
|
105 |
-
def section_pairs(cls, text):
|
106 |
-
return (
|
107 |
-
section._replace(value=Pair.parse(section.value))
|
108 |
-
for section in cls.read(text, filter_=cls.valid)
|
109 |
-
if section.name is not None
|
110 |
-
)
|
111 |
-
|
112 |
-
@staticmethod
|
113 |
-
def read(text, filter_=None):
|
114 |
-
lines = filter(filter_, map(str.strip, text.splitlines()))
|
115 |
-
name = None
|
116 |
-
for value in lines:
|
117 |
-
section_match = value.startswith('[') and value.endswith(']')
|
118 |
-
if section_match:
|
119 |
-
name = value.strip('[]')
|
120 |
-
continue
|
121 |
-
yield Pair(name, value)
|
122 |
-
|
123 |
-
@staticmethod
|
124 |
-
def valid(line):
|
125 |
-
return line and not line.startswith('#')
|
126 |
-
|
127 |
-
|
128 |
-
class DeprecatedTuple:
|
129 |
-
"""
|
130 |
-
Provide subscript item access for backward compatibility.
|
131 |
-
|
132 |
-
>>> recwarn = getfixture('recwarn')
|
133 |
-
>>> ep = EntryPoint(name='name', value='value', group='group')
|
134 |
-
>>> ep[:]
|
135 |
-
('name', 'value', 'group')
|
136 |
-
>>> ep[0]
|
137 |
-
'name'
|
138 |
-
>>> len(recwarn)
|
139 |
-
1
|
140 |
-
"""
|
141 |
-
|
142 |
-
_warn = functools.partial(
|
143 |
-
warnings.warn,
|
144 |
-
"EntryPoint tuple interface is deprecated. Access members by name.",
|
145 |
-
DeprecationWarning,
|
146 |
-
stacklevel=pypy_partial(2),
|
147 |
-
)
|
148 |
-
|
149 |
-
def __getitem__(self, item):
|
150 |
-
self._warn()
|
151 |
-
return self._key()[item]
|
152 |
-
|
153 |
-
|
154 |
-
class EntryPoint(DeprecatedTuple):
|
155 |
-
"""An entry point as defined by Python packaging conventions.
|
156 |
-
|
157 |
-
See `the packaging docs on entry points
|
158 |
-
<https://packaging.python.org/specifications/entry-points/>`_
|
159 |
-
for more information.
|
160 |
-
"""
|
161 |
-
|
162 |
-
pattern = re.compile(
|
163 |
-
r'(?P<module>[\w.]+)\s*'
|
164 |
-
r'(:\s*(?P<attr>[\w.]+)\s*)?'
|
165 |
-
r'((?P<extras>\[.*\])\s*)?$'
|
166 |
-
)
|
167 |
-
"""
|
168 |
-
A regular expression describing the syntax for an entry point,
|
169 |
-
which might look like:
|
170 |
-
|
171 |
-
- module
|
172 |
-
- package.module
|
173 |
-
- package.module:attribute
|
174 |
-
- package.module:object.attribute
|
175 |
-
- package.module:attr [extra1, extra2]
|
176 |
-
|
177 |
-
Other combinations are possible as well.
|
178 |
-
|
179 |
-
The expression is lenient about whitespace around the ':',
|
180 |
-
following the attr, and following any extras.
|
181 |
-
"""
|
182 |
-
|
183 |
-
dist: Optional['Distribution'] = None
|
184 |
-
|
185 |
-
def __init__(self, name, value, group):
|
186 |
-
vars(self).update(name=name, value=value, group=group)
|
187 |
-
|
188 |
-
def load(self):
|
189 |
-
"""Load the entry point from its definition. If only a module
|
190 |
-
is indicated by the value, return that module. Otherwise,
|
191 |
-
return the named object.
|
192 |
-
"""
|
193 |
-
match = self.pattern.match(self.value)
|
194 |
-
module = import_module(match.group('module'))
|
195 |
-
attrs = filter(None, (match.group('attr') or '').split('.'))
|
196 |
-
return functools.reduce(getattr, attrs, module)
|
197 |
-
|
198 |
-
@property
|
199 |
-
def module(self):
|
200 |
-
match = self.pattern.match(self.value)
|
201 |
-
return match.group('module')
|
202 |
-
|
203 |
-
@property
|
204 |
-
def attr(self):
|
205 |
-
match = self.pattern.match(self.value)
|
206 |
-
return match.group('attr')
|
207 |
-
|
208 |
-
@property
|
209 |
-
def extras(self):
|
210 |
-
match = self.pattern.match(self.value)
|
211 |
-
return list(re.finditer(r'\w+', match.group('extras') or ''))
|
212 |
-
|
213 |
-
def _for(self, dist):
|
214 |
-
vars(self).update(dist=dist)
|
215 |
-
return self
|
216 |
-
|
217 |
-
def __iter__(self):
|
218 |
-
"""
|
219 |
-
Supply iter so one may construct dicts of EntryPoints by name.
|
220 |
-
"""
|
221 |
-
msg = (
|
222 |
-
"Construction of dict of EntryPoints is deprecated in "
|
223 |
-
"favor of EntryPoints."
|
224 |
-
)
|
225 |
-
warnings.warn(msg, DeprecationWarning)
|
226 |
-
return iter((self.name, self))
|
227 |
-
|
228 |
-
def matches(self, **params):
|
229 |
-
attrs = (getattr(self, param) for param in params)
|
230 |
-
return all(map(operator.eq, params.values(), attrs))
|
231 |
-
|
232 |
-
def _key(self):
|
233 |
-
return self.name, self.value, self.group
|
234 |
-
|
235 |
-
def __lt__(self, other):
|
236 |
-
return self._key() < other._key()
|
237 |
-
|
238 |
-
def __eq__(self, other):
|
239 |
-
return self._key() == other._key()
|
240 |
-
|
241 |
-
def __setattr__(self, name, value):
|
242 |
-
raise AttributeError("EntryPoint objects are immutable.")
|
243 |
-
|
244 |
-
def __repr__(self):
|
245 |
-
return (
|
246 |
-
f'EntryPoint(name={self.name!r}, value={self.value!r}, '
|
247 |
-
f'group={self.group!r})'
|
248 |
-
)
|
249 |
-
|
250 |
-
def __hash__(self):
|
251 |
-
return hash(self._key())
|
252 |
-
|
253 |
-
|
254 |
-
class DeprecatedList(list):
|
255 |
-
"""
|
256 |
-
Allow an otherwise immutable object to implement mutability
|
257 |
-
for compatibility.
|
258 |
-
|
259 |
-
>>> recwarn = getfixture('recwarn')
|
260 |
-
>>> dl = DeprecatedList(range(3))
|
261 |
-
>>> dl[0] = 1
|
262 |
-
>>> dl.append(3)
|
263 |
-
>>> del dl[3]
|
264 |
-
>>> dl.reverse()
|
265 |
-
>>> dl.sort()
|
266 |
-
>>> dl.extend([4])
|
267 |
-
>>> dl.pop(-1)
|
268 |
-
4
|
269 |
-
>>> dl.remove(1)
|
270 |
-
>>> dl += [5]
|
271 |
-
>>> dl + [6]
|
272 |
-
[1, 2, 5, 6]
|
273 |
-
>>> dl + (6,)
|
274 |
-
[1, 2, 5, 6]
|
275 |
-
>>> dl.insert(0, 0)
|
276 |
-
>>> dl
|
277 |
-
[0, 1, 2, 5]
|
278 |
-
>>> dl == [0, 1, 2, 5]
|
279 |
-
True
|
280 |
-
>>> dl == (0, 1, 2, 5)
|
281 |
-
True
|
282 |
-
>>> len(recwarn)
|
283 |
-
1
|
284 |
-
"""
|
285 |
-
|
286 |
-
__slots__ = ()
|
287 |
-
|
288 |
-
_warn = functools.partial(
|
289 |
-
warnings.warn,
|
290 |
-
"EntryPoints list interface is deprecated. Cast to list if needed.",
|
291 |
-
DeprecationWarning,
|
292 |
-
stacklevel=pypy_partial(2),
|
293 |
-
)
|
294 |
-
|
295 |
-
def _wrap_deprecated_method(method_name: str): # type: ignore
|
296 |
-
def wrapped(self, *args, **kwargs):
|
297 |
-
self._warn()
|
298 |
-
return getattr(super(), method_name)(*args, **kwargs)
|
299 |
-
|
300 |
-
return method_name, wrapped
|
301 |
-
|
302 |
-
locals().update(
|
303 |
-
map(
|
304 |
-
_wrap_deprecated_method,
|
305 |
-
'__setitem__ __delitem__ append reverse extend pop remove '
|
306 |
-
'__iadd__ insert sort'.split(),
|
307 |
-
)
|
308 |
-
)
|
309 |
-
|
310 |
-
def __add__(self, other):
|
311 |
-
if not isinstance(other, tuple):
|
312 |
-
self._warn()
|
313 |
-
other = tuple(other)
|
314 |
-
return self.__class__(tuple(self) + other)
|
315 |
-
|
316 |
-
def __eq__(self, other):
|
317 |
-
if not isinstance(other, tuple):
|
318 |
-
self._warn()
|
319 |
-
other = tuple(other)
|
320 |
-
|
321 |
-
return tuple(self).__eq__(other)
|
322 |
-
|
323 |
-
|
324 |
-
class EntryPoints(DeprecatedList):
|
325 |
-
"""
|
326 |
-
An immutable collection of selectable EntryPoint objects.
|
327 |
-
"""
|
328 |
-
|
329 |
-
__slots__ = ()
|
330 |
-
|
331 |
-
def __getitem__(self, name): # -> EntryPoint:
|
332 |
-
"""
|
333 |
-
Get the EntryPoint in self matching name.
|
334 |
-
"""
|
335 |
-
if isinstance(name, int):
|
336 |
-
warnings.warn(
|
337 |
-
"Accessing entry points by index is deprecated. "
|
338 |
-
"Cast to tuple if needed.",
|
339 |
-
DeprecationWarning,
|
340 |
-
stacklevel=2,
|
341 |
-
)
|
342 |
-
return super().__getitem__(name)
|
343 |
-
try:
|
344 |
-
return next(iter(self.select(name=name)))
|
345 |
-
except StopIteration:
|
346 |
-
raise KeyError(name)
|
347 |
-
|
348 |
-
def select(self, **params):
|
349 |
-
"""
|
350 |
-
Select entry points from self that match the
|
351 |
-
given parameters (typically group and/or name).
|
352 |
-
"""
|
353 |
-
return EntryPoints(ep for ep in self if ep.matches(**params))
|
354 |
-
|
355 |
-
@property
|
356 |
-
def names(self):
|
357 |
-
"""
|
358 |
-
Return the set of all names of all entry points.
|
359 |
-
"""
|
360 |
-
return {ep.name for ep in self}
|
361 |
-
|
362 |
-
@property
|
363 |
-
def groups(self):
|
364 |
-
"""
|
365 |
-
Return the set of all groups of all entry points.
|
366 |
-
|
367 |
-
For coverage while SelectableGroups is present.
|
368 |
-
>>> EntryPoints().groups
|
369 |
-
set()
|
370 |
-
"""
|
371 |
-
return {ep.group for ep in self}
|
372 |
-
|
373 |
-
@classmethod
|
374 |
-
def _from_text_for(cls, text, dist):
|
375 |
-
return cls(ep._for(dist) for ep in cls._from_text(text))
|
376 |
-
|
377 |
-
@staticmethod
|
378 |
-
def _from_text(text):
|
379 |
-
return (
|
380 |
-
EntryPoint(name=item.value.name, value=item.value.value, group=item.name)
|
381 |
-
for item in Sectioned.section_pairs(text or '')
|
382 |
-
)
|
383 |
-
|
384 |
-
|
385 |
-
class Deprecated:
|
386 |
-
"""
|
387 |
-
Compatibility add-in for mapping to indicate that
|
388 |
-
mapping behavior is deprecated.
|
389 |
-
|
390 |
-
>>> recwarn = getfixture('recwarn')
|
391 |
-
>>> class DeprecatedDict(Deprecated, dict): pass
|
392 |
-
>>> dd = DeprecatedDict(foo='bar')
|
393 |
-
>>> dd.get('baz', None)
|
394 |
-
>>> dd['foo']
|
395 |
-
'bar'
|
396 |
-
>>> list(dd)
|
397 |
-
['foo']
|
398 |
-
>>> list(dd.keys())
|
399 |
-
['foo']
|
400 |
-
>>> 'foo' in dd
|
401 |
-
True
|
402 |
-
>>> list(dd.values())
|
403 |
-
['bar']
|
404 |
-
>>> len(recwarn)
|
405 |
-
1
|
406 |
-
"""
|
407 |
-
|
408 |
-
_warn = functools.partial(
|
409 |
-
warnings.warn,
|
410 |
-
"SelectableGroups dict interface is deprecated. Use select.",
|
411 |
-
DeprecationWarning,
|
412 |
-
stacklevel=pypy_partial(2),
|
413 |
-
)
|
414 |
-
|
415 |
-
def __getitem__(self, name):
|
416 |
-
self._warn()
|
417 |
-
return super().__getitem__(name)
|
418 |
-
|
419 |
-
def get(self, name, default=None):
|
420 |
-
self._warn()
|
421 |
-
return super().get(name, default)
|
422 |
-
|
423 |
-
def __iter__(self):
|
424 |
-
self._warn()
|
425 |
-
return super().__iter__()
|
426 |
-
|
427 |
-
def __contains__(self, *args):
|
428 |
-
self._warn()
|
429 |
-
return super().__contains__(*args)
|
430 |
-
|
431 |
-
def keys(self):
|
432 |
-
self._warn()
|
433 |
-
return super().keys()
|
434 |
-
|
435 |
-
def values(self):
|
436 |
-
self._warn()
|
437 |
-
return super().values()
|
438 |
-
|
439 |
-
|
440 |
-
class SelectableGroups(Deprecated, dict):
|
441 |
-
"""
|
442 |
-
A backward- and forward-compatible result from
|
443 |
-
entry_points that fully implements the dict interface.
|
444 |
-
"""
|
445 |
-
|
446 |
-
@classmethod
|
447 |
-
def load(cls, eps):
|
448 |
-
by_group = operator.attrgetter('group')
|
449 |
-
ordered = sorted(eps, key=by_group)
|
450 |
-
grouped = itertools.groupby(ordered, by_group)
|
451 |
-
return cls((group, EntryPoints(eps)) for group, eps in grouped)
|
452 |
-
|
453 |
-
@property
|
454 |
-
def _all(self):
|
455 |
-
"""
|
456 |
-
Reconstruct a list of all entrypoints from the groups.
|
457 |
-
"""
|
458 |
-
groups = super(Deprecated, self).values()
|
459 |
-
return EntryPoints(itertools.chain.from_iterable(groups))
|
460 |
-
|
461 |
-
@property
|
462 |
-
def groups(self):
|
463 |
-
return self._all.groups
|
464 |
-
|
465 |
-
@property
|
466 |
-
def names(self):
|
467 |
-
"""
|
468 |
-
for coverage:
|
469 |
-
>>> SelectableGroups().names
|
470 |
-
set()
|
471 |
-
"""
|
472 |
-
return self._all.names
|
473 |
-
|
474 |
-
def select(self, **params):
|
475 |
-
if not params:
|
476 |
-
return self
|
477 |
-
return self._all.select(**params)
|
478 |
-
|
479 |
-
|
480 |
-
class PackagePath(pathlib.PurePosixPath):
|
481 |
-
"""A reference to a path in a package"""
|
482 |
-
|
483 |
-
def read_text(self, encoding='utf-8'):
|
484 |
-
with self.locate().open(encoding=encoding) as stream:
|
485 |
-
return stream.read()
|
486 |
-
|
487 |
-
def read_binary(self):
|
488 |
-
with self.locate().open('rb') as stream:
|
489 |
-
return stream.read()
|
490 |
-
|
491 |
-
def locate(self):
|
492 |
-
"""Return a path-like object for this path"""
|
493 |
-
return self.dist.locate_file(self)
|
494 |
-
|
495 |
-
|
496 |
-
class FileHash:
|
497 |
-
def __init__(self, spec):
|
498 |
-
self.mode, _, self.value = spec.partition('=')
|
499 |
-
|
500 |
-
def __repr__(self):
|
501 |
-
return f'<FileHash mode: {self.mode} value: {self.value}>'
|
502 |
-
|
503 |
-
|
504 |
-
class Distribution:
|
505 |
-
"""A Python distribution package."""
|
506 |
-
|
507 |
-
@abc.abstractmethod
|
508 |
-
def read_text(self, filename):
|
509 |
-
"""Attempt to load metadata file given by the name.
|
510 |
-
|
511 |
-
:param filename: The name of the file in the distribution info.
|
512 |
-
:return: The text if found, otherwise None.
|
513 |
-
"""
|
514 |
-
|
515 |
-
@abc.abstractmethod
|
516 |
-
def locate_file(self, path):
|
517 |
-
"""
|
518 |
-
Given a path to a file in this distribution, return a path
|
519 |
-
to it.
|
520 |
-
"""
|
521 |
-
|
522 |
-
@classmethod
|
523 |
-
def from_name(cls, name):
|
524 |
-
"""Return the Distribution for the given package name.
|
525 |
-
|
526 |
-
:param name: The name of the distribution package to search for.
|
527 |
-
:return: The Distribution instance (or subclass thereof) for the named
|
528 |
-
package, if found.
|
529 |
-
:raises PackageNotFoundError: When the named package's distribution
|
530 |
-
metadata cannot be found.
|
531 |
-
"""
|
532 |
-
for resolver in cls._discover_resolvers():
|
533 |
-
dists = resolver(DistributionFinder.Context(name=name))
|
534 |
-
dist = next(iter(dists), None)
|
535 |
-
if dist is not None:
|
536 |
-
return dist
|
537 |
-
else:
|
538 |
-
raise PackageNotFoundError(name)
|
539 |
-
|
540 |
-
@classmethod
|
541 |
-
def discover(cls, **kwargs):
|
542 |
-
"""Return an iterable of Distribution objects for all packages.
|
543 |
-
|
544 |
-
Pass a ``context`` or pass keyword arguments for constructing
|
545 |
-
a context.
|
546 |
-
|
547 |
-
:context: A ``DistributionFinder.Context`` object.
|
548 |
-
:return: Iterable of Distribution objects for all packages.
|
549 |
-
"""
|
550 |
-
context = kwargs.pop('context', None)
|
551 |
-
if context and kwargs:
|
552 |
-
raise ValueError("cannot accept context and kwargs")
|
553 |
-
context = context or DistributionFinder.Context(**kwargs)
|
554 |
-
return itertools.chain.from_iterable(
|
555 |
-
resolver(context) for resolver in cls._discover_resolvers()
|
556 |
-
)
|
557 |
-
|
558 |
-
@staticmethod
|
559 |
-
def at(path):
|
560 |
-
"""Return a Distribution for the indicated metadata path
|
561 |
-
|
562 |
-
:param path: a string or path-like object
|
563 |
-
:return: a concrete Distribution instance for the path
|
564 |
-
"""
|
565 |
-
return PathDistribution(pathlib.Path(path))
|
566 |
-
|
567 |
-
@staticmethod
|
568 |
-
def _discover_resolvers():
|
569 |
-
"""Search the meta_path for resolvers."""
|
570 |
-
declared = (
|
571 |
-
getattr(finder, 'find_distributions', None) for finder in sys.meta_path
|
572 |
-
)
|
573 |
-
return filter(None, declared)
|
574 |
-
|
575 |
-
@property
|
576 |
-
def metadata(self) -> _meta.PackageMetadata:
|
577 |
-
"""Return the parsed metadata for this Distribution.
|
578 |
-
|
579 |
-
The returned object will have keys that name the various bits of
|
580 |
-
metadata. See PEP 566 for details.
|
581 |
-
"""
|
582 |
-
text = (
|
583 |
-
self.read_text('METADATA')
|
584 |
-
or self.read_text('PKG-INFO')
|
585 |
-
# This last clause is here to support old egg-info files. Its
|
586 |
-
# effect is to just end up using the PathDistribution's self._path
|
587 |
-
# (which points to the egg-info file) attribute unchanged.
|
588 |
-
or self.read_text('')
|
589 |
-
)
|
590 |
-
return _adapters.Message(email.message_from_string(text))
|
591 |
-
|
592 |
-
@property
|
593 |
-
def name(self):
|
594 |
-
"""Return the 'Name' metadata for the distribution package."""
|
595 |
-
return self.metadata['Name']
|
596 |
-
|
597 |
-
@property
|
598 |
-
def _normalized_name(self):
|
599 |
-
"""Return a normalized version of the name."""
|
600 |
-
return Prepared.normalize(self.name)
|
601 |
-
|
602 |
-
@property
|
603 |
-
def version(self):
|
604 |
-
"""Return the 'Version' metadata for the distribution package."""
|
605 |
-
return self.metadata['Version']
|
606 |
-
|
607 |
-
@property
|
608 |
-
def entry_points(self):
|
609 |
-
return EntryPoints._from_text_for(self.read_text('entry_points.txt'), self)
|
610 |
-
|
611 |
-
@property
|
612 |
-
def files(self):
|
613 |
-
"""Files in this distribution.
|
614 |
-
|
615 |
-
:return: List of PackagePath for this distribution or None
|
616 |
-
|
617 |
-
Result is `None` if the metadata file that enumerates files
|
618 |
-
(i.e. RECORD for dist-info or SOURCES.txt for egg-info) is
|
619 |
-
missing.
|
620 |
-
Result may be empty if the metadata exists but is empty.
|
621 |
-
"""
|
622 |
-
|
623 |
-
def make_file(name, hash=None, size_str=None):
|
624 |
-
result = PackagePath(name)
|
625 |
-
result.hash = FileHash(hash) if hash else None
|
626 |
-
result.size = int(size_str) if size_str else None
|
627 |
-
result.dist = self
|
628 |
-
return result
|
629 |
-
|
630 |
-
@pass_none
|
631 |
-
def make_files(lines):
|
632 |
-
return list(starmap(make_file, csv.reader(lines)))
|
633 |
-
|
634 |
-
return make_files(self._read_files_distinfo() or self._read_files_egginfo())
|
635 |
-
|
636 |
-
def _read_files_distinfo(self):
|
637 |
-
"""
|
638 |
-
Read the lines of RECORD
|
639 |
-
"""
|
640 |
-
text = self.read_text('RECORD')
|
641 |
-
return text and text.splitlines()
|
642 |
-
|
643 |
-
def _read_files_egginfo(self):
|
644 |
-
"""
|
645 |
-
SOURCES.txt might contain literal commas, so wrap each line
|
646 |
-
in quotes.
|
647 |
-
"""
|
648 |
-
text = self.read_text('SOURCES.txt')
|
649 |
-
return text and map('"{}"'.format, text.splitlines())
|
650 |
-
|
651 |
-
@property
|
652 |
-
def requires(self):
|
653 |
-
"""Generated requirements specified for this Distribution"""
|
654 |
-
reqs = self._read_dist_info_reqs() or self._read_egg_info_reqs()
|
655 |
-
return reqs and list(reqs)
|
656 |
-
|
657 |
-
def _read_dist_info_reqs(self):
|
658 |
-
return self.metadata.get_all('Requires-Dist')
|
659 |
-
|
660 |
-
def _read_egg_info_reqs(self):
|
661 |
-
source = self.read_text('requires.txt')
|
662 |
-
return pass_none(self._deps_from_requires_text)(source)
|
663 |
-
|
664 |
-
@classmethod
|
665 |
-
def _deps_from_requires_text(cls, source):
|
666 |
-
return cls._convert_egg_info_reqs_to_simple_reqs(Sectioned.read(source))
|
667 |
-
|
668 |
-
@staticmethod
|
669 |
-
def _convert_egg_info_reqs_to_simple_reqs(sections):
|
670 |
-
"""
|
671 |
-
Historically, setuptools would solicit and store 'extra'
|
672 |
-
requirements, including those with environment markers,
|
673 |
-
in separate sections. More modern tools expect each
|
674 |
-
dependency to be defined separately, with any relevant
|
675 |
-
extras and environment markers attached directly to that
|
676 |
-
requirement. This method converts the former to the
|
677 |
-
latter. See _test_deps_from_requires_text for an example.
|
678 |
-
"""
|
679 |
-
|
680 |
-
def make_condition(name):
|
681 |
-
return name and f'extra == "{name}"'
|
682 |
-
|
683 |
-
def quoted_marker(section):
|
684 |
-
section = section or ''
|
685 |
-
extra, sep, markers = section.partition(':')
|
686 |
-
if extra and markers:
|
687 |
-
markers = f'({markers})'
|
688 |
-
conditions = list(filter(None, [markers, make_condition(extra)]))
|
689 |
-
return '; ' + ' and '.join(conditions) if conditions else ''
|
690 |
-
|
691 |
-
def url_req_space(req):
|
692 |
-
"""
|
693 |
-
PEP 508 requires a space between the url_spec and the quoted_marker.
|
694 |
-
Ref python/importlib_metadata#357.
|
695 |
-
"""
|
696 |
-
# '@' is uniquely indicative of a url_req.
|
697 |
-
return ' ' * ('@' in req)
|
698 |
-
|
699 |
-
for section in sections:
|
700 |
-
space = url_req_space(section.value)
|
701 |
-
yield section.value + space + quoted_marker(section.name)
|
702 |
-
|
703 |
-
|
704 |
-
class DistributionFinder(MetaPathFinder):
|
705 |
-
"""
|
706 |
-
A MetaPathFinder capable of discovering installed distributions.
|
707 |
-
"""
|
708 |
-
|
709 |
-
class Context:
|
710 |
-
"""
|
711 |
-
Keyword arguments presented by the caller to
|
712 |
-
``distributions()`` or ``Distribution.discover()``
|
713 |
-
to narrow the scope of a search for distributions
|
714 |
-
in all DistributionFinders.
|
715 |
-
|
716 |
-
Each DistributionFinder may expect any parameters
|
717 |
-
and should attempt to honor the canonical
|
718 |
-
parameters defined below when appropriate.
|
719 |
-
"""
|
720 |
-
|
721 |
-
name = None
|
722 |
-
"""
|
723 |
-
Specific name for which a distribution finder should match.
|
724 |
-
A name of ``None`` matches all distributions.
|
725 |
-
"""
|
726 |
-
|
727 |
-
def __init__(self, **kwargs):
|
728 |
-
vars(self).update(kwargs)
|
729 |
-
|
730 |
-
@property
|
731 |
-
def path(self):
|
732 |
-
"""
|
733 |
-
The sequence of directory path that a distribution finder
|
734 |
-
should search.
|
735 |
-
|
736 |
-
Typically refers to Python installed package paths such as
|
737 |
-
"site-packages" directories and defaults to ``sys.path``.
|
738 |
-
"""
|
739 |
-
return vars(self).get('path', sys.path)
|
740 |
-
|
741 |
-
@abc.abstractmethod
|
742 |
-
def find_distributions(self, context=Context()):
|
743 |
-
"""
|
744 |
-
Find distributions.
|
745 |
-
|
746 |
-
Return an iterable of all Distribution instances capable of
|
747 |
-
loading the metadata for packages matching the ``context``,
|
748 |
-
a DistributionFinder.Context instance.
|
749 |
-
"""
|
750 |
-
|
751 |
-
|
752 |
-
class FastPath:
|
753 |
-
"""
|
754 |
-
Micro-optimized class for searching a path for
|
755 |
-
children.
|
756 |
-
|
757 |
-
>>> FastPath('').children()
|
758 |
-
['...']
|
759 |
-
"""
|
760 |
-
|
761 |
-
@functools.lru_cache() # type: ignore
|
762 |
-
def __new__(cls, root):
|
763 |
-
return super().__new__(cls)
|
764 |
-
|
765 |
-
def __init__(self, root):
|
766 |
-
self.root = str(root)
|
767 |
-
|
768 |
-
def joinpath(self, child):
|
769 |
-
return pathlib.Path(self.root, child)
|
770 |
-
|
771 |
-
def children(self):
|
772 |
-
with suppress(Exception):
|
773 |
-
return os.listdir(self.root or '.')
|
774 |
-
with suppress(Exception):
|
775 |
-
return self.zip_children()
|
776 |
-
return []
|
777 |
-
|
778 |
-
def zip_children(self):
|
779 |
-
zip_path = zipp.Path(self.root)
|
780 |
-
names = zip_path.root.namelist()
|
781 |
-
self.joinpath = zip_path.joinpath
|
782 |
-
|
783 |
-
return dict.fromkeys(child.split(posixpath.sep, 1)[0] for child in names)
|
784 |
-
|
785 |
-
def search(self, name):
|
786 |
-
return self.lookup(self.mtime).search(name)
|
787 |
-
|
788 |
-
@property
|
789 |
-
def mtime(self):
|
790 |
-
with suppress(OSError):
|
791 |
-
return os.stat(self.root).st_mtime
|
792 |
-
self.lookup.cache_clear()
|
793 |
-
|
794 |
-
@method_cache
|
795 |
-
def lookup(self, mtime):
|
796 |
-
return Lookup(self)
|
797 |
-
|
798 |
-
|
799 |
-
class Lookup:
|
800 |
-
def __init__(self, path: FastPath):
|
801 |
-
base = os.path.basename(path.root).lower()
|
802 |
-
base_is_egg = base.endswith(".egg")
|
803 |
-
self.infos = FreezableDefaultDict(list)
|
804 |
-
self.eggs = FreezableDefaultDict(list)
|
805 |
-
|
806 |
-
for child in path.children():
|
807 |
-
low = child.lower()
|
808 |
-
if low.endswith((".dist-info", ".egg-info")):
|
809 |
-
# rpartition is faster than splitext and suitable for this purpose.
|
810 |
-
name = low.rpartition(".")[0].partition("-")[0]
|
811 |
-
normalized = Prepared.normalize(name)
|
812 |
-
self.infos[normalized].append(path.joinpath(child))
|
813 |
-
elif base_is_egg and low == "egg-info":
|
814 |
-
name = base.rpartition(".")[0].partition("-")[0]
|
815 |
-
legacy_normalized = Prepared.legacy_normalize(name)
|
816 |
-
self.eggs[legacy_normalized].append(path.joinpath(child))
|
817 |
-
|
818 |
-
self.infos.freeze()
|
819 |
-
self.eggs.freeze()
|
820 |
-
|
821 |
-
def search(self, prepared):
|
822 |
-
infos = (
|
823 |
-
self.infos[prepared.normalized]
|
824 |
-
if prepared
|
825 |
-
else itertools.chain.from_iterable(self.infos.values())
|
826 |
-
)
|
827 |
-
eggs = (
|
828 |
-
self.eggs[prepared.legacy_normalized]
|
829 |
-
if prepared
|
830 |
-
else itertools.chain.from_iterable(self.eggs.values())
|
831 |
-
)
|
832 |
-
return itertools.chain(infos, eggs)
|
833 |
-
|
834 |
-
|
835 |
-
class Prepared:
|
836 |
-
"""
|
837 |
-
A prepared search for metadata on a possibly-named package.
|
838 |
-
"""
|
839 |
-
|
840 |
-
normalized = None
|
841 |
-
legacy_normalized = None
|
842 |
-
|
843 |
-
def __init__(self, name):
|
844 |
-
self.name = name
|
845 |
-
if name is None:
|
846 |
-
return
|
847 |
-
self.normalized = self.normalize(name)
|
848 |
-
self.legacy_normalized = self.legacy_normalize(name)
|
849 |
-
|
850 |
-
@staticmethod
|
851 |
-
def normalize(name):
|
852 |
-
"""
|
853 |
-
PEP 503 normalization plus dashes as underscores.
|
854 |
-
"""
|
855 |
-
return re.sub(r"[-_.]+", "-", name).lower().replace('-', '_')
|
856 |
-
|
857 |
-
@staticmethod
|
858 |
-
def legacy_normalize(name):
|
859 |
-
"""
|
860 |
-
Normalize the package name as found in the convention in
|
861 |
-
older packaging tools versions and specs.
|
862 |
-
"""
|
863 |
-
return name.lower().replace('-', '_')
|
864 |
-
|
865 |
-
def __bool__(self):
|
866 |
-
return bool(self.name)
|
867 |
-
|
868 |
-
|
869 |
-
@install
|
870 |
-
class MetadataPathFinder(NullFinder, DistributionFinder):
|
871 |
-
"""A degenerate finder for distribution packages on the file system.
|
872 |
-
|
873 |
-
This finder supplies only a find_distributions() method for versions
|
874 |
-
of Python that do not have a PathFinder find_distributions().
|
875 |
-
"""
|
876 |
-
|
877 |
-
def find_distributions(self, context=DistributionFinder.Context()):
|
878 |
-
"""
|
879 |
-
Find distributions.
|
880 |
-
|
881 |
-
Return an iterable of all Distribution instances capable of
|
882 |
-
loading the metadata for packages matching ``context.name``
|
883 |
-
(or all names if ``None`` indicated) along the paths in the list
|
884 |
-
of directories ``context.path``.
|
885 |
-
"""
|
886 |
-
found = self._search_paths(context.name, context.path)
|
887 |
-
return map(PathDistribution, found)
|
888 |
-
|
889 |
-
@classmethod
|
890 |
-
def _search_paths(cls, name, paths):
|
891 |
-
"""Find metadata directories in paths heuristically."""
|
892 |
-
prepared = Prepared(name)
|
893 |
-
return itertools.chain.from_iterable(
|
894 |
-
path.search(prepared) for path in map(FastPath, paths)
|
895 |
-
)
|
896 |
-
|
897 |
-
def invalidate_caches(cls):
|
898 |
-
FastPath.__new__.cache_clear()
|
899 |
-
|
900 |
-
|
901 |
-
class PathDistribution(Distribution):
|
902 |
-
def __init__(self, path: SimplePath):
|
903 |
-
"""Construct a distribution.
|
904 |
-
|
905 |
-
:param path: SimplePath indicating the metadata directory.
|
906 |
-
"""
|
907 |
-
self._path = path
|
908 |
-
|
909 |
-
def read_text(self, filename):
|
910 |
-
with suppress(
|
911 |
-
FileNotFoundError,
|
912 |
-
IsADirectoryError,
|
913 |
-
KeyError,
|
914 |
-
NotADirectoryError,
|
915 |
-
PermissionError,
|
916 |
-
):
|
917 |
-
return self._path.joinpath(filename).read_text(encoding='utf-8')
|
918 |
-
|
919 |
-
read_text.__doc__ = Distribution.read_text.__doc__
|
920 |
-
|
921 |
-
def locate_file(self, path):
|
922 |
-
return self._path.parent / path
|
923 |
-
|
924 |
-
@property
|
925 |
-
def _normalized_name(self):
|
926 |
-
"""
|
927 |
-
Performance optimization: where possible, resolve the
|
928 |
-
normalized name from the file system path.
|
929 |
-
"""
|
930 |
-
stem = os.path.basename(str(self._path))
|
931 |
-
return self._name_from_stem(stem) or super()._normalized_name
|
932 |
-
|
933 |
-
def _name_from_stem(self, stem):
|
934 |
-
name, ext = os.path.splitext(stem)
|
935 |
-
if ext not in ('.dist-info', '.egg-info'):
|
936 |
-
return
|
937 |
-
name, sep, rest = stem.partition('-')
|
938 |
-
return name
|
939 |
-
|
940 |
-
|
941 |
-
def distribution(distribution_name):
|
942 |
-
"""Get the ``Distribution`` instance for the named package.
|
943 |
-
|
944 |
-
:param distribution_name: The name of the distribution package as a string.
|
945 |
-
:return: A ``Distribution`` instance (or subclass thereof).
|
946 |
-
"""
|
947 |
-
return Distribution.from_name(distribution_name)
|
948 |
-
|
949 |
-
|
950 |
-
def distributions(**kwargs):
|
951 |
-
"""Get all ``Distribution`` instances in the current environment.
|
952 |
-
|
953 |
-
:return: An iterable of ``Distribution`` instances.
|
954 |
-
"""
|
955 |
-
return Distribution.discover(**kwargs)
|
956 |
-
|
957 |
-
|
958 |
-
def metadata(distribution_name) -> _meta.PackageMetadata:
|
959 |
-
"""Get the metadata for the named package.
|
960 |
-
|
961 |
-
:param distribution_name: The name of the distribution package to query.
|
962 |
-
:return: A PackageMetadata containing the parsed metadata.
|
963 |
-
"""
|
964 |
-
return Distribution.from_name(distribution_name).metadata
|
965 |
-
|
966 |
-
|
967 |
-
def version(distribution_name):
|
968 |
-
"""Get the version string for the named package.
|
969 |
-
|
970 |
-
:param distribution_name: The name of the distribution package to query.
|
971 |
-
:return: The version string for the package as defined in the package's
|
972 |
-
"Version" metadata key.
|
973 |
-
"""
|
974 |
-
return distribution(distribution_name).version
|
975 |
-
|
976 |
-
|
977 |
-
def entry_points(**params) -> Union[EntryPoints, SelectableGroups]:
|
978 |
-
"""Return EntryPoint objects for all installed packages.
|
979 |
-
|
980 |
-
Pass selection parameters (group or name) to filter the
|
981 |
-
result to entry points matching those properties (see
|
982 |
-
EntryPoints.select()).
|
983 |
-
|
984 |
-
For compatibility, returns ``SelectableGroups`` object unless
|
985 |
-
selection parameters are supplied. In the future, this function
|
986 |
-
will return ``EntryPoints`` instead of ``SelectableGroups``
|
987 |
-
even when no selection parameters are supplied.
|
988 |
-
|
989 |
-
For maximum future compatibility, pass selection parameters
|
990 |
-
or invoke ``.select`` with parameters on the result.
|
991 |
-
|
992 |
-
:return: EntryPoints or SelectableGroups for all installed packages.
|
993 |
-
"""
|
994 |
-
norm_name = operator.attrgetter('_normalized_name')
|
995 |
-
unique = functools.partial(unique_everseen, key=norm_name)
|
996 |
-
eps = itertools.chain.from_iterable(
|
997 |
-
dist.entry_points for dist in unique(distributions())
|
998 |
-
)
|
999 |
-
return SelectableGroups.load(eps).select(**params)
|
1000 |
-
|
1001 |
-
|
1002 |
-
def files(distribution_name):
|
1003 |
-
"""Return a list of files for the named package.
|
1004 |
-
|
1005 |
-
:param distribution_name: The name of the distribution package to query.
|
1006 |
-
:return: List of files composing the distribution.
|
1007 |
-
"""
|
1008 |
-
return distribution(distribution_name).files
|
1009 |
-
|
1010 |
-
|
1011 |
-
def requires(distribution_name):
|
1012 |
-
"""
|
1013 |
-
Return a list of requirements for the named package.
|
1014 |
-
|
1015 |
-
:return: An iterator of requirements, suitable for
|
1016 |
-
packaging.requirement.Requirement.
|
1017 |
-
"""
|
1018 |
-
return distribution(distribution_name).requires
|
1019 |
-
|
1020 |
-
|
1021 |
-
def packages_distributions() -> Mapping[str, List[str]]:
|
1022 |
-
"""
|
1023 |
-
Return a mapping of top-level packages to their
|
1024 |
-
distributions.
|
1025 |
-
|
1026 |
-
>>> import collections.abc
|
1027 |
-
>>> pkgs = packages_distributions()
|
1028 |
-
>>> all(isinstance(dist, collections.abc.Sequence) for dist in pkgs.values())
|
1029 |
-
True
|
1030 |
-
"""
|
1031 |
-
pkg_to_dist = collections.defaultdict(list)
|
1032 |
-
for dist in distributions():
|
1033 |
-
for pkg in _top_level_declared(dist) or _top_level_inferred(dist):
|
1034 |
-
pkg_to_dist[pkg].append(dist.metadata['Name'])
|
1035 |
-
return dict(pkg_to_dist)
|
1036 |
-
|
1037 |
-
|
1038 |
-
def _top_level_declared(dist):
|
1039 |
-
return (dist.read_text('top_level.txt') or '').split()
|
1040 |
-
|
1041 |
-
|
1042 |
-
def _top_level_inferred(dist):
|
1043 |
-
return {
|
1044 |
-
f.parts[0] if len(f.parts) > 1 else f.with_suffix('').name
|
1045 |
-
for f in always_iterable(dist.files)
|
1046 |
-
if f.suffix == ".py"
|
1047 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
spaces/AutoLLM/AutoAgents/autoagents/tools/__init__.py
DELETED
File without changes
|
spaces/Bakar31/PotterQuest/README.md
DELETED
@@ -1,13 +0,0 @@
|
|
1 |
-
---
|
2 |
-
title: PotterQuest
|
3 |
-
emoji: 📚
|
4 |
-
colorFrom: yellow
|
5 |
-
colorTo: gray
|
6 |
-
sdk: gradio
|
7 |
-
sdk_version: 3.29.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/Bart92/RVC_HF/Applio-RVC-Fork/utils/i18n.py
DELETED
@@ -1,28 +0,0 @@
|
|
1 |
-
import locale
|
2 |
-
import json
|
3 |
-
import os
|
4 |
-
|
5 |
-
|
6 |
-
def load_language_list(language):
|
7 |
-
with open(f"./i18n/{language}.json", "r", encoding="utf-8") as f:
|
8 |
-
language_list = json.load(f)
|
9 |
-
return language_list
|
10 |
-
|
11 |
-
|
12 |
-
class I18nAuto:
|
13 |
-
def __init__(self, language=None):
|
14 |
-
if language in ["Auto", None]:
|
15 |
-
language = "es_ES"
|
16 |
-
if not os.path.exists(f"./i18n/{language}.json"):
|
17 |
-
language = "es_ES"
|
18 |
-
language = "es_ES"
|
19 |
-
self.language = language
|
20 |
-
# print("Use Language:", language)
|
21 |
-
self.language_map = load_language_list(language)
|
22 |
-
|
23 |
-
def __call__(self, key):
|
24 |
-
return self.language_map.get(key, key)
|
25 |
-
|
26 |
-
def print(self):
|
27 |
-
# print("Use Language:", self.language)
|
28 |
-
print("")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
spaces/Big-Web/MMSD/env/Lib/site-packages/pip/_internal/pyproject.py
DELETED
@@ -1,179 +0,0 @@
|
|
1 |
-
import importlib.util
|
2 |
-
import os
|
3 |
-
from collections import namedtuple
|
4 |
-
from typing import Any, List, Optional
|
5 |
-
|
6 |
-
from pip._vendor import tomli
|
7 |
-
from pip._vendor.packaging.requirements import InvalidRequirement, Requirement
|
8 |
-
|
9 |
-
from pip._internal.exceptions import (
|
10 |
-
InstallationError,
|
11 |
-
InvalidPyProjectBuildRequires,
|
12 |
-
MissingPyProjectBuildRequires,
|
13 |
-
)
|
14 |
-
|
15 |
-
|
16 |
-
def _is_list_of_str(obj: Any) -> bool:
|
17 |
-
return isinstance(obj, list) and all(isinstance(item, str) for item in obj)
|
18 |
-
|
19 |
-
|
20 |
-
def make_pyproject_path(unpacked_source_directory: str) -> str:
|
21 |
-
return os.path.join(unpacked_source_directory, "pyproject.toml")
|
22 |
-
|
23 |
-
|
24 |
-
BuildSystemDetails = namedtuple(
|
25 |
-
"BuildSystemDetails", ["requires", "backend", "check", "backend_path"]
|
26 |
-
)
|
27 |
-
|
28 |
-
|
29 |
-
def load_pyproject_toml(
|
30 |
-
use_pep517: Optional[bool], pyproject_toml: str, setup_py: str, req_name: str
|
31 |
-
) -> Optional[BuildSystemDetails]:
|
32 |
-
"""Load the pyproject.toml file.
|
33 |
-
|
34 |
-
Parameters:
|
35 |
-
use_pep517 - Has the user requested PEP 517 processing? None
|
36 |
-
means the user hasn't explicitly specified.
|
37 |
-
pyproject_toml - Location of the project's pyproject.toml file
|
38 |
-
setup_py - Location of the project's setup.py file
|
39 |
-
req_name - The name of the requirement we're processing (for
|
40 |
-
error reporting)
|
41 |
-
|
42 |
-
Returns:
|
43 |
-
None if we should use the legacy code path, otherwise a tuple
|
44 |
-
(
|
45 |
-
requirements from pyproject.toml,
|
46 |
-
name of PEP 517 backend,
|
47 |
-
requirements we should check are installed after setting
|
48 |
-
up the build environment
|
49 |
-
directory paths to import the backend from (backend-path),
|
50 |
-
relative to the project root.
|
51 |
-
)
|
52 |
-
"""
|
53 |
-
has_pyproject = os.path.isfile(pyproject_toml)
|
54 |
-
has_setup = os.path.isfile(setup_py)
|
55 |
-
|
56 |
-
if not has_pyproject and not has_setup:
|
57 |
-
raise InstallationError(
|
58 |
-
f"{req_name} does not appear to be a Python project: "
|
59 |
-
f"neither 'setup.py' nor 'pyproject.toml' found."
|
60 |
-
)
|
61 |
-
|
62 |
-
if has_pyproject:
|
63 |
-
with open(pyproject_toml, encoding="utf-8") as f:
|
64 |
-
pp_toml = tomli.loads(f.read())
|
65 |
-
build_system = pp_toml.get("build-system")
|
66 |
-
else:
|
67 |
-
build_system = None
|
68 |
-
|
69 |
-
# The following cases must use PEP 517
|
70 |
-
# We check for use_pep517 being non-None and falsey because that means
|
71 |
-
# the user explicitly requested --no-use-pep517. The value 0 as
|
72 |
-
# opposed to False can occur when the value is provided via an
|
73 |
-
# environment variable or config file option (due to the quirk of
|
74 |
-
# strtobool() returning an integer in pip's configuration code).
|
75 |
-
if has_pyproject and not has_setup:
|
76 |
-
if use_pep517 is not None and not use_pep517:
|
77 |
-
raise InstallationError(
|
78 |
-
"Disabling PEP 517 processing is invalid: "
|
79 |
-
"project does not have a setup.py"
|
80 |
-
)
|
81 |
-
use_pep517 = True
|
82 |
-
elif build_system and "build-backend" in build_system:
|
83 |
-
if use_pep517 is not None and not use_pep517:
|
84 |
-
raise InstallationError(
|
85 |
-
"Disabling PEP 517 processing is invalid: "
|
86 |
-
"project specifies a build backend of {} "
|
87 |
-
"in pyproject.toml".format(build_system["build-backend"])
|
88 |
-
)
|
89 |
-
use_pep517 = True
|
90 |
-
|
91 |
-
# If we haven't worked out whether to use PEP 517 yet,
|
92 |
-
# and the user hasn't explicitly stated a preference,
|
93 |
-
# we do so if the project has a pyproject.toml file
|
94 |
-
# or if we cannot import setuptools or wheels.
|
95 |
-
|
96 |
-
# We fallback to PEP 517 when without setuptools or without the wheel package,
|
97 |
-
# so setuptools can be installed as a default build backend.
|
98 |
-
# For more info see:
|
99 |
-
# https://discuss.python.org/t/pip-without-setuptools-could-the-experience-be-improved/11810/9
|
100 |
-
# https://github.com/pypa/pip/issues/8559
|
101 |
-
elif use_pep517 is None:
|
102 |
-
use_pep517 = (
|
103 |
-
has_pyproject
|
104 |
-
or not importlib.util.find_spec("setuptools")
|
105 |
-
or not importlib.util.find_spec("wheel")
|
106 |
-
)
|
107 |
-
|
108 |
-
# At this point, we know whether we're going to use PEP 517.
|
109 |
-
assert use_pep517 is not None
|
110 |
-
|
111 |
-
# If we're using the legacy code path, there is nothing further
|
112 |
-
# for us to do here.
|
113 |
-
if not use_pep517:
|
114 |
-
return None
|
115 |
-
|
116 |
-
if build_system is None:
|
117 |
-
# Either the user has a pyproject.toml with no build-system
|
118 |
-
# section, or the user has no pyproject.toml, but has opted in
|
119 |
-
# explicitly via --use-pep517.
|
120 |
-
# In the absence of any explicit backend specification, we
|
121 |
-
# assume the setuptools backend that most closely emulates the
|
122 |
-
# traditional direct setup.py execution, and require wheel and
|
123 |
-
# a version of setuptools that supports that backend.
|
124 |
-
|
125 |
-
build_system = {
|
126 |
-
"requires": ["setuptools>=40.8.0", "wheel"],
|
127 |
-
"build-backend": "setuptools.build_meta:__legacy__",
|
128 |
-
}
|
129 |
-
|
130 |
-
# If we're using PEP 517, we have build system information (either
|
131 |
-
# from pyproject.toml, or defaulted by the code above).
|
132 |
-
# Note that at this point, we do not know if the user has actually
|
133 |
-
# specified a backend, though.
|
134 |
-
assert build_system is not None
|
135 |
-
|
136 |
-
# Ensure that the build-system section in pyproject.toml conforms
|
137 |
-
# to PEP 518.
|
138 |
-
|
139 |
-
# Specifying the build-system table but not the requires key is invalid
|
140 |
-
if "requires" not in build_system:
|
141 |
-
raise MissingPyProjectBuildRequires(package=req_name)
|
142 |
-
|
143 |
-
# Error out if requires is not a list of strings
|
144 |
-
requires = build_system["requires"]
|
145 |
-
if not _is_list_of_str(requires):
|
146 |
-
raise InvalidPyProjectBuildRequires(
|
147 |
-
package=req_name,
|
148 |
-
reason="It is not a list of strings.",
|
149 |
-
)
|
150 |
-
|
151 |
-
# Each requirement must be valid as per PEP 508
|
152 |
-
for requirement in requires:
|
153 |
-
try:
|
154 |
-
Requirement(requirement)
|
155 |
-
except InvalidRequirement as error:
|
156 |
-
raise InvalidPyProjectBuildRequires(
|
157 |
-
package=req_name,
|
158 |
-
reason=f"It contains an invalid requirement: {requirement!r}",
|
159 |
-
) from error
|
160 |
-
|
161 |
-
backend = build_system.get("build-backend")
|
162 |
-
backend_path = build_system.get("backend-path", [])
|
163 |
-
check: List[str] = []
|
164 |
-
if backend is None:
|
165 |
-
# If the user didn't specify a backend, we assume they want to use
|
166 |
-
# the setuptools backend. But we can't be sure they have included
|
167 |
-
# a version of setuptools which supplies the backend. So we
|
168 |
-
# make a note to check that this requirement is present once
|
169 |
-
# we have set up the environment.
|
170 |
-
# This is quite a lot of work to check for a very specific case. But
|
171 |
-
# the problem is, that case is potentially quite common - projects that
|
172 |
-
# adopted PEP 518 early for the ability to specify requirements to
|
173 |
-
# execute setup.py, but never considered needing to mention the build
|
174 |
-
# tools themselves. The original PEP 518 code had a similar check (but
|
175 |
-
# implemented in a different way).
|
176 |
-
backend = "setuptools.build_meta:__legacy__"
|
177 |
-
check = ["setuptools>=40.8.0"]
|
178 |
-
|
179 |
-
return BuildSystemDetails(requires, backend, check, backend_path)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
spaces/Big-Web/MMSD/env/Lib/site-packages/pip/_vendor/distro/__init__.py
DELETED
@@ -1,54 +0,0 @@
|
|
1 |
-
from .distro import (
|
2 |
-
NORMALIZED_DISTRO_ID,
|
3 |
-
NORMALIZED_LSB_ID,
|
4 |
-
NORMALIZED_OS_ID,
|
5 |
-
LinuxDistribution,
|
6 |
-
__version__,
|
7 |
-
build_number,
|
8 |
-
codename,
|
9 |
-
distro_release_attr,
|
10 |
-
distro_release_info,
|
11 |
-
id,
|
12 |
-
info,
|
13 |
-
like,
|
14 |
-
linux_distribution,
|
15 |
-
lsb_release_attr,
|
16 |
-
lsb_release_info,
|
17 |
-
major_version,
|
18 |
-
minor_version,
|
19 |
-
name,
|
20 |
-
os_release_attr,
|
21 |
-
os_release_info,
|
22 |
-
uname_attr,
|
23 |
-
uname_info,
|
24 |
-
version,
|
25 |
-
version_parts,
|
26 |
-
)
|
27 |
-
|
28 |
-
__all__ = [
|
29 |
-
"NORMALIZED_DISTRO_ID",
|
30 |
-
"NORMALIZED_LSB_ID",
|
31 |
-
"NORMALIZED_OS_ID",
|
32 |
-
"LinuxDistribution",
|
33 |
-
"build_number",
|
34 |
-
"codename",
|
35 |
-
"distro_release_attr",
|
36 |
-
"distro_release_info",
|
37 |
-
"id",
|
38 |
-
"info",
|
39 |
-
"like",
|
40 |
-
"linux_distribution",
|
41 |
-
"lsb_release_attr",
|
42 |
-
"lsb_release_info",
|
43 |
-
"major_version",
|
44 |
-
"minor_version",
|
45 |
-
"name",
|
46 |
-
"os_release_attr",
|
47 |
-
"os_release_info",
|
48 |
-
"uname_attr",
|
49 |
-
"uname_info",
|
50 |
-
"version",
|
51 |
-
"version_parts",
|
52 |
-
]
|
53 |
-
|
54 |
-
__version__ = __version__
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
spaces/Bonp/B/README.md
DELETED
@@ -1,10 +0,0 @@
|
|
1 |
-
---
|
2 |
-
title: B
|
3 |
-
emoji: 🌖
|
4 |
-
colorFrom: green
|
5 |
-
colorTo: pink
|
6 |
-
sdk: docker
|
7 |
-
pinned: false
|
8 |
-
---
|
9 |
-
|
10 |
-
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
spaces/CVPR/LIVE/thrust/thrust/system/cuda/detail/managed_memory_pointer.h
DELETED
@@ -1,195 +0,0 @@
|
|
1 |
-
/*
|
2 |
-
* Copyright 2020 NVIDIA Corporation
|
3 |
-
*
|
4 |
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
5 |
-
* you may not use this file except in compliance with the License.
|
6 |
-
* You may obtain a copy of the License at
|
7 |
-
*
|
8 |
-
* http://www.apache.org/licenses/LICENSE-2.0
|
9 |
-
*
|
10 |
-
* Unless required by applicable law or agreed to in writing, software
|
11 |
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
12 |
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
13 |
-
* See the License for the specific language governing permissions and
|
14 |
-
* limitations under the License.
|
15 |
-
*/
|
16 |
-
|
17 |
-
#pragma once
|
18 |
-
|
19 |
-
#include <thrust/detail/pointer.h>
|
20 |
-
|
21 |
-
#include <thrust/detail/type_traits.h>
|
22 |
-
#include <thrust/system/cuda/detail/execution_policy.h>
|
23 |
-
|
24 |
-
namespace thrust
|
25 |
-
{
|
26 |
-
namespace system
|
27 |
-
{
|
28 |
-
namespace cuda
|
29 |
-
{
|
30 |
-
namespace detail
|
31 |
-
{
|
32 |
-
|
33 |
-
// forward decl for iterator traits:
|
34 |
-
template <typename T>
|
35 |
-
class managed_memory_pointer;
|
36 |
-
|
37 |
-
} // end namespace detail
|
38 |
-
} // end namespace cuda
|
39 |
-
} // end namespace system
|
40 |
-
|
41 |
-
// Specialize iterator traits to define `pointer` to something meaningful.
|
42 |
-
template <typename Element, typename Tag, typename Reference>
|
43 |
-
struct iterator_traits<thrust::pointer<
|
44 |
-
Element,
|
45 |
-
Tag,
|
46 |
-
Reference,
|
47 |
-
thrust::system::cuda::detail::managed_memory_pointer<Element> > > {
|
48 |
-
private:
|
49 |
-
typedef thrust::pointer<
|
50 |
-
Element,
|
51 |
-
Tag,
|
52 |
-
Reference,
|
53 |
-
thrust::system::cuda::detail::managed_memory_pointer<Element> >
|
54 |
-
ptr;
|
55 |
-
|
56 |
-
public:
|
57 |
-
typedef typename ptr::iterator_category iterator_category;
|
58 |
-
typedef typename ptr::value_type value_type;
|
59 |
-
typedef typename ptr::difference_type difference_type;
|
60 |
-
typedef Element* pointer;
|
61 |
-
typedef typename ptr::reference reference;
|
62 |
-
}; // end iterator_traits
|
63 |
-
|
64 |
-
namespace system
|
65 |
-
{
|
66 |
-
namespace cuda
|
67 |
-
{
|
68 |
-
namespace detail
|
69 |
-
{
|
70 |
-
|
71 |
-
/*! A version of thrust::cuda_cub::pointer that uses c++ references instead
|
72 |
-
* of thrust::cuda::reference. This is to allow managed memory pointers to
|
73 |
-
* be used with host-side code in standard libraries that are not compatible
|
74 |
-
* with proxy references.
|
75 |
-
*/
|
76 |
-
template <typename T>
|
77 |
-
class managed_memory_pointer
|
78 |
-
: public thrust::pointer<
|
79 |
-
T,
|
80 |
-
thrust::cuda_cub::tag,
|
81 |
-
typename thrust::detail::add_reference<T>::type,
|
82 |
-
thrust::system::cuda::detail::managed_memory_pointer<T> >
|
83 |
-
{
|
84 |
-
private:
|
85 |
-
typedef thrust::pointer<
|
86 |
-
T,
|
87 |
-
thrust::cuda_cub::tag,
|
88 |
-
typename thrust::detail::add_reference<T>::type,
|
89 |
-
thrust::system::cuda::detail::managed_memory_pointer<T> >
|
90 |
-
super_t;
|
91 |
-
|
92 |
-
public:
|
93 |
-
typedef typename super_t::raw_pointer pointer;
|
94 |
-
|
95 |
-
/*! \p managed_memory_pointer's no-argument constructor initializes its
|
96 |
-
* encapsulated pointer to \c 0.
|
97 |
-
*/
|
98 |
-
__host__ __device__ managed_memory_pointer()
|
99 |
-
: super_t()
|
100 |
-
{}
|
101 |
-
|
102 |
-
#if THRUST_CPP_DIALECT >= 2011
|
103 |
-
// NOTE: This is needed so that Thrust smart pointers can be used in
|
104 |
-
// `std::unique_ptr`.
|
105 |
-
__host__ __device__ managed_memory_pointer(decltype(nullptr))
|
106 |
-
: super_t(nullptr)
|
107 |
-
{}
|
108 |
-
#endif
|
109 |
-
|
110 |
-
/*! This constructor allows construction of a <tt><const T></tt> from a
|
111 |
-
* <tt>T*</tt>.
|
112 |
-
*
|
113 |
-
* \param ptr A raw pointer to copy from, presumed to point to a location
|
114 |
-
* in memory accessible by the \p cuda system. \tparam OtherT \p OtherT
|
115 |
-
* shall be convertible to \p T.
|
116 |
-
*/
|
117 |
-
template <typename OtherT>
|
118 |
-
__host__ __device__ explicit managed_memory_pointer(OtherT* ptr)
|
119 |
-
: super_t(ptr)
|
120 |
-
{}
|
121 |
-
|
122 |
-
/*! This constructor allows construction from another pointer-like object
|
123 |
-
* with related type.
|
124 |
-
*
|
125 |
-
* \param other The \p OtherPointer to copy.
|
126 |
-
* \tparam OtherPointer The system tag associated with \p OtherPointer
|
127 |
-
* shall be convertible to \p thrust::system::cuda::tag and its element
|
128 |
-
* type shall be convertible to \p T.
|
129 |
-
*/
|
130 |
-
template <typename OtherPointer>
|
131 |
-
__host__ __device__ managed_memory_pointer(
|
132 |
-
const OtherPointer& other,
|
133 |
-
typename thrust::detail::enable_if_pointer_is_convertible<
|
134 |
-
OtherPointer,
|
135 |
-
managed_memory_pointer>::type* = 0)
|
136 |
-
: super_t(other)
|
137 |
-
{}
|
138 |
-
|
139 |
-
/*! This constructor allows construction from another pointer-like object
|
140 |
-
* with \p void type.
|
141 |
-
*
|
142 |
-
* \param other The \p OtherPointer to copy.
|
143 |
-
* \tparam OtherPointer The system tag associated with \p OtherPointer
|
144 |
-
* shall be convertible to \p thrust::system::cuda::tag and its element
|
145 |
-
* type shall be \p void.
|
146 |
-
*/
|
147 |
-
template <typename OtherPointer>
|
148 |
-
__host__ __device__ explicit managed_memory_pointer(
|
149 |
-
const OtherPointer& other,
|
150 |
-
typename thrust::detail::enable_if_void_pointer_is_system_convertible<
|
151 |
-
OtherPointer,
|
152 |
-
managed_memory_pointer>::type* = 0)
|
153 |
-
: super_t(other)
|
154 |
-
{}
|
155 |
-
|
156 |
-
/*! Assignment operator allows assigning from another pointer-like object
|
157 |
-
* with related type.
|
158 |
-
*
|
159 |
-
* \param other The other pointer-like object to assign from.
|
160 |
-
* \tparam OtherPointer The system tag associated with \p OtherPointer
|
161 |
-
* shall be convertible to \p thrust::system::cuda::tag and its element
|
162 |
-
* type shall be convertible to \p T.
|
163 |
-
*/
|
164 |
-
template <typename OtherPointer>
|
165 |
-
__host__ __device__ typename thrust::detail::enable_if_pointer_is_convertible<
|
166 |
-
OtherPointer,
|
167 |
-
managed_memory_pointer,
|
168 |
-
managed_memory_pointer&>::type
|
169 |
-
operator=(const OtherPointer& other)
|
170 |
-
{
|
171 |
-
return super_t::operator=(other);
|
172 |
-
}
|
173 |
-
|
174 |
-
#if THRUST_CPP_DIALECT >= 2011
|
175 |
-
// NOTE: This is needed so that Thrust smart pointers can be used in
|
176 |
-
// `std::unique_ptr`.
|
177 |
-
__host__ __device__ managed_memory_pointer& operator=(decltype(nullptr))
|
178 |
-
{
|
179 |
-
super_t::operator=(nullptr);
|
180 |
-
return *this;
|
181 |
-
}
|
182 |
-
#endif
|
183 |
-
|
184 |
-
__host__ __device__
|
185 |
-
pointer operator->() const
|
186 |
-
{
|
187 |
-
return this->get();
|
188 |
-
}
|
189 |
-
|
190 |
-
}; // class managed_memory_pointer
|
191 |
-
|
192 |
-
} // namespace detail
|
193 |
-
} // namespace cuda
|
194 |
-
} // namespace system
|
195 |
-
} // namespace thrust
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
spaces/CVPR/regionclip-demo/detectron2/config/defaults.py
DELETED
@@ -1,786 +0,0 @@
|
|
1 |
-
# Copyright (c) Facebook, Inc. and its affiliates.
|
2 |
-
from .config import CfgNode as CN
|
3 |
-
|
4 |
-
# ------------------------------------------------------------------de-----------
|
5 |
-
# Convention about Training / Test specific parameters
|
6 |
-
# -----------------------------------------------------------------------------
|
7 |
-
# Whenever an argument can be either used for training or for testing, the
|
8 |
-
# corresponding name will be post-fixed by a _TRAIN for a training parameter,
|
9 |
-
# or _TEST for a test-specific parameter.
|
10 |
-
# For example, the number of images during training will be
|
11 |
-
# IMAGES_PER_BATCH_TRAIN, while the number of images for testing will be
|
12 |
-
# IMAGES_PER_BATCH_TEST
|
13 |
-
|
14 |
-
# -----------------------------------------------------------------------------
|
15 |
-
# Config definition
|
16 |
-
# -----------------------------------------------------------------------------
|
17 |
-
|
18 |
-
_C = CN()
|
19 |
-
|
20 |
-
# The version number, to upgrade from old configs to new ones if any
|
21 |
-
# changes happen. It's recommended to keep a VERSION in your config file.
|
22 |
-
_C.VERSION = 2
|
23 |
-
|
24 |
-
_C.MODEL = CN()
|
25 |
-
_C.MODEL.LOAD_PROPOSALS = False
|
26 |
-
_C.MODEL.MASK_ON = False
|
27 |
-
_C.MODEL.KEYPOINT_ON = False
|
28 |
-
_C.MODEL.DEVICE = "cpu"
|
29 |
-
_C.MODEL.META_ARCHITECTURE = "GeneralizedRCNN"
|
30 |
-
|
31 |
-
# Path (a file path, or URL like detectron2://.., https://..) to a checkpoint file
|
32 |
-
# to be loaded to the model. You can find available models in the model zoo.
|
33 |
-
_C.MODEL.WEIGHTS = ""
|
34 |
-
|
35 |
-
# Values to be used for image normalization (BGR order, since INPUT.FORMAT defaults to BGR).
|
36 |
-
# To train on images of different number of channels, just set different mean & std.
|
37 |
-
# Default values are the mean pixel value from ImageNet: [103.53, 116.28, 123.675]
|
38 |
-
_C.MODEL.PIXEL_MEAN = [103.530, 116.280, 123.675]
|
39 |
-
# When using pre-trained models in Detectron1 or any MSRA models,
|
40 |
-
# std has been absorbed into its conv1 weights, so the std needs to be set 1.
|
41 |
-
# Otherwise, you can use [57.375, 57.120, 58.395] (ImageNet std)
|
42 |
-
_C.MODEL.PIXEL_STD = [1.0, 1.0, 1.0]
|
43 |
-
|
44 |
-
|
45 |
-
# -----------------------------------------------------------------------------
|
46 |
-
# INPUT
|
47 |
-
# -----------------------------------------------------------------------------
|
48 |
-
_C.INPUT = CN()
|
49 |
-
# Size of the smallest side of the image during training
|
50 |
-
_C.INPUT.MIN_SIZE_TRAIN = (800,)
|
51 |
-
# Sample size of smallest side by choice or random selection from range give by
|
52 |
-
# INPUT.MIN_SIZE_TRAIN
|
53 |
-
_C.INPUT.MIN_SIZE_TRAIN_SAMPLING = "choice"
|
54 |
-
# Maximum size of the side of the image during training
|
55 |
-
_C.INPUT.MAX_SIZE_TRAIN = 1333
|
56 |
-
# Size of the smallest side of the image during testing. Set to zero to disable resize in testing.
|
57 |
-
_C.INPUT.MIN_SIZE_TEST = 800
|
58 |
-
# Maximum size of the side of the image during testing
|
59 |
-
_C.INPUT.MAX_SIZE_TEST = 1333
|
60 |
-
# Mode for flipping images used in data augmentation during training
|
61 |
-
# choose one of ["horizontal, "vertical", "none"]
|
62 |
-
_C.INPUT.RANDOM_FLIP = "horizontal"
|
63 |
-
|
64 |
-
# `True` if cropping is used for data augmentation during training
|
65 |
-
_C.INPUT.CROP = CN({"ENABLED": False})
|
66 |
-
# Cropping type. See documentation of `detectron2.data.transforms.RandomCrop` for explanation.
|
67 |
-
_C.INPUT.CROP.TYPE = "relative_range"
|
68 |
-
# Size of crop in range (0, 1] if CROP.TYPE is "relative" or "relative_range" and in number of
|
69 |
-
# pixels if CROP.TYPE is "absolute"
|
70 |
-
_C.INPUT.CROP.SIZE = [0.9, 0.9]
|
71 |
-
|
72 |
-
|
73 |
-
# Whether the model needs RGB, YUV, HSV etc.
|
74 |
-
# Should be one of the modes defined here, as we use PIL to read the image:
|
75 |
-
# https://pillow.readthedocs.io/en/stable/handbook/concepts.html#concept-modes
|
76 |
-
# with BGR being the one exception. One can set image format to BGR, we will
|
77 |
-
# internally use RGB for conversion and flip the channels over
|
78 |
-
_C.INPUT.FORMAT = "BGR"
|
79 |
-
# The ground truth mask format that the model will use.
|
80 |
-
# Mask R-CNN supports either "polygon" or "bitmask" as ground truth.
|
81 |
-
_C.INPUT.MASK_FORMAT = "polygon" # alternative: "bitmask"
|
82 |
-
|
83 |
-
################### Text Tokenizer from MSR-CLIP ##################
|
84 |
-
_C.INPUT.TEXT_TOKENIZER = "openai_bpe" # "bert-base-cased"
|
85 |
-
|
86 |
-
################## Data Augmentation from MSR-CLIP ##################
|
87 |
-
_C.AUG = CN()
|
88 |
-
_C.AUG.SCALE = (0.08, 1.0)
|
89 |
-
_C.AUG.RATIO = (3.0/4.0, 4.0/3.0)
|
90 |
-
_C.AUG.COLOR_JITTER = [0.4, 0.4, 0.4, 0.1, 0.0]
|
91 |
-
_C.AUG.GRAY_SCALE = 0.0
|
92 |
-
_C.AUG.GAUSSIAN_BLUR = 0.0
|
93 |
-
_C.AUG.DROPBLOCK_LAYERS = [3, 4]
|
94 |
-
_C.AUG.DROPBLOCK_KEEP_PROB = 1.0
|
95 |
-
_C.AUG.DROPBLOCK_BLOCK_SIZE = 7
|
96 |
-
_C.AUG.MIXUP_PROB = 0.0
|
97 |
-
_C.AUG.MIXUP = 0.0
|
98 |
-
_C.AUG.MIXCUT = 0.0
|
99 |
-
_C.AUG.MIXCUT_MINMAX = []
|
100 |
-
_C.AUG.MIXUP_SWITCH_PROB = 0.5
|
101 |
-
_C.AUG.MIXUP_MODE = 'batch'
|
102 |
-
_C.AUG.MIXCUT_AND_MIXUP = False
|
103 |
-
_C.AUG.INTERPOLATION = 3
|
104 |
-
_C.AUG.USE_TIMM = False
|
105 |
-
_C.AUG.TIMM_AUG = CN(new_allowed=True)
|
106 |
-
_C.AUG.TIMM_AUG.USE_LOADER = False
|
107 |
-
_C.AUG.TIMM_AUG.USE_TRANSFORM = False
|
108 |
-
|
109 |
-
_C.AUG.TRAIN = CN()
|
110 |
-
_C.AUG.TRAIN.IMAGE_SIZE = [224, 224] # width * height, ex: 192 * 256
|
111 |
-
_C.AUG.TRAIN.MAX_SIZE = None # the maximum size for longer edge after resizing
|
112 |
-
_C.AUG.TEST = CN()
|
113 |
-
_C.AUG.TEST.IMAGE_SIZE = [224, 224] # width * height, ex: 192 * 256
|
114 |
-
_C.AUG.TEST.MAX_SIZE = None # the maximum size for longer edge after resizing
|
115 |
-
_C.AUG.TEST.CENTER_CROP = False
|
116 |
-
_C.AUG.TEST.INTERPOLATION = 3
|
117 |
-
|
118 |
-
|
119 |
-
# -----------------------------------------------------------------------------
|
120 |
-
# Dataset
|
121 |
-
# -----------------------------------------------------------------------------
|
122 |
-
_C.DATASETS = CN()
|
123 |
-
# List of the dataset names for training. Must be registered in DatasetCatalog
|
124 |
-
# Samples from these datasets will be merged and used as one dataset.
|
125 |
-
_C.DATASETS.TRAIN = ()
|
126 |
-
# List of the pre-computed proposal files for training, which must be consistent
|
127 |
-
# with datasets listed in DATASETS.TRAIN.
|
128 |
-
_C.DATASETS.PROPOSAL_FILES_TRAIN = ()
|
129 |
-
# Number of top scoring precomputed proposals to keep for training
|
130 |
-
_C.DATASETS.PRECOMPUTED_PROPOSAL_TOPK_TRAIN = 2000
|
131 |
-
# List of the dataset names for testing. Must be registered in DatasetCatalog
|
132 |
-
_C.DATASETS.TEST = ()
|
133 |
-
# List of the pre-computed proposal files for test, which must be consistent
|
134 |
-
# with datasets listed in DATASETS.TEST.
|
135 |
-
_C.DATASETS.PROPOSAL_FILES_TEST = ()
|
136 |
-
# Number of top scoring precomputed proposals to keep for test
|
137 |
-
_C.DATASETS.PRECOMPUTED_PROPOSAL_TOPK_TEST = 1000
|
138 |
-
################## Data Loading from MSR-CLIP ##################
|
139 |
-
# List of dataset class names for training
|
140 |
-
_C.DATASETS.FACTORY_TRAIN = ()
|
141 |
-
# List of dataset folder for training
|
142 |
-
_C.DATASETS.PATH_TRAIN = ()
|
143 |
-
# List of the dataset names for auxilary training, as present in paths_catalog.py
|
144 |
-
_C.DATASETS.AUX = ()
|
145 |
-
# List of dataset class names for auxilary training
|
146 |
-
_C.DATASETS.FACTORY_AUX = ()
|
147 |
-
# List of dataset folder for auxilary training
|
148 |
-
_C.DATASETS.PATH_AUX = ()
|
149 |
-
# List of dataset class names for testing
|
150 |
-
_C.DATASETS.FACTORY_TEST = ()
|
151 |
-
# List of dataset folder for testing
|
152 |
-
_C.DATASETS.PATH_TEST = ()
|
153 |
-
# Labelmap file to convert to tsv or for demo purpose
|
154 |
-
_C.DATASETS.LABELMAP_FILE = ''
|
155 |
-
_C.DATASETS.ATTR_LABELMAP_FILE = ''
|
156 |
-
_C.DATASETS.FILTERED_CLASSIFICATION_DATASETS = ''
|
157 |
-
# hierarchy file for test time score aggregation (developed on OpenImages)
|
158 |
-
_C.DATASETS.HIERARCHY_FILE = ''
|
159 |
-
# List of box extra fields for training/testing
|
160 |
-
# If given, will not infer from the other cfgs.
|
161 |
-
_C.DATASETS.BOX_EXTRA_FIELDS = ()
|
162 |
-
|
163 |
-
_C.DATASETS.NUM_CLASSES = 0
|
164 |
-
_C.DATASETS.ROOT = ''
|
165 |
-
_C.DATASETS.TRAIN_SET = 'train'
|
166 |
-
_C.DATASETS.VAL_SET = ''
|
167 |
-
_C.DATASETS.TEST_SET = 'val'
|
168 |
-
|
169 |
-
# The maximum total input sequence length after WordPiece tokenization
|
170 |
-
# Sequences longer than this will be truncated, and sequences shorter than this will be padded.
|
171 |
-
_C.DATASETS.MAX_SEQ_LENGTH = 35
|
172 |
-
|
173 |
-
# -----------------------------------------------------------------------------
|
174 |
-
# DataLoader
|
175 |
-
# -----------------------------------------------------------------------------
|
176 |
-
_C.DATALOADER = CN()
|
177 |
-
# Number of data loading threads
|
178 |
-
_C.DATALOADER.NUM_WORKERS = 4
|
179 |
-
# If True, each batch should contain only images for which the aspect ratio
|
180 |
-
# is compatible. This groups portrait images together, and landscape images
|
181 |
-
# are not batched with portrait images.
|
182 |
-
_C.DATALOADER.ASPECT_RATIO_GROUPING = True
|
183 |
-
# Options: TrainingSampler, RepeatFactorTrainingSampler
|
184 |
-
_C.DATALOADER.SAMPLER_TRAIN = "TrainingSampler"
|
185 |
-
# Repeat threshold for RepeatFactorTrainingSampler
|
186 |
-
_C.DATALOADER.REPEAT_THRESHOLD = 0.0
|
187 |
-
# Tf True, when working on datasets that have instance annotations, the
|
188 |
-
# training dataloader will filter out images without associated annotations
|
189 |
-
_C.DATALOADER.FILTER_EMPTY_ANNOTATIONS = True
|
190 |
-
|
191 |
-
# ---------------------------------------------------------------------------- #
|
192 |
-
# CLIP options
|
193 |
-
# ---------------------------------------------------------------------------- #
|
194 |
-
_C.MODEL.CLIP = CN()
|
195 |
-
|
196 |
-
_C.MODEL.CLIP.CROP_REGION_TYPE = "" # options: "GT", "RPN"
|
197 |
-
_C.MODEL.CLIP.BB_RPN_WEIGHTS = None # the weights of pretrained MaskRCNN
|
198 |
-
_C.MODEL.CLIP.IMS_PER_BATCH_TEST = 8 # the #images during inference per batch
|
199 |
-
|
200 |
-
_C.MODEL.CLIP.USE_TEXT_EMB_CLASSIFIER = False # if True, use the CLIP text embedding as the classifier's weights
|
201 |
-
_C.MODEL.CLIP.TEXT_EMB_PATH = None # "/mnt/output_storage/trained_models/lvis_cls_emb/lvis_1203_cls_emb.pth"
|
202 |
-
_C.MODEL.CLIP.OFFLINE_RPN_CONFIG = None # option: all configs of pretrained RPN
|
203 |
-
_C.MODEL.CLIP.NO_BOX_DELTA = False # if True, during inference, no box delta will be applied to region proposals
|
204 |
-
|
205 |
-
_C.MODEL.CLIP.BG_CLS_LOSS_WEIGHT = None # if not None, it is the loss weight for bg regions
|
206 |
-
_C.MODEL.CLIP.ONLY_SAMPLE_FG_PROPOSALS = False # if True, during training, ignore all bg proposals and only sample fg proposals
|
207 |
-
_C.MODEL.CLIP.MULTIPLY_RPN_SCORE = False # if True, during inference, multiply RPN scores with classification scores
|
208 |
-
|
209 |
-
_C.MODEL.CLIP.OPENSET_TEST_NUM_CLASSES = None # if an integer, it is #all_cls in test
|
210 |
-
_C.MODEL.CLIP.OPENSET_TEST_TEXT_EMB_PATH = None # if not None, enables the openset/zero-shot training, the category embeddings during test
|
211 |
-
|
212 |
-
_C.MODEL.CLIP.CLSS_TEMP = None # if None, dot product wo normalization & temperature; if float, normalization plus temperature
|
213 |
-
_C.MODEL.CLIP.RUN_CVPR_OVR = False # if True, train CVPR OVR model with their text embeddings
|
214 |
-
_C.MODEL.CLIP.FOCAL_SCALED_LOSS = None # if not None (float value for gamma), apply focal loss scaling idea to standard cross-entropy loss
|
215 |
-
|
216 |
-
_C.MODEL.CLIP.OFFLINE_RPN_NMS_THRESH = None # the threshold of NMS in offline RPN
|
217 |
-
_C.MODEL.CLIP.PRETRAIN_IMG_TXT_LEVEL = True # if True, pretrain model using image-text level matching
|
218 |
-
_C.MODEL.CLIP.PRETRAIN_ONLY_EOT = False # if True, use end-of-token emb to match region features, in image-text level matching
|
219 |
-
_C.MODEL.CLIP.PRETRAIN_RPN_REGIONS = None # if not None, the number of RPN regions per image during pretraining
|
220 |
-
_C.MODEL.CLIP.PRETRAIN_SAMPLE_REGIONS = None # if not None, the number of regions per image during pretraining after sampling, to avoid overfitting
|
221 |
-
_C.MODEL.CLIP.GATHER_GPUS = False # if True, gather tensors across GPUS to increase batch size
|
222 |
-
_C.MODEL.CLIP.GRID_REGIONS = False # if True, use grid boxes to extract grid features, instead of object proposals
|
223 |
-
_C.MODEL.CLIP.CONCEPT_POOL_EMB = None # if not None, it provides the file path of embs of concept pool and thus enables region-concept matching
|
224 |
-
_C.MODEL.CLIP.CONCEPT_THRES = None # if not None, the threshold to filter out the regions with low matching score with concept embs, dependent on temp (default: 0.01)
|
225 |
-
|
226 |
-
_C.MODEL.CLIP.OFFLINE_RPN_LSJ_PRETRAINED = False # if True, use large-scale jittering (LSJ) pretrained RPN
|
227 |
-
_C.MODEL.CLIP.TEACHER_RESNETS_DEPTH = 50 # the type of visual encoder of teacher model, sucha as ResNet 50, 101, 200 (a flag for 50x4)
|
228 |
-
_C.MODEL.CLIP.TEACHER_CONCEPT_POOL_EMB = None # if not None, it uses the same concept embedding as student model; otherwise, uses a seperate embedding of teacher model
|
229 |
-
_C.MODEL.CLIP.TEACHER_POOLER_RESOLUTION = 14 # RoIpooling resolution of teacher model
|
230 |
-
|
231 |
-
_C.MODEL.CLIP.TEXT_EMB_DIM = 1024 # the dimension of precomputed class embeddings
|
232 |
-
|
233 |
-
# ---------------------------------------------------------------------------- #
|
234 |
-
# Backbone options
|
235 |
-
# ---------------------------------------------------------------------------- #
|
236 |
-
_C.MODEL.BACKBONE = CN()
|
237 |
-
|
238 |
-
_C.MODEL.BACKBONE.NAME = "build_resnet_backbone"
|
239 |
-
# Freeze the first several stages so they are not trained.
|
240 |
-
# There are 5 stages in ResNet. The first is a convolution, and the following
|
241 |
-
# stages are each group of residual blocks.
|
242 |
-
_C.MODEL.BACKBONE.FREEZE_AT = 2
|
243 |
-
|
244 |
-
_C.MODEL.TEXT_BACKBONE = CN()
|
245 |
-
_C.MODEL.TEXT_BACKBONE.NAME = "build_clip_swin_text_backbone"
|
246 |
-
|
247 |
-
|
248 |
-
# ---------------------------------------------------------------------------- #
|
249 |
-
# FPN options
|
250 |
-
# ---------------------------------------------------------------------------- #
|
251 |
-
_C.MODEL.FPN = CN()
|
252 |
-
# Names of the input feature maps to be used by FPN
|
253 |
-
# They must have contiguous power of 2 strides
|
254 |
-
# e.g., ["res2", "res3", "res4", "res5"]
|
255 |
-
_C.MODEL.FPN.IN_FEATURES = []
|
256 |
-
_C.MODEL.FPN.OUT_CHANNELS = 256
|
257 |
-
|
258 |
-
# Options: "" (no norm), "GN"
|
259 |
-
_C.MODEL.FPN.NORM = ""
|
260 |
-
|
261 |
-
# Types for fusing the FPN top-down and lateral features. Can be either "sum" or "avg"
|
262 |
-
_C.MODEL.FPN.FUSE_TYPE = "sum"
|
263 |
-
|
264 |
-
|
265 |
-
# ---------------------------------------------------------------------------- #
|
266 |
-
# Proposal generator options
|
267 |
-
# ---------------------------------------------------------------------------- #
|
268 |
-
_C.MODEL.PROPOSAL_GENERATOR = CN()
|
269 |
-
# Current proposal generators include "RPN", "RRPN" and "PrecomputedProposals"
|
270 |
-
_C.MODEL.PROPOSAL_GENERATOR.NAME = "RPN"
|
271 |
-
# Proposal height and width both need to be greater than MIN_SIZE
|
272 |
-
# (a the scale used during training or inference)
|
273 |
-
_C.MODEL.PROPOSAL_GENERATOR.MIN_SIZE = 0
|
274 |
-
|
275 |
-
|
276 |
-
# ---------------------------------------------------------------------------- #
|
277 |
-
# Anchor generator options
|
278 |
-
# ---------------------------------------------------------------------------- #
|
279 |
-
_C.MODEL.ANCHOR_GENERATOR = CN()
|
280 |
-
# The generator can be any name in the ANCHOR_GENERATOR registry
|
281 |
-
_C.MODEL.ANCHOR_GENERATOR.NAME = "DefaultAnchorGenerator"
|
282 |
-
# Anchor sizes (i.e. sqrt of area) in absolute pixels w.r.t. the network input.
|
283 |
-
# Format: list[list[float]]. SIZES[i] specifies the list of sizes to use for
|
284 |
-
# IN_FEATURES[i]; len(SIZES) must be equal to len(IN_FEATURES) or 1.
|
285 |
-
# When len(SIZES) == 1, SIZES[0] is used for all IN_FEATURES.
|
286 |
-
_C.MODEL.ANCHOR_GENERATOR.SIZES = [[32, 64, 128, 256, 512]]
|
287 |
-
# Anchor aspect ratios. For each area given in `SIZES`, anchors with different aspect
|
288 |
-
# ratios are generated by an anchor generator.
|
289 |
-
# Format: list[list[float]]. ASPECT_RATIOS[i] specifies the list of aspect ratios (H/W)
|
290 |
-
# to use for IN_FEATURES[i]; len(ASPECT_RATIOS) == len(IN_FEATURES) must be true,
|
291 |
-
# or len(ASPECT_RATIOS) == 1 is true and aspect ratio list ASPECT_RATIOS[0] is used
|
292 |
-
# for all IN_FEATURES.
|
293 |
-
_C.MODEL.ANCHOR_GENERATOR.ASPECT_RATIOS = [[0.5, 1.0, 2.0]]
|
294 |
-
# Anchor angles.
|
295 |
-
# list[list[float]], the angle in degrees, for each input feature map.
|
296 |
-
# ANGLES[i] specifies the list of angles for IN_FEATURES[i].
|
297 |
-
_C.MODEL.ANCHOR_GENERATOR.ANGLES = [[-90, 0, 90]]
|
298 |
-
# Relative offset between the center of the first anchor and the top-left corner of the image
|
299 |
-
# Value has to be in [0, 1). Recommend to use 0.5, which means half stride.
|
300 |
-
# The value is not expected to affect model accuracy.
|
301 |
-
_C.MODEL.ANCHOR_GENERATOR.OFFSET = 0.0
|
302 |
-
|
303 |
-
# ---------------------------------------------------------------------------- #
|
304 |
-
# RPN options
|
305 |
-
# ---------------------------------------------------------------------------- #
|
306 |
-
_C.MODEL.RPN = CN()
|
307 |
-
_C.MODEL.RPN.HEAD_NAME = "StandardRPNHead" # used by RPN_HEAD_REGISTRY
|
308 |
-
|
309 |
-
# Names of the input feature maps to be used by RPN
|
310 |
-
# e.g., ["p2", "p3", "p4", "p5", "p6"] for FPN
|
311 |
-
_C.MODEL.RPN.IN_FEATURES = ["res4"]
|
312 |
-
# Remove RPN anchors that go outside the image by BOUNDARY_THRESH pixels
|
313 |
-
# Set to -1 or a large value, e.g. 100000, to disable pruning anchors
|
314 |
-
_C.MODEL.RPN.BOUNDARY_THRESH = -1
|
315 |
-
# IOU overlap ratios [BG_IOU_THRESHOLD, FG_IOU_THRESHOLD]
|
316 |
-
# Minimum overlap required between an anchor and ground-truth box for the
|
317 |
-
# (anchor, gt box) pair to be a positive example (IoU >= FG_IOU_THRESHOLD
|
318 |
-
# ==> positive RPN example: 1)
|
319 |
-
# Maximum overlap allowed between an anchor and ground-truth box for the
|
320 |
-
# (anchor, gt box) pair to be a negative examples (IoU < BG_IOU_THRESHOLD
|
321 |
-
# ==> negative RPN example: 0)
|
322 |
-
# Anchors with overlap in between (BG_IOU_THRESHOLD <= IoU < FG_IOU_THRESHOLD)
|
323 |
-
# are ignored (-1)
|
324 |
-
_C.MODEL.RPN.IOU_THRESHOLDS = [0.3, 0.7]
|
325 |
-
_C.MODEL.RPN.IOU_LABELS = [0, -1, 1]
|
326 |
-
# Number of regions per image used to train RPN
|
327 |
-
_C.MODEL.RPN.BATCH_SIZE_PER_IMAGE = 256
|
328 |
-
# Target fraction of foreground (positive) examples per RPN minibatch
|
329 |
-
_C.MODEL.RPN.POSITIVE_FRACTION = 0.5
|
330 |
-
# Options are: "smooth_l1", "giou"
|
331 |
-
_C.MODEL.RPN.BBOX_REG_LOSS_TYPE = "smooth_l1"
|
332 |
-
_C.MODEL.RPN.BBOX_REG_LOSS_WEIGHT = 1.0
|
333 |
-
# Weights on (dx, dy, dw, dh) for normalizing RPN anchor regression targets
|
334 |
-
_C.MODEL.RPN.BBOX_REG_WEIGHTS = (1.0, 1.0, 1.0, 1.0)
|
335 |
-
# The transition point from L1 to L2 loss. Set to 0.0 to make the loss simply L1.
|
336 |
-
_C.MODEL.RPN.SMOOTH_L1_BETA = 0.0
|
337 |
-
_C.MODEL.RPN.LOSS_WEIGHT = 1.0
|
338 |
-
# Number of top scoring RPN proposals to keep before applying NMS
|
339 |
-
# When FPN is used, this is *per FPN level* (not total)
|
340 |
-
_C.MODEL.RPN.PRE_NMS_TOPK_TRAIN = 12000
|
341 |
-
_C.MODEL.RPN.PRE_NMS_TOPK_TEST = 6000
|
342 |
-
# Number of top scoring RPN proposals to keep after applying NMS
|
343 |
-
# When FPN is used, this limit is applied per level and then again to the union
|
344 |
-
# of proposals from all levels
|
345 |
-
# NOTE: When FPN is used, the meaning of this config is different from Detectron1.
|
346 |
-
# It means per-batch topk in Detectron1, but per-image topk here.
|
347 |
-
# See the "find_top_rpn_proposals" function for details.
|
348 |
-
_C.MODEL.RPN.POST_NMS_TOPK_TRAIN = 2000
|
349 |
-
_C.MODEL.RPN.POST_NMS_TOPK_TEST = 1000
|
350 |
-
# NMS threshold used on RPN proposals
|
351 |
-
_C.MODEL.RPN.NMS_THRESH = 0.7
|
352 |
-
# Set this to -1 to use the same number of output channels as input channels.
|
353 |
-
_C.MODEL.RPN.CONV_DIMS = [-1]
|
354 |
-
|
355 |
-
# ---------------------------------------------------------------------------- #
|
356 |
-
# ROI HEADS options
|
357 |
-
# ---------------------------------------------------------------------------- #
|
358 |
-
_C.MODEL.ROI_HEADS = CN()
|
359 |
-
_C.MODEL.ROI_HEADS.NAME = "Res5ROIHeads"
|
360 |
-
# Number of foreground classes
|
361 |
-
_C.MODEL.ROI_HEADS.NUM_CLASSES = 80
|
362 |
-
# Names of the input feature maps to be used by ROI heads
|
363 |
-
# Currently all heads (box, mask, ...) use the same input feature map list
|
364 |
-
# e.g., ["p2", "p3", "p4", "p5"] is commonly used for FPN
|
365 |
-
_C.MODEL.ROI_HEADS.IN_FEATURES = ["res4"]
|
366 |
-
# IOU overlap ratios [IOU_THRESHOLD]
|
367 |
-
# Overlap threshold for an RoI to be considered background (if < IOU_THRESHOLD)
|
368 |
-
# Overlap threshold for an RoI to be considered foreground (if >= IOU_THRESHOLD)
|
369 |
-
_C.MODEL.ROI_HEADS.IOU_THRESHOLDS = [0.5]
|
370 |
-
_C.MODEL.ROI_HEADS.IOU_LABELS = [0, 1]
|
371 |
-
# RoI minibatch size *per image* (number of regions of interest [ROIs])
|
372 |
-
# Total number of RoIs per training minibatch =
|
373 |
-
# ROI_HEADS.BATCH_SIZE_PER_IMAGE * SOLVER.IMS_PER_BATCH
|
374 |
-
# E.g., a common configuration is: 512 * 16 = 8192
|
375 |
-
_C.MODEL.ROI_HEADS.BATCH_SIZE_PER_IMAGE = 512
|
376 |
-
# Target fraction of RoI minibatch that is labeled foreground (i.e. class > 0)
|
377 |
-
_C.MODEL.ROI_HEADS.POSITIVE_FRACTION = 0.25
|
378 |
-
|
379 |
-
# Only used on test mode
|
380 |
-
|
381 |
-
# Minimum score threshold (assuming scores in a [0, 1] range); a value chosen to
|
382 |
-
# balance obtaining high recall with not having too many low precision
|
383 |
-
# detections that will slow down inference post processing steps (like NMS)
|
384 |
-
# A default threshold of 0.0 increases AP by ~0.2-0.3 but significantly slows down
|
385 |
-
# inference.
|
386 |
-
_C.MODEL.ROI_HEADS.SCORE_THRESH_TEST = 0.05
|
387 |
-
# Overlap threshold used for non-maximum suppression (suppress boxes with
|
388 |
-
# IoU >= this threshold)
|
389 |
-
_C.MODEL.ROI_HEADS.NMS_THRESH_TEST = 0.5
|
390 |
-
# If True, augment proposals with ground-truth boxes before sampling proposals to
|
391 |
-
# train ROI heads.
|
392 |
-
_C.MODEL.ROI_HEADS.PROPOSAL_APPEND_GT = True
|
393 |
-
|
394 |
-
# Use soft NMS instead of standard NMS if set to True
|
395 |
-
_C.MODEL.ROI_HEADS.SOFT_NMS_ENABLED = False
|
396 |
-
# See soft NMS paper for definition of these options
|
397 |
-
_C.MODEL.ROI_HEADS.SOFT_NMS_METHOD = "gaussian" # "linear"
|
398 |
-
_C.MODEL.ROI_HEADS.SOFT_NMS_SIGMA = 0.5
|
399 |
-
# For the linear_threshold we use NMS_THRESH_TEST
|
400 |
-
_C.MODEL.ROI_HEADS.SOFT_NMS_PRUNE = 0.001
|
401 |
-
|
402 |
-
# ---------------------------------------------------------------------------- #
|
403 |
-
# Box Head
|
404 |
-
# ---------------------------------------------------------------------------- #
|
405 |
-
_C.MODEL.ROI_BOX_HEAD = CN()
|
406 |
-
# C4 don't use head name option
|
407 |
-
# Options for non-C4 models: FastRCNNConvFCHead,
|
408 |
-
_C.MODEL.ROI_BOX_HEAD.NAME = ""
|
409 |
-
# Options are: "smooth_l1", "giou"
|
410 |
-
_C.MODEL.ROI_BOX_HEAD.BBOX_REG_LOSS_TYPE = "smooth_l1"
|
411 |
-
# The final scaling coefficient on the box regression loss, used to balance the magnitude of its
|
412 |
-
# gradients with other losses in the model. See also `MODEL.ROI_KEYPOINT_HEAD.LOSS_WEIGHT`.
|
413 |
-
_C.MODEL.ROI_BOX_HEAD.BBOX_REG_LOSS_WEIGHT = 1.0
|
414 |
-
# Default weights on (dx, dy, dw, dh) for normalizing bbox regression targets
|
415 |
-
# These are empirically chosen to approximately lead to unit variance targets
|
416 |
-
_C.MODEL.ROI_BOX_HEAD.BBOX_REG_WEIGHTS = (10.0, 10.0, 5.0, 5.0)
|
417 |
-
# The transition point from L1 to L2 loss. Set to 0.0 to make the loss simply L1.
|
418 |
-
_C.MODEL.ROI_BOX_HEAD.SMOOTH_L1_BETA = 0.0
|
419 |
-
_C.MODEL.ROI_BOX_HEAD.POOLER_RESOLUTION = 14
|
420 |
-
_C.MODEL.ROI_BOX_HEAD.POOLER_SAMPLING_RATIO = 0
|
421 |
-
# Type of pooling operation applied to the incoming feature map for each RoI
|
422 |
-
_C.MODEL.ROI_BOX_HEAD.POOLER_TYPE = "ROIAlignV2"
|
423 |
-
|
424 |
-
_C.MODEL.ROI_BOX_HEAD.NUM_FC = 0
|
425 |
-
# Hidden layer dimension for FC layers in the RoI box head
|
426 |
-
_C.MODEL.ROI_BOX_HEAD.FC_DIM = 1024
|
427 |
-
_C.MODEL.ROI_BOX_HEAD.NUM_CONV = 0
|
428 |
-
# Channel dimension for Conv layers in the RoI box head
|
429 |
-
_C.MODEL.ROI_BOX_HEAD.CONV_DIM = 256
|
430 |
-
# Normalization method for the convolution layers.
|
431 |
-
# Options: "" (no norm), "GN", "SyncBN".
|
432 |
-
_C.MODEL.ROI_BOX_HEAD.NORM = ""
|
433 |
-
# Whether to use class agnostic for bbox regression
|
434 |
-
_C.MODEL.ROI_BOX_HEAD.CLS_AGNOSTIC_BBOX_REG = False
|
435 |
-
# If true, RoI heads use bounding boxes predicted by the box head rather than proposal boxes.
|
436 |
-
_C.MODEL.ROI_BOX_HEAD.TRAIN_ON_PRED_BOXES = False
|
437 |
-
|
438 |
-
# ---------------------------------------------------------------------------- #
|
439 |
-
# Cascaded Box Head
|
440 |
-
# ---------------------------------------------------------------------------- #
|
441 |
-
_C.MODEL.ROI_BOX_CASCADE_HEAD = CN()
|
442 |
-
# The number of cascade stages is implicitly defined by the length of the following two configs.
|
443 |
-
_C.MODEL.ROI_BOX_CASCADE_HEAD.BBOX_REG_WEIGHTS = (
|
444 |
-
(10.0, 10.0, 5.0, 5.0),
|
445 |
-
(20.0, 20.0, 10.0, 10.0),
|
446 |
-
(30.0, 30.0, 15.0, 15.0),
|
447 |
-
)
|
448 |
-
_C.MODEL.ROI_BOX_CASCADE_HEAD.IOUS = (0.5, 0.6, 0.7)
|
449 |
-
|
450 |
-
|
451 |
-
# ---------------------------------------------------------------------------- #
|
452 |
-
# Mask Head
|
453 |
-
# ---------------------------------------------------------------------------- #
|
454 |
-
_C.MODEL.ROI_MASK_HEAD = CN()
|
455 |
-
_C.MODEL.ROI_MASK_HEAD.NAME = "MaskRCNNConvUpsampleHead"
|
456 |
-
_C.MODEL.ROI_MASK_HEAD.POOLER_RESOLUTION = 14
|
457 |
-
_C.MODEL.ROI_MASK_HEAD.POOLER_SAMPLING_RATIO = 0
|
458 |
-
_C.MODEL.ROI_MASK_HEAD.NUM_CONV = 0 # The number of convs in the mask head
|
459 |
-
_C.MODEL.ROI_MASK_HEAD.CONV_DIM = 256
|
460 |
-
# Normalization method for the convolution layers.
|
461 |
-
# Options: "" (no norm), "GN", "SyncBN".
|
462 |
-
_C.MODEL.ROI_MASK_HEAD.NORM = ""
|
463 |
-
# Whether to use class agnostic for mask prediction
|
464 |
-
_C.MODEL.ROI_MASK_HEAD.CLS_AGNOSTIC_MASK = False
|
465 |
-
# Type of pooling operation applied to the incoming feature map for each RoI
|
466 |
-
_C.MODEL.ROI_MASK_HEAD.POOLER_TYPE = "ROIAlignV2"
|
467 |
-
|
468 |
-
|
469 |
-
# ---------------------------------------------------------------------------- #
|
470 |
-
# Keypoint Head
|
471 |
-
# ---------------------------------------------------------------------------- #
|
472 |
-
_C.MODEL.ROI_KEYPOINT_HEAD = CN()
|
473 |
-
_C.MODEL.ROI_KEYPOINT_HEAD.NAME = "KRCNNConvDeconvUpsampleHead"
|
474 |
-
_C.MODEL.ROI_KEYPOINT_HEAD.POOLER_RESOLUTION = 14
|
475 |
-
_C.MODEL.ROI_KEYPOINT_HEAD.POOLER_SAMPLING_RATIO = 0
|
476 |
-
_C.MODEL.ROI_KEYPOINT_HEAD.CONV_DIMS = tuple(512 for _ in range(8))
|
477 |
-
_C.MODEL.ROI_KEYPOINT_HEAD.NUM_KEYPOINTS = 17 # 17 is the number of keypoints in COCO.
|
478 |
-
|
479 |
-
# Images with too few (or no) keypoints are excluded from training.
|
480 |
-
_C.MODEL.ROI_KEYPOINT_HEAD.MIN_KEYPOINTS_PER_IMAGE = 1
|
481 |
-
# Normalize by the total number of visible keypoints in the minibatch if True.
|
482 |
-
# Otherwise, normalize by the total number of keypoints that could ever exist
|
483 |
-
# in the minibatch.
|
484 |
-
# The keypoint softmax loss is only calculated on visible keypoints.
|
485 |
-
# Since the number of visible keypoints can vary significantly between
|
486 |
-
# minibatches, this has the effect of up-weighting the importance of
|
487 |
-
# minibatches with few visible keypoints. (Imagine the extreme case of
|
488 |
-
# only one visible keypoint versus N: in the case of N, each one
|
489 |
-
# contributes 1/N to the gradient compared to the single keypoint
|
490 |
-
# determining the gradient direction). Instead, we can normalize the
|
491 |
-
# loss by the total number of keypoints, if it were the case that all
|
492 |
-
# keypoints were visible in a full minibatch. (Returning to the example,
|
493 |
-
# this means that the one visible keypoint contributes as much as each
|
494 |
-
# of the N keypoints.)
|
495 |
-
_C.MODEL.ROI_KEYPOINT_HEAD.NORMALIZE_LOSS_BY_VISIBLE_KEYPOINTS = True
|
496 |
-
# Multi-task loss weight to use for keypoints
|
497 |
-
# Recommended values:
|
498 |
-
# - use 1.0 if NORMALIZE_LOSS_BY_VISIBLE_KEYPOINTS is True
|
499 |
-
# - use 4.0 if NORMALIZE_LOSS_BY_VISIBLE_KEYPOINTS is False
|
500 |
-
_C.MODEL.ROI_KEYPOINT_HEAD.LOSS_WEIGHT = 1.0
|
501 |
-
# Type of pooling operation applied to the incoming feature map for each RoI
|
502 |
-
_C.MODEL.ROI_KEYPOINT_HEAD.POOLER_TYPE = "ROIAlignV2"
|
503 |
-
|
504 |
-
# ---------------------------------------------------------------------------- #
|
505 |
-
# Semantic Segmentation Head
|
506 |
-
# ---------------------------------------------------------------------------- #
|
507 |
-
_C.MODEL.SEM_SEG_HEAD = CN()
|
508 |
-
_C.MODEL.SEM_SEG_HEAD.NAME = "SemSegFPNHead"
|
509 |
-
_C.MODEL.SEM_SEG_HEAD.IN_FEATURES = ["p2", "p3", "p4", "p5"]
|
510 |
-
# Label in the semantic segmentation ground truth that is ignored, i.e., no loss is calculated for
|
511 |
-
# the correposnding pixel.
|
512 |
-
_C.MODEL.SEM_SEG_HEAD.IGNORE_VALUE = 255
|
513 |
-
# Number of classes in the semantic segmentation head
|
514 |
-
_C.MODEL.SEM_SEG_HEAD.NUM_CLASSES = 54
|
515 |
-
# Number of channels in the 3x3 convs inside semantic-FPN heads.
|
516 |
-
_C.MODEL.SEM_SEG_HEAD.CONVS_DIM = 128
|
517 |
-
# Outputs from semantic-FPN heads are up-scaled to the COMMON_STRIDE stride.
|
518 |
-
_C.MODEL.SEM_SEG_HEAD.COMMON_STRIDE = 4
|
519 |
-
# Normalization method for the convolution layers. Options: "" (no norm), "GN".
|
520 |
-
_C.MODEL.SEM_SEG_HEAD.NORM = "GN"
|
521 |
-
_C.MODEL.SEM_SEG_HEAD.LOSS_WEIGHT = 1.0
|
522 |
-
|
523 |
-
_C.MODEL.PANOPTIC_FPN = CN()
|
524 |
-
# Scaling of all losses from instance detection / segmentation head.
|
525 |
-
_C.MODEL.PANOPTIC_FPN.INSTANCE_LOSS_WEIGHT = 1.0
|
526 |
-
|
527 |
-
# options when combining instance & semantic segmentation outputs
|
528 |
-
_C.MODEL.PANOPTIC_FPN.COMBINE = CN({"ENABLED": True}) # "COMBINE.ENABLED" is deprecated & not used
|
529 |
-
_C.MODEL.PANOPTIC_FPN.COMBINE.OVERLAP_THRESH = 0.5
|
530 |
-
_C.MODEL.PANOPTIC_FPN.COMBINE.STUFF_AREA_LIMIT = 4096
|
531 |
-
_C.MODEL.PANOPTIC_FPN.COMBINE.INSTANCES_CONFIDENCE_THRESH = 0.5
|
532 |
-
|
533 |
-
|
534 |
-
# ---------------------------------------------------------------------------- #
|
535 |
-
# RetinaNet Head
|
536 |
-
# ---------------------------------------------------------------------------- #
|
537 |
-
_C.MODEL.RETINANET = CN()
|
538 |
-
|
539 |
-
# This is the number of foreground classes.
|
540 |
-
_C.MODEL.RETINANET.NUM_CLASSES = 80
|
541 |
-
|
542 |
-
_C.MODEL.RETINANET.IN_FEATURES = ["p3", "p4", "p5", "p6", "p7"]
|
543 |
-
|
544 |
-
# Convolutions to use in the cls and bbox tower
|
545 |
-
# NOTE: this doesn't include the last conv for logits
|
546 |
-
_C.MODEL.RETINANET.NUM_CONVS = 4
|
547 |
-
|
548 |
-
# IoU overlap ratio [bg, fg] for labeling anchors.
|
549 |
-
# Anchors with < bg are labeled negative (0)
|
550 |
-
# Anchors with >= bg and < fg are ignored (-1)
|
551 |
-
# Anchors with >= fg are labeled positive (1)
|
552 |
-
_C.MODEL.RETINANET.IOU_THRESHOLDS = [0.4, 0.5]
|
553 |
-
_C.MODEL.RETINANET.IOU_LABELS = [0, -1, 1]
|
554 |
-
|
555 |
-
# Prior prob for rare case (i.e. foreground) at the beginning of training.
|
556 |
-
# This is used to set the bias for the logits layer of the classifier subnet.
|
557 |
-
# This improves training stability in the case of heavy class imbalance.
|
558 |
-
_C.MODEL.RETINANET.PRIOR_PROB = 0.01
|
559 |
-
|
560 |
-
# Inference cls score threshold, only anchors with score > INFERENCE_TH are
|
561 |
-
# considered for inference (to improve speed)
|
562 |
-
_C.MODEL.RETINANET.SCORE_THRESH_TEST = 0.05
|
563 |
-
# Select topk candidates before NMS
|
564 |
-
_C.MODEL.RETINANET.TOPK_CANDIDATES_TEST = 1000
|
565 |
-
_C.MODEL.RETINANET.NMS_THRESH_TEST = 0.5
|
566 |
-
|
567 |
-
# Weights on (dx, dy, dw, dh) for normalizing Retinanet anchor regression targets
|
568 |
-
_C.MODEL.RETINANET.BBOX_REG_WEIGHTS = (1.0, 1.0, 1.0, 1.0)
|
569 |
-
|
570 |
-
# Loss parameters
|
571 |
-
_C.MODEL.RETINANET.FOCAL_LOSS_GAMMA = 2.0
|
572 |
-
_C.MODEL.RETINANET.FOCAL_LOSS_ALPHA = 0.25
|
573 |
-
_C.MODEL.RETINANET.SMOOTH_L1_LOSS_BETA = 0.1
|
574 |
-
# Options are: "smooth_l1", "giou"
|
575 |
-
_C.MODEL.RETINANET.BBOX_REG_LOSS_TYPE = "smooth_l1"
|
576 |
-
|
577 |
-
# One of BN, SyncBN, FrozenBN, GN
|
578 |
-
# Only supports GN until unshared norm is implemented
|
579 |
-
_C.MODEL.RETINANET.NORM = ""
|
580 |
-
|
581 |
-
|
582 |
-
# ---------------------------------------------------------------------------- #
|
583 |
-
# ResNe[X]t options (ResNets = {ResNet, ResNeXt}
|
584 |
-
# Note that parts of a resnet may be used for both the backbone and the head
|
585 |
-
# These options apply to both
|
586 |
-
# ---------------------------------------------------------------------------- #
|
587 |
-
_C.MODEL.RESNETS = CN()
|
588 |
-
|
589 |
-
_C.MODEL.RESNETS.DEPTH = 50
|
590 |
-
_C.MODEL.RESNETS.OUT_FEATURES = ["res4"] # res4 for C4 backbone, res2..5 for FPN backbone
|
591 |
-
|
592 |
-
# Number of groups to use; 1 ==> ResNet; > 1 ==> ResNeXt
|
593 |
-
_C.MODEL.RESNETS.NUM_GROUPS = 1
|
594 |
-
|
595 |
-
# Options: FrozenBN, GN, "SyncBN", "BN"
|
596 |
-
_C.MODEL.RESNETS.NORM = "FrozenBN"
|
597 |
-
|
598 |
-
# Baseline width of each group.
|
599 |
-
# Scaling this parameters will scale the width of all bottleneck layers.
|
600 |
-
_C.MODEL.RESNETS.WIDTH_PER_GROUP = 64
|
601 |
-
|
602 |
-
# Place the stride 2 conv on the 1x1 filter
|
603 |
-
# Use True only for the original MSRA ResNet; use False for C2 and Torch models
|
604 |
-
_C.MODEL.RESNETS.STRIDE_IN_1X1 = True
|
605 |
-
|
606 |
-
# Apply dilation in stage "res5"
|
607 |
-
_C.MODEL.RESNETS.RES5_DILATION = 1
|
608 |
-
|
609 |
-
# Output width of res2. Scaling this parameters will scale the width of all 1x1 convs in ResNet
|
610 |
-
# For R18 and R34, this needs to be set to 64
|
611 |
-
_C.MODEL.RESNETS.RES2_OUT_CHANNELS = 256
|
612 |
-
_C.MODEL.RESNETS.STEM_OUT_CHANNELS = 64
|
613 |
-
|
614 |
-
# Apply Deformable Convolution in stages
|
615 |
-
# Specify if apply deform_conv on Res2, Res3, Res4, Res5
|
616 |
-
_C.MODEL.RESNETS.DEFORM_ON_PER_STAGE = [False, False, False, False]
|
617 |
-
# Use True to use modulated deform_conv (DeformableV2, https://arxiv.org/abs/1811.11168);
|
618 |
-
# Use False for DeformableV1.
|
619 |
-
_C.MODEL.RESNETS.DEFORM_MODULATED = False
|
620 |
-
# Number of groups in deformable conv.
|
621 |
-
_C.MODEL.RESNETS.DEFORM_NUM_GROUPS = 1
|
622 |
-
|
623 |
-
|
624 |
-
# ---------------------------------------------------------------------------- #
|
625 |
-
# Swin options
|
626 |
-
# Note that parts of a resnet may be used for both the backbone and the head
|
627 |
-
# These options apply to both
|
628 |
-
# ---------------------------------------------------------------------------- #
|
629 |
-
_C.MODEL.SPEC = CN()
|
630 |
-
_C.MODEL.SPEC.EMBED_DIM = 512
|
631 |
-
|
632 |
-
_C.MODEL.SPEC.VISION = CN()
|
633 |
-
_C.MODEL.SPEC.VISION.PATCH_SIZE = 4
|
634 |
-
_C.MODEL.SPEC.VISION.IN_CHANS = 3
|
635 |
-
_C.MODEL.SPEC.VISION.EMBED_DIM = 96
|
636 |
-
_C.MODEL.SPEC.VISION.DEPTHS = [2, 2, 6, 2]
|
637 |
-
_C.MODEL.SPEC.VISION.NUM_HEADS = [3, 6, 12, 24]
|
638 |
-
_C.MODEL.SPEC.VISION.WINDOW_SIZE = 7
|
639 |
-
_C.MODEL.SPEC.VISION.MLP_RATIO = 4.
|
640 |
-
_C.MODEL.SPEC.VISION.DROP_RATE = .0
|
641 |
-
_C.MODEL.SPEC.VISION.ATTN_DROP_RATE = .0
|
642 |
-
_C.MODEL.SPEC.VISION.DROP_PATH_RATE = .0
|
643 |
-
_C.MODEL.SPEC.VISION.QKV_BIAS = True
|
644 |
-
_C.MODEL.SPEC.VISION.QK_SCALE = False
|
645 |
-
_C.MODEL.SPEC.VISION.APE = False
|
646 |
-
_C.MODEL.SPEC.VISION.PATCH_NORM = True
|
647 |
-
_C.MODEL.SPEC.VISION.OUT_FEATURES = ["stage2", "stage3", "stage4", "stage5"]
|
648 |
-
|
649 |
-
_C.MODEL.SPEC.TEXT = CN()
|
650 |
-
_C.MODEL.SPEC.TEXT.NAME = 'transformer'
|
651 |
-
_C.MODEL.SPEC.TEXT.LOAD_PRETRAINED = False
|
652 |
-
_C.MODEL.SPEC.TEXT.PRETRAINED = ''
|
653 |
-
_C.MODEL.SPEC.TEXT.TOKENIZER = 'clip'
|
654 |
-
_C.MODEL.SPEC.TEXT.CONTEXT_LENGTH = 77
|
655 |
-
_C.MODEL.SPEC.TEXT.WIDTH = 512
|
656 |
-
_C.MODEL.SPEC.TEXT.HEADS = 8
|
657 |
-
_C.MODEL.SPEC.TEXT.LAYERS = 12
|
658 |
-
_C.MODEL.SPEC.TEXT.AUTOGRESSIVE = True
|
659 |
-
|
660 |
-
# ---------------------------------------------------------------------------- #
|
661 |
-
# Solver
|
662 |
-
# ---------------------------------------------------------------------------- #
|
663 |
-
_C.SOLVER = CN()
|
664 |
-
|
665 |
-
# See detectron2/solver/build.py for LR scheduler options
|
666 |
-
_C.SOLVER.LR_SCHEDULER_NAME = "WarmupMultiStepLR"
|
667 |
-
|
668 |
-
_C.SOLVER.MAX_ITER = 40000
|
669 |
-
|
670 |
-
_C.SOLVER.BASE_LR = 0.001
|
671 |
-
|
672 |
-
_C.SOLVER.MOMENTUM = 0.9
|
673 |
-
|
674 |
-
_C.SOLVER.NESTEROV = False
|
675 |
-
|
676 |
-
_C.SOLVER.WEIGHT_DECAY = 0.0001
|
677 |
-
# The weight decay that's applied to parameters of normalization layers
|
678 |
-
# (typically the affine transformation)
|
679 |
-
_C.SOLVER.WEIGHT_DECAY_NORM = 0.0
|
680 |
-
|
681 |
-
_C.SOLVER.GAMMA = 0.1
|
682 |
-
# The iteration number to decrease learning rate by GAMMA.
|
683 |
-
_C.SOLVER.STEPS = (30000,)
|
684 |
-
|
685 |
-
_C.SOLVER.WARMUP_FACTOR = 1.0 / 1000
|
686 |
-
_C.SOLVER.WARMUP_ITERS = 1000
|
687 |
-
_C.SOLVER.WARMUP_METHOD = "linear"
|
688 |
-
|
689 |
-
# Save a checkpoint after every this number of iterations
|
690 |
-
_C.SOLVER.CHECKPOINT_PERIOD = 5000
|
691 |
-
|
692 |
-
# Number of images per batch across all machines. This is also the number
|
693 |
-
# of training images per step (i.e. per iteration). If we use 16 GPUs
|
694 |
-
# and IMS_PER_BATCH = 32, each GPU will see 2 images per batch.
|
695 |
-
# May be adjusted automatically if REFERENCE_WORLD_SIZE is set.
|
696 |
-
_C.SOLVER.IMS_PER_BATCH = 16
|
697 |
-
|
698 |
-
# The reference number of workers (GPUs) this config is meant to train with.
|
699 |
-
# It takes no effect when set to 0.
|
700 |
-
# With a non-zero value, it will be used by DefaultTrainer to compute a desired
|
701 |
-
# per-worker batch size, and then scale the other related configs (total batch size,
|
702 |
-
# learning rate, etc) to match the per-worker batch size.
|
703 |
-
# See documentation of `DefaultTrainer.auto_scale_workers` for details:
|
704 |
-
_C.SOLVER.REFERENCE_WORLD_SIZE = 0
|
705 |
-
|
706 |
-
# Detectron v1 (and previous detection code) used a 2x higher LR and 0 WD for
|
707 |
-
# biases. This is not useful (at least for recent models). You should avoid
|
708 |
-
# changing these and they exist only to reproduce Detectron v1 training if
|
709 |
-
# desired.
|
710 |
-
_C.SOLVER.BIAS_LR_FACTOR = 1.0
|
711 |
-
_C.SOLVER.WEIGHT_DECAY_BIAS = _C.SOLVER.WEIGHT_DECAY
|
712 |
-
|
713 |
-
# Gradient clipping
|
714 |
-
_C.SOLVER.CLIP_GRADIENTS = CN({"ENABLED": False})
|
715 |
-
# Type of gradient clipping, currently 2 values are supported:
|
716 |
-
# - "value": the absolute values of elements of each gradients are clipped
|
717 |
-
# - "norm": the norm of the gradient for each parameter is clipped thus
|
718 |
-
# affecting all elements in the parameter
|
719 |
-
_C.SOLVER.CLIP_GRADIENTS.CLIP_TYPE = "value"
|
720 |
-
# Maximum absolute value used for clipping gradients
|
721 |
-
_C.SOLVER.CLIP_GRADIENTS.CLIP_VALUE = 1.0
|
722 |
-
# Floating point number p for L-p norm to be used with the "norm"
|
723 |
-
# gradient clipping type; for L-inf, please specify .inf
|
724 |
-
_C.SOLVER.CLIP_GRADIENTS.NORM_TYPE = 2.0
|
725 |
-
|
726 |
-
# Enable automatic mixed precision for training
|
727 |
-
# Note that this does not change model's inference behavior.
|
728 |
-
# To use AMP in inference, run inference under autocast()
|
729 |
-
_C.SOLVER.AMP = CN({"ENABLED": False})
|
730 |
-
|
731 |
-
# ---------------------------------------------------------------------------- #
|
732 |
-
# Specific test options
|
733 |
-
# ---------------------------------------------------------------------------- #
|
734 |
-
_C.TEST = CN()
|
735 |
-
# For end-to-end tests to verify the expected accuracy.
|
736 |
-
# Each item is [task, metric, value, tolerance]
|
737 |
-
# e.g.: [['bbox', 'AP', 38.5, 0.2]]
|
738 |
-
_C.TEST.EXPECTED_RESULTS = []
|
739 |
-
# The period (in terms of steps) to evaluate the model during training.
|
740 |
-
# Set to 0 to disable.
|
741 |
-
_C.TEST.EVAL_PERIOD = 0
|
742 |
-
# The sigmas used to calculate keypoint OKS. See http://cocodataset.org/#keypoints-eval
|
743 |
-
# When empty, it will use the defaults in COCO.
|
744 |
-
# Otherwise it should be a list[float] with the same length as ROI_KEYPOINT_HEAD.NUM_KEYPOINTS.
|
745 |
-
_C.TEST.KEYPOINT_OKS_SIGMAS = []
|
746 |
-
# Maximum number of detections to return per image during inference (100 is
|
747 |
-
# based on the limit established for the COCO dataset).
|
748 |
-
_C.TEST.DETECTIONS_PER_IMAGE = 100
|
749 |
-
|
750 |
-
_C.TEST.AUG = CN({"ENABLED": False})
|
751 |
-
_C.TEST.AUG.MIN_SIZES = (400, 500, 600, 700, 800, 900, 1000, 1100, 1200)
|
752 |
-
_C.TEST.AUG.MAX_SIZE = 4000
|
753 |
-
_C.TEST.AUG.FLIP = True
|
754 |
-
|
755 |
-
_C.TEST.PRECISE_BN = CN({"ENABLED": False})
|
756 |
-
_C.TEST.PRECISE_BN.NUM_ITER = 200
|
757 |
-
|
758 |
-
# ---------------------------------------------------------------------------- #
|
759 |
-
# Misc options
|
760 |
-
# ---------------------------------------------------------------------------- #
|
761 |
-
# Directory where output files are written
|
762 |
-
_C.OUTPUT_DIR = "./output"
|
763 |
-
# Set seed to negative to fully randomize everything.
|
764 |
-
# Set seed to positive to use a fixed seed. Note that a fixed seed increases
|
765 |
-
# reproducibility but does not guarantee fully deterministic behavior.
|
766 |
-
# Disabling all parallelism further increases reproducibility.
|
767 |
-
_C.SEED = -1
|
768 |
-
# Benchmark different cudnn algorithms.
|
769 |
-
# If input images have very different sizes, this option will have large overhead
|
770 |
-
# for about 10k iterations. It usually hurts total time, but can benefit for certain models.
|
771 |
-
# If input images have the same or similar sizes, benchmark is often helpful.
|
772 |
-
_C.CUDNN_BENCHMARK = False
|
773 |
-
# The period (in terms of steps) for minibatch visualization at train time.
|
774 |
-
# Set to 0 to disable.
|
775 |
-
_C.VIS_PERIOD = 0
|
776 |
-
|
777 |
-
# global config is for quick hack purposes.
|
778 |
-
# You can set them in command line or config files,
|
779 |
-
# and access it with:
|
780 |
-
#
|
781 |
-
# from detectron2.config import global_cfg
|
782 |
-
# print(global_cfg.HACK)
|
783 |
-
#
|
784 |
-
# Do not commit any configs into it.
|
785 |
-
_C.GLOBAL = CN()
|
786 |
-
_C.GLOBAL.HACK = 1.0
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
spaces/CVPR/regionclip-demo/detectron2/export/__init__.py
DELETED
@@ -1,7 +0,0 @@
|
|
1 |
-
# -*- coding: utf-8 -*-
|
2 |
-
|
3 |
-
from .api import *
|
4 |
-
from .flatten import TracingAdapter
|
5 |
-
from .torchscript import scripting_with_instances, dump_torchscript_IR
|
6 |
-
|
7 |
-
__all__ = [k for k in globals().keys() if not k.startswith("_")]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
spaces/Cletrason/Cletrason-toad-mario-movie/README.md
DELETED
@@ -1,12 +0,0 @@
|
|
1 |
-
---
|
2 |
-
title: Cletrason Toad Mario Movie
|
3 |
-
emoji: 🐠
|
4 |
-
colorFrom: red
|
5 |
-
colorTo: indigo
|
6 |
-
sdk: gradio
|
7 |
-
sdk_version: 3.23.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/CobaltZvc/Hyper_Bot/index.html
DELETED
@@ -1,29 +0,0 @@
|
|
1 |
-
<!DOCTYPE html>
|
2 |
-
<html>
|
3 |
-
<head>
|
4 |
-
<title>Example</title>
|
5 |
-
</head>
|
6 |
-
<body>
|
7 |
-
<div style="text-align: center;">
|
8 |
-
<iframe id="myIframe"
|
9 |
-
frameborder="0"
|
10 |
-
style="width: 100%; max-width: 850px; height: 2000px;"
|
11 |
-
></iframe>
|
12 |
-
</div>
|
13 |
-
<script>
|
14 |
-
// Fetch the content of Read.txt from the Hugging Face repository
|
15 |
-
fetch('Read.txt')
|
16 |
-
.then(response => response.text())
|
17 |
-
.then(data => {
|
18 |
-
// Fetch the content of the linked file from GitHub repository
|
19 |
-
return fetch(data.trim());
|
20 |
-
})
|
21 |
-
.then(response => response.text())
|
22 |
-
.then(data => {
|
23 |
-
const myIframe = document.getElementById('myIframe');
|
24 |
-
myIframe.src = data.trim();
|
25 |
-
})
|
26 |
-
.catch(error => console.error(error));
|
27 |
-
</script>
|
28 |
-
</body>
|
29 |
-
</html>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
spaces/CompVis/stable-diffusion-license/index.html
DELETED
The diff for this file is too large to render.
See raw diff
|
|
spaces/Cropinky/hana_hanak_houses/realesrgan/models/__init__.py
DELETED
@@ -1,10 +0,0 @@
|
|
1 |
-
import importlib
|
2 |
-
from basicsr.utils import scandir
|
3 |
-
from os import path as osp
|
4 |
-
|
5 |
-
# automatically scan and import model modules for registry
|
6 |
-
# scan all the files that end with '_model.py' under the model folder
|
7 |
-
model_folder = osp.dirname(osp.abspath(__file__))
|
8 |
-
model_filenames = [osp.splitext(osp.basename(v))[0] for v in scandir(model_folder) if v.endswith('_model.py')]
|
9 |
-
# import all the model modules
|
10 |
-
_model_modules = [importlib.import_module(f'realesrgan.models.{file_name}') for file_name in model_filenames]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
spaces/DQChoi/gpt-demo/venv/lib/python3.11/site-packages/fontTools/svgLib/path/parser.py
DELETED
@@ -1,321 +0,0 @@
|
|
1 |
-
# SVG Path specification parser.
|
2 |
-
# This is an adaptation from 'svg.path' by Lennart Regebro (@regebro),
|
3 |
-
# modified so that the parser takes a FontTools Pen object instead of
|
4 |
-
# returning a list of svg.path Path objects.
|
5 |
-
# The original code can be found at:
|
6 |
-
# https://github.com/regebro/svg.path/blob/4f9b6e3/src/svg/path/parser.py
|
7 |
-
# Copyright (c) 2013-2014 Lennart Regebro
|
8 |
-
# License: MIT
|
9 |
-
|
10 |
-
from .arc import EllipticalArc
|
11 |
-
import re
|
12 |
-
|
13 |
-
|
14 |
-
COMMANDS = set("MmZzLlHhVvCcSsQqTtAa")
|
15 |
-
ARC_COMMANDS = set("Aa")
|
16 |
-
UPPERCASE = set("MZLHVCSQTA")
|
17 |
-
|
18 |
-
COMMAND_RE = re.compile("([MmZzLlHhVvCcSsQqTtAa])")
|
19 |
-
|
20 |
-
# https://www.w3.org/TR/css-syntax-3/#number-token-diagram
|
21 |
-
# but -6.e-5 will be tokenized as "-6" then "-5" and confuse parsing
|
22 |
-
FLOAT_RE = re.compile(
|
23 |
-
r"[-+]?" # optional sign
|
24 |
-
r"(?:"
|
25 |
-
r"(?:0|[1-9][0-9]*)(?:\.[0-9]+)?(?:[eE][-+]?[0-9]+)?" # int/float
|
26 |
-
r"|"
|
27 |
-
r"(?:\.[0-9]+(?:[eE][-+]?[0-9]+)?)" # float with leading dot (e.g. '.42')
|
28 |
-
r")"
|
29 |
-
)
|
30 |
-
BOOL_RE = re.compile("^[01]")
|
31 |
-
SEPARATOR_RE = re.compile(f"[, \t]")
|
32 |
-
|
33 |
-
|
34 |
-
def _tokenize_path(pathdef):
|
35 |
-
arc_cmd = None
|
36 |
-
for x in COMMAND_RE.split(pathdef):
|
37 |
-
if x in COMMANDS:
|
38 |
-
arc_cmd = x if x in ARC_COMMANDS else None
|
39 |
-
yield x
|
40 |
-
continue
|
41 |
-
|
42 |
-
if arc_cmd:
|
43 |
-
try:
|
44 |
-
yield from _tokenize_arc_arguments(x)
|
45 |
-
except ValueError as e:
|
46 |
-
raise ValueError(f"Invalid arc command: '{arc_cmd}{x}'") from e
|
47 |
-
else:
|
48 |
-
for token in FLOAT_RE.findall(x):
|
49 |
-
yield token
|
50 |
-
|
51 |
-
|
52 |
-
ARC_ARGUMENT_TYPES = (
|
53 |
-
("rx", FLOAT_RE),
|
54 |
-
("ry", FLOAT_RE),
|
55 |
-
("x-axis-rotation", FLOAT_RE),
|
56 |
-
("large-arc-flag", BOOL_RE),
|
57 |
-
("sweep-flag", BOOL_RE),
|
58 |
-
("x", FLOAT_RE),
|
59 |
-
("y", FLOAT_RE),
|
60 |
-
)
|
61 |
-
|
62 |
-
|
63 |
-
def _tokenize_arc_arguments(arcdef):
|
64 |
-
raw_args = [s for s in SEPARATOR_RE.split(arcdef) if s]
|
65 |
-
if not raw_args:
|
66 |
-
raise ValueError(f"Not enough arguments: '{arcdef}'")
|
67 |
-
raw_args.reverse()
|
68 |
-
|
69 |
-
i = 0
|
70 |
-
while raw_args:
|
71 |
-
arg = raw_args.pop()
|
72 |
-
|
73 |
-
name, pattern = ARC_ARGUMENT_TYPES[i]
|
74 |
-
match = pattern.search(arg)
|
75 |
-
if not match:
|
76 |
-
raise ValueError(f"Invalid argument for '{name}' parameter: {arg!r}")
|
77 |
-
|
78 |
-
j, k = match.span()
|
79 |
-
yield arg[j:k]
|
80 |
-
arg = arg[k:]
|
81 |
-
|
82 |
-
if arg:
|
83 |
-
raw_args.append(arg)
|
84 |
-
|
85 |
-
# wrap around every 7 consecutive arguments
|
86 |
-
if i == 6:
|
87 |
-
i = 0
|
88 |
-
else:
|
89 |
-
i += 1
|
90 |
-
|
91 |
-
if i != 0:
|
92 |
-
raise ValueError(f"Not enough arguments: '{arcdef}'")
|
93 |
-
|
94 |
-
|
95 |
-
def parse_path(pathdef, pen, current_pos=(0, 0), arc_class=EllipticalArc):
|
96 |
-
"""Parse SVG path definition (i.e. "d" attribute of <path> elements)
|
97 |
-
and call a 'pen' object's moveTo, lineTo, curveTo, qCurveTo and closePath
|
98 |
-
methods.
|
99 |
-
|
100 |
-
If 'current_pos' (2-float tuple) is provided, the initial moveTo will
|
101 |
-
be relative to that instead being absolute.
|
102 |
-
|
103 |
-
If the pen has an "arcTo" method, it is called with the original values
|
104 |
-
of the elliptical arc curve commands:
|
105 |
-
|
106 |
-
pen.arcTo(rx, ry, rotation, arc_large, arc_sweep, (x, y))
|
107 |
-
|
108 |
-
Otherwise, the arcs are approximated by series of cubic Bezier segments
|
109 |
-
("curveTo"), one every 90 degrees.
|
110 |
-
"""
|
111 |
-
# In the SVG specs, initial movetos are absolute, even if
|
112 |
-
# specified as 'm'. This is the default behavior here as well.
|
113 |
-
# But if you pass in a current_pos variable, the initial moveto
|
114 |
-
# will be relative to that current_pos. This is useful.
|
115 |
-
current_pos = complex(*current_pos)
|
116 |
-
|
117 |
-
elements = list(_tokenize_path(pathdef))
|
118 |
-
# Reverse for easy use of .pop()
|
119 |
-
elements.reverse()
|
120 |
-
|
121 |
-
start_pos = None
|
122 |
-
command = None
|
123 |
-
last_control = None
|
124 |
-
|
125 |
-
have_arcTo = hasattr(pen, "arcTo")
|
126 |
-
|
127 |
-
while elements:
|
128 |
-
|
129 |
-
if elements[-1] in COMMANDS:
|
130 |
-
# New command.
|
131 |
-
last_command = command # Used by S and T
|
132 |
-
command = elements.pop()
|
133 |
-
absolute = command in UPPERCASE
|
134 |
-
command = command.upper()
|
135 |
-
else:
|
136 |
-
# If this element starts with numbers, it is an implicit command
|
137 |
-
# and we don't change the command. Check that it's allowed:
|
138 |
-
if command is None:
|
139 |
-
raise ValueError(
|
140 |
-
"Unallowed implicit command in %s, position %s"
|
141 |
-
% (pathdef, len(pathdef.split()) - len(elements))
|
142 |
-
)
|
143 |
-
last_command = command # Used by S and T
|
144 |
-
|
145 |
-
if command == "M":
|
146 |
-
# Moveto command.
|
147 |
-
x = elements.pop()
|
148 |
-
y = elements.pop()
|
149 |
-
pos = float(x) + float(y) * 1j
|
150 |
-
if absolute:
|
151 |
-
current_pos = pos
|
152 |
-
else:
|
153 |
-
current_pos += pos
|
154 |
-
|
155 |
-
# M is not preceded by Z; it's an open subpath
|
156 |
-
if start_pos is not None:
|
157 |
-
pen.endPath()
|
158 |
-
|
159 |
-
pen.moveTo((current_pos.real, current_pos.imag))
|
160 |
-
|
161 |
-
# when M is called, reset start_pos
|
162 |
-
# This behavior of Z is defined in svg spec:
|
163 |
-
# http://www.w3.org/TR/SVG/paths.html#PathDataClosePathCommand
|
164 |
-
start_pos = current_pos
|
165 |
-
|
166 |
-
# Implicit moveto commands are treated as lineto commands.
|
167 |
-
# So we set command to lineto here, in case there are
|
168 |
-
# further implicit commands after this moveto.
|
169 |
-
command = "L"
|
170 |
-
|
171 |
-
elif command == "Z":
|
172 |
-
# Close path
|
173 |
-
if current_pos != start_pos:
|
174 |
-
pen.lineTo((start_pos.real, start_pos.imag))
|
175 |
-
pen.closePath()
|
176 |
-
current_pos = start_pos
|
177 |
-
start_pos = None
|
178 |
-
command = None # You can't have implicit commands after closing.
|
179 |
-
|
180 |
-
elif command == "L":
|
181 |
-
x = elements.pop()
|
182 |
-
y = elements.pop()
|
183 |
-
pos = float(x) + float(y) * 1j
|
184 |
-
if not absolute:
|
185 |
-
pos += current_pos
|
186 |
-
pen.lineTo((pos.real, pos.imag))
|
187 |
-
current_pos = pos
|
188 |
-
|
189 |
-
elif command == "H":
|
190 |
-
x = elements.pop()
|
191 |
-
pos = float(x) + current_pos.imag * 1j
|
192 |
-
if not absolute:
|
193 |
-
pos += current_pos.real
|
194 |
-
pen.lineTo((pos.real, pos.imag))
|
195 |
-
current_pos = pos
|
196 |
-
|
197 |
-
elif command == "V":
|
198 |
-
y = elements.pop()
|
199 |
-
pos = current_pos.real + float(y) * 1j
|
200 |
-
if not absolute:
|
201 |
-
pos += current_pos.imag * 1j
|
202 |
-
pen.lineTo((pos.real, pos.imag))
|
203 |
-
current_pos = pos
|
204 |
-
|
205 |
-
elif command == "C":
|
206 |
-
control1 = float(elements.pop()) + float(elements.pop()) * 1j
|
207 |
-
control2 = float(elements.pop()) + float(elements.pop()) * 1j
|
208 |
-
end = float(elements.pop()) + float(elements.pop()) * 1j
|
209 |
-
|
210 |
-
if not absolute:
|
211 |
-
control1 += current_pos
|
212 |
-
control2 += current_pos
|
213 |
-
end += current_pos
|
214 |
-
|
215 |
-
pen.curveTo(
|
216 |
-
(control1.real, control1.imag),
|
217 |
-
(control2.real, control2.imag),
|
218 |
-
(end.real, end.imag),
|
219 |
-
)
|
220 |
-
current_pos = end
|
221 |
-
last_control = control2
|
222 |
-
|
223 |
-
elif command == "S":
|
224 |
-
# Smooth curve. First control point is the "reflection" of
|
225 |
-
# the second control point in the previous path.
|
226 |
-
|
227 |
-
if last_command not in "CS":
|
228 |
-
# If there is no previous command or if the previous command
|
229 |
-
# was not an C, c, S or s, assume the first control point is
|
230 |
-
# coincident with the current point.
|
231 |
-
control1 = current_pos
|
232 |
-
else:
|
233 |
-
# The first control point is assumed to be the reflection of
|
234 |
-
# the second control point on the previous command relative
|
235 |
-
# to the current point.
|
236 |
-
control1 = current_pos + current_pos - last_control
|
237 |
-
|
238 |
-
control2 = float(elements.pop()) + float(elements.pop()) * 1j
|
239 |
-
end = float(elements.pop()) + float(elements.pop()) * 1j
|
240 |
-
|
241 |
-
if not absolute:
|
242 |
-
control2 += current_pos
|
243 |
-
end += current_pos
|
244 |
-
|
245 |
-
pen.curveTo(
|
246 |
-
(control1.real, control1.imag),
|
247 |
-
(control2.real, control2.imag),
|
248 |
-
(end.real, end.imag),
|
249 |
-
)
|
250 |
-
current_pos = end
|
251 |
-
last_control = control2
|
252 |
-
|
253 |
-
elif command == "Q":
|
254 |
-
control = float(elements.pop()) + float(elements.pop()) * 1j
|
255 |
-
end = float(elements.pop()) + float(elements.pop()) * 1j
|
256 |
-
|
257 |
-
if not absolute:
|
258 |
-
control += current_pos
|
259 |
-
end += current_pos
|
260 |
-
|
261 |
-
pen.qCurveTo((control.real, control.imag), (end.real, end.imag))
|
262 |
-
current_pos = end
|
263 |
-
last_control = control
|
264 |
-
|
265 |
-
elif command == "T":
|
266 |
-
# Smooth curve. Control point is the "reflection" of
|
267 |
-
# the second control point in the previous path.
|
268 |
-
|
269 |
-
if last_command not in "QT":
|
270 |
-
# If there is no previous command or if the previous command
|
271 |
-
# was not an Q, q, T or t, assume the first control point is
|
272 |
-
# coincident with the current point.
|
273 |
-
control = current_pos
|
274 |
-
else:
|
275 |
-
# The control point is assumed to be the reflection of
|
276 |
-
# the control point on the previous command relative
|
277 |
-
# to the current point.
|
278 |
-
control = current_pos + current_pos - last_control
|
279 |
-
|
280 |
-
end = float(elements.pop()) + float(elements.pop()) * 1j
|
281 |
-
|
282 |
-
if not absolute:
|
283 |
-
end += current_pos
|
284 |
-
|
285 |
-
pen.qCurveTo((control.real, control.imag), (end.real, end.imag))
|
286 |
-
current_pos = end
|
287 |
-
last_control = control
|
288 |
-
|
289 |
-
elif command == "A":
|
290 |
-
rx = abs(float(elements.pop()))
|
291 |
-
ry = abs(float(elements.pop()))
|
292 |
-
rotation = float(elements.pop())
|
293 |
-
arc_large = bool(int(elements.pop()))
|
294 |
-
arc_sweep = bool(int(elements.pop()))
|
295 |
-
end = float(elements.pop()) + float(elements.pop()) * 1j
|
296 |
-
|
297 |
-
if not absolute:
|
298 |
-
end += current_pos
|
299 |
-
|
300 |
-
# if the pen supports arcs, pass the values unchanged, otherwise
|
301 |
-
# approximate the arc with a series of cubic bezier curves
|
302 |
-
if have_arcTo:
|
303 |
-
pen.arcTo(
|
304 |
-
rx,
|
305 |
-
ry,
|
306 |
-
rotation,
|
307 |
-
arc_large,
|
308 |
-
arc_sweep,
|
309 |
-
(end.real, end.imag),
|
310 |
-
)
|
311 |
-
else:
|
312 |
-
arc = arc_class(
|
313 |
-
current_pos, rx, ry, rotation, arc_large, arc_sweep, end
|
314 |
-
)
|
315 |
-
arc.draw(pen)
|
316 |
-
|
317 |
-
current_pos = end
|
318 |
-
|
319 |
-
# no final Z command, it's an open path
|
320 |
-
if start_pos is not None:
|
321 |
-
pen.endPath()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
spaces/DQChoi/gpt-demo/venv/lib/python3.11/site-packages/fontTools/ttLib/tables/C_B_D_T_.py
DELETED
@@ -1,105 +0,0 @@
|
|
1 |
-
# Copyright 2013 Google, Inc. All Rights Reserved.
|
2 |
-
#
|
3 |
-
# Google Author(s): Matt Fontaine
|
4 |
-
|
5 |
-
|
6 |
-
from fontTools.misc.textTools import bytesjoin
|
7 |
-
from fontTools.misc import sstruct
|
8 |
-
from . import E_B_D_T_
|
9 |
-
from .BitmapGlyphMetrics import (
|
10 |
-
BigGlyphMetrics,
|
11 |
-
bigGlyphMetricsFormat,
|
12 |
-
SmallGlyphMetrics,
|
13 |
-
smallGlyphMetricsFormat,
|
14 |
-
)
|
15 |
-
from .E_B_D_T_ import (
|
16 |
-
BitmapGlyph,
|
17 |
-
BitmapPlusSmallMetricsMixin,
|
18 |
-
BitmapPlusBigMetricsMixin,
|
19 |
-
)
|
20 |
-
import struct
|
21 |
-
|
22 |
-
|
23 |
-
class table_C_B_D_T_(E_B_D_T_.table_E_B_D_T_):
|
24 |
-
|
25 |
-
# Change the data locator table being referenced.
|
26 |
-
locatorName = "CBLC"
|
27 |
-
|
28 |
-
# Modify the format class accessor for color bitmap use.
|
29 |
-
def getImageFormatClass(self, imageFormat):
|
30 |
-
try:
|
31 |
-
return E_B_D_T_.table_E_B_D_T_.getImageFormatClass(self, imageFormat)
|
32 |
-
except KeyError:
|
33 |
-
return cbdt_bitmap_classes[imageFormat]
|
34 |
-
|
35 |
-
|
36 |
-
# Helper method for removing export features not supported by color bitmaps.
|
37 |
-
# Write data in the parent class will default to raw if an option is unsupported.
|
38 |
-
def _removeUnsupportedForColor(dataFunctions):
|
39 |
-
dataFunctions = dict(dataFunctions)
|
40 |
-
del dataFunctions["row"]
|
41 |
-
return dataFunctions
|
42 |
-
|
43 |
-
|
44 |
-
class ColorBitmapGlyph(BitmapGlyph):
|
45 |
-
|
46 |
-
fileExtension = ".png"
|
47 |
-
xmlDataFunctions = _removeUnsupportedForColor(BitmapGlyph.xmlDataFunctions)
|
48 |
-
|
49 |
-
|
50 |
-
class cbdt_bitmap_format_17(BitmapPlusSmallMetricsMixin, ColorBitmapGlyph):
|
51 |
-
def decompile(self):
|
52 |
-
self.metrics = SmallGlyphMetrics()
|
53 |
-
dummy, data = sstruct.unpack2(smallGlyphMetricsFormat, self.data, self.metrics)
|
54 |
-
(dataLen,) = struct.unpack(">L", data[:4])
|
55 |
-
data = data[4:]
|
56 |
-
|
57 |
-
# For the image data cut it to the size specified by dataLen.
|
58 |
-
assert dataLen <= len(data), "Data overun in format 17"
|
59 |
-
self.imageData = data[:dataLen]
|
60 |
-
|
61 |
-
def compile(self, ttFont):
|
62 |
-
dataList = []
|
63 |
-
dataList.append(sstruct.pack(smallGlyphMetricsFormat, self.metrics))
|
64 |
-
dataList.append(struct.pack(">L", len(self.imageData)))
|
65 |
-
dataList.append(self.imageData)
|
66 |
-
return bytesjoin(dataList)
|
67 |
-
|
68 |
-
|
69 |
-
class cbdt_bitmap_format_18(BitmapPlusBigMetricsMixin, ColorBitmapGlyph):
|
70 |
-
def decompile(self):
|
71 |
-
self.metrics = BigGlyphMetrics()
|
72 |
-
dummy, data = sstruct.unpack2(bigGlyphMetricsFormat, self.data, self.metrics)
|
73 |
-
(dataLen,) = struct.unpack(">L", data[:4])
|
74 |
-
data = data[4:]
|
75 |
-
|
76 |
-
# For the image data cut it to the size specified by dataLen.
|
77 |
-
assert dataLen <= len(data), "Data overun in format 18"
|
78 |
-
self.imageData = data[:dataLen]
|
79 |
-
|
80 |
-
def compile(self, ttFont):
|
81 |
-
dataList = []
|
82 |
-
dataList.append(sstruct.pack(bigGlyphMetricsFormat, self.metrics))
|
83 |
-
dataList.append(struct.pack(">L", len(self.imageData)))
|
84 |
-
dataList.append(self.imageData)
|
85 |
-
return bytesjoin(dataList)
|
86 |
-
|
87 |
-
|
88 |
-
class cbdt_bitmap_format_19(ColorBitmapGlyph):
|
89 |
-
def decompile(self):
|
90 |
-
(dataLen,) = struct.unpack(">L", self.data[:4])
|
91 |
-
data = self.data[4:]
|
92 |
-
|
93 |
-
assert dataLen <= len(data), "Data overun in format 19"
|
94 |
-
self.imageData = data[:dataLen]
|
95 |
-
|
96 |
-
def compile(self, ttFont):
|
97 |
-
return struct.pack(">L", len(self.imageData)) + self.imageData
|
98 |
-
|
99 |
-
|
100 |
-
# Dict for CBDT extended formats.
|
101 |
-
cbdt_bitmap_classes = {
|
102 |
-
17: cbdt_bitmap_format_17,
|
103 |
-
18: cbdt_bitmap_format_18,
|
104 |
-
19: cbdt_bitmap_format_19,
|
105 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
spaces/Devaholic/fruit-demo/utils/__init__.py
DELETED
@@ -1,54 +0,0 @@
|
|
1 |
-
from PIL import Image
|
2 |
-
import os
|
3 |
-
import base64
|
4 |
-
from io import BytesIO
|
5 |
-
import requests
|
6 |
-
|
7 |
-
def get_labels() -> list:
|
8 |
-
cur_dir = os.getcwd()
|
9 |
-
labels = os.listdir(cur_dir + '/data/Training')
|
10 |
-
return labels
|
11 |
-
|
12 |
-
def remove_number(label: str) -> str:
|
13 |
-
words = label.split()
|
14 |
-
words = [word for word in words if not word.isdigit()]
|
15 |
-
return ' '.join(words)
|
16 |
-
|
17 |
-
def get_image_from_url(url: str):
|
18 |
-
"""
|
19 |
-
Only accepts jpeg and png images or regular URL
|
20 |
-
"""
|
21 |
-
try:
|
22 |
-
if 'data:image/jpeg;base64,' in url:
|
23 |
-
base_string = url.replace("data:image/jpeg;base64,", "")
|
24 |
-
decoded_img = base64.b64decode(base_string)
|
25 |
-
img = Image.open(BytesIO(decoded_img))
|
26 |
-
return img
|
27 |
-
elif 'data:image/png;base64,' in url:
|
28 |
-
base_string = url.replace("data:image/png;base64,", "")
|
29 |
-
decoded_img = base64.b64decode(base_string)
|
30 |
-
img = Image.open(BytesIO(decoded_img))
|
31 |
-
return img
|
32 |
-
else:
|
33 |
-
response = requests.get(url)
|
34 |
-
img = Image.open(BytesIO(response.content))
|
35 |
-
return img
|
36 |
-
except Exception as e:
|
37 |
-
print(e)
|
38 |
-
return None
|
39 |
-
|
40 |
-
def delete_in_folder(folder: str) -> None:
|
41 |
-
"""
|
42 |
-
Delete all files in a folder
|
43 |
-
"""
|
44 |
-
for file in os.listdir(folder):
|
45 |
-
file_path = os.path.join(folder, file)
|
46 |
-
try:
|
47 |
-
if os.path.isfile(file_path):
|
48 |
-
os.remove(file_path)
|
49 |
-
except Exception as e:
|
50 |
-
print(e)
|
51 |
-
return None
|
52 |
-
|
53 |
-
if __name__ == '__main__':
|
54 |
-
print(get_labels())
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
spaces/Dorado607/ChuanhuChatGPT/modules/index_func.py
DELETED
@@ -1,149 +0,0 @@
|
|
1 |
-
import os
|
2 |
-
import logging
|
3 |
-
|
4 |
-
import colorama
|
5 |
-
import PyPDF2
|
6 |
-
from tqdm import tqdm
|
7 |
-
|
8 |
-
from modules.presets import *
|
9 |
-
from modules.utils import *
|
10 |
-
from modules.config import local_embedding
|
11 |
-
|
12 |
-
|
13 |
-
def get_index_name(file_src):
|
14 |
-
file_paths = [x.name for x in file_src]
|
15 |
-
file_paths.sort(key=lambda x: os.path.basename(x))
|
16 |
-
|
17 |
-
md5_hash = hashlib.md5()
|
18 |
-
for file_path in file_paths:
|
19 |
-
with open(file_path, "rb") as f:
|
20 |
-
while chunk := f.read(8192):
|
21 |
-
md5_hash.update(chunk)
|
22 |
-
|
23 |
-
return md5_hash.hexdigest()
|
24 |
-
|
25 |
-
|
26 |
-
def get_documents(file_src):
|
27 |
-
from langchain.schema import Document
|
28 |
-
from langchain.text_splitter import TokenTextSplitter
|
29 |
-
text_splitter = TokenTextSplitter(chunk_size=500, chunk_overlap=30)
|
30 |
-
|
31 |
-
documents = []
|
32 |
-
logging.debug("Loading documents...")
|
33 |
-
logging.debug(f"file_src: {file_src}")
|
34 |
-
for file in file_src:
|
35 |
-
filepath = file.name
|
36 |
-
filename = os.path.basename(filepath)
|
37 |
-
file_type = os.path.splitext(filename)[1]
|
38 |
-
logging.info(f"loading file: {filename}")
|
39 |
-
try:
|
40 |
-
if file_type == ".pdf":
|
41 |
-
logging.debug("Loading PDF...")
|
42 |
-
try:
|
43 |
-
from modules.pdf_func import parse_pdf
|
44 |
-
from modules.config import advance_docs
|
45 |
-
|
46 |
-
two_column = advance_docs["pdf"].get("two_column", False)
|
47 |
-
pdftext = parse_pdf(filepath, two_column).text
|
48 |
-
except:
|
49 |
-
pdftext = ""
|
50 |
-
with open(filepath, "rb") as pdfFileObj:
|
51 |
-
pdfReader = PyPDF2.PdfReader(pdfFileObj)
|
52 |
-
for page in tqdm(pdfReader.pages):
|
53 |
-
pdftext += page.extract_text()
|
54 |
-
texts = [Document(page_content=pdftext,
|
55 |
-
metadata={"source": filepath})]
|
56 |
-
elif file_type == ".docx":
|
57 |
-
logging.debug("Loading Word...")
|
58 |
-
from langchain.document_loaders import UnstructuredWordDocumentLoader
|
59 |
-
loader = UnstructuredWordDocumentLoader(filepath)
|
60 |
-
texts = loader.load()
|
61 |
-
elif file_type == ".pptx":
|
62 |
-
logging.debug("Loading PowerPoint...")
|
63 |
-
from langchain.document_loaders import UnstructuredPowerPointLoader
|
64 |
-
loader = UnstructuredPowerPointLoader(filepath)
|
65 |
-
texts = loader.load()
|
66 |
-
elif file_type == ".epub":
|
67 |
-
logging.debug("Loading EPUB...")
|
68 |
-
from langchain.document_loaders import UnstructuredEPubLoader
|
69 |
-
loader = UnstructuredEPubLoader(filepath)
|
70 |
-
texts = loader.load()
|
71 |
-
elif file_type == ".xlsx":
|
72 |
-
logging.debug("Loading Excel...")
|
73 |
-
text_list = excel_to_string(filepath)
|
74 |
-
texts = []
|
75 |
-
for elem in text_list:
|
76 |
-
texts.append(Document(page_content=elem,
|
77 |
-
metadata={"source": filepath}))
|
78 |
-
else:
|
79 |
-
logging.debug("Loading text file...")
|
80 |
-
from langchain.document_loaders import TextLoader
|
81 |
-
loader = TextLoader(filepath, "utf8")
|
82 |
-
texts = loader.load()
|
83 |
-
except Exception as e:
|
84 |
-
import traceback
|
85 |
-
logging.error(f"Error loading file: {filename}")
|
86 |
-
traceback.print_exc()
|
87 |
-
|
88 |
-
texts = text_splitter.split_documents(texts)
|
89 |
-
documents.extend(texts)
|
90 |
-
logging.debug("Documents loaded.")
|
91 |
-
return documents
|
92 |
-
|
93 |
-
|
94 |
-
def construct_index(
|
95 |
-
api_key,
|
96 |
-
file_src,
|
97 |
-
max_input_size=4096,
|
98 |
-
num_outputs=5,
|
99 |
-
max_chunk_overlap=20,
|
100 |
-
chunk_size_limit=600,
|
101 |
-
embedding_limit=None,
|
102 |
-
separator=" ",
|
103 |
-
):
|
104 |
-
from langchain.chat_models import ChatOpenAI
|
105 |
-
from langchain.vectorstores import FAISS
|
106 |
-
|
107 |
-
if api_key:
|
108 |
-
os.environ["OPENAI_API_KEY"] = api_key
|
109 |
-
else:
|
110 |
-
# 由于一个依赖的愚蠢的设计,这里必须要有一个API KEY
|
111 |
-
os.environ["OPENAI_API_KEY"] = "sk-xxxxxxx"
|
112 |
-
chunk_size_limit = None if chunk_size_limit == 0 else chunk_size_limit
|
113 |
-
embedding_limit = None if embedding_limit == 0 else embedding_limit
|
114 |
-
separator = " " if separator == "" else separator
|
115 |
-
|
116 |
-
index_name = get_index_name(file_src)
|
117 |
-
index_path = f"./index/{index_name}"
|
118 |
-
if local_embedding:
|
119 |
-
from langchain.embeddings.huggingface import HuggingFaceEmbeddings
|
120 |
-
embeddings = HuggingFaceEmbeddings(
|
121 |
-
model_name="sentence-transformers/distiluse-base-multilingual-cased-v2")
|
122 |
-
else:
|
123 |
-
from langchain.embeddings import OpenAIEmbeddings
|
124 |
-
if os.environ.get("OPENAI_API_TYPE", "openai") == "openai":
|
125 |
-
embeddings = OpenAIEmbeddings(openai_api_base=os.environ.get(
|
126 |
-
"OPENAI_API_BASE", None), openai_api_key=os.environ.get("OPENAI_EMBEDDING_API_KEY", api_key))
|
127 |
-
else:
|
128 |
-
embeddings = OpenAIEmbeddings(deployment=os.environ["AZURE_EMBEDDING_DEPLOYMENT_NAME"], openai_api_key=os.environ["AZURE_OPENAI_API_KEY"],
|
129 |
-
model=os.environ["AZURE_EMBEDDING_MODEL_NAME"], openai_api_base=os.environ["AZURE_OPENAI_API_BASE_URL"], openai_api_type="azure")
|
130 |
-
if os.path.exists(index_path):
|
131 |
-
logging.info("找到了缓存的索引文件,加载中……")
|
132 |
-
return FAISS.load_local(index_path, embeddings)
|
133 |
-
else:
|
134 |
-
try:
|
135 |
-
documents = get_documents(file_src)
|
136 |
-
logging.info("构建索引中……")
|
137 |
-
with retrieve_proxy():
|
138 |
-
index = FAISS.from_documents(documents, embeddings)
|
139 |
-
logging.debug("索引构建完成!")
|
140 |
-
os.makedirs("./index", exist_ok=True)
|
141 |
-
index.save_local(index_path)
|
142 |
-
logging.debug("索引已保存至本地!")
|
143 |
-
return index
|
144 |
-
|
145 |
-
except Exception as e:
|
146 |
-
import traceback
|
147 |
-
logging.error("索引构建失败!%s", e)
|
148 |
-
traceback.print_exc()
|
149 |
-
return None
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
spaces/DragGan/DragGan-Inversion/PTI/utils/ImagesDataset.py
DELETED
@@ -1,43 +0,0 @@
|
|
1 |
-
import os
|
2 |
-
|
3 |
-
from torch.utils.data import Dataset
|
4 |
-
from PIL import Image
|
5 |
-
|
6 |
-
from PTI.utils.data_utils import make_dataset
|
7 |
-
from torchvision import transforms
|
8 |
-
|
9 |
-
|
10 |
-
class Image2Dataset(Dataset):
|
11 |
-
def __init__(self, image) -> None:
|
12 |
-
super().__init__()
|
13 |
-
self.image = image
|
14 |
-
self.transform = transforms.Compose(
|
15 |
-
[
|
16 |
-
transforms.ToTensor(),
|
17 |
-
transforms.Normalize([0.5, 0.5, 0.5], [0.5, 0.5, 0.5]),
|
18 |
-
]
|
19 |
-
)
|
20 |
-
|
21 |
-
def __len__(self):
|
22 |
-
return 1
|
23 |
-
|
24 |
-
def __getitem__(self, index):
|
25 |
-
return "customIMG", self.transform(self.image)
|
26 |
-
|
27 |
-
|
28 |
-
class ImagesDataset(Dataset):
|
29 |
-
def __init__(self, source_root, source_transform=None):
|
30 |
-
self.source_paths = sorted(make_dataset(source_root))
|
31 |
-
self.source_transform = source_transform
|
32 |
-
|
33 |
-
def __len__(self):
|
34 |
-
return len(self.source_paths)
|
35 |
-
|
36 |
-
def __getitem__(self, index):
|
37 |
-
fname, from_path = self.source_paths[index]
|
38 |
-
from_im = Image.open(from_path).convert("RGB").resize([1024, 1024])
|
39 |
-
|
40 |
-
if self.source_transform:
|
41 |
-
from_im = self.source_transform(from_im)
|
42 |
-
|
43 |
-
return fname, from_im
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
spaces/Dusan/clickbaitonator/fudge/constants.py
DELETED
@@ -1,32 +0,0 @@
|
|
1 |
-
PAD_TOKEN = '[PAD]'
|
2 |
-
EOT_TOKEN = '<|endoftext|>'
|
3 |
-
SEP = 50256 # just use the weird eot token
|
4 |
-
|
5 |
-
TOPIC_MODEL_STRING = 'gpt2-medium'
|
6 |
-
FORMALITY_MODEL_STRING = 'Helsinki-NLP/opus-mt-es-en'
|
7 |
-
|
8 |
-
DIR_END_SPLIT_POSITIONS = 32
|
9 |
-
|
10 |
-
TOPIC_VAL_SIZE = 100000
|
11 |
-
FORMALITY_VAL_SIZE = 2000
|
12 |
-
VOCAB_SIZE = 50000
|
13 |
-
|
14 |
-
FORMALITY_MAX_LEN = 200
|
15 |
-
|
16 |
-
GLOVE_PRINT_PROGRESS_FREQ = 1000000
|
17 |
-
GLOVE_DIM = 300
|
18 |
-
HIDDEN_DIM = 300
|
19 |
-
RNN_DIM = 150
|
20 |
-
|
21 |
-
MIN_SENTENCE_LENGTH = 3
|
22 |
-
|
23 |
-
POETRY_LINE_SYLLABLES = 10
|
24 |
-
MAX_SYLLABLES_PER_WORD = 10 # no way anything is more
|
25 |
-
MAX_COUNT_SYLLABLE_DIST = 10
|
26 |
-
MAX_COUNT_SYLLABLE_INPUT_LENGTH = 25 # for just a couplet, shouldn't need more
|
27 |
-
COUNT_SYLLABLE_DIM = 100
|
28 |
-
UNKNOWN_RHYME_GROUP = 'UNKNOWN_RHYME_GROUP'
|
29 |
-
PHRASE_ENDS = '.?!'
|
30 |
-
|
31 |
-
POETRY_BANNED_TOKENS = [198, 50256, 628, 220] # newlines and eos and such
|
32 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
spaces/EXPOSUREEE/Ai-Image-Enhancer/tests/test_utils.py
DELETED
@@ -1,87 +0,0 @@
|
|
1 |
-
import numpy as np
|
2 |
-
from basicsr.archs.rrdbnet_arch import RRDBNet
|
3 |
-
|
4 |
-
from realesrgan.utils import RealESRGANer
|
5 |
-
|
6 |
-
|
7 |
-
def test_realesrganer():
|
8 |
-
# initialize with default model
|
9 |
-
restorer = RealESRGANer(
|
10 |
-
scale=4,
|
11 |
-
model_path='experiments/pretrained_models/RealESRGAN_x4plus.pth',
|
12 |
-
model=None,
|
13 |
-
tile=10,
|
14 |
-
tile_pad=10,
|
15 |
-
pre_pad=2,
|
16 |
-
half=False)
|
17 |
-
assert isinstance(restorer.model, RRDBNet)
|
18 |
-
assert restorer.half is False
|
19 |
-
# initialize with user-defined model
|
20 |
-
model = RRDBNet(num_in_ch=3, num_out_ch=3, num_feat=64, num_block=6, num_grow_ch=32, scale=4)
|
21 |
-
restorer = RealESRGANer(
|
22 |
-
scale=4,
|
23 |
-
model_path='experiments/pretrained_models/RealESRGAN_x4plus_anime_6B.pth',
|
24 |
-
model=model,
|
25 |
-
tile=10,
|
26 |
-
tile_pad=10,
|
27 |
-
pre_pad=2,
|
28 |
-
half=True)
|
29 |
-
# test attribute
|
30 |
-
assert isinstance(restorer.model, RRDBNet)
|
31 |
-
assert restorer.half is True
|
32 |
-
|
33 |
-
# ------------------ test pre_process ---------------- #
|
34 |
-
img = np.random.random((12, 12, 3)).astype(np.float32)
|
35 |
-
restorer.pre_process(img)
|
36 |
-
assert restorer.img.shape == (1, 3, 14, 14)
|
37 |
-
# with modcrop
|
38 |
-
restorer.scale = 1
|
39 |
-
restorer.pre_process(img)
|
40 |
-
assert restorer.img.shape == (1, 3, 16, 16)
|
41 |
-
|
42 |
-
# ------------------ test process ---------------- #
|
43 |
-
restorer.process()
|
44 |
-
assert restorer.output.shape == (1, 3, 64, 64)
|
45 |
-
|
46 |
-
# ------------------ test post_process ---------------- #
|
47 |
-
restorer.mod_scale = 4
|
48 |
-
output = restorer.post_process()
|
49 |
-
assert output.shape == (1, 3, 60, 60)
|
50 |
-
|
51 |
-
# ------------------ test tile_process ---------------- #
|
52 |
-
restorer.scale = 4
|
53 |
-
img = np.random.random((12, 12, 3)).astype(np.float32)
|
54 |
-
restorer.pre_process(img)
|
55 |
-
restorer.tile_process()
|
56 |
-
assert restorer.output.shape == (1, 3, 64, 64)
|
57 |
-
|
58 |
-
# ------------------ test enhance ---------------- #
|
59 |
-
img = np.random.random((12, 12, 3)).astype(np.float32)
|
60 |
-
result = restorer.enhance(img, outscale=2)
|
61 |
-
assert result[0].shape == (24, 24, 3)
|
62 |
-
assert result[1] == 'RGB'
|
63 |
-
|
64 |
-
# ------------------ test enhance with 16-bit image---------------- #
|
65 |
-
img = np.random.random((4, 4, 3)).astype(np.uint16) + 512
|
66 |
-
result = restorer.enhance(img, outscale=2)
|
67 |
-
assert result[0].shape == (8, 8, 3)
|
68 |
-
assert result[1] == 'RGB'
|
69 |
-
|
70 |
-
# ------------------ test enhance with gray image---------------- #
|
71 |
-
img = np.random.random((4, 4)).astype(np.float32)
|
72 |
-
result = restorer.enhance(img, outscale=2)
|
73 |
-
assert result[0].shape == (8, 8)
|
74 |
-
assert result[1] == 'L'
|
75 |
-
|
76 |
-
# ------------------ test enhance with RGBA---------------- #
|
77 |
-
img = np.random.random((4, 4, 4)).astype(np.float32)
|
78 |
-
result = restorer.enhance(img, outscale=2)
|
79 |
-
assert result[0].shape == (8, 8, 4)
|
80 |
-
assert result[1] == 'RGBA'
|
81 |
-
|
82 |
-
# ------------------ test enhance with RGBA, alpha_upsampler---------------- #
|
83 |
-
restorer.tile_size = 0
|
84 |
-
img = np.random.random((4, 4, 4)).astype(np.float32)
|
85 |
-
result = restorer.enhance(img, outscale=2, alpha_upsampler=None)
|
86 |
-
assert result[0].shape == (8, 8, 4)
|
87 |
-
assert result[1] == 'RGBA'
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
spaces/Eddycrack864/Applio-Inference/infer/modules/train/extract_feature_print.py
DELETED
@@ -1,137 +0,0 @@
|
|
1 |
-
import os
|
2 |
-
import sys
|
3 |
-
import traceback
|
4 |
-
|
5 |
-
os.environ["PYTORCH_ENABLE_MPS_FALLBACK"] = "1"
|
6 |
-
os.environ["PYTORCH_MPS_HIGH_WATERMARK_RATIO"] = "0.0"
|
7 |
-
|
8 |
-
device = sys.argv[1]
|
9 |
-
n_part = int(sys.argv[2])
|
10 |
-
i_part = int(sys.argv[3])
|
11 |
-
if len(sys.argv) == 6:
|
12 |
-
exp_dir = sys.argv[4]
|
13 |
-
version = sys.argv[5]
|
14 |
-
else:
|
15 |
-
i_gpu = sys.argv[4]
|
16 |
-
exp_dir = sys.argv[5]
|
17 |
-
os.environ["CUDA_VISIBLE_DEVICES"] = str(i_gpu)
|
18 |
-
version = sys.argv[6]
|
19 |
-
import fairseq
|
20 |
-
import numpy as np
|
21 |
-
import soundfile as sf
|
22 |
-
import torch
|
23 |
-
import torch.nn.functional as F
|
24 |
-
|
25 |
-
if "privateuseone" not in device:
|
26 |
-
device = "cpu"
|
27 |
-
if torch.cuda.is_available():
|
28 |
-
device = "cuda"
|
29 |
-
elif torch.backends.mps.is_available():
|
30 |
-
device = "mps"
|
31 |
-
else:
|
32 |
-
import torch_directml
|
33 |
-
|
34 |
-
device = torch_directml.device(torch_directml.default_device())
|
35 |
-
|
36 |
-
def forward_dml(ctx, x, scale):
|
37 |
-
ctx.scale = scale
|
38 |
-
res = x.clone().detach()
|
39 |
-
return res
|
40 |
-
|
41 |
-
fairseq.modules.grad_multiply.GradMultiply.forward = forward_dml
|
42 |
-
|
43 |
-
f = open("%s/extract_f0_feature.log" % exp_dir, "a+")
|
44 |
-
|
45 |
-
|
46 |
-
def printt(strr):
|
47 |
-
print(strr)
|
48 |
-
f.write("%s\n" % strr)
|
49 |
-
f.flush()
|
50 |
-
|
51 |
-
|
52 |
-
printt(sys.argv)
|
53 |
-
model_path = "assets/hubert/hubert_base.pt"
|
54 |
-
|
55 |
-
printt(exp_dir)
|
56 |
-
wavPath = "%s/1_16k_wavs" % exp_dir
|
57 |
-
outPath = (
|
58 |
-
"%s/3_feature256" % exp_dir if version == "v1" else "%s/3_feature768" % exp_dir
|
59 |
-
)
|
60 |
-
os.makedirs(outPath, exist_ok=True)
|
61 |
-
|
62 |
-
|
63 |
-
# wave must be 16k, hop_size=320
|
64 |
-
def readwave(wav_path, normalize=False):
|
65 |
-
wav, sr = sf.read(wav_path)
|
66 |
-
assert sr == 16000
|
67 |
-
feats = torch.from_numpy(wav).float()
|
68 |
-
if feats.dim() == 2: # double channels
|
69 |
-
feats = feats.mean(-1)
|
70 |
-
assert feats.dim() == 1, feats.dim()
|
71 |
-
if normalize:
|
72 |
-
with torch.no_grad():
|
73 |
-
feats = F.layer_norm(feats, feats.shape)
|
74 |
-
feats = feats.view(1, -1)
|
75 |
-
return feats
|
76 |
-
|
77 |
-
|
78 |
-
# HuBERT model
|
79 |
-
printt("load model(s) from {}".format(model_path))
|
80 |
-
# if hubert model is exist
|
81 |
-
if os.access(model_path, os.F_OK) == False:
|
82 |
-
printt(
|
83 |
-
"Error: Extracting is shut down because %s does not exist, you may download it from https://huggingface.co/lj1995/VoiceConversionWebUI/tree/main"
|
84 |
-
% model_path
|
85 |
-
)
|
86 |
-
exit(0)
|
87 |
-
models, saved_cfg, task = fairseq.checkpoint_utils.load_model_ensemble_and_task(
|
88 |
-
[model_path],
|
89 |
-
suffix="",
|
90 |
-
)
|
91 |
-
model = models[0]
|
92 |
-
model = model.to(device)
|
93 |
-
printt("move model to %s" % device)
|
94 |
-
if device not in ["mps", "cpu"]:
|
95 |
-
model = model.half()
|
96 |
-
model.eval()
|
97 |
-
|
98 |
-
todo = sorted(list(os.listdir(wavPath)))[i_part::n_part]
|
99 |
-
n = max(1, len(todo) // 10) # 最多打印十条
|
100 |
-
if len(todo) == 0:
|
101 |
-
printt("no-feature-todo")
|
102 |
-
else:
|
103 |
-
printt("all-feature-%s" % len(todo))
|
104 |
-
for idx, file in enumerate(todo):
|
105 |
-
try:
|
106 |
-
if file.endswith(".wav"):
|
107 |
-
wav_path = "%s/%s" % (wavPath, file)
|
108 |
-
out_path = "%s/%s" % (outPath, file.replace("wav", "npy"))
|
109 |
-
|
110 |
-
if os.path.exists(out_path):
|
111 |
-
continue
|
112 |
-
|
113 |
-
feats = readwave(wav_path, normalize=saved_cfg.task.normalize)
|
114 |
-
padding_mask = torch.BoolTensor(feats.shape).fill_(False)
|
115 |
-
inputs = {
|
116 |
-
"source": feats.half().to(device)
|
117 |
-
if device not in ["mps", "cpu"]
|
118 |
-
else feats.to(device),
|
119 |
-
"padding_mask": padding_mask.to(device),
|
120 |
-
"output_layer": 9 if version == "v1" else 12, # layer 9
|
121 |
-
}
|
122 |
-
with torch.no_grad():
|
123 |
-
logits = model.extract_features(**inputs)
|
124 |
-
feats = (
|
125 |
-
model.final_proj(logits[0]) if version == "v1" else logits[0]
|
126 |
-
)
|
127 |
-
|
128 |
-
feats = feats.squeeze(0).float().cpu().numpy()
|
129 |
-
if np.isnan(feats).sum() == 0:
|
130 |
-
np.save(out_path, feats, allow_pickle=False)
|
131 |
-
else:
|
132 |
-
printt("%s-contains nan" % file)
|
133 |
-
if idx % n == 0:
|
134 |
-
printt("now-%s,all-%s,%s,%s" % (len(todo), idx, file, feats.shape))
|
135 |
-
except:
|
136 |
-
printt(traceback.format_exc())
|
137 |
-
printt("all-feature-done")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
spaces/Felix123456/bingo/src/components/providers.tsx
DELETED
@@ -1,15 +0,0 @@
|
|
1 |
-
'use client'
|
2 |
-
|
3 |
-
import * as React from 'react'
|
4 |
-
import { ThemeProvider as NextThemesProvider } from 'next-themes'
|
5 |
-
import { ThemeProviderProps } from 'next-themes/dist/types'
|
6 |
-
|
7 |
-
import { TooltipProvider } from '@/components/ui/tooltip'
|
8 |
-
|
9 |
-
export function Providers({ children, ...props }: ThemeProviderProps) {
|
10 |
-
return (
|
11 |
-
<NextThemesProvider {...props}>
|
12 |
-
<TooltipProvider>{children}</TooltipProvider>
|
13 |
-
</NextThemesProvider>
|
14 |
-
)
|
15 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
spaces/Fernando22/freegpt-webui/g4f/utils.py
DELETED
@@ -1,49 +0,0 @@
|
|
1 |
-
import browser_cookie3
|
2 |
-
|
3 |
-
|
4 |
-
class Utils:
|
5 |
-
browsers = [
|
6 |
-
browser_cookie3.chrome, # 62.74% market share
|
7 |
-
browser_cookie3.safari, # 24.12% market share
|
8 |
-
browser_cookie3.firefox, # 4.56% market share
|
9 |
-
browser_cookie3.edge, # 2.85% market share
|
10 |
-
browser_cookie3.opera, # 1.69% market share
|
11 |
-
browser_cookie3.brave, # 0.96% market share
|
12 |
-
browser_cookie3.opera_gx, # 0.64% market share
|
13 |
-
browser_cookie3.vivaldi, # 0.32% market share
|
14 |
-
]
|
15 |
-
|
16 |
-
def get_cookies(domain: str, setName: str = None, setBrowser: str = False) -> dict:
|
17 |
-
cookies = {}
|
18 |
-
|
19 |
-
if setBrowser != False:
|
20 |
-
for browser in Utils.browsers:
|
21 |
-
if browser.__name__ == setBrowser:
|
22 |
-
try:
|
23 |
-
for c in browser(domain_name=domain):
|
24 |
-
if c.name not in cookies:
|
25 |
-
cookies = cookies | {c.name: c.value}
|
26 |
-
|
27 |
-
except Exception as e:
|
28 |
-
pass
|
29 |
-
|
30 |
-
else:
|
31 |
-
for browser in Utils.browsers:
|
32 |
-
try:
|
33 |
-
for c in browser(domain_name=domain):
|
34 |
-
if c.name not in cookies:
|
35 |
-
cookies = cookies | {c.name: c.value}
|
36 |
-
|
37 |
-
except Exception as e:
|
38 |
-
pass
|
39 |
-
|
40 |
-
if setName:
|
41 |
-
try:
|
42 |
-
return {setName: cookies[setName]}
|
43 |
-
|
44 |
-
except ValueError:
|
45 |
-
print(f'Error: could not find {setName} cookie in any browser.')
|
46 |
-
exit(1)
|
47 |
-
|
48 |
-
else:
|
49 |
-
return cookies
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
spaces/FredZhang7/paint-journey-demo/README.md
DELETED
@@ -1,13 +0,0 @@
|
|
1 |
-
---
|
2 |
-
title: Paint Journey Demo
|
3 |
-
emoji: 😻
|
4 |
-
colorFrom: purple
|
5 |
-
colorTo: green
|
6 |
-
sdk: gradio
|
7 |
-
sdk_version: 3.16.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/FridaZuley/RVC_HFKawaii/infer/modules/ipex/__init__.py.py
DELETED
@@ -1,165 +0,0 @@
|
|
1 |
-
import os
|
2 |
-
import sys
|
3 |
-
import contextlib
|
4 |
-
import torch
|
5 |
-
import intel_extension_for_pytorch as ipex # pylint: disable=import-error, unused-import
|
6 |
-
from .hijacks import ipex_hijacks
|
7 |
-
from .attention import attention_init
|
8 |
-
|
9 |
-
# pylint: disable=protected-access, missing-function-docstring, line-too-long
|
10 |
-
|
11 |
-
def ipex_init(): # pylint: disable=too-many-statements
|
12 |
-
try:
|
13 |
-
#Replace cuda with xpu:
|
14 |
-
torch.cuda.current_device = torch.xpu.current_device
|
15 |
-
torch.cuda.current_stream = torch.xpu.current_stream
|
16 |
-
torch.cuda.device = torch.xpu.device
|
17 |
-
torch.cuda.device_count = torch.xpu.device_count
|
18 |
-
torch.cuda.device_of = torch.xpu.device_of
|
19 |
-
torch.cuda.getDeviceIdListForCard = torch.xpu.getDeviceIdListForCard
|
20 |
-
torch.cuda.get_device_name = torch.xpu.get_device_name
|
21 |
-
torch.cuda.get_device_properties = torch.xpu.get_device_properties
|
22 |
-
torch.cuda.init = torch.xpu.init
|
23 |
-
torch.cuda.is_available = torch.xpu.is_available
|
24 |
-
torch.cuda.is_initialized = torch.xpu.is_initialized
|
25 |
-
torch.cuda.is_current_stream_capturing = lambda: False
|
26 |
-
torch.cuda.set_device = torch.xpu.set_device
|
27 |
-
torch.cuda.stream = torch.xpu.stream
|
28 |
-
torch.cuda.synchronize = torch.xpu.synchronize
|
29 |
-
torch.cuda.Event = torch.xpu.Event
|
30 |
-
torch.cuda.Stream = torch.xpu.Stream
|
31 |
-
torch.cuda.FloatTensor = torch.xpu.FloatTensor
|
32 |
-
torch.Tensor.cuda = torch.Tensor.xpu
|
33 |
-
torch.Tensor.is_cuda = torch.Tensor.is_xpu
|
34 |
-
torch.cuda._initialization_lock = torch.xpu.lazy_init._initialization_lock
|
35 |
-
torch.cuda._initialized = torch.xpu.lazy_init._initialized
|
36 |
-
torch.cuda._lazy_seed_tracker = torch.xpu.lazy_init._lazy_seed_tracker
|
37 |
-
torch.cuda._queued_calls = torch.xpu.lazy_init._queued_calls
|
38 |
-
torch.cuda._tls = torch.xpu.lazy_init._tls
|
39 |
-
torch.cuda.threading = torch.xpu.lazy_init.threading
|
40 |
-
torch.cuda.traceback = torch.xpu.lazy_init.traceback
|
41 |
-
torch.cuda.Optional = torch.xpu.Optional
|
42 |
-
torch.cuda.__cached__ = torch.xpu.__cached__
|
43 |
-
torch.cuda.__loader__ = torch.xpu.__loader__
|
44 |
-
torch.cuda.ComplexFloatStorage = torch.xpu.ComplexFloatStorage
|
45 |
-
torch.cuda.Tuple = torch.xpu.Tuple
|
46 |
-
torch.cuda.streams = torch.xpu.streams
|
47 |
-
torch.cuda._lazy_new = torch.xpu._lazy_new
|
48 |
-
torch.cuda.FloatStorage = torch.xpu.FloatStorage
|
49 |
-
torch.cuda.Any = torch.xpu.Any
|
50 |
-
torch.cuda.__doc__ = torch.xpu.__doc__
|
51 |
-
torch.cuda.default_generators = torch.xpu.default_generators
|
52 |
-
torch.cuda.HalfTensor = torch.xpu.HalfTensor
|
53 |
-
torch.cuda._get_device_index = torch.xpu._get_device_index
|
54 |
-
torch.cuda.__path__ = torch.xpu.__path__
|
55 |
-
torch.cuda.Device = torch.xpu.Device
|
56 |
-
torch.cuda.IntTensor = torch.xpu.IntTensor
|
57 |
-
torch.cuda.ByteStorage = torch.xpu.ByteStorage
|
58 |
-
torch.cuda.set_stream = torch.xpu.set_stream
|
59 |
-
torch.cuda.BoolStorage = torch.xpu.BoolStorage
|
60 |
-
torch.cuda.os = torch.xpu.os
|
61 |
-
torch.cuda.torch = torch.xpu.torch
|
62 |
-
torch.cuda.BFloat16Storage = torch.xpu.BFloat16Storage
|
63 |
-
torch.cuda.Union = torch.xpu.Union
|
64 |
-
torch.cuda.DoubleTensor = torch.xpu.DoubleTensor
|
65 |
-
torch.cuda.ShortTensor = torch.xpu.ShortTensor
|
66 |
-
torch.cuda.LongTensor = torch.xpu.LongTensor
|
67 |
-
torch.cuda.IntStorage = torch.xpu.IntStorage
|
68 |
-
torch.cuda.LongStorage = torch.xpu.LongStorage
|
69 |
-
torch.cuda.__annotations__ = torch.xpu.__annotations__
|
70 |
-
torch.cuda.__package__ = torch.xpu.__package__
|
71 |
-
torch.cuda.__builtins__ = torch.xpu.__builtins__
|
72 |
-
torch.cuda.CharTensor = torch.xpu.CharTensor
|
73 |
-
torch.cuda.List = torch.xpu.List
|
74 |
-
torch.cuda._lazy_init = torch.xpu._lazy_init
|
75 |
-
torch.cuda.BFloat16Tensor = torch.xpu.BFloat16Tensor
|
76 |
-
torch.cuda.DoubleStorage = torch.xpu.DoubleStorage
|
77 |
-
torch.cuda.ByteTensor = torch.xpu.ByteTensor
|
78 |
-
torch.cuda.StreamContext = torch.xpu.StreamContext
|
79 |
-
torch.cuda.ComplexDoubleStorage = torch.xpu.ComplexDoubleStorage
|
80 |
-
torch.cuda.ShortStorage = torch.xpu.ShortStorage
|
81 |
-
torch.cuda._lazy_call = torch.xpu._lazy_call
|
82 |
-
torch.cuda.HalfStorage = torch.xpu.HalfStorage
|
83 |
-
torch.cuda.random = torch.xpu.random
|
84 |
-
torch.cuda._device = torch.xpu._device
|
85 |
-
torch.cuda.classproperty = torch.xpu.classproperty
|
86 |
-
torch.cuda.__name__ = torch.xpu.__name__
|
87 |
-
torch.cuda._device_t = torch.xpu._device_t
|
88 |
-
torch.cuda.warnings = torch.xpu.warnings
|
89 |
-
torch.cuda.__spec__ = torch.xpu.__spec__
|
90 |
-
torch.cuda.BoolTensor = torch.xpu.BoolTensor
|
91 |
-
torch.cuda.CharStorage = torch.xpu.CharStorage
|
92 |
-
torch.cuda.__file__ = torch.xpu.__file__
|
93 |
-
torch.cuda._is_in_bad_fork = torch.xpu.lazy_init._is_in_bad_fork
|
94 |
-
#torch.cuda.is_current_stream_capturing = torch.xpu.is_current_stream_capturing
|
95 |
-
|
96 |
-
#Memory:
|
97 |
-
torch.cuda.memory = torch.xpu.memory
|
98 |
-
if 'linux' in sys.platform and "WSL2" in os.popen("uname -a").read():
|
99 |
-
torch.xpu.empty_cache = lambda: None
|
100 |
-
torch.cuda.empty_cache = torch.xpu.empty_cache
|
101 |
-
torch.cuda.memory_stats = torch.xpu.memory_stats
|
102 |
-
torch.cuda.memory_summary = torch.xpu.memory_summary
|
103 |
-
torch.cuda.memory_snapshot = torch.xpu.memory_snapshot
|
104 |
-
torch.cuda.memory_allocated = torch.xpu.memory_allocated
|
105 |
-
torch.cuda.max_memory_allocated = torch.xpu.max_memory_allocated
|
106 |
-
torch.cuda.memory_reserved = torch.xpu.memory_reserved
|
107 |
-
torch.cuda.memory_cached = torch.xpu.memory_reserved
|
108 |
-
torch.cuda.max_memory_reserved = torch.xpu.max_memory_reserved
|
109 |
-
torch.cuda.max_memory_cached = torch.xpu.max_memory_reserved
|
110 |
-
torch.cuda.reset_peak_memory_stats = torch.xpu.reset_peak_memory_stats
|
111 |
-
torch.cuda.reset_max_memory_cached = torch.xpu.reset_peak_memory_stats
|
112 |
-
torch.cuda.reset_max_memory_allocated = torch.xpu.reset_peak_memory_stats
|
113 |
-
torch.cuda.memory_stats_as_nested_dict = torch.xpu.memory_stats_as_nested_dict
|
114 |
-
torch.cuda.reset_accumulated_memory_stats = torch.xpu.reset_accumulated_memory_stats
|
115 |
-
|
116 |
-
#RNG:
|
117 |
-
torch.cuda.get_rng_state = torch.xpu.get_rng_state
|
118 |
-
torch.cuda.get_rng_state_all = torch.xpu.get_rng_state_all
|
119 |
-
torch.cuda.set_rng_state = torch.xpu.set_rng_state
|
120 |
-
torch.cuda.set_rng_state_all = torch.xpu.set_rng_state_all
|
121 |
-
torch.cuda.manual_seed = torch.xpu.manual_seed
|
122 |
-
torch.cuda.manual_seed_all = torch.xpu.manual_seed_all
|
123 |
-
torch.cuda.seed = torch.xpu.seed
|
124 |
-
torch.cuda.seed_all = torch.xpu.seed_all
|
125 |
-
torch.cuda.initial_seed = torch.xpu.initial_seed
|
126 |
-
|
127 |
-
#AMP:
|
128 |
-
torch.cuda.amp = torch.xpu.amp
|
129 |
-
if not hasattr(torch.cuda.amp, "common"):
|
130 |
-
torch.cuda.amp.common = contextlib.nullcontext()
|
131 |
-
torch.cuda.amp.common.amp_definitely_not_available = lambda: False
|
132 |
-
try:
|
133 |
-
torch.cuda.amp.GradScaler = torch.xpu.amp.GradScaler
|
134 |
-
except Exception: # pylint: disable=broad-exception-caught
|
135 |
-
try:
|
136 |
-
from .gradscaler import gradscaler_init # pylint: disable=import-outside-toplevel, import-error
|
137 |
-
gradscaler_init()
|
138 |
-
torch.cuda.amp.GradScaler = torch.xpu.amp.GradScaler
|
139 |
-
except Exception: # pylint: disable=broad-exception-caught
|
140 |
-
torch.cuda.amp.GradScaler = ipex.cpu.autocast._grad_scaler.GradScaler
|
141 |
-
|
142 |
-
#C
|
143 |
-
torch._C._cuda_getCurrentRawStream = ipex._C._getCurrentStream
|
144 |
-
ipex._C._DeviceProperties.major = 2023
|
145 |
-
ipex._C._DeviceProperties.minor = 2
|
146 |
-
|
147 |
-
#Fix functions with ipex:
|
148 |
-
torch.cuda.mem_get_info = lambda device=None: [(torch.xpu.get_device_properties(device).total_memory - torch.xpu.memory_allocated(device)), torch.xpu.get_device_properties(device).total_memory]
|
149 |
-
torch._utils._get_available_device_type = lambda: "xpu"
|
150 |
-
torch.has_cuda = True
|
151 |
-
torch.cuda.has_half = True
|
152 |
-
torch.cuda.is_bf16_supported = lambda *args, **kwargs: True
|
153 |
-
torch.cuda.is_fp16_supported = lambda *args, **kwargs: True
|
154 |
-
torch.version.cuda = "11.7"
|
155 |
-
torch.cuda.get_device_capability = lambda *args, **kwargs: [11,7]
|
156 |
-
torch.cuda.get_device_properties.major = 11
|
157 |
-
torch.cuda.get_device_properties.minor = 7
|
158 |
-
torch.cuda.ipc_collect = lambda *args, **kwargs: None
|
159 |
-
torch.cuda.utilization = lambda *args, **kwargs: 0
|
160 |
-
|
161 |
-
ipex_hijacks()
|
162 |
-
attention_init()
|
163 |
-
except Exception as e:
|
164 |
-
return False, e
|
165 |
-
return True, None
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|