Code
Hub
Workspaces
Following
Trending
Connect
MCP
copy
Create free account
hub
/
github.com/NVlabs/alpamayo
/ functions
Functions
101 in github.com/NVlabs/alpamayo
⨍
Functions
101
◇
Types & classes
19
↓ 8 callers
Method
get_action_space_dims
Get the dimensions of the action space. Returns: action_space_dims: the action space dimensions
src/alpamayo_r1/action_space/action_space.py:74
↓ 4 callers
Function
construct_DTD
Construct the dense matrix D^T s D for multiple orders of smoothing. Explanation of the smoothing lambda term: For 1st/2nd/3rd smoothing ter
src/alpamayo_r1/action_space/utils.py:81
↓ 3 callers
Method
__init__
(self, dim: int, eps: float)
src/alpamayo_r1/models/action_in_proj.py:23
↓ 3 callers
Function
to_special_token
Convert a token to a special token.
src/alpamayo_r1/models/token_utils.py:24
↓ 2 callers
Method
action_to_traj
Transform the action space to the trajectory. Args: action: (..., *action_space_dims) traj_history_xyz: (..., T, 3)
src/alpamayo_r1/action_space/action_space.py:51
↓ 2 callers
Method
estimate_t0_states
Estimate the t0 states from the trajectory history.
src/alpamayo_r1/action_space/unicycle_accel_curvature.py:209
↓ 2 callers
Function
so3_to_yaw_torch
Computes the yaw angle given an so3 rotation matrix (assumes that rotation is described in xyz order) Args: rot_mat (torch.Tensor): [
src/alpamayo_r1/geometry/rotation.py:25
↓ 2 callers
Function
solve_xs_eq_y
Solve the following problem: min_x={x_0, ..., x_N-1} sum_i={0, ..., N-1} w_data_i (x_i * s_i - y_i)**2 + smooth_terms Args: s (...,
src/alpamayo_r1/action_space/utils.py:241
↓ 2 callers
Function
unwrap_angle
Unwrap the last dimension of the tensor to make sure the diff is in (-pi, pi].
src/alpamayo_r1/action_space/utils.py:26
↓ 1 callers
Method
__init__
( self, config: ReasoningVLAConfig, pretrained_modules: dict[str, torch.nn.Module] | N
src/alpamayo_r1/models/base_model.py:291
↓ 1 callers
Method
__init__
( self, config: AlpamayoR1Config, pretrained_modules: dict[str, torch.nn.Module] | Non
src/alpamayo_r1/models/alpamayo_r1.py:81
↓ 1 callers
Method
_build_processor
Build the processor with trajectory tokens.
src/alpamayo_r1/models/base_model.py:251
↓ 1 callers
Method
_build_tokenizer
Build tokenizer with trajectory tokens.
src/alpamayo_r1/models/base_model.py:327
↓ 1 callers
Method
_euler
Euler integration for flow matching. Args: batch_size: The batch size. step_fn: The denoising step function.
src/alpamayo_r1/diffusion/flow_matching.py:100
↓ 1 callers
Method
_initialize_qwenvl3_vlm
Initialize Qwen3-VL VLM backbone. Qwen3-VL uses Qwen3VLForConditionalGeneration from transformers. See: https://huggingface.co/Qwen/Q
src/alpamayo_r1/models/base_model.py:367
↓ 1 callers
Method
_initialize_trajectory_tokenizers
Initialize trajectory tokenizers.
src/alpamayo_r1/models/base_model.py:383
↓ 1 callers
Method
_initialize_vlm_backbone
Initialize the VLM backbone based on configuration.
src/alpamayo_r1/models/base_model.py:354
↓ 1 callers
Method
_initialize_vlm_config
Initialize VLM-specific configuration based on backend type.
src/alpamayo_r1/models/base_model.py:241
↓ 1 callers
Method
_norm
Normalize the input tensor.
src/alpamayo_r1/models/action_in_proj.py:28
↓ 1 callers
Function
_recursive_setattr
Recursively set attribute on object and all its children.
src/alpamayo_r1/models/base_model.py:78
↓ 1 callers
Method
_theta_v_a_to_kappa
Compute the curvature from the theta, v, a, jerk. The kappa is computed by s = dt * v + dt^2 * a / 2 kappa = dtheta
src/alpamayo_r1/action_space/unicycle_accel_curvature.py:164
↓ 1 callers
Method
_v_to_a
Compute the acceleration from the velocity. Define: Δv_t = v_t+1 - v_t According to the kinematic model Δv_t
src/alpamayo_r1/action_space/unicycle_accel_curvature.py:127
↓ 1 callers
Method
_validate_mixin_requirements
Validate that all required mixin attributes are present.
src/alpamayo_r1/models/base_model.py:128
↓ 1 callers
Function
dxy_theta_to_v
Given the dxy and theta, compute the velocity. The velocity is defined by the trapezoidal integration: define: u_t = [cos theta_t, si
src/alpamayo_r1/action_space/utils.py:405
↓ 1 callers
Function
dxy_theta_to_v_without_v0
Given the dxy and theta, compute the velocity. The velocity is defined by the trapezoidal integration: define: u_t = [cos theta_t, si
src/alpamayo_r1/action_space/utils.py:319
↓ 1 callers
Method
encode
Encodes the trajectories as discrete tokens. The model conditions on the historical waypoints to tokenize the future waypoints. Trajectories c
src/alpamayo_r1/models/delta_tokenizer.py:47
↓ 1 callers
Function
extract_between_special_tokens
Extract text between special tokens. Args: decoded_batch (list[str]): the data we extract from token (str): the special token we
src/alpamayo_r1/models/token_utils.py:123
↓ 1 callers
Function
extract_text_tokens
Extract text tokens (e.g., cot, meta_action, question, answers) from the output tokens. Args: output_tokens (torch.Tensor): The output to
src/alpamayo_r1/models/token_utils.py:151
↓ 1 callers
Function
first_order_D
Build the banded matrix for the first-order smoothing term.
src/alpamayo_r1/action_space/utils.py:33
↓ 1 callers
Method
fuse_traj_tokens
Fuse the trajectory tokens into the input ids. Args: input_ids: [B, n_token] traj_data: dict containing ego_history_x
src/alpamayo_r1/models/base_model.py:168
↓ 1 callers
Function
get_global_rank
Get the rank (GPU device) of the worker. Returns: rank (int): The rank of the worker.
src/alpamayo_r1/common/logging.py:57
↓ 1 callers
Function
get_yaw_rotation_matrices
Calculate yaw rotation matrices using polynomial fitting for both x(t) and y(t) Args: trajectory: np.array of shape (B, N, 3) for batch o
src/alpamayo_r1/models/delta_tokenizer.py:157
↓ 1 callers
Function
load_physical_aiavdataset
Load data from physical_ai_av for model inference. This function loads a sample from the physical_ai_av dataset and converts it to the format
src/alpamayo_r1/load_physical_aiavdataset.py:27
↓ 1 callers
Function
rank_prefixed_message
Add a prefix with the rank to a message.
src/alpamayo_r1/common/logging.py:49
↓ 1 callers
Function
replace_pad_token
Replace pad tokens in input_ids with new token values.
src/alpamayo_r1/models/base_model.py:85
↓ 1 callers
Function
replace_padding_after_eos
Overwrite token IDs after the first EOS token with padding token ID. Args: token_ids (torch.Tensor): Token IDs of shape [B, L]. e
src/alpamayo_r1/models/token_utils.py:212
↓ 1 callers
Function
rot_2d_to_3d
Converts a 2D rotation matrix to a 3D rotation matrix assuming flat xy plane. Args: rot (torch.Tensor): The 2D rotation matrix to convert
src/alpamayo_r1/geometry/rotation.py:197
↓ 1 callers
Function
rotation_matrix
Creates one or many 2D rotation matrices. Args: angle (Union[float, np.ndarray]): The angle to rotate points by. if float, re
src/alpamayo_r1/geometry/rotation.py:85
↓ 1 callers
Function
rotation_matrix_torch
Creates one or many 2D rotation matrices. Args: angle (torch.Tensor): The angle to rotate points by. Size: [...]. Returns: t
src/alpamayo_r1/geometry/rotation.py:109
↓ 1 callers
Function
round_2pi_torch
Normalize angles to the range [-pi, pi] in torch. Args: x: Angle(s) in radians, can be numpy array or torch tensor Returns:
src/alpamayo_r1/geometry/rotation.py:237
↓ 1 callers
Method
sample
Sample from the diffusion model. Args: batch_size: The batch size. step_fn: The denoising step function that takes a
src/alpamayo_r1/diffusion/base.py:64
↓ 1 callers
Method
sample
Sample data from the model. Args: batch_size: The batch size. step_fn: The denoising step function. devic
src/alpamayo_r1/diffusion/flow_matching.py:61
↓ 1 callers
Method
sample_trajectories_from_data_with_vlm_rollout
Sample trajectories from the data with VLM rollout. Args: data: The input data. top_p: The top-p value for sampling.
src/alpamayo_r1/models/alpamayo_r1.py:124
↓ 1 callers
Function
second_order_D
Build the banded matrix for the second-order smoothing term.
src/alpamayo_r1/action_space/utils.py:47
↓ 1 callers
Function
solve_single_constraint
Solve a single-point constrained sequence with multiple orders of smoothing. This function solves the following problem: min_x={x_1, ...,
src/alpamayo_r1/action_space/utils.py:165
↓ 1 callers
Function
theta_smooth
Smooth the heading of the trajectory. Args: traj_future_rot: (..., T, 3, 3)
src/alpamayo_r1/action_space/utils.py:491
↓ 1 callers
Function
third_order_D
Build the banded matrix for the third-order smoothing term.
src/alpamayo_r1/action_space/utils.py:62
↓ 1 callers
Function
tokenize_history_trajectory
Tokenize the history trajectory with prefix shape of (B, n_traj, ...). Args: tokenizer: Trajectory tokenizer with encode method t
src/alpamayo_r1/models/base_model.py:91
↓ 1 callers
Method
traj_to_action
Transform the future trajectory to the action space. Args: traj_history_xyz: (..., T, 3) traj_history_rot: (..., T, 3
src/alpamayo_r1/action_space/action_space.py:27
Method
__call__
Denoising step function. Args: x: The input tensor. t: The timestep. Returns: torch.Tensor: The
src/alpamayo_r1/diffusion/base.py:27
Method
__call__
Call the stopping criteria. Args: input_ids (torch.LongTensor): The input IDs of shape [B, L]. scores (torch.FloatTen
src/alpamayo_r1/models/token_utils.py:184
Method
__call__
Call the ExpertLogitsProcessor to mask out the logits for discrete trajectory tokens. The discrete trajectory tokens are not used for the exp
src/alpamayo_r1/models/alpamayo_r1.py:55
Method
__init__
( self, diffusion_cfg: dict[str, Any] | None = None, action_space_cfg: dict[str, Any]
src/alpamayo_r1/config.py:28
Method
__init__
Initialize the BaseDiffusion model. Args: x_dims: The dimension of the input tensor.
src/alpamayo_r1/diffusion/base.py:48
Method
__init__
Initialize the FlowMatching model. Args: int_method: The integration method used in inference. num_inference_steps: T
src/alpamayo_r1/diffusion/flow_matching.py:32
Method
__init__
Initialize the UnicycleAccelCurvatureActionSpace. Args: accel_mean: Mean for normalizing acceleration. accel_std: Std
src/alpamayo_r1/action_space/unicycle_accel_curvature.py:39
Method
__init__
Initializes the tokenizer.
src/alpamayo_r1/action_space/discrete_action_space.py:27
Method
__init__
Initializes a multi-GPU-friendly python command line logger that logs on all processes with their rank prefixed in the log message. A
src/alpamayo_r1/common/logging.py:72
Method
__init__
Initializes the tokenizer.
src/alpamayo_r1/models/delta_tokenizer.py:24
Method
__init__
Args: eos_token_id (int): The EOS token ID.
src/alpamayo_r1/models/token_utils.py:177
Method
__init__
( self, vlm_name_or_path: str = "Qwen/Qwen3-VL-8B-Instruct", vlm_backend: str = "qwenv
src/alpamayo_r1/models/base_model.py:205
Method
__init__
Initialize the ExpertLogitsProcessor. Args: traj_token_offset: The offset of the trajectory tokens. traj_vocab_size:
src/alpamayo_r1/models/alpamayo_r1.py:44
Method
__init__
(self, num_input_feats: int, num_enc_layers: int, hidden_size: int, outdim: int)
src/alpamayo_r1/models/action_in_proj.py:41
Method
__init__
Initialize the Fourier encoder V2. Args: dim: Output dimension of the encoder. Must be even as it's split into si
src/alpamayo_r1/models/action_in_proj.py:76
Method
__init__
Initialize the per-waypoint action projection module V2. Args: in_dims: List of input dimensions. The last element specifies the
src/alpamayo_r1/models/action_in_proj.py:111
Method
action_to_traj
Transform the action space to the trajectory. Args: action: (..., T, 2) traj_history_xyz: (..., T, 3) tra
src/alpamayo_r1/action_space/unicycle_accel_curvature.py:300
Function
angle_wrap
This function wraps angles to lie within [-pi, pi). Args: radians (np.ndarray): The input array of angles (in radians). Returns:
src/alpamayo_r1/geometry/rotation.py:71
Method
compute_loss_from_pred
Training step for the flow matching model.
src/alpamayo_r1/diffusion/flow_matching.py:166
Method
construct_training_data
Construct the training data for the flow matching model.
src/alpamayo_r1/diffusion/flow_matching.py:140
Function
create_message
Construct the message using images and cot.
src/alpamayo_r1/helper.py:28
Method
decode
Decodes the given tokens into future trajectories. We assume the the future tstamp is consistent with the future trajectory. Args:
src/alpamayo_r1/action_space/discrete_action_space.py:80
Method
decode
Decodes the given tokens into future trajectories. The future trajectory is returned in the same coordinate frame as the historical trajectory
src/alpamayo_r1/models/delta_tokenizer.py:99
Method
encode
Encodes the trajectories as discrete tokens. We assume the the future tstamp is consistent with the future trajectory. Args:
src/alpamayo_r1/action_space/discrete_action_space.py:47
Function
euler_2_so3
Converts the euler angles representation to the so3 rotation matrix Args: euler_angles (np.array): euler angles [n,3] degrees bool
src/alpamayo_r1/geometry/rotation.py:56
Function
extract_traj_tokens
Extract the trajectory tokens from the output tokens (parallel/vectorized version). This is a fully vectorized implementation that processes all
src/alpamayo_r1/models/token_utils.py:29
Method
forward
Normalize the input tensor.
src/alpamayo_r1/models/action_in_proj.py:32
Method
forward
(B, C) -> (B, outdim)
src/alpamayo_r1/models/action_in_proj.py:68
Method
forward
Forward pass of the Fourier encoder V2. Args: x: Input tensor of arbitrary shape (..., ). Returns: Fourier-e
src/alpamayo_r1/models/action_in_proj.py:91
Method
forward
Forward pass of the per-waypoint action projection V2. Args: x: Action tensor of shape (batch_size, num_waypoints, action_dim).
src/alpamayo_r1/models/action_in_proj.py:148
Method
from_pretrained_submodules
Load submodules with pretrained submodules and initialize the model.
src/alpamayo_r1/models/base_model.py:404
Method
get_action_space_dims
Get the dimensions of the action space.
src/alpamayo_r1/action_space/unicycle_accel_curvature.py:98
Method
get_input_embeddings
Get the input embeddings of the model.
src/alpamayo_r1/models/base_model.py:438
Method
get_output_embeddings
Get the output embeddings of the model.
src/alpamayo_r1/models/base_model.py:434
Function
get_processor
Get the processor for the Qwen3-VL-2B-Instruct model.
src/alpamayo_r1/helper.py:71
Method
is_within_bounds
Check if a normalized action is within bounds. Args: action: (..., N, 2) Returns: is_within_bounds: (...,)
src/alpamayo_r1/action_space/unicycle_accel_curvature.py:102
Method
is_within_bounds
Check if the action is within the bounds. By default, we assume the action is within bounds (dummy implementation). Args:
src/alpamayo_r1/action_space/action_space.py:81
Method
log
Delegate a log call to the underlying logger, after prefixing its message with the rank of the process it's being logged from. If `'rank'` is
src/alpamayo_r1/common/logging.py:92
Function
ratan2
Robust arctan2 for pytorch torch.arctan2(0,0)=nan, this function avoids the nan situation and returns ratan2(0,0)=0
src/alpamayo_r1/geometry/rotation.py:216
Function
rot_3d_to_2d
Converts a 3D rotation matrix to a 2D rotation matrix by taking the x and y axes of the 3D rotation matrix, projecting them to xy plan, and perfor
src/alpamayo_r1/geometry/rotation.py:177
Function
round_2pi
Normalize angles to the range [-pi, pi]. Args: x: Angle(s) in radians, can be numpy array or torch tensor Returns: Normalize
src/alpamayo_r1/geometry/rotation.py:225
Function
setup_logging
Configure the root logger with a single colored console handler. Clears existing root handlers first to avoid duplicate log output when used
src/alpamayo_r1/common/logging.py:26
Function
so3_to_yaw_np
Computes the yaw angle given an so3 rotation matrix (assumes that rotation is described in xyz order) Args: rot_mat (np.ndarray): [..
src/alpamayo_r1/geometry/rotation.py:41
Function
stable_gramschmidt
Orthonormalize two 3D vectors using a stable Gram-Schmidt step. Args: M: Tensor of shape (..., 3, 2) with vectors (x, y). Returns:
src/alpamayo_r1/geometry/rotation.py:156
Method
step_fn
( x: torch.Tensor, t: torch.Tensor, )
src/alpamayo_r1/models/alpamayo_r1.py:257
Method
tie_weights
Delegate weight tying to the nested VLM model.
src/alpamayo_r1/models/base_model.py:442
Function
to_device
Recursively cast data into the specified device, dtype.
src/alpamayo_r1/helper.py:83
Method
traj_to_action
Transform the future trajectory to the action space. Here we assume the traj_history_xyz[..., -1, :] is the current position and is all zeros
src/alpamayo_r1/action_space/unicycle_accel_curvature.py:227
Function
transform_coords_2d_np
Args: coords (np.ndarray): [..., 2] coordinates offset (Optional[np.ndarray], optional): [..., 2] offset to translate. Defaults to Non
src/alpamayo_r1/geometry/rotation.py:128
Method
vocab_size
Tokens are integers from the set {0, 1, ..., vocab_size - 1}
src/alpamayo_r1/action_space/discrete_action_space.py:43
Method
vocab_size
Tokens are integers from the set {0, 1, ..., vocab_size - 1}
src/alpamayo_r1/models/delta_tokenizer.py:43
next →
1–100 of 101, ranked by callers