Spaces:
Running
on
Zero
Running
on
Zero
enable ucb
Browse files- model/matchmaker.py +1 -1
- model/model_manager.py +15 -19
- model/models/other_api_models.py +1 -1
- model/models/replicate_api_models.py +17 -17
- serve/update_skill.py +4 -5
model/matchmaker.py
CHANGED
@@ -79,7 +79,7 @@ def load_json_via_sftp():
|
|
79 |
class RunningPivot(object):
|
80 |
running_pivot = []
|
81 |
|
82 |
-
not_run = [
|
83 |
|
84 |
def matchmaker(num_players, k_group=4):
|
85 |
trueskill_env = TrueSkill()
|
|
|
79 |
class RunningPivot(object):
|
80 |
running_pivot = []
|
81 |
|
82 |
+
not_run = [16, 18, 19, 22]
|
83 |
|
84 |
def matchmaker(num_players, k_group=4):
|
85 |
trueskill_env = TrueSkill()
|
model/model_manager.py
CHANGED
@@ -70,17 +70,17 @@ class ModelManager:
|
|
70 |
|
71 |
def generate_image_ig_parallel_anony(self, prompt, model_A, model_B, model_C, model_D):
|
72 |
if model_A == "" and model_B == "" and model_C == "" and model_D == "":
|
73 |
-
not_run = [11, 12, 13, 14, 15, 16, 17, 18, 19]
|
74 |
-
filtered_models = [model for i, model in enumerate(self.model_ig_list) if i not in not_run]
|
75 |
-
model_names = random.sample([model for model in filtered_models], 4)
|
76 |
-
|
77 |
-
|
78 |
|
79 |
-
#
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
|
|
|
|
84 |
else:
|
85 |
model_names = [model_A, model_B, model_C, model_D]
|
86 |
|
@@ -96,15 +96,11 @@ class ModelManager:
|
|
96 |
if model_A == "" and model_B == "" and model_C == "" and model_D == "":
|
97 |
# model_names = random.sample([model for model in self.model_ig_list], 4)
|
98 |
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
-
# model_ids = matchmaker(num_players=len(self.model_ig_list))
|
105 |
-
# print(model_ids)
|
106 |
-
# model_names = [self.model_ig_list[i] for i in model_ids]
|
107 |
-
# print(model_names)
|
108 |
else:
|
109 |
model_names = [model_A, model_B, model_C, model_D]
|
110 |
|
|
|
70 |
|
71 |
def generate_image_ig_parallel_anony(self, prompt, model_A, model_B, model_C, model_D):
|
72 |
if model_A == "" and model_B == "" and model_C == "" and model_D == "":
|
73 |
+
# not_run = [11, 12, 13, 14, 15, 16, 17, 18, 19]
|
74 |
+
# filtered_models = [model for i, model in enumerate(self.model_ig_list) if i not in not_run]
|
75 |
+
# model_names = random.sample([model for model in filtered_models], 4)
|
|
|
|
|
76 |
|
77 |
+
# model_names = random.sample([model for model in self.model_ig_list], 4)
|
78 |
+
|
79 |
+
from .matchmaker import matchmaker
|
80 |
+
model_ids = matchmaker(num_players=len(self.model_ig_list))
|
81 |
+
print(model_ids)
|
82 |
+
model_names = [self.model_ig_list[i] for i in model_ids]
|
83 |
+
print(model_names)
|
84 |
else:
|
85 |
model_names = [model_A, model_B, model_C, model_D]
|
86 |
|
|
|
96 |
if model_A == "" and model_B == "" and model_C == "" and model_D == "":
|
97 |
# model_names = random.sample([model for model in self.model_ig_list], 4)
|
98 |
|
99 |
+
from .matchmaker import matchmaker
|
100 |
+
model_ids = matchmaker(num_players=len(self.model_ig_list))
|
101 |
+
print(model_ids)
|
102 |
+
model_names = [self.model_ig_list[i] for i in model_ids]
|
103 |
+
print(model_names)
|
|
|
|
|
|
|
|
|
104 |
else:
|
105 |
model_names = [model_A, model_B, model_C, model_D]
|
106 |
|
model/models/other_api_models.py
CHANGED
@@ -47,7 +47,7 @@ class OtherModel():
|
|
47 |
img_id = response_json["result"]
|
48 |
result_url = self.get_url + img_id
|
49 |
print(result_url)
|
50 |
-
self.repeat_num =
|
51 |
while 1:
|
52 |
time.sleep(1)
|
53 |
img_response = requests.get(result_url)
|
|
|
47 |
img_id = response_json["result"]
|
48 |
result_url = self.get_url + img_id
|
49 |
print(result_url)
|
50 |
+
self.repeat_num = 800
|
51 |
while 1:
|
52 |
time.sleep(1)
|
53 |
img_response = requests.get(result_url)
|
model/models/replicate_api_models.py
CHANGED
@@ -6,24 +6,24 @@ import os
|
|
6 |
import base64
|
7 |
|
8 |
Replicate_MODEl_NAME_MAP = {
|
9 |
-
"SDXL": "stability-ai/sdxl:7762fd07cf82c948538e41f63f77d685e02b063e37e496e96eefd46c929f9bdc",
|
10 |
-
"SD-v3.0": "stability-ai/stable-diffusion-3",
|
11 |
-
"SD-v2.1": "stability-ai/stable-diffusion:ac732df83cea7fff18b8472768c88ad041fa750ff7682a21affe81863cbe77e4",
|
12 |
-
"SD-v1.5": "stability-ai/stable-diffusion:b3d14e1cd1f9470bbb0bb68cac48e5f483e5be309551992cc33dc30654a82bb7",
|
13 |
-
"SDXL-Lightning": "bytedance/sdxl-lightning-4step:5f24084160c9089501c1b3545d9be3c27883ae2239b6f412990e82d4a6210f8f",
|
14 |
-
"Kandinsky-v2.0": "ai-forever/kandinsky-2:3c6374e7a9a17e01afe306a5218cc67de55b19ea536466d6ea2602cfecea40a9",
|
15 |
-
"Kandinsky-v2.2": "ai-forever/kandinsky-2.2:ad9d7879fbffa2874e1d909d1d37d9bc682889cc65b31f7bb00d2362619f194a",
|
16 |
-
"Proteus-v0.2": "lucataco/proteus-v0.2:06775cd262843edbde5abab958abdbb65a0a6b58ca301c9fd78fa55c775fc019",
|
17 |
-
"Playground-v2.0": "playgroundai/playground-v2-1024px-aesthetic:42fe626e41cc811eaf02c94b892774839268ce1994ea778eba97103fe1ef51b8",
|
18 |
-
"Playground-v2.5": "playgroundai/playground-v2.5-1024px-aesthetic:a45f82a1382bed5c7aeb861dac7c7d191b0fdf74d8d57c4a0e6ed7d4d0bf7d24",
|
19 |
-
"Dreamshaper-xl-turbo": "lucataco/dreamshaper-xl-turbo:0a1710e0187b01a255302738ca0158ff02a22f4638679533e111082f9dd1b615",
|
20 |
-
"SDXL-Deepcache": "lucataco/sdxl-deepcache:eaf678fb34006669e9a3c6dd5971e2279bf20ee0adeced464d7b6d95de16dc93",
|
21 |
-
"Openjourney-v4": "prompthero/openjourney:ad59ca21177f9e217b9075e7300cf6e14f7e5b4505b87b9689dbd866e9768969",
|
22 |
-
"LCM-v1.5": "fofr/latent-consistency-model:683d19dc312f7a9f0428b04429a9ccefd28dbf7785fef083ad5cf991b65f406f",
|
23 |
-
"Realvisxl-v3.0": "fofr/realvisxl-v3:33279060bbbb8858700eb2146350a98d96ef334fcf817f37eb05915e1534aa1c",
|
24 |
|
25 |
-
"Realvisxl-v2.0": "lucataco/realvisxl-v2.0:7d6a2f9c4754477b12c14ed2a58f89bb85128edcdd581d24ce58b6926029de08",
|
26 |
-
"Pixart-Sigma": "cjwbw/pixart-sigma:5a54352c99d9fef467986bc8f3a20205e8712cbd3df1cbae4975d6254c902de1",
|
27 |
"SSD-1b": "lucataco/ssd-1b:b19e3639452c59ce8295b82aba70a231404cb062f2eb580ea894b31e8ce5bbb6",
|
28 |
"Open-Dalle-v1.1": "lucataco/open-dalle-v1.1:1c7d4c8dec39c7306df7794b28419078cb9d18b9213ab1c21fdc46a1deca0144",
|
29 |
"Deepfloyd-IF": "andreasjansson/deepfloyd-if:fb84d659df149f4515c351e394d22222a94144aa1403870c36025c8b28846c8d",
|
|
|
6 |
import base64
|
7 |
|
8 |
Replicate_MODEl_NAME_MAP = {
|
9 |
+
# "SDXL": "stability-ai/sdxl:7762fd07cf82c948538e41f63f77d685e02b063e37e496e96eefd46c929f9bdc",
|
10 |
+
# "SD-v3.0": "stability-ai/stable-diffusion-3",
|
11 |
+
# "SD-v2.1": "stability-ai/stable-diffusion:ac732df83cea7fff18b8472768c88ad041fa750ff7682a21affe81863cbe77e4",
|
12 |
+
# "SD-v1.5": "stability-ai/stable-diffusion:b3d14e1cd1f9470bbb0bb68cac48e5f483e5be309551992cc33dc30654a82bb7",
|
13 |
+
# "SDXL-Lightning": "bytedance/sdxl-lightning-4step:5f24084160c9089501c1b3545d9be3c27883ae2239b6f412990e82d4a6210f8f",
|
14 |
+
# "Kandinsky-v2.0": "ai-forever/kandinsky-2:3c6374e7a9a17e01afe306a5218cc67de55b19ea536466d6ea2602cfecea40a9",
|
15 |
+
# "Kandinsky-v2.2": "ai-forever/kandinsky-2.2:ad9d7879fbffa2874e1d909d1d37d9bc682889cc65b31f7bb00d2362619f194a",
|
16 |
+
# "Proteus-v0.2": "lucataco/proteus-v0.2:06775cd262843edbde5abab958abdbb65a0a6b58ca301c9fd78fa55c775fc019",
|
17 |
+
# "Playground-v2.0": "playgroundai/playground-v2-1024px-aesthetic:42fe626e41cc811eaf02c94b892774839268ce1994ea778eba97103fe1ef51b8",
|
18 |
+
# "Playground-v2.5": "playgroundai/playground-v2.5-1024px-aesthetic:a45f82a1382bed5c7aeb861dac7c7d191b0fdf74d8d57c4a0e6ed7d4d0bf7d24",
|
19 |
+
# "Dreamshaper-xl-turbo": "lucataco/dreamshaper-xl-turbo:0a1710e0187b01a255302738ca0158ff02a22f4638679533e111082f9dd1b615",
|
20 |
+
# "SDXL-Deepcache": "lucataco/sdxl-deepcache:eaf678fb34006669e9a3c6dd5971e2279bf20ee0adeced464d7b6d95de16dc93",
|
21 |
+
# "Openjourney-v4": "prompthero/openjourney:ad59ca21177f9e217b9075e7300cf6e14f7e5b4505b87b9689dbd866e9768969",
|
22 |
+
# "LCM-v1.5": "fofr/latent-consistency-model:683d19dc312f7a9f0428b04429a9ccefd28dbf7785fef083ad5cf991b65f406f",
|
23 |
+
# "Realvisxl-v3.0": "fofr/realvisxl-v3:33279060bbbb8858700eb2146350a98d96ef334fcf817f37eb05915e1534aa1c",
|
24 |
|
25 |
+
# "Realvisxl-v2.0": "lucataco/realvisxl-v2.0:7d6a2f9c4754477b12c14ed2a58f89bb85128edcdd581d24ce58b6926029de08",
|
26 |
+
# "Pixart-Sigma": "cjwbw/pixart-sigma:5a54352c99d9fef467986bc8f3a20205e8712cbd3df1cbae4975d6254c902de1",
|
27 |
"SSD-1b": "lucataco/ssd-1b:b19e3639452c59ce8295b82aba70a231404cb062f2eb580ea894b31e8ce5bbb6",
|
28 |
"Open-Dalle-v1.1": "lucataco/open-dalle-v1.1:1c7d4c8dec39c7306df7794b28419078cb9d18b9213ab1c21fdc46a1deca0144",
|
29 |
"Deepfloyd-IF": "andreasjansson/deepfloyd-if:fb84d659df149f4515c351e394d22222a94144aa1403870c36025c8b28846c8d",
|
serve/update_skill.py
CHANGED
@@ -82,7 +82,6 @@ def update_skill(rank, model_names, k_group=4):
|
|
82 |
|
83 |
ratings, comparison_counts, total_comparisons = load_json_via_sftp()
|
84 |
|
85 |
-
'''
|
86 |
# group = Model_ID.group
|
87 |
group = []
|
88 |
for model_name in model_names:
|
@@ -102,11 +101,11 @@ def update_skill(rank, model_names, k_group=4):
|
|
102 |
|
103 |
comparison_counts[group[player1], group[player2]] += 1
|
104 |
comparison_counts[group[player2], group[player1]] += 1
|
105 |
-
|
106 |
total_comparisons += 1
|
107 |
|
108 |
save_json_via_sftp(ratings, comparison_counts, total_comparisons)
|
109 |
|
110 |
-
|
111 |
-
|
112 |
-
|
|
|
82 |
|
83 |
ratings, comparison_counts, total_comparisons = load_json_via_sftp()
|
84 |
|
|
|
85 |
# group = Model_ID.group
|
86 |
group = []
|
87 |
for model_name in model_names:
|
|
|
101 |
|
102 |
comparison_counts[group[player1], group[player2]] += 1
|
103 |
comparison_counts[group[player2], group[player1]] += 1
|
104 |
+
|
105 |
total_comparisons += 1
|
106 |
|
107 |
save_json_via_sftp(ratings, comparison_counts, total_comparisons)
|
108 |
|
109 |
+
from model.matchmaker import RunningPivot
|
110 |
+
if group[0] in RunningPivot.running_pivot:
|
111 |
+
RunningPivot.running_pivot.remove(group[0])
|