Spaces:
Runtime error
Runtime error
ffreemt
commited on
Commit
•
e1519aa
1
Parent(s):
365d2be
Update
Browse files- app.py +7 -3
- dl_model.py +6 -12
app.py
CHANGED
@@ -59,7 +59,8 @@ ai_prefix = "### Assistant"
|
|
59 |
stop_list = [f"{human_prefix}:"]
|
60 |
|
61 |
if "beluga" in model_loc.lower():
|
62 |
-
prompt_template = dedent(
|
|
|
63 |
### System:
|
64 |
You are Stable Beluga, an AI that follows instructions extremely well. Help as much as you can.
|
65 |
Let's think step by step.
|
@@ -67,7 +68,8 @@ if "beluga" in model_loc.lower():
|
|
67 |
### User: {question}
|
68 |
|
69 |
### Assistant:
|
70 |
-
"""
|
|
|
71 |
human_prefix = "### User"
|
72 |
ai_prefix = "### Assistant"
|
73 |
stop_list = [f"{human_prefix}:"]
|
@@ -380,6 +382,8 @@ else:
|
|
380 |
server_port = 7860
|
381 |
if "forindo" in platform.node():
|
382 |
server_port = 7861
|
383 |
-
block.queue(max_size=5).launch(
|
|
|
|
|
384 |
|
385 |
# block.queue(max_size=5).launch(debug=True, server_name="0.0.0.0")
|
|
|
59 |
stop_list = [f"{human_prefix}:"]
|
60 |
|
61 |
if "beluga" in model_loc.lower():
|
62 |
+
prompt_template = dedent(
|
63 |
+
"""
|
64 |
### System:
|
65 |
You are Stable Beluga, an AI that follows instructions extremely well. Help as much as you can.
|
66 |
Let's think step by step.
|
|
|
68 |
### User: {question}
|
69 |
|
70 |
### Assistant:
|
71 |
+
"""
|
72 |
+
).lstrip()
|
73 |
human_prefix = "### User"
|
74 |
ai_prefix = "### Assistant"
|
75 |
stop_list = [f"{human_prefix}:"]
|
|
|
382 |
server_port = 7860
|
383 |
if "forindo" in platform.node():
|
384 |
server_port = 7861
|
385 |
+
block.queue(max_size=5).launch(
|
386 |
+
debug=True, server_name="0.0.0.0", server_port=server_port
|
387 |
+
)
|
388 |
|
389 |
# block.queue(max_size=5).launch(debug=True, server_name="0.0.0.0")
|
dl_model.py
CHANGED
@@ -20,7 +20,9 @@ app = typer.Typer(
|
|
20 |
|
21 |
def _version_callback(value: bool) -> None:
|
22 |
if value:
|
23 |
-
typer.echo(
|
|
|
|
|
24 |
raise typer.Exit()
|
25 |
|
26 |
|
@@ -28,8 +30,8 @@ def _version_callback(value: bool) -> None:
|
|
28 |
def main(
|
29 |
urls: str = typer.Argument( # pylint: disable=unused-argument
|
30 |
"",
|
31 |
-
|
32 |
-
|
33 |
),
|
34 |
version: Optional[bool] = typer.Option( # pylint: disable=unused-argument
|
35 |
None,
|
@@ -46,15 +48,7 @@ def main(
|
|
46 |
help="dir to save downloaded models (default models)",
|
47 |
),
|
48 |
):
|
49 |
-
"""
|
50 |
-
Define main.
|
51 |
-
|
52 |
-
Args:
|
53 |
-
----
|
54 |
-
version: verson and help info.
|
55 |
-
urls: model urls separated by space(s) (default url.
|
56 |
-
model_dir: location to save downlaoded models (default models).
|
57 |
-
"""
|
58 |
logger.trace(f"{urls}")
|
59 |
if model_dir is None:
|
60 |
model_dir = "models"
|
|
|
20 |
|
21 |
def _version_callback(value: bool) -> None:
|
22 |
if value:
|
23 |
+
typer.echo(
|
24 |
+
f"{app.info.name} v.{__version__} -- download models for given url(s)"
|
25 |
+
)
|
26 |
raise typer.Exit()
|
27 |
|
28 |
|
|
|
30 |
def main(
|
31 |
urls: str = typer.Argument( # pylint: disable=unused-argument
|
32 |
"",
|
33 |
+
help=f"one or more urls (default {url})",
|
34 |
+
show_default=False,
|
35 |
),
|
36 |
version: Optional[bool] = typer.Option( # pylint: disable=unused-argument
|
37 |
None,
|
|
|
48 |
help="dir to save downloaded models (default models)",
|
49 |
),
|
50 |
):
|
51 |
+
"""Download a model or model given url(s)."""
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
52 |
logger.trace(f"{urls}")
|
53 |
if model_dir is None:
|
54 |
model_dir = "models"
|