File tree Expand file tree Collapse file tree 1 file changed +8
-2
lines changed Expand file tree Collapse file tree 1 file changed +8
-2
lines changed Original file line number Diff line number Diff line change 33
33
"" ,
34
34
"if set, then save the result to the given file name" ,
35
35
)
36
-
36
+ flags .DEFINE_bool (
37
+ "internal_use_local_tokenizer" ,
38
+ 0 ,
39
+ "Use local tokenizer if set to True" )
37
40
38
41
def shard_weights (env , weights , weight_shardings ):
39
42
"""Shard weights according to weight_shardings"""
@@ -57,8 +60,11 @@ def create_engine(devices):
57
60
FLAGS .max_input_length ,
58
61
FLAGS .max_output_length ,
59
62
)
60
- tokenizer = AutoTokenizer .from_pretrained (FLAGS .model_id )
61
63
env = environment .JetEngineEnvironment (env_data )
64
+ if FLAGS .internal_use_local_tokenizer :
65
+ tokenizer = AutoTokenizer .from_pretrained (env_data .tokenizer_path )
66
+ else :
67
+ tokenizer = AutoTokenizer .from_pretrained (FLAGS .model_id )
62
68
env .hf_tokenizer = tokenizer
63
69
model = fetch_models .instantiate_model_from_repo_id (FLAGS .model_id , env )
64
70
# NOTE: this is assigned later because, the model should be constructed
You can’t perform that action at this time.
0 commit comments