Skip to content

Commit e448a0f

Browse files
authored
Fix warnings for new gradio versions (#2538)
1 parent 5dbc4f3 commit e448a0f

File tree

8 files changed

+41
-13
lines changed

8 files changed

+41
-13
lines changed

docs/commands/webserver.md

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,16 @@ vim /home/vicuna/anaconda3/envs/fastchat/lib/python3.9/site-packages/gradio/temp
7272
<script src="https://cdnjs.cloudflare.com/ajax/libs/html2canvas/1.4.1/html2canvas.min.js"></script>
7373
```
7474

75-
2. Loading
75+
2. deprecation warnings
76+
```
77+
vim /home/vicuna/anaconda3/envs/fastchat/lib/python3.9/site-packages/gradio/deprecation.py
78+
```
79+
80+
```
81+
def check_deprecated_parameters(
82+
```
83+
84+
3. Loading
7685
```
7786
vim /home/vicuna/anaconda3/envs/fastchat/lib/python3.9/site-packages/gradio/templates/frontend/assets/index-188ef5e8.js
7887
```

fastchat/llm_judge/qa_browser.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636

3737
def display_question(category_selector, request: gr.Request):
3838
choices = category_selector_map[category_selector]
39-
return gr.Dropdown.update(
39+
return gr.Dropdown(
4040
value=choices[0],
4141
choices=choices,
4242
)
@@ -353,7 +353,7 @@ def build_single_answer_browser_tab():
353353

354354

355355
def load_demo():
356-
dropdown_update = gr.Dropdown.update(value=list(category_selector_map.keys())[0])
356+
dropdown_update = gr.Dropdown(value=list(category_selector_map.keys())[0])
357357
return dropdown_update, dropdown_update
358358

359359

fastchat/model/model_registry.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ def get_model_info(name: str) -> ModelInfo:
8484
],
8585
"Vicuna",
8686
"https://lmsys.org/blog/2023-03-30-vicuna/",
87-
"a chat assistant fine-tuned from LLaMA on user-shared conversations by LMSYS",
87+
"a chat assistant fine-tuned on user-shared conversations by LMSYS",
8888
)
8989
register_model_info(
9090
["wizardlm-70b", "wizardlm-30b", "wizardlm-13b"],
@@ -312,3 +312,9 @@ def get_model_info(name: str) -> ModelInfo:
312312
"https://huggingface.co/mistralai/Mistral-7B-Instruct-v0.1",
313313
"a large language model by Mistral AI team",
314314
)
315+
register_model_info(
316+
["deluxe-chat-v1"],
317+
"DeluxeChat",
318+
"",
319+
"Deluxe Chat",
320+
)

fastchat/serve/gradio_block_arena_anony.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,8 @@ def load_demo_side_by_side_anony(models_, url_params):
5353

5454
states = (None,) * num_sides
5555
selector_updates = (
56-
gr.Markdown.update(visible=True),
57-
gr.Markdown.update(visible=True),
56+
gr.Markdown(visible=True),
57+
gr.Markdown(visible=True),
5858
)
5959

6060
return states + selector_updates

fastchat/serve/gradio_block_arena_named.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,8 @@ def load_demo_side_by_side_named(models, url_params):
5858
model_right = model_left
5959

6060
selector_updates = (
61-
gr.Dropdown.update(choices=models, value=model_left, visible=True),
62-
gr.Dropdown.update(choices=models, value=model_right, visible=True),
61+
gr.Dropdown(choices=models, value=model_left, visible=True),
62+
gr.Dropdown(choices=models, value=model_right, visible=True),
6363
)
6464

6565
return states + selector_updates

fastchat/serve/gradio_web_server.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -159,9 +159,7 @@ def load_demo_single(models, url_params):
159159
if model in models:
160160
selected_model = model
161161

162-
dropdown_update = gr.Dropdown.update(
163-
choices=models, value=selected_model, visible=True
164-
)
162+
dropdown_update = gr.Dropdown(choices=models, value=selected_model, visible=True)
165163

166164
state = None
167165
return state, dropdown_update
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
import requests
2+
3+
headers = {"authorization": "Bearer hf_XXX"}
4+
5+
url = "https://huggingface.co/api/datasets/lmsys/lmsys-chat-1m/user-access-request/pending"
6+
a = requests.get(url, headers=headers)
7+
8+
for u in a.json():
9+
user = u["user"]["user"]
10+
url = "https://huggingface.co/api/datasets/lmsys/lmsys-chat-1m/user-access-request/grant"
11+
ret = requests.post(url, headers=headers, json={"user": user})
12+
print(user, ret.status_code)
13+
assert ret.status_code == 200

fastchat/serve/monitor/monitor.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,8 @@ def build_leaderboard_tab(elo_results_file, leaderboard_table_file):
210210
elem_id="leaderboard_dataframe",
211211
)
212212
gr.Markdown(
213-
"If you want to see more models, please help us [add them](https://github.com/lm-sys/FastChat/blob/main/docs/arena.md#how-to-add-a-new-model)."
213+
"If you want to see more models, please help us [add them](https://github.com/lm-sys/FastChat/blob/main/docs/arena.md#how-to-add-a-new-model).",
214+
elem_id="leaderboard_markdown",
214215
)
215216
else:
216217
pass
@@ -219,7 +220,8 @@ def build_leaderboard_tab(elo_results_file, leaderboard_table_file):
219220
f"""## More Statistics for Chatbot Arena\n
220221
We added some additional figures to show more statistics. The code for generating them is also included in this [notebook]({notebook_url}).
221222
Please note that you may see different orders from different ranking methods. This is expected for models that perform similarly, as demonstrated by the confidence interval in the bootstrap figure. Going forward, we prefer the classical Elo calculation because of its scalability and interpretability. You can find more discussions in this blog [post](https://lmsys.org/blog/2023-05-03-arena/).
222-
"""
223+
""",
224+
elem_id="leaderboard_markdown",
223225
)
224226

225227
leader_component_values[:] = [md, p1, p2, p3, p4]

0 commit comments

Comments
 (0)