xinference 1.6.0.post1__py3-none-any.whl → 1.7.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of xinference might be problematic. Click here for more details.
- xinference/_version.py +3 -3
- xinference/api/restful_api.py +79 -2
- xinference/client/restful/restful_client.py +65 -3
- xinference/conftest.py +0 -7
- xinference/core/media_interface.py +132 -8
- xinference/core/model.py +44 -6
- xinference/core/scheduler.py +1 -10
- xinference/core/supervisor.py +8 -17
- xinference/core/worker.py +5 -27
- xinference/deploy/cmdline.py +6 -2
- xinference/model/audio/chattts.py +24 -39
- xinference/model/audio/cosyvoice.py +18 -30
- xinference/model/audio/funasr.py +42 -0
- xinference/model/audio/model_spec.json +71 -1
- xinference/model/audio/model_spec_modelscope.json +76 -2
- xinference/model/audio/utils.py +75 -0
- xinference/model/core.py +1 -0
- xinference/model/embedding/__init__.py +74 -18
- xinference/model/embedding/core.py +98 -589
- xinference/model/embedding/embed_family.py +133 -0
- xinference/{thirdparty/omnilmm/train → model/embedding/flag}/__init__.py +1 -1
- xinference/model/embedding/flag/core.py +282 -0
- xinference/model/embedding/model_spec.json +24 -0
- xinference/model/embedding/model_spec_modelscope.json +24 -0
- xinference/model/embedding/sentence_transformers/__init__.py +13 -0
- xinference/model/embedding/sentence_transformers/core.py +399 -0
- xinference/model/embedding/vllm/core.py +95 -0
- xinference/model/image/model_spec.json +30 -3
- xinference/model/image/model_spec_modelscope.json +41 -2
- xinference/model/image/stable_diffusion/core.py +144 -53
- xinference/model/llm/__init__.py +6 -54
- xinference/model/llm/core.py +19 -5
- xinference/model/llm/llama_cpp/core.py +59 -3
- xinference/model/llm/llama_cpp/memory.py +457 -0
- xinference/model/llm/llm_family.json +247 -402
- xinference/model/llm/llm_family.py +88 -16
- xinference/model/llm/llm_family_modelscope.json +260 -421
- xinference/model/llm/llm_family_openmind_hub.json +0 -34
- xinference/model/llm/sglang/core.py +8 -0
- xinference/model/llm/transformers/__init__.py +27 -6
- xinference/model/llm/transformers/chatglm.py +4 -2
- xinference/model/llm/transformers/core.py +49 -28
- xinference/model/llm/transformers/deepseek_v2.py +6 -49
- xinference/model/llm/transformers/gemma3.py +119 -164
- xinference/model/llm/transformers/multimodal/__init__.py +13 -0
- xinference/model/llm/transformers/{cogagent.py → multimodal/cogagent.py} +58 -95
- xinference/model/llm/transformers/multimodal/core.py +205 -0
- xinference/model/llm/transformers/{deepseek_vl2.py → multimodal/deepseek_vl2.py} +59 -120
- xinference/model/llm/transformers/multimodal/gemma3.py +117 -0
- xinference/model/llm/transformers/{glm4v.py → multimodal/glm4v.py} +57 -93
- xinference/model/llm/transformers/multimodal/intern_vl.py +412 -0
- xinference/model/llm/transformers/{minicpmv26.py → multimodal/minicpmv26.py} +55 -102
- xinference/model/llm/transformers/{ovis2.py → multimodal/ovis2.py} +114 -175
- xinference/model/llm/transformers/{qwen-omni.py → multimodal/qwen-omni.py} +82 -167
- xinference/model/llm/transformers/multimodal/qwen2_audio.py +131 -0
- xinference/model/llm/transformers/{qwen2_vl.py → multimodal/qwen2_vl.py} +224 -256
- xinference/model/llm/transformers/opt.py +4 -2
- xinference/model/llm/transformers/utils.py +6 -37
- xinference/model/llm/utils.py +11 -0
- xinference/model/llm/vllm/core.py +7 -0
- xinference/model/rerank/core.py +91 -3
- xinference/model/rerank/model_spec.json +24 -0
- xinference/model/rerank/model_spec_modelscope.json +24 -0
- xinference/model/rerank/utils.py +20 -2
- xinference/model/utils.py +38 -1
- xinference/model/video/diffusers.py +65 -3
- xinference/model/video/model_spec.json +31 -4
- xinference/model/video/model_spec_modelscope.json +32 -4
- xinference/web/ui/build/asset-manifest.json +6 -6
- xinference/web/ui/build/index.html +1 -1
- xinference/web/ui/build/static/css/main.013f296b.css +2 -0
- xinference/web/ui/build/static/css/main.013f296b.css.map +1 -0
- xinference/web/ui/build/static/js/main.8a9e3ba0.js +3 -0
- xinference/web/ui/build/static/js/main.8a9e3ba0.js.map +1 -0
- xinference/web/ui/node_modules/.cache/babel-loader/34cfbfb7836e136ba3261cfd411cc554bf99ba24b35dcceebeaa4f008cb3c9dc.json +1 -0
- xinference/web/ui/node_modules/.cache/babel-loader/55b9fb40b57fa926e8f05f31c2f96467e76e5ad62f033dca97c03f9e8c4eb4fe.json +1 -0
- xinference/web/ui/node_modules/.cache/babel-loader/567e49df411efb24425d289bb484758cb57067ca54f8b5c67fe4505f698deb96.json +1 -0
- xinference/web/ui/node_modules/.cache/babel-loader/6595880facebca7ceace6f17cf21c3a5a9219a2f52fb0ba9f3cf1131eddbcf6b.json +1 -0
- xinference/web/ui/node_modules/.cache/babel-loader/aa998bc2d9c11853add6b8a2e08f50327f56d8824ccaaec92d6dde1b305f0d85.json +1 -0
- xinference/web/ui/node_modules/.cache/babel-loader/c748246b1d7bcebc16153be69f37e955bb2145526c47dd425aeeff70d3004dbc.json +1 -0
- xinference/web/ui/node_modules/.cache/babel-loader/e31234e95d60a5a7883fbcd70de2475dc1c88c90705df1a530abb68f86f80a51.json +1 -0
- xinference/web/ui/src/locales/en.json +21 -8
- xinference/web/ui/src/locales/ja.json +224 -0
- xinference/web/ui/src/locales/ko.json +224 -0
- xinference/web/ui/src/locales/zh.json +21 -8
- {xinference-1.6.0.post1.dist-info → xinference-1.7.0.dist-info}/METADATA +14 -11
- {xinference-1.6.0.post1.dist-info → xinference-1.7.0.dist-info}/RECORD +93 -100
- {xinference-1.6.0.post1.dist-info → xinference-1.7.0.dist-info}/WHEEL +1 -1
- xinference/model/llm/transformers/cogvlm2.py +0 -442
- xinference/model/llm/transformers/cogvlm2_video.py +0 -333
- xinference/model/llm/transformers/deepseek_vl.py +0 -280
- xinference/model/llm/transformers/glm_edge_v.py +0 -213
- xinference/model/llm/transformers/intern_vl.py +0 -526
- xinference/model/llm/transformers/internlm2.py +0 -94
- xinference/model/llm/transformers/minicpmv25.py +0 -193
- xinference/model/llm/transformers/omnilmm.py +0 -132
- xinference/model/llm/transformers/qwen2_audio.py +0 -179
- xinference/model/llm/transformers/qwen_vl.py +0 -360
- xinference/thirdparty/omnilmm/LICENSE +0 -201
- xinference/thirdparty/omnilmm/chat.py +0 -218
- xinference/thirdparty/omnilmm/constants.py +0 -4
- xinference/thirdparty/omnilmm/conversation.py +0 -332
- xinference/thirdparty/omnilmm/model/__init__.py +0 -1
- xinference/thirdparty/omnilmm/model/omnilmm.py +0 -595
- xinference/thirdparty/omnilmm/model/resampler.py +0 -166
- xinference/thirdparty/omnilmm/model/utils.py +0 -578
- xinference/thirdparty/omnilmm/train/train_utils.py +0 -150
- xinference/thirdparty/omnilmm/utils.py +0 -134
- xinference/web/ui/build/static/css/main.337afe76.css +0 -2
- xinference/web/ui/build/static/css/main.337afe76.css.map +0 -1
- xinference/web/ui/build/static/js/main.ae579a97.js +0 -3
- xinference/web/ui/build/static/js/main.ae579a97.js.map +0 -1
- xinference/web/ui/node_modules/.cache/babel-loader/12e02ee790dbf57ead09a241a93bb5f893393aa36628ca741d44390e836a103f.json +0 -1
- xinference/web/ui/node_modules/.cache/babel-loader/2fdc61dcb6a9d1fbcb44be592d0e87d8c3f21297a7327559ef5345665f8343f7.json +0 -1
- xinference/web/ui/node_modules/.cache/babel-loader/3d596a3e8dd6430d7ce81d164e32c31f8d47cfa5f725c328a298754d78563e14.json +0 -1
- xinference/web/ui/node_modules/.cache/babel-loader/5c08e2cd07809ed3e41486b16652253404cbb63a3ff8d0366ee50f57e2413cea.json +0 -1
- xinference/web/ui/node_modules/.cache/babel-loader/8472e58a31720892d534f3febda31f746b25ec4aa60787eef34217b074e67965.json +0 -1
- xinference/web/ui/node_modules/.cache/babel-loader/dc249829767b8abcbc3677e0b07b6d3ecbfdfe6d08cfe23a665eb33373a9aa9d.json +0 -1
- xinference/web/ui/node_modules/.cache/babel-loader/f91af913d7f91c410719ab13136aaed3aaf0f8dda06652f25c42cb5231587398.json +0 -1
- /xinference/{thirdparty/omnilmm → model/embedding/vllm}/__init__.py +0 -0
- /xinference/web/ui/build/static/js/{main.ae579a97.js.LICENSE.txt → main.8a9e3ba0.js.LICENSE.txt} +0 -0
- {xinference-1.6.0.post1.dist-info → xinference-1.7.0.dist-info}/entry_points.txt +0 -0
- {xinference-1.6.0.post1.dist-info → xinference-1.7.0.dist-info}/licenses/LICENSE +0 -0
- {xinference-1.6.0.post1.dist-info → xinference-1.7.0.dist-info}/top_level.txt +0 -0
|
@@ -1,150 +0,0 @@
|
|
|
1
|
-
import copy
|
|
2
|
-
import warnings
|
|
3
|
-
from typing import Dict, Sequence
|
|
4
|
-
|
|
5
|
-
import numpy as np
|
|
6
|
-
import transformers
|
|
7
|
-
|
|
8
|
-
IGNORE_INDEX = -100
|
|
9
|
-
DEFAULT_IMAGE_TOKEN = "<image>"
|
|
10
|
-
DEFAULT_IMAGE_PATCH_TOKEN = "<im_patch>"
|
|
11
|
-
DEFAULT_IM_START_TOKEN = "<im_start>"
|
|
12
|
-
DEFAULT_IM_END_TOKEN = "<im_end>"
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
def _tokenize_fn(
|
|
16
|
-
strings: Sequence[str], tokenizer: transformers.PreTrainedTokenizer
|
|
17
|
-
) -> Dict:
|
|
18
|
-
"""Tokenize a list of strings."""
|
|
19
|
-
tokenized_list = [
|
|
20
|
-
tokenizer(
|
|
21
|
-
text,
|
|
22
|
-
return_tensors="pt",
|
|
23
|
-
padding="longest",
|
|
24
|
-
max_length=tokenizer.model_max_length,
|
|
25
|
-
truncation=True,
|
|
26
|
-
)
|
|
27
|
-
for text in strings
|
|
28
|
-
]
|
|
29
|
-
input_ids = labels = [tokenized.input_ids[0] for tokenized in tokenized_list]
|
|
30
|
-
input_ids_lens = labels_lens = [
|
|
31
|
-
tokenized.input_ids.ne(tokenizer.pad_token_id).sum().item()
|
|
32
|
-
for tokenized in tokenized_list
|
|
33
|
-
]
|
|
34
|
-
return dict(
|
|
35
|
-
input_ids=input_ids,
|
|
36
|
-
labels=labels,
|
|
37
|
-
input_ids_lens=input_ids_lens,
|
|
38
|
-
labels_lens=labels_lens,
|
|
39
|
-
)
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
def omni_preprocess(
|
|
43
|
-
sources, tokenizer: transformers.PreTrainedTokenizer, generation=False
|
|
44
|
-
):
|
|
45
|
-
system_content = "You are an artificial intelligence assistant, which gives helpful, detailed, and polite answers to the human's questions."
|
|
46
|
-
ignore_index = -100
|
|
47
|
-
|
|
48
|
-
response_template = "\n<|assistant|>\n"
|
|
49
|
-
instruction_template = "\n<|user|>\n"
|
|
50
|
-
response_token_ids = tokenizer.encode(response_template, add_special_tokens=False)
|
|
51
|
-
instruction_token_ids = tokenizer.encode(
|
|
52
|
-
instruction_template, add_special_tokens=False
|
|
53
|
-
)
|
|
54
|
-
|
|
55
|
-
batch_input_ids = []
|
|
56
|
-
batch_labels = []
|
|
57
|
-
for i in range(len(sources)):
|
|
58
|
-
new_source = []
|
|
59
|
-
prev_role = "unexpect"
|
|
60
|
-
for conv_turn in sources[i]:
|
|
61
|
-
role = conv_turn["from"] if "from" in conv_turn else conv_turn["role"]
|
|
62
|
-
content = (
|
|
63
|
-
conv_turn["value"] if "value" in conv_turn else conv_turn["content"]
|
|
64
|
-
)
|
|
65
|
-
|
|
66
|
-
role = "user" if role == "human" else role
|
|
67
|
-
role = "assistant" if role == "gpt" else role
|
|
68
|
-
|
|
69
|
-
assert role in ["user", "assistant"]
|
|
70
|
-
assert role != prev_role, f"role={role}, prev_role={prev_role}"
|
|
71
|
-
prev_role = role
|
|
72
|
-
|
|
73
|
-
new_turn = {"role": role, "content": content}
|
|
74
|
-
new_source.append(new_turn)
|
|
75
|
-
if new_source[0]["role"] != "system":
|
|
76
|
-
new_source.insert(0, {"role": "system", "content": system_content})
|
|
77
|
-
|
|
78
|
-
# TODO: this automatically add '\n' to the end
|
|
79
|
-
res_text = tokenizer.apply_chat_template(
|
|
80
|
-
new_source, tokenize=False, add_generation_prompt=generation
|
|
81
|
-
)
|
|
82
|
-
if not generation:
|
|
83
|
-
res_text = res_text.strip()
|
|
84
|
-
|
|
85
|
-
conversations_tokenized = _tokenize_fn([res_text], tokenizer)
|
|
86
|
-
res_input_ids = conversations_tokenized["input_ids"][0]
|
|
87
|
-
|
|
88
|
-
# since labels and input_ids are reference towards the same object
|
|
89
|
-
res_labels = copy.deepcopy(conversations_tokenized["labels"][0])
|
|
90
|
-
|
|
91
|
-
response_token_ids_idxs = []
|
|
92
|
-
human_token_ids_idxs = []
|
|
93
|
-
|
|
94
|
-
for assistant_idx in np.where(res_labels == response_token_ids[0])[0]:
|
|
95
|
-
# find the indexes of the start of a response.
|
|
96
|
-
if (
|
|
97
|
-
response_token_ids
|
|
98
|
-
== res_labels[
|
|
99
|
-
assistant_idx : assistant_idx + len(response_token_ids)
|
|
100
|
-
].tolist()
|
|
101
|
-
):
|
|
102
|
-
response_token_ids_idxs.append(assistant_idx + len(response_token_ids))
|
|
103
|
-
|
|
104
|
-
if len(response_token_ids_idxs) == 0:
|
|
105
|
-
warnings.warn(
|
|
106
|
-
f"Could not find response key `{response_template}` in the "
|
|
107
|
-
f"following instance: @===>{tokenizer.decode(res_input_ids)}<===@ "
|
|
108
|
-
f"Raw text is @===>{res_text}<===@"
|
|
109
|
-
f"Raw source is @===>{new_source}<===@"
|
|
110
|
-
f"This instance will be ignored in loss calculation. "
|
|
111
|
-
f"Note, if this happens often, consider increasing the `max_seq_length`."
|
|
112
|
-
)
|
|
113
|
-
res_labels[:] = ignore_index
|
|
114
|
-
|
|
115
|
-
human_token_ids = instruction_token_ids
|
|
116
|
-
for human_idx in np.where(res_labels == human_token_ids[0])[0]:
|
|
117
|
-
# find the indexes of the start of a human answer.
|
|
118
|
-
if (
|
|
119
|
-
human_token_ids
|
|
120
|
-
== res_labels[human_idx : human_idx + len(human_token_ids)].tolist()
|
|
121
|
-
):
|
|
122
|
-
human_token_ids_idxs.append(human_idx)
|
|
123
|
-
|
|
124
|
-
if len(human_token_ids_idxs) == 0:
|
|
125
|
-
warnings.warn(
|
|
126
|
-
f"Could not find instruction key `{instruction_template}` in the "
|
|
127
|
-
f"following instance: @===>{tokenizer.decode(res_input_ids)}<===@ "
|
|
128
|
-
f"Raw text is @===>{res_text}<===@"
|
|
129
|
-
f"Raw source is @===>{new_source}<===@"
|
|
130
|
-
f"This instance will be ignored in loss calculation. "
|
|
131
|
-
f"Note, if this happens often, consider increasing the `max_seq_length`."
|
|
132
|
-
)
|
|
133
|
-
res_labels[:] = ignore_index
|
|
134
|
-
|
|
135
|
-
for idx, (start, end) in enumerate(
|
|
136
|
-
zip(human_token_ids_idxs, response_token_ids_idxs)
|
|
137
|
-
):
|
|
138
|
-
# Make pytorch loss function ignore all non response tokens
|
|
139
|
-
if idx != 0:
|
|
140
|
-
res_labels[start:end] = ignore_index
|
|
141
|
-
else:
|
|
142
|
-
res_labels[:end] = ignore_index
|
|
143
|
-
|
|
144
|
-
if len(response_token_ids_idxs) < len(human_token_ids_idxs):
|
|
145
|
-
res_labels[human_token_ids_idxs[-1] :] = ignore_index
|
|
146
|
-
|
|
147
|
-
batch_input_ids.append(res_input_ids)
|
|
148
|
-
batch_labels.append(res_labels)
|
|
149
|
-
|
|
150
|
-
return dict(input_ids=batch_input_ids, labels=batch_labels)
|
|
@@ -1,134 +0,0 @@
|
|
|
1
|
-
import logging
|
|
2
|
-
import logging.handlers
|
|
3
|
-
import os
|
|
4
|
-
import sys
|
|
5
|
-
|
|
6
|
-
import requests
|
|
7
|
-
|
|
8
|
-
from .constants import LOGDIR
|
|
9
|
-
|
|
10
|
-
server_error_msg = (
|
|
11
|
-
"**NETWORK ERROR DUE TO HIGH TRAFFIC. PLEASE REGENERATE OR REFRESH THIS PAGE.**"
|
|
12
|
-
)
|
|
13
|
-
moderation_msg = (
|
|
14
|
-
"YOUR INPUT VIOLATES OUR CONTENT MODERATION GUIDELINES. PLEASE TRY AGAIN."
|
|
15
|
-
)
|
|
16
|
-
|
|
17
|
-
handler = None
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
def build_logger(logger_name, logger_filename):
|
|
21
|
-
global handler
|
|
22
|
-
|
|
23
|
-
formatter = logging.Formatter(
|
|
24
|
-
fmt="%(asctime)s | %(levelname)s | %(name)s | %(message)s",
|
|
25
|
-
datefmt="%Y-%m-%d %H:%M:%S",
|
|
26
|
-
)
|
|
27
|
-
|
|
28
|
-
# Set the format of root handlers
|
|
29
|
-
if not logging.getLogger().handlers:
|
|
30
|
-
logging.basicConfig(level=logging.INFO)
|
|
31
|
-
logging.getLogger().handlers[0].setFormatter(formatter)
|
|
32
|
-
|
|
33
|
-
# Redirect stdout and stderr to loggers
|
|
34
|
-
stdout_logger = logging.getLogger("stdout")
|
|
35
|
-
stdout_logger.setLevel(logging.INFO)
|
|
36
|
-
sl = StreamToLogger(stdout_logger, logging.INFO)
|
|
37
|
-
sys.stdout = sl
|
|
38
|
-
|
|
39
|
-
stderr_logger = logging.getLogger("stderr")
|
|
40
|
-
stderr_logger.setLevel(logging.ERROR)
|
|
41
|
-
sl = StreamToLogger(stderr_logger, logging.ERROR)
|
|
42
|
-
sys.stderr = sl
|
|
43
|
-
|
|
44
|
-
# Get logger
|
|
45
|
-
logger = logging.getLogger(logger_name)
|
|
46
|
-
logger.setLevel(logging.INFO)
|
|
47
|
-
|
|
48
|
-
# Add a file handler for all loggers
|
|
49
|
-
if handler is None:
|
|
50
|
-
os.makedirs(LOGDIR, exist_ok=True)
|
|
51
|
-
filename = os.path.join(LOGDIR, logger_filename)
|
|
52
|
-
handler = logging.handlers.TimedRotatingFileHandler(
|
|
53
|
-
filename, when="D", utc=True
|
|
54
|
-
)
|
|
55
|
-
handler.setFormatter(formatter)
|
|
56
|
-
|
|
57
|
-
for name, item in logging.root.manager.loggerDict.items():
|
|
58
|
-
if isinstance(item, logging.Logger):
|
|
59
|
-
item.addHandler(handler)
|
|
60
|
-
|
|
61
|
-
return logger
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
class StreamToLogger(object):
|
|
65
|
-
"""
|
|
66
|
-
Fake file-like stream object that redirects writes to a logger instance.
|
|
67
|
-
"""
|
|
68
|
-
|
|
69
|
-
def __init__(self, logger, log_level=logging.INFO):
|
|
70
|
-
self.terminal = sys.stdout
|
|
71
|
-
self.logger = logger
|
|
72
|
-
self.log_level = log_level
|
|
73
|
-
self.linebuf = ""
|
|
74
|
-
|
|
75
|
-
def __getattr__(self, attr):
|
|
76
|
-
return getattr(self.terminal, attr)
|
|
77
|
-
|
|
78
|
-
def write(self, buf):
|
|
79
|
-
temp_linebuf = self.linebuf + buf
|
|
80
|
-
self.linebuf = ""
|
|
81
|
-
for line in temp_linebuf.splitlines(True):
|
|
82
|
-
# From the io.TextIOWrapper docs:
|
|
83
|
-
# On output, if newline is None, any '\n' characters written
|
|
84
|
-
# are translated to the system default line separator.
|
|
85
|
-
# By default sys.stdout.write() expects '\n' newlines and then
|
|
86
|
-
# translates them so this is still cross platform.
|
|
87
|
-
if line[-1] == "\n":
|
|
88
|
-
self.logger.log(self.log_level, line.rstrip())
|
|
89
|
-
else:
|
|
90
|
-
self.linebuf += line
|
|
91
|
-
|
|
92
|
-
def flush(self):
|
|
93
|
-
if self.linebuf != "":
|
|
94
|
-
self.logger.log(self.log_level, self.linebuf.rstrip())
|
|
95
|
-
self.linebuf = ""
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
def disable_torch_init():
|
|
99
|
-
"""
|
|
100
|
-
Disable the redundant torch default initialization to accelerate model creation.
|
|
101
|
-
"""
|
|
102
|
-
import torch
|
|
103
|
-
|
|
104
|
-
setattr(torch.nn.Linear, "reset_parameters", lambda self: None)
|
|
105
|
-
setattr(torch.nn.LayerNorm, "reset_parameters", lambda self: None)
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
def violates_moderation(text):
|
|
109
|
-
"""
|
|
110
|
-
Check whether the text violates OpenAI moderation API.
|
|
111
|
-
"""
|
|
112
|
-
url = "https://api.openai.com/v1/moderations"
|
|
113
|
-
headers = {
|
|
114
|
-
"Content-Type": "application/json",
|
|
115
|
-
"Authorization": "Bearer " + os.environ["OPENAI_API_KEY"],
|
|
116
|
-
}
|
|
117
|
-
text = text.replace("\n", "")
|
|
118
|
-
data = "{" + '"input": ' + f'"{text}"' + "}"
|
|
119
|
-
data = data.encode("utf-8")
|
|
120
|
-
try:
|
|
121
|
-
ret = requests.post(url, headers=headers, data=data, timeout=5)
|
|
122
|
-
flagged = ret.json()["results"][0]["flagged"]
|
|
123
|
-
except requests.exceptions.RequestException:
|
|
124
|
-
flagged = False
|
|
125
|
-
except KeyError:
|
|
126
|
-
flagged = False
|
|
127
|
-
|
|
128
|
-
return flagged
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
def pretty_print_semaphore(semaphore):
|
|
132
|
-
if semaphore is None:
|
|
133
|
-
return "None"
|
|
134
|
-
return f"Semaphore(value={semaphore._value}, locked={semaphore.locked()})"
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
.container{cursor:pointer;display:block}.container,.descriptionCard{border-radius:20px;height:300px;position:relative;width:300px}.descriptionCard{left:-1px;padding:20px;top:-1px}.cardTitle{display:flex;justify-content:space-between}.iconButtonBox{align-items:center;display:flex}.drawerCard{min-height:100%;padding:20px 80px 0;position:relative;width:60vw}.p{-webkit-line-clamp:4;-webkit-box-orient:vertical;display:-webkit-box;font-size:14px;overflow:hidden;padding:0 10px;text-overflow:ellipsis;word-break:break-word}.pasteText{color:#1976d2;cursor:pointer;font-size:18px!important;margin-inline:10px}.pasteText:hover{color:#1976d2b3}.copyToCommandLine{color:#1976d2;cursor:pointer;font-size:16px!important}.copyToCommandLine:hover{color:#1976d2b3}.formContainer{height:80%;overflow:scroll;padding:0 10px 160px}.buttonsContainer{bottom:50px;left:100px;position:absolute;right:100px}.buttons{align-items:center;display:flex;gap:20px;justify-content:space-between}.css-1be5mm1-MuiLinearProgress-root-MuiMobileStepper-progress,.css-r5rjnf-MuiLinearProgress-root-MuiMobileStepper-progress{width:100%!important}.instructionText{color:#666;font-size:12px;font-style:italic;margin:30px 0;text-align:center}.iconRow{bottom:20px;justify-content:space-between;left:20px;position:absolute;right:20px}.iconItem,.iconRow{align-items:center;display:flex}.iconItem{flex-direction:column;margin:20px}.boldIconText{font-size:1.2em;font-weight:700}.muiIcon{font-size:1.5em}.smallText{font-size:.8em}.dialogBox{height:607px;margin:32px;overflow-x:scroll;width:1241px}.dialogTitle{display:flex;justify-content:space-between;padding:20px 20px 7px}.dialogTitle-model_name{font-size:18px;font-weight:700}.pathBox{cursor:pointer;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;width:160px}.pathBox2{width:300px}.empty{color:#555;font-size:20px;left:50%;position:absolute;top:30%;-webkit-transform:translate(-50%);transform:translate(-50%)}.deleteDialog{align-items:center;display:flex}.warningIcon{color:#ed6c02;margin-right:10px}.jsonDialog{border-radius:8px;color:#000;display:flex;flex-direction:column;padding:10px 30px}.jsonDialog-title{align-items:center;display:flex;justify-content:space-between;margin:10px 0 20px}.title-name{font-size:16px;font-weight:700}.main-box{height:500px;width:700px}.but-box{display:flex;justify-content:end;margin-top:20px}.drawer{bottom:0;left:0;opacity:0;position:fixed;right:0;top:0;transition:visibility .3s ease,opacity .3s ease;visibility:hidden;z-index:1000}.drawer.open{opacity:1;visibility:visible}.drawer-overlay{background-color:rgba(0,0,0,.5);left:0;z-index:999}.drawer-content,.drawer-overlay{bottom:0;position:absolute;right:0;top:0}.drawer-content{background-color:#fff;box-shadow:-2px 0 10px rgba(0,0,0,.1);overflow-y:auto;-webkit-transform:translateX(100%);transform:translateX(100%);transition:-webkit-transform .3s ease;transition:transform .3s ease;transition:transform .3s ease,-webkit-transform .3s ease;z-index:1000}.drawer.open .drawer-content{-webkit-transform:translateX(0);transform:translateX(0)}.textHighlight .MuiInputBase-input,.textHighlight .MuiSelect-select{color:#1976d2}.copyText{color:#666;cursor:pointer;font-size:14px!important}.copyText:hover{color:#1976d2}.formBox{max-height:80vh;max-width:50vw;min-width:50vw;overflow:auto;padding:40px 20px 0 0;position:relative;transition:all .4s ease-in-out}.broaden{max-width:100%;min-width:100%;padding-right:0}.show-json{align-items:center;display:flex;right:60px;top:90px}.icon,.show-json{position:absolute}.icon{cursor:pointer;margin-left:20px;right:-40px}.icon:hover{color:#1976d2}.arrow{font-size:24px!important}.jsonBox{min-height:80vh;position:relative;transition:all .4s ease-in-out;width:100%}.hide{overflow:hidden;-webkit-transform:translate(30vw);transform:translate(30vw);width:0}.checkboxWrapper{align-items:center;display:flex;flex-wrap:wrap;width:100%}.jsonBox-header{align-items:center;display:flex;justify-content:space-between}.jsonBox-title{font-weight:700;line-height:40px}.textarea{background-color:initial;border:1px solid #ddd;border-radius:5px;color:#666;height:calc(100% - 40px);padding:5px 10px;resize:none;width:100%}.addBtn{margin-left:20px!important}.item{border:1px solid #ddd;border-radius:10px;margin:10px 50px 0;overflow:hidden;padding:20px;position:relative}.item:hover .deleteBtn{-webkit-transform:translateX(-50px);transform:translateX(-50px)}.deleteBtn{background-color:#1976d2;border-radius:25px;height:50px;line-height:70px;position:absolute;right:20px;text-align:center;top:calc(50% - 25px);-webkit-transform:translateX(80px);transform:translateX(80px);transition:all .3s ease-in-out;width:50px}.deleteBtn:hover{box-shadow:0 0 10px #aaa;cursor:pointer}.deleteIcon{color:#fff;font-size:28px!important}.chat_template_box{align-items:start;display:flex;gap:10px}.chat_template_test{width:30%}.chat_template_test_mainBox{border:1px solid #ccc;border-radius:4px;height:137px;overflow:scroll;padding:10px}.chat_template_test_tip{color:rgba(0,0,0,.6);font-size:10px;margin:4px 14px 0}.test_res_box{border:1px solid #ddd;border-radius:4px;margin-top:5px;min-height:55px;padding:10px}.css-19qh8xo-MuiInputBase-input-MuiOutlinedInput-input.Mui-disabled{-webkit-text-fill-color:#000!important}
|
|
2
|
-
/*# sourceMappingURL=main.337afe76.css.map*/
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"static/css/main.337afe76.css","mappings":"AAAA,WAKE,cAAe,CAJf,aAMF,CACA,4BAFE,kBAAmB,CAFnB,YAAa,CAFb,iBAAkB,CAClB,WAaF,C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AEF,CAEA,UAQE,wBAA6B,CAJ7B,qBAAsB,CACtB,iBAAkB,CAElB,UAAW,CALX,wBAAyB,CACzB,gBAAiB,CAGjB,WAAY,CALZ,UAQF,CAEA,QACE,0BACF,CAEA,MAEE,qBAAsB,CAGtB,kBAAmB,CAFnB,kBAAmB,CAGnB,eAAgB,CAFhB,YAAa,CAHb,iBAMF,CAEA,uBACE,mCAA4B,CAA5B,2BACF,CAEA,WAUE,wBAAyB,CADzB,kBAAmB,CAJnB,WAAY,CAGZ,gBAAiB,CAPjB,iBAAkB,CAClB,UAAW,CAKX,iBAAkB,CAJlB,oBAAqB,CAGrB,kCAA2B,CAA3B,0BAA2B,CAK3B,8BAAgC,CAPhC,UAQF,CAEA,iBAEE,wBAAyB,CADzB,cAEF,CAEA,YAEE,UAAW,CADX,wBAEF,CAEA,mBAEE,iBAAkB,CADlB,YAAa,CAEb,QACF,CAEA,oBACE,SACF,CAEA,4BAGE,qBAAsB,CACtB,iBAAkB,CAHlB,YAAa,CAIb,eAAgB,CAHhB,YAIF,CAEA,wBAGE,oBAAyB,CAFzB,cAAe,CACf,iBAEF,CAEA,cACE,qBAAsB,CAItB,iBAAkB,CADlB,cAAe,CAFf,eAAgB,CAChB,YAGF,CAEA,oEACE,sCACF","sources":["scenes/launch_model/styles/modelCardStyle.css","components/copyComponent/style.css","scenes/register_model/styles/registerModelStyle.css"],"sourcesContent":[".container {\n display: block;\n position: relative;\n width: 300px;\n height: 300px;\n cursor: pointer;\n border-radius: 20px;\n}\n.descriptionCard {\n position: relative;\n top: -1px;\n left: -1px;\n width: 300px;\n height: 300px;\n padding: 20px;\n border-radius: 20px;\n}\n.cardTitle {\n display: flex;\n justify-content: space-between;\n}\n.iconButtonBox {\n display: flex;\n align-items: center;\n}\n.drawerCard {\n position: relative;\n padding: 20px 80px 0;\n min-height: 100%;\n width: 60vw;\n}\n.p {\n display: -webkit-box;\n -webkit-line-clamp: 4;\n -webkit-box-orient: vertical;\n overflow: hidden;\n text-overflow: ellipsis;\n word-break: break-word;\n font-size: 14px;\n padding: 0px 10px;\n}\n.pasteText {\n font-size: 18px !important;\n color: #1976d2;\n cursor: pointer;\n margin-inline: 10px;\n}\n.pasteText:hover {\n color: #1976d2b3;\n}\n.copyToCommandLine {\n font-size: 16px !important;\n color: #1976d2;\n cursor: pointer;\n}\n.copyToCommandLine:hover {\n color: #1976d2b3;\n}\n.formContainer {\n height: 80%;\n overflow: scroll;\n padding: 0 10px;\n padding-bottom: 160px;\n}\n.buttonsContainer {\n position: absolute;\n bottom: 50px;\n left: 100px;\n right: 100px;\n}\n.buttons {\n display: flex;\n justify-content: space-between;\n align-items: center;\n gap: 20px;\n}\n.css-1be5mm1-MuiLinearProgress-root-MuiMobileStepper-progress {\n width: 100% !important;\n}\n.css-r5rjnf-MuiLinearProgress-root-MuiMobileStepper-progress {\n width: 100% !important;\n}\n.instructionText {\n font-size: 12px;\n color: #666666;\n font-style: italic;\n margin: 30px 0;\n text-align: center;\n}\n.iconRow {\n position: absolute;\n bottom: 20px;\n left: 20px;\n right: 20px;\n display: flex;\n justify-content: space-between;\n align-items: center;\n}\n.iconItem {\n display: flex;\n flex-direction: column;\n align-items: center;\n margin: 20px;\n}\n.boldIconText {\n font-weight: bold;\n font-size: 1.2em;\n}\n.muiIcon {\n font-size: 1.5em;\n}\n.smallText {\n font-size: 0.8em;\n}\n.dialogBox {\n width: 1241px;\n height: 607px;\n margin: 32px;\n overflow-x: scroll;\n}\n.dialogTitle {\n display: flex;\n justify-content: space-between;\n padding: 20px 20px 7px;\n}\n.dialogTitle-model_name {\n font-size: 18px;\n font-weight: 700;\n}\n.pathBox {\n width: 160px;\n cursor: pointer;\n overflow: hidden;\n white-space: nowrap;\n text-overflow: ellipsis;\n}\n.pathBox2 {\n width: 300px;\n}\n.empty {\n position: absolute;\n left: 50%;\n top: 30%;\n font-size: 20px;\n color: #555;\n transform: translate(-50%, 0);\n}\n.deleteDialog {\n display: flex;\n align-items: center;\n}\n.warningIcon {\n margin-right: 10px;\n color: rgb(237, 108, 2);\n}\n.jsonDialog {\n display: flex;\n flex-direction: column;\n padding: 10px 30px;\n color: #000;\n border-radius: 8px;\n}\n.jsonDialog-title {\n display: flex;\n justify-content: space-between;\n align-items: center;\n margin: 10px 0 20px 0;\n}\n.title-name {\n font-size: 16px;\n font-weight: 700;\n}\n.main-box {\n width: 700px;\n height: 500px;\n}\n.but-box {\n display: flex;\n justify-content: end;\n margin-top: 20px;\n}\n.drawer {\n z-index: 1000;\n position: fixed;\n top: 0;\n right: 0;\n bottom: 0;\n left: 0;\n visibility: hidden;\n opacity: 0;\n transition: visibility 0.3s ease, opacity 0.3s ease;\n}\n.drawer.open {\n visibility: visible;\n opacity: 1;\n}\n.drawer-overlay {\n position: absolute;\n top: 0;\n right: 0;\n bottom: 0;\n left: 0;\n background-color: rgba(0, 0, 0, 0.5);\n z-index: 999;\n}\n.drawer-content {\n position: absolute;\n top: 0;\n right: 0;\n bottom: 0;\n background-color: white;\n z-index: 1000;\n box-shadow: -2px 0 10px rgba(0, 0, 0, 0.1);\n transition: transform 0.3s ease;\n transform: translateX(100%);\n overflow-y: auto;\n}\n.drawer.open .drawer-content {\n transform: translateX(0);\n}\n.textHighlight .MuiSelect-select {\n color: #1976d2;\n}\n.textHighlight .MuiInputBase-input {\n color: #1976d2;\n}\n",".copyText {\n font-size: 14px !important;\n color: #666;\n cursor: pointer;\n}\n\n.copyText:hover {\n color: #1976d2;\n}\n",".formBox {\n position: relative;\n max-width: 50vw;\n min-width: 50vw;\n max-height: 80vh;\n overflow: auto;\n padding: 40px 20px 0 0;\n transition: all 0.4s ease-in-out;\n}\n\n.broaden {\n max-width: 100%;\n min-width: 100%;\n padding-right: 0;\n}\n\n.show-json {\n display: flex;\n align-items: center;\n position: absolute;\n top: 90px;\n right: 60px;\n}\n\n.icon {\n position: absolute;\n right: -40px;\n cursor: pointer;\n margin-left: 20px;\n}\n\n.icon:hover {\n color: #1976d2;\n}\n\n.arrow {\n font-size: 24px !important;\n}\n\n.jsonBox {\n position: relative;\n min-height: 80vh;\n width: 100%;\n transition: all 0.4s ease-in-out;\n}\n\n.hide {\n width: 0;\n transform: translate(30vw, 0);\n overflow: hidden;\n}\n\n.checkboxWrapper {\n display: flex;\n flex-wrap: wrap;\n align-items: center;\n width: 100%;\n}\n\n.jsonBox-header {\n display: flex;\n justify-content: space-between;\n align-items: center;\n}\n\n.jsonBox-title {\n line-height: 40px;\n font-weight: 700;\n}\n\n.textarea {\n width: 100%;\n height: calc(100% - 40px);\n padding: 5px 10px;\n border: 1px solid #ddd;\n border-radius: 5px;\n resize: none;\n color: #666;\n background-color: transparent;\n}\n\n.addBtn {\n margin-left: 20px !important;\n}\n\n.item {\n position: relative;\n border: 1px solid #ddd;\n margin: 10px 50px 0;\n padding: 20px;\n border-radius: 10px;\n overflow: hidden;\n}\n\n.item:hover .deleteBtn {\n transform: translateX(-50px);\n}\n\n.deleteBtn {\n position: absolute;\n right: 20px;\n top: calc(50% - 25px);\n width: 50px;\n height: 50px;\n transform: translateX(80px);\n text-align: center;\n line-height: 70px;\n border-radius: 25px;\n background-color: #1976d2;\n transition: all 0.3s ease-in-out;\n}\n\n.deleteBtn:hover {\n cursor: pointer;\n box-shadow: 0 0 10px #aaa;\n}\n\n.deleteIcon {\n font-size: 28px !important;\n color: #fff;\n}\n\n.chat_template_box {\n display: flex;\n align-items: start;\n gap: 10px;\n}\n\n.chat_template_test {\n width: 30%;\n}\n\n.chat_template_test_mainBox {\n height: 137px;\n padding: 10px;\n border: 1px solid #ccc;\n border-radius: 4px;\n overflow: scroll;\n}\n\n.chat_template_test_tip {\n font-size: 10px;\n margin: 4px 14px 0;\n color: rgba(0, 0, 0, 0.6);\n}\n\n.test_res_box {\n border: 1px solid #ddd;\n min-height: 55px;\n padding: 10px;\n margin-top: 5px;\n border-radius: 4px;\n}\n\n.css-19qh8xo-MuiInputBase-input-MuiOutlinedInput-input.Mui-disabled {\n -webkit-text-fill-color: #000 !important;\n}\n"],"names":[],"sourceRoot":""}
|