mirror of
				https://github.com/ml-explore/mlx-examples.git
				synced 2025-10-31 10:58:07 +08:00 
			
		
		
		
	Mixtral: Stop at EOS token (#183)
* Stop at EOS token * Precommit format files * Fix precommit hooks * Fix precommit hooks
This commit is contained in:
		| @@ -329,9 +329,16 @@ if __name__ == "__main__": | ||||
|  | ||||
|         if (len(tokens) % 10) == 0: | ||||
|             mx.eval(tokens) | ||||
|             eos_index = next( | ||||
|                 (i for i, t in enumerate(tokens) if t.item() == tokenizer.eos_id), None | ||||
|             ) | ||||
|             if eos_index is not None: | ||||
|                 tokens = tokens[:eos_index] | ||||
|             s = tokenizer.decode([t.item() for t in tokens]) | ||||
|             print(s, end="", flush=True) | ||||
|             tokens = [] | ||||
|             if eos_index is not None: | ||||
|                 break | ||||
|  | ||||
|     mx.eval(tokens) | ||||
|     s = tokenizer.decode([t.item() for t in tokens]) | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 devonthomas35
					devonthomas35