MCPcopy Create free account
hub / github.com/RightNow-AI/TIDE / generate

Method generate

python/TIDE/runtime.py:355–372  ·  view source on GitHub ↗

Autoregressive generation with post-hoc early exit. Each decode step runs all layers (preserving KV cache correctness), then evaluates routers to select which layer's output to use for the next token. Compatible with all transformers versions.

(
        self,
        input_ids: torch.Tensor,
        max_new_tokens: int = 512,
        temperature: float = 1.0,
        top_k: int = 50,
        top_p: float = 0.9,
        **kwargs,
    )

Source from the content-addressed store, hash-verified

353
354 @torch.no_grad()
355 def generate(
356 self,
357 input_ids: torch.Tensor,
358 max_new_tokens: int = 512,
359 temperature: float = 1.0,
360 top_k: int = 50,
361 top_p: float = 0.9,
362 **kwargs,
363 ) -> torch.Tensor:
364 """Autoregressive generation with post-hoc early exit.
365
366 Each decode step runs all layers (preserving KV cache correctness),
367 then evaluates routers to select which layer's output to use for
368 the next token. Compatible with all transformers versions.
369 """
370 return self._generate_with_skipping(
371 input_ids, max_new_tokens, temperature, top_k, top_p,
372 )
373
374 @staticmethod
375 def calibrate(

Callers 12

bench_reasoningFunction · 0.95
benchmark_8bFunction · 0.95
benchmark_modelFunction · 0.95
test_inferenceFunction · 0.95
run_experimentFunction · 0.95
test_kv_cache_generationFunction · 0.95
benchmark_modelFunction · 0.95
mainFunction · 0.80
mainFunction · 0.80
mainFunction · 0.80
mainFunction · 0.80

Calls 1

Tested by 3

test_inferenceFunction · 0.76
test_kv_cache_generationFunction · 0.76