KJNodes/miscgenerated

MiniMax H3 Token Counter(MiniMaxH3TokenCounter)

The MiniMax H3 Token Counter calculates the packed sequence length that a MiniMax H3 generation will use, without running the sampler.

Mini Max H3 Token Counter

samples
conditioning
samples
conditioning
tokens
breakdown
KJNodes

Description

The MiniMax H3 Token Counter calculates the packed sequence length that a MiniMax H3 generation will use, without running the sampler. It rebuilds the same packed layout the model uses — [text | keyframes/references | audio | video] — from the supplied AV latent and positive conditioning. The text length and any keyframe/reference blocks are read from the conditioning, while the audio and video portions come from the AV latent.

This is an inspection/measurement node: it does not sample and does not produce a packed sequence tensor. Use it to check how much sequence length a prompt, keyframe setup, or reference setup will consume before committing to a generation.

Inputs

samples

  • Type: LATENT
  • Required: Yes

The AV latent that would be sampled, the video+audio pair produced by the H3 latent nodes. Its audio and video portions define the audio and video sections of the packed layout and therefore affect the resulting sequence length.

conditioning

  • Type: CONDITIONING
  • Required: Yes

Positive conditioning for the generation. The node reads the text length and any keyframe/reference blocks from this conditioning. These contribute to the text and keyframe/reference sections of the packed layout and are included in the count. No negative conditioning is read.

Outputs

LATENT

The input AV latent passed through, so the counter can be inserted inline in an existing H3 graph without breaking the latent path.

CONDITIONING output

The input positive conditioning passed through, so the conditioning path can continue after counting.

INT

The total packed sequence length that the MiniMax H3 generation will run at, the combined length of the text, keyframe/reference, audio, and video sections. This is the primary value to compare against context-length limits or between prompt/reference setups.

STRING

A text representation of the counted result for display, logging, or debugging. Use this when you want the count visible in the graph or logs rather than consumed as an integer.

Usage Notes

  • Connect the same samples and positive conditioning that you would feed to the MiniMax H3 sampler. The count reflects the layout those inputs produce.
  • Because the node does not sample, it is cheap to run and can be used to test prompt lengths, keyframe sets, and reference blocks before generation.
  • Only keyframes/references present in the supplied conditioning are counted. If you change the text, add/remove keyframes, or change reference blocks, rerun the counter to get the updated length.
  • Use the INT output for numeric checks and the STRING output when you need a human-readable report in the workflow or logs.

Comments

Sign in with GitHub to join the discussion.

Loading comments…