File tree 3 files changed +0
-40
lines changed
3 files changed +0
-40
lines changed Original file line number Diff line number Diff line change @@ -107,34 +107,6 @@ def add_json_schema_filter(
107
107
# Append the filters
108
108
self .filters .extend ([lmfilter , prefix_filter ])
109
109
110
- def add_pydantic_filter (
111
- self ,
112
- pydantic_model : BaseModel ,
113
- model : ExLlamaV2 ,
114
- tokenizer :ExLlamaV2Tokenizer
115
- ):
116
- """Adds an ExllamaV2 filter based on a Pydantic model"""
117
- # Create the parser
118
- try :
119
- schema_parser = JsonSchemaParser (pydantic_model .model_json_schema ())
120
- except Exception :
121
- traceback .print_exc ()
122
- logger .error (
123
- "Skipping because the pydantic model couldn't be used. "
124
- "Please read the above error for more information."
125
- )
126
-
127
- return
128
-
129
- json_prefixes = ["[" , "{" ]
130
-
131
- lmfilter = ExLlamaV2TokenEnforcerFilter (
132
- schema_parser , _get_lmfe_tokenizer_data (tokenizer )
133
- )
134
- prefix_filter = ExLlamaV2PrefixFilter (model , tokenizer , json_prefixes )
135
-
136
- self .filters .extend ([lmfilter , prefix_filter ])
137
-
138
110
def add_regex_filter (
139
111
self ,
140
112
pattern : str ,
Original file line number Diff line number Diff line change @@ -1080,13 +1080,6 @@ async def generate_gen(
1080
1080
json_schema , self .model , self .tokenizer
1081
1081
)
1082
1082
1083
- # Add pydantic filter if it exists
1084
- pydantic_model = unwrap (kwargs .get ("pydantic_model" ))
1085
- if pydantic_model :
1086
- grammar_handler .add_pydantic_filter (
1087
- pydantic_model , self .model , self .tokenizer
1088
- )
1089
-
1090
1083
# Add regex filter if it exists
1091
1084
regex_pattern = unwrap (kwargs .get ("regex_pattern" ))
1092
1085
if regex_pattern :
Original file line number Diff line number Diff line change @@ -183,10 +183,6 @@ class BaseSamplerRequest(BaseModel):
183
183
default_factory = lambda : get_default_sampler_value ("json_schema" ),
184
184
)
185
185
186
- pydantic_model : Optional [Type [BaseModel ]] = Field (
187
- default_factory = lambda : get_default_sampler_value ("pydantic_model" ),
188
- )
189
-
190
186
regex_pattern : Optional [str ] = Field (
191
187
default_factory = lambda : get_default_sampler_value ("regex_pattern" ),
192
188
)
@@ -346,7 +342,6 @@ def to_gen_params(self, **kwargs):
346
342
"cfg_scale" : self .cfg_scale ,
347
343
"negative_prompt" : self .negative_prompt ,
348
344
"json_schema" : self .json_schema ,
349
- "pydantic_model" : self .pydantic_model ,
350
345
"regex_pattern" : self .regex_pattern ,
351
346
"grammar_string" : self .grammar_string ,
352
347
"speculative_ngram" : self .speculative_ngram ,
You can’t perform that action at this time.
0 commit comments