mirror of
				https://github.com/KoboldAI/KoboldAI-Client.git
				synced 2025-06-05 21:59:24 +02:00 
			
		
		
		
	Merge pull request #40 from VE-FORBRYDERNE/patch
Allow bad words filter to ban <|endoftext|> token
This commit is contained in:
		| @@ -655,6 +655,14 @@ if(not vars.model in ["InferKit", "Colab", "OAI", "ReadOnly", "TPUMeshTransforme | |||||||
|         transformers.generation_utils.GenerationMixin.sample = new_sample |         transformers.generation_utils.GenerationMixin.sample = new_sample | ||||||
|  |  | ||||||
|  |  | ||||||
|  |         # Allow bad words filter to ban <|endoftext|> token | ||||||
|  |         import transformers.generation_logits_process | ||||||
|  |         def new_init(self, bad_words_ids: List[List[int]], eos_token_id: int): | ||||||
|  |             return new_init.old_init(self, bad_words_ids, -1) | ||||||
|  |         new_init.old_init = transformers.generation_logits_process.NoBadWordsLogitsProcessor.__init__ | ||||||
|  |         transformers.generation_logits_process.NoBadWordsLogitsProcessor.__init__ = new_init | ||||||
|  |  | ||||||
|  |  | ||||||
|         # Sets up dynamic world info scanner |         # Sets up dynamic world info scanner | ||||||
|         class DynamicWorldInfoScanCriteria(StoppingCriteria): |         class DynamicWorldInfoScanCriteria(StoppingCriteria): | ||||||
|             def __init__( |             def __init__( | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user