-
Notifications
You must be signed in to change notification settings - Fork 27
/
Copy path__init__.py
128 lines (103 loc) ยท 4.7 KB
/
__init__.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
from .src.install import check_and_install, check_and_install_version
check_and_install("tqdm")
check_and_install("image-reward",import_name="ImageReward")
check_and_install_version("Pillow","10.1.0",import_name="PIL")
check_and_install_version("huggingface_hub","0.20.1")
# 4bit internlm
# linux must install manually for kernel compile
check_and_install_version("auto-gptq","0.7.1",import_name="auto_gptq")
check_and_install_version("einops","0.7.0")
check_and_install("torchvision")
check_and_install_version("accelerate","0.25.0")
check_and_install_version("timm","0.9.16")
# Qwen-1.5 awq
check_and_install_version("autoawq","0.2.3",import_name="awq")
## Qwen1_8 Prompt
check_and_install("tiktoken")
# check_and_install_version("transformers-stream-generator", "0.0.4",import_name="transformers_stream_generator")
# deepseek
check_and_install("attrdict")
check_and_install_version("einops","0.7.0")
check_and_install_version("sentencepiece","0.2.0")
check_and_install("git+https://github.com/deepseek-ai/DeepSeek-VL.git@86a3096",import_name="deepseek_vl")
# >= 4.37.1 Qwen-1.5
# >= 4.38.2 deepseek , test ok == 4.37.1
# >= 4.38.2 llama3
check_and_install_version("transformers","4.38.2",up_version=False)
# llama3 4bit or 8bit
check_and_install_version("accelerate","0.29.3")
check_and_install_version("bitsandbytes","0.43.1")
# youdao Translate
check_and_install("pycryptodome",import_name="Crypto")
from .src.image2text import Image2Text, LoadImage2TextModel, Image2TextWithTags
from .src.text2prompt import LoadText2PromptModel,Text2Prompt,Text2GPTPrompt
from .src.tools import Translate2Chinese,ShowText,TextBox
from .src.conditioning import PromptConditioning,AdvancedCLIPTextEncode
from .src.reward import LoadImageRewardScoreModel,ImageRewardScore,ImageBatchToList
from .src.t5_gpt import T5_LLM_Node,QuantizationConfig_Node,Load_T5_LLM_Model
NODE_CLASS_MAPPINGS = {
"Image2Text": Image2Text,
"LoadImage2TextModel": LoadImage2TextModel,
"Image2TextWithTags": Image2TextWithTags,
"LoadText2PromptModel":LoadText2PromptModel,
"Text2Prompt":Text2Prompt,
"Text2GPTPrompt":Text2GPTPrompt,
"Translate2Chinese|fofo":Translate2Chinese,
"ShowText|fofo":ShowText,
"TextBox|fofo":TextBox,
"CLIP PromptConditioning|fofo":PromptConditioning,
"CLIP AdvancedTextEncode|fofo":AdvancedCLIPTextEncode,
"LoadImageRewardScoreModel|fofo":LoadImageRewardScoreModel,
"ImageRewardScore|fofo":ImageRewardScore,
"ImageBatchToList|fofo":ImageBatchToList,
"LoadT5Model|fofo": Load_T5_LLM_Model,
"T5QuantizationConfig|fofo": QuantizationConfig_Node,
"T5Text2Prompt|fofo": T5_LLM_Node,
}
# A dictionary that contains the friendly/humanly readable titles for the nodes
NODE_DISPLAY_NAME_MAPPINGS = {
"Image2Text": "Image to Text ๐ผ",
"LoadImage2TextModel": "Loader Image to Text Model ๐ผ",
"Image2TextWithTags":"Image to Text with Tags ๐ผ",
"LoadText2PromptModel":"Loader Text to Prompt Model ๐ผ",
"Text2Prompt":"Text to Prompt ๐ผ",
"Text2GPTPrompt":"Multi Text to GPTPrompt ๐ผ",
"Translate2Chinese|fofo":"Translate Text to Chinese ๐ผ",
"ShowText|fofo":"Show Text ๐ผ",
"TextBox|fofo":"Text Box ๐ผ",
"CLIP PromptConditioning|fofo":"CLIP Prompt Conditioning ๐ผ",
"CLIP AdvancedTextEncode|fofo": "CLIP Advanced Text Encode ๐ผ",
"LoadImageRewardScoreModel|fofo":"Load Image Reward Score Model ๐ผ",
"ImageRewardScore|fofo":"Image Reward Score ๐ผ",
"ImageBatchToList|fofo":"Image Batch to List ๐ผ",
"LoadT5Model|fofo": "Load T5 Model ๐ผ",
"T5QuantizationConfig|fofo": "T5 Quantization Config ๐ผ",
"T5Text2Prompt|fofo": "T5 Text to Prompt ๐ผ",
}
## model dir
from .src.install import GLOBAL_MODELS_DIR
import os
if not os.path.exists(GLOBAL_MODELS_DIR):
os.makedirs(GLOBAL_MODELS_DIR,exist_ok=True)
## js file
import folder_paths
import filecmp
import shutil
def copy_js_files():
javascript_folder = os.path.join(os.path.dirname(os.path.realpath(__file__)), "js")
extentions_folder = os.path.join(folder_paths.base_path,"web" , "extensions" , "fofo" )
os.makedirs(extentions_folder,exist_ok=True)
result = filecmp.dircmp(javascript_folder, extentions_folder)
print(javascript_folder)
print(extentions_folder)
if result.left_only or result.diff_files:
file_list = list(result.left_only)
file_list.extend(x for x in result.diff_files if x not in file_list)
for file in file_list:
src_file = os.path.join(javascript_folder, file)
dst_file = os.path.join(extentions_folder, file)
print(src_file,dst_file)
if os.path.exists(dst_file):
os.remove(dst_file)
shutil.copy(src_file, dst_file)
copy_js_files()