Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion tensorrt_llm/functional.py
Original file line number Diff line number Diff line change
Expand Up @@ -264,8 +264,16 @@ def create_sinusoidal_positions_for_attention_plugin(
# Other scaling configs that only used by certain scaling types.
rope_scaling_config: dict = None,
duplicate_data: bool = False,
dtype=np.float32,
):
# The rotary table dtype is pinned to fp32 and is intentionally not a caller
# argument. inv_freq and the positions are built at this dtype, so the stored
# angle (position * inv_freq) accumulates the fp32 rounding of inv_freq -- an
# error that is invisible in short contexts but grows ~linearly with position
# (about a milliradian at 32k). Reference implementations also round inv_freq
# to fp32, and building in fp64 was measured and deliberately not adopted (it
# removes one side of a two-sided rounding difference rather than improving
# agreement). Change this only with a re-measurement.
dtype = np.float32
Comment thread
brnguyen2 marked this conversation as resolved.
if scale_type == RotaryScalingType.linear:
scale = 1.0 / scale
if scale_type == RotaryScalingType.llama3:
Expand Down
Loading