Code
Hub
Workspaces
Following
Trending
Connect
MCP
copy
Create free account
hub
/
github.com/apple/ml-4m
/ functions
Functions
1,193 in github.com/apple/ml-4m
⨍
Functions
1,193
◇
Types & classes
183
↓ 1 callers
Function
rand_bbox
Standard CutMix bounding-box Generates a random square bbox based on lambda value. This impl includes support for enforcing a border margin a
fourm/utils/timm/mixup.py:34
↓ 1 callers
Function
rand_bbox_minmax
Min-Max CutMix bounding-box Inspired by Darknet cutmix impl, generates a random rectangular bbox based on min/max percent values applied to e
fourm/utils/timm/mixup.py:58
↓ 1 callers
Method
random_color_jitter
(self, strength=0.5)
fourm/data/modality_transforms.py:206
↓ 1 callers
Function
reduce_bool
(value, device)
run_training_4m_fsdp.py:886
↓ 1 callers
Method
register_hook
(self, hook_fn_loc, hook_fn)
fourm/utils/timm/model.py:82
↓ 1 callers
Function
remove_ext_with_gz
(s)
fourm/data/unified_datasets.py:157
↓ 1 callers
Method
remove_redundant_lines
Removes the redundant lines added during cropping.
fourm/data/modality_transforms.py:412
↓ 1 callers
Method
remove_tiny_instances
Remove instances that have an area ratio smaller than `bbox_area_threshold`.
fourm/data/modality_transforms.py:495
↓ 1 callers
Function
render_body_keypoints
Render OpenPose body keypoints on input image. Args: img (np.array): Input image of shape (H, W, 3) with pixel values in the [0,255]
fourm/utils/hmr2_utils/hmr2/utils/render_openpose.py:99
↓ 1 callers
Function
render_keypoints
Render keypoints on input image. Args: img (np.array): Input image of shape (H, W, 3) with pixel values in the [0,255] range.
fourm/utils/hmr2_utils/hmr2/utils/render_openpose.py:39
↓ 1 callers
Method
render_rgba_multiple
( self, vertices: List[np.array], cam_t: List[np.array], rot_a
fourm/utils/hmr2_utils/hmr2/utils/renderer.py:317
↓ 1 callers
Method
replace_batch_random
(self, samples, mask)
fourm/vq/quantizers/quantize_lucid.py:235
↓ 1 callers
Method
replace_batch_random
(self, samples, mask)
fourm/vq/quantizers/quantize_lucid.py:360
↓ 1 callers
Method
replace_linde_buzo_gray
(self, mask)
fourm/vq/quantizers/quantize_lucid.py:239
↓ 1 callers
Method
replace_linde_buzo_gray
(self, mask)
fourm/vq/quantizers/quantize_lucid.py:364
↓ 1 callers
Function
rescale_noise_cfg
Rescale `noise_cfg` according to `guidance_rescale`. Based on findings of [Common Diffusion Noise Schedules and Sample Steps are Flawed](http
fourm/vq/scheduling/diffusion_pipeline.py:23
↓ 1 callers
Method
reset_iterator
Reset the iterator when exhausted.
fourm/data/unified_datasets.py:531
↓ 1 callers
Method
resize_sample
Resize the sample
fourm/data/modality_transforms.py:482
↓ 1 callers
Method
rgb_to_tensor
(self, img)
fourm/data/modality_transforms.py:216
↓ 1 callers
Function
rotx
(theta)
fourm/utils/hmr2_utils/hmr2/utils/renderer.py:80
↓ 1 callers
Function
roty
(theta)
fourm/utils/hmr2_utils/hmr2/utils/renderer.py:91
↓ 1 callers
Function
rotz
(theta)
fourm/utils/hmr2_utils/hmr2/utils/renderer.py:102
↓ 1 callers
Function
safe_parse_metadata
(metadata_str)
fourm/utils/checkpoint.py:162
↓ 1 callers
Method
sample_mask
Returns a mask of shape B H_Q W_Q, where True = masked-out, False = keep. Args: quant: Dequantized latent tensor of shape B D_Q H
fourm/vq/vqvae.py:618
↓ 1 callers
Method
sample_mask
Returns a mask of shape B H_Q W_Q, where True = masked-out, False = keep. Args: quant: Dequantized latent tensor of shape B D_Q H
fourm/vq/vqvae.py:854
↓ 1 callers
Function
sample_multinomial
(total_count, probs)
fourm/vq/quantizers/quantize_lucid.py:75
↓ 1 callers
Function
sample_vectors
(samples, num)
fourm/vq/quantizers/quantize_lucid.py:62
↓ 1 callers
Function
save_conds_and_targets
Saves the conditioning and target modalities for a batch of samples. Args: cond_domains (list of str): List of conditioning domains
fourm/utils/plotting_utils.py:1258
↓ 1 callers
Method
scale_jitter
(self, orig_height, orig_width)
fourm/data/image_augmenter.py:155
↓ 1 callers
Method
semseg_to_tensor
(self, img)
fourm/data/modality_transforms.py:342
↓ 1 callers
Method
sequence_emb_mask_span
Applies input masking to an sequence embedding tensor, target masking is not supported with sequence embeddings Args: emb_tensor:
fourm/data/masking.py:448
↓ 1 callers
Method
sequence_mask
Applies input and target masking to a sequence The keep probability is sampled from a cosine schedule and does not depend on the number of to
fourm/data/masking.py:345
↓ 1 callers
Method
sequence_token_mask
Applies input and target masking to a sequence of tokens (e.g. DINOv2 global tokens) The keep probability is sampled from a cosine schedule an
fourm/data/masking.py:268
↓ 1 callers
Method
set_timesteps
Sets the discrete timesteps used for the diffusion chain. Supporting function to be run before inference. Args: num_infe
fourm/vq/scheduling/scheduling_pndm.py:173
↓ 1 callers
Function
setup_data
(args)
run_training_4m.py:256
↓ 1 callers
Function
setup_data
(args)
run_training_4m_fsdp.py:262
↓ 1 callers
Function
setup_for_distributed
This function disables printing when not in main process
fourm/utils/dist.py:31
↓ 1 callers
Function
setup_modality_info
Sets up the modality info dictionary for the given domains.
run_training_vqcontrolnet.py:79
↓ 1 callers
Function
setup_modality_info
Sets up the modality info dictionary for the given domains.
run_training_divae.py:80
↓ 1 callers
Function
setup_modality_info
Sets up the modality info dictionary for the given domains.
run_training_vqvae.py:91
↓ 1 callers
Function
setup_modality_info
(args)
run_training_4m.py:242
↓ 1 callers
Function
setup_modality_info
(args)
run_training_4m_fsdp.py:248
↓ 1 callers
Method
share_modality_embeddings
Share modality embeddings across the encoder and decoder embedding modules.
fourm/models/fm.py:176
↓ 1 callers
Function
spatial_average
(x, keepdim=True)
fourm/vq/percept_losses/lpips.py:176
↓ 1 callers
Function
split_by_sentinel
(seq_ids, sentinel_ids)
fourm/utils/tokenizer/text_tokenizer.py:115
↓ 1 callers
Function
state_dict_to_master_params
(model, state_dict, use_fp16)
fourm/vq/models/unet/fp16_util.py:136
↓ 1 callers
Method
step_plms
Step function propagating the sample with the linear multi-step method. This has one forward pass with multiple times to approximate
fourm/vq/scheduling/scheduling_pndm.py:321
↓ 1 callers
Method
step_prk
Step function propagating the sample with the Runge-Kutta method. RK takes 4 forward passes to approximate the solution to the differ
fourm/vq/scheduling/scheduling_pndm.py:266
↓ 1 callers
Method
target_image
Applies masking for an image given as target Args: tensor: Image tensor num_tokens: Number of tokens in the tensor
fourm/data/masking.py:621
↓ 1 callers
Method
target_sequence
Applies masking for a sequence given as target Args: sequence_str: Sequence string max_tokens: Maximum number of toke
fourm/data/masking.py:682
↓ 1 callers
Method
target_token_budget
Sample a token budget for the target Args: input_token_budget: Token budget for the input num_target_tokens: Number o
fourm/data/masking.py:207
↓ 1 callers
Function
timestep_embedding
Create sinusoidal timestep embeddings. :param timesteps: a 1-D Tensor of N indices, one per batch element. These may be
fourm/vq/models/unet/nn.py:114
↓ 1 callers
Method
tokenize
Tokenizes an input image tensor. Args: x: Input image tensor of shape B C H W or B H W in case of semantic segmenta
fourm/vq/vqvae.py:320
↓ 1 callers
Method
tokens_to_embedding
Look up the codebook entries corresponding the discrete tokens. Args: tokens: Quantized indices of shape B H_Q W_Q Retur
fourm/vq/vqvae.py:357
↓ 1 callers
Function
train_one_epoch
(model: torch.nn.Module, data_loader: Iterable, optimizer: torch.optim.Optimizer, device: torch.device, epoch:
run_training_vqcontrolnet.py:794
↓ 1 callers
Function
train_one_epoch
Perform one training epoch and return stats. The image resolution is randomly sampled from train_res_choices. At the specified intervals, eva
run_training_divae.py:833
↓ 1 callers
Function
train_one_epoch
Perform one training epoch and return stats. The image resolution is randomly sampled from train_res_choices. At the specified intervals, eva
run_training_vqvae.py:1005
↓ 1 callers
Function
train_one_epoch
(model: torch.nn.Module, data_loader: Iterable, optimizer: torch.optim.Optimizer, num_inpu
run_training_4m.py:676
↓ 1 callers
Function
train_one_epoch
(model: torch.nn.Module, data_loader: Iterable, optimizer: torch.optim.Optimizer, num_inpu
run_training_4m_fsdp.py:712
↓ 1 callers
Function
train_tokenizer
(args)
train_wordpiece_tokenizer.py:38
↓ 1 callers
Function
train_unified_wordpiece_tokenizer
( files, vocab_size, sentinel_tokens: List[Union[str, AddedToken]] = None, coo
fourm/utils/tokenizer/text_tokenizer.py:47
↓ 1 callers
Function
transforms_imagenet_eval
( img_size=224, crop_pct=None, interpolation='bilinear', use_prefetcher=False,
fourm/utils/timm/transforms_factory.py:136
↓ 1 callers
Function
transforms_imagenet_train
If separate==True, the transforms are returned as a tuple of 3 separate transforms for use in a mixing dataset that passes * all data th
fourm/utils/timm/transforms_factory.py:50
↓ 1 callers
Function
transforms_noaug_train
( img_size=224, interpolation='bilinear', use_prefetcher=False, mean=IMAGENET_
fourm/utils/timm/transforms_factory.py:23
↓ 1 callers
Method
truncated_depth_standardization
Truncated depth standardization :param depth: Depth map :param thresh: Threshold :return: Robustly standardized depth map
fourm/data/modality_transforms.py:258
↓ 1 callers
Function
try_cast
(item, dtype)
run_generation.py:328
↓ 1 callers
Function
unfreeze_batch_norm_2d
Converts all `FrozenBatchNorm2d` layers of provided module into `BatchNorm2d`. If `module` is itself and instance of `FrozenBatchNorm2d`, it
fourm/utils/timm/model.py:140
↓ 1 callers
Method
unified_image_augment
Apply the image augmenter to all modalities where it is applicable Args: mod_dict (dict): Dict of modalities crop_set
fourm/data/modality_transforms.py:84
↓ 1 callers
Function
uniform_init
(*shape)
fourm/vq/quantizers/quantize_lucid.py:41
↓ 1 callers
Method
update
(self, model)
fourm/utils/timm/model_ema.py:70
↓ 1 callers
Function
visualize_human_poses
(pose, poses_tokenizer, mod_dict)
fourm/utils/plotting_utils.py:934
↓ 1 callers
Function
visualize_palettes_multi
(palettes)
fourm/utils/plotting_utils.py:891
↓ 1 callers
Function
vit
(cfg)
fourm/utils/hmr2_utils/hmr2/models/backbones/vit.py:17
↓ 1 callers
Function
whitespace_clean
(text)
fourm/utils/clip/simple_tokenizer.py:61
↓ 1 callers
Function
zero_grad
(model_params)
fourm/vq/models/unet/fp16_util.py:153
Method
__call__
(self, loss, optimizer, clip_grad=None, skip_grad=None, parameters=None, create_graph=False, update_grad=True,
fourm/utils/native_scaler.py:27
Method
__call__
(self, img)
fourm/utils/timm/auto_augment.py:341
Method
__call__
(self, img)
fourm/utils/timm/auto_augment.py:511
Method
__call__
(self, img)
fourm/utils/timm/auto_augment.py:630
Method
__call__
(self, img)
fourm/utils/timm/auto_augment.py:778
Method
__call__
(self, pil_img)
fourm/utils/timm/transforms.py:18
Method
__call__
(self, pil_img)
fourm/utils/timm/transforms.py:31
Method
__call__
Args: img (PIL Image): Image to be cropped and resized. Returns: PIL Image: Randomly cropped and resized ima
fourm/utils/timm/transforms.py:138
Method
__call__
(self, x, target)
fourm/utils/timm/mixup.py:214
Method
__call__
(self, batch, _=None)
fourm/utils/timm/mixup.py:304
Method
__call__
(self, input)
fourm/utils/timm/random_erasing.py:93
Method
__call__
Render meshes on input image Args: vertices (np.array): Array of shape (V, 3) containing the mesh vertices. c
fourm/utils/hmr2_utils/hmr2/utils/renderer.py:160
Method
__call__
Render batch of 3D keypoints. Args: pred_keypoints_3d (torch.Tensor): Tensor of shape (B, S, N, 3) containing a batch of
fourm/utils/hmr2_utils/hmr2/utils/skeleton_renderer.py:26
Method
__call__
Applies input and target masking to a dictionary of modalities Args: mod_dict: Dictionary of modalities Returns:
fourm/data/masking.py:519
Method
__call__
Applies input and target masking to a dictionary of modalities Args: mod_dict: Dictionary of modalities Returns:
fourm/data/masking.py:721
Method
__call__
Apply the augmentation to a dict of modalities (both image based and sequence based modalities) Args: mod_dict (dict): Dict of mo
fourm/data/modality_transforms.py:112
Method
__call__
(self, mod_dict, crop_settings)
fourm/data/image_augmenter.py:28
Method
__call__
(self, mod_dict, crop_settings)
fourm/data/image_augmenter.py:42
Method
__call__
(self, mod_dict, crop_settings)
fourm/data/image_augmenter.py:68
Method
__call__
(self, mod_dict, crop_settings)
fourm/data/image_augmenter.py:85
Method
__call__
(self, mod_dict, crop_settings=None)
fourm/data/image_augmenter.py:107
Method
__call__
(self, mod_dict, crop_settings)
fourm/data/image_augmenter.py:134
Method
__call__
(self, mod_dict, crop_settings)
fourm/data/image_augmenter.py:164
Method
__call__
(self, mod_dict, crop_settings)
fourm/data/image_augmenter.py:185
Method
__call__
The call function to the pipeline for conditional image generation. Args: cond: The conditional input to the model. g
fourm/vq/scheduling/diffusion_pipeline.py:52
← previous
next →
501–600 of 1,193, ranked by callers