File tree Expand file tree Collapse file tree 1 file changed +3
-2
lines changed Expand file tree Collapse file tree 1 file changed +3
-2
lines changed Original file line number Diff line number Diff line change @@ -234,7 +234,7 @@ def _protected_step(self, next_token_id: int) -> Optional[str]:
234234        try :
235235            token  =  self .stream .step (self .tokenizer , next_token_id )
236236        except  Exception  as  e :
237-             if  str (e )  !=   INVALID_PREFIX_ERR_MSG :
237+             if  not   str (e ). startswith ( INVALID_PREFIX_ERR_MSG ) :
238238                raise  e 
239239            # Recover from edge case where tokenizer can produce non-monotonic, 
240240            # invalid UTF-8 output, which breaks the internal state of 
@@ -243,7 +243,8 @@ def _protected_step(self, next_token_id: int) -> Optional[str]:
243243            logger .warning (
244244                "Encountered invalid prefix detokenization error" 
245245                " for request %s, resetting decode stream." , self .request_id )
246-             self .stream  =  DecodeStream (self .skip_special_tokens )
246+             self .stream  =  DecodeStream (
247+                 skip_special_tokens = self .skip_special_tokens )
247248            token  =  self .stream .step (self .tokenizer , next_token_id )
248249        return  token 
249250
 
 
   
 
     
   
   
          
    
    
     
    
      
     
     
    You can’t perform that action at this time.
  
 
    
  
    
      
        
     
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments