Generation#
|
Sampler for transformer model. |
|
Configuration for the KV cache. |
- class tunix.Sampler(transformer: Module, tokenizer: Any, cache_config: CacheConfig, image_processor: ImageProcessor | None = None)#
Sampler for transformer model.
- init_sample_state(all_input_ids: Array, total_sampling_steps: int, include_logits: bool, forbidden_token_ids: tuple[int, ...] | None, temperature: float, top_p: float | None, top_k: int | None, seed: Array, beam_size: int | None) _SamplingState#
Initializes the sampling state given input prompts.
- tokenize(input_string: str) ndarray | list[int]#
Tokenizes the input string.