Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
OpenDAS
text-generation-inference
Commits
ed87b464
You need to sign in or sign up before continuing.
Unverified
Commit
ed87b464
authored
Oct 25, 2024
by
Nicolas Patry
Committed by
GitHub
Oct 25, 2024
Browse files
Fixing "deadlock" when python prompts for trust_remote_code by always (#2664)
specifiying a value.
parent
eab07f74
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
20 additions
and
4 deletions
+20
-4
backends/v2/src/main.rs
backends/v2/src/main.rs
+4
-0
backends/v3/src/main.rs
backends/v3/src/main.rs
+4
-0
launcher/src/main.rs
launcher/src/main.rs
+4
-0
router/src/server.rs
router/src/server.rs
+8
-4
No files found.
backends/v2/src/main.rs
View file @
ed87b464
...
...
@@ -44,6 +44,8 @@ struct Args {
tokenizer_config_path
:
Option
<
String
>
,
#[clap(long,
env)]
revision
:
Option
<
String
>
,
#[clap(long,
env,
value_enum)]
trust_remote_code
:
bool
,
#[clap(default_value
=
"2"
,
long,
env)]
validation_workers
:
usize
,
#[clap(long,
env)]
...
...
@@ -99,6 +101,7 @@ async fn main() -> Result<(), RouterError> {
tokenizer_name
,
tokenizer_config_path
,
revision
,
trust_remote_code
,
validation_workers
,
api_key
,
json_output
,
...
...
@@ -181,6 +184,7 @@ async fn main() -> Result<(), RouterError> {
tokenizer_name
,
tokenizer_config_path
,
revision
,
trust_remote_code
,
hostname
,
port
,
cors_allow_origin
,
...
...
backends/v3/src/main.rs
View file @
ed87b464
...
...
@@ -44,6 +44,8 @@ struct Args {
tokenizer_config_path
:
Option
<
String
>
,
#[clap(long,
env)]
revision
:
Option
<
String
>
,
#[clap(long,
env,
value_enum)]
trust_remote_code
:
bool
,
#[clap(default_value
=
"2"
,
long,
env)]
validation_workers
:
usize
,
#[clap(long,
env)]
...
...
@@ -99,6 +101,7 @@ async fn main() -> Result<(), RouterError> {
tokenizer_name
,
tokenizer_config_path
,
revision
,
trust_remote_code
,
validation_workers
,
api_key
,
json_output
,
...
...
@@ -181,6 +184,7 @@ async fn main() -> Result<(), RouterError> {
tokenizer_name
,
tokenizer_config_path
,
revision
,
trust_remote_code
,
hostname
,
port
,
cors_allow_origin
,
...
...
launcher/src/main.rs
View file @
ed87b464
...
...
@@ -1509,6 +1509,10 @@ fn spawn_webserver(
router_args
.push
(
revision
.to_string
())
}
if
args
.trust_remote_code
{
router_args
.push
(
"--trust-remote-code"
.to_string
());
}
if
args
.json_output
{
router_args
.push
(
"--json-output"
.to_string
());
}
...
...
router/src/server.rs
View file @
ed87b464
...
...
@@ -1609,6 +1609,7 @@ pub async fn run(
tokenizer_name
:
String
,
tokenizer_config_path
:
Option
<
String
>
,
revision
:
Option
<
String
>
,
trust_remote_code
:
bool
,
hostname
:
String
,
port
:
u16
,
cors_allow_origin
:
Option
<
Vec
<
String
>>
,
...
...
@@ -1768,10 +1769,13 @@ pub async fn run(
let
auto
=
transformers
.getattr
(
"AutoTokenizer"
)
?
;
let
from_pretrained
=
auto
.getattr
(
"from_pretrained"
)
?
;
let
args
=
(
tokenizer_name
.to_string
(),);
let
kwargs
=
[(
"revision"
,
revision
.clone
()
.unwrap_or_else
(||
"main"
.to_string
()),
)]
let
kwargs
=
[
(
"revision"
,
(
revision
.clone
()
.unwrap_or_else
(||
"main"
.to_string
()))
.into_py
(
py
),
),
(
"trust_remote_code"
,
trust_remote_code
.into_py
(
py
)),
]
.into_py_dict_bound
(
py
);
let
tokenizer
=
from_pretrained
.call
(
args
,
Some
(
&
kwargs
))
?
;
let
save
=
tokenizer
.getattr
(
"save_pretrained"
)
?
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment