File tree Expand file tree Collapse file tree 1 file changed +5
-10
lines changed
server/text_generation_server/models Expand file tree Collapse file tree 1 file changed +5
-10
lines changed Original file line number Diff line number Diff line change @@ -86,14 +86,7 @@ def count_kernels(guard):
86
86
self .n_kernels += 1
87
87
88
88
compiled_forward = torch ._dynamo .optimize (
89
- lambda model , inputs : compile_fx (
90
- model ,
91
- inputs ,
92
- config_patches = {
93
- "triton.cudagraphs" : False ,
94
- "size_asserts" : False ,
95
- },
96
- ),
89
+ compile_fx ,
97
90
dynamic = True ,
98
91
guard_fail_fn = count_kernels ,
99
92
)(self .model .forward )
@@ -155,12 +148,14 @@ def get_indices_to_keep(
155
148
return next_batch_keep_indices
156
149
157
150
def _setup_prompt_encoder (self ) -> bool :
158
- if hasattr (self .model , "named_children" ):
151
+ vocab_size = getattr (self .model .config , "vocab_size" , None )
152
+
153
+ if vocab_size is not None and hasattr (self .model , "named_children" ):
159
154
# Logic derived from https://github.com/huggingface/peft/blob/75925b1aaee47fe483a3fd0322d86df3d3eb8d22/src/peft/peft_model.py#L185
160
155
for name , module in self .model .named_children ():
161
156
if isinstance (module , PreTrainedModel ):
162
157
for named_param , value in list (module .named_parameters ()):
163
- if value .shape [0 ] == self . model . config . vocab_size :
158
+ if value .shape [0 ] == vocab_size :
164
159
self .word_embeddings = module .get_submodule (named_param .replace (".weight" , "" ))
165
160
return True
166
161
You can’t perform that action at this time.
0 commit comments