Code
Hub
Workspaces
Following
Trending
Connect
MCP
copy
Create free account
hub
/
github.com/ByteDance-Seed/Cola-DLM
/ functions
Functions
221 in github.com/ByteDance-Seed/Cola-DLM
⨍
Functions
221
◇
Types & classes
40
↳
Endpoints
3
↓ 24 callers
Method
encode
Encode per-sample ``input_ids`` into per-sample latents. Realizes the inference encoder ``q_phi(z_0 | x)`` of Eq. 2.1.1 of the paper.
cola_dlm/modeling_cola_vae.py:580
↓ 21 callers
Function
print0
(*a, **kw)
scripts/cola_pretrain.py:112
↓ 19 callers
Function
print0
(*a, **kw)
scripts/cola_sft.py:126
↓ 15 callers
Function
print0
(*a, **kw)
scripts/cola_cpt.py:90
↓ 13 callers
Function
add
(token_ids, role)
scripts/cola_sft.py:241
↓ 10 callers
Method
decode
Decode flattened latents into vocabulary logits. Realizes the conditional decoder ``p_theta(x | z_0)`` of Eq. 2.1.1. During block-wis
cola_dlm/modeling_cola_vae.py:646
↓ 10 callers
Method
set_kv_cache
(self, flag: bool)
cola_dlm/modeling_cola_vae.py:373
↓ 9 callers
Function
normalize_text
(text)
scripts/acc_calc.py:181
↓ 8 callers
Method
__init__
(self, dim: int, expand_ratio: int, **kwargs)
cola_dlm/modeling_cola_dit.py:373
↓ 7 callers
Function
build_norm_layer
(layer_norm_type: str, dim: int, eps: float = 1e-5, elementwise_affine: bool = True)
cola_dlm/modeling_cola_vae.py:239
↓ 7 callers
Function
set_attn_backend
Set attention backend: 'naive' (default), 'sdpa', or 'flex'.
cola_dlm/modeling_cola_dit.py:86
↓ 6 callers
Function
_as_flat_long
Accept ``(B, 1)`` or ``(B,)`` per-sample length tensors uniformly.
cola_dlm/attention_utils.py:83
↓ 6 callers
Function
create_na_block_causal_mask
Additive block-diagonal block-causal attention mask for NA sequences. Invariants the inference code guarantees and that we rely on here: * `
cola_dlm/attention_utils.py:88
↓ 5 callers
Function
_env_int
(name: str, default: int)
openai_adapter/server.py:41
↓ 5 callers
Function
init_normal
(module, std: float, init_cutoff_factor: Optional[float] = None)
cola_dlm/modeling_cola_vae.py:245
↓ 4 callers
Function
_openai_error
(status_code: int, message: str, error_type: str = "invalid_request_error")
openai_adapter/server.py:234
↓ 4 callers
Function
create_2l_block_causal_mask
Attention mask for the 2L training trick. Each sample has layout ``[clean(L) | noisy(L)]``. Q may cover the full ``2L`` (when ``txt_q_shape
cola_dlm/attention_utils.py:161
↓ 4 callers
Function
create_2l_flex_block_mask
FlexAttention block mask for the 2L training trick (NA form). Uses Fast-dLLM v2 layout ``[xt(noisy, L) | x0(clean, L)]`` per sample. The call
cola_dlm/attention_utils.py:271
↓ 4 callers
Function
pretrain_data_loader
BOS-aligned best-fit packing dataloader for pretraining. Args: tokenizer_path: path to tokenizer.json (OLMo 2 / HuggingFace tokenize
cola_dlm/dataloader.py:75
↓ 4 callers
Method
step
(self)
cola_dlm/optim.py:193
↓ 3 callers
Function
_env_float
(name: str, default: float)
openai_adapter/server.py:48
↓ 3 callers
Function
_shape_tensor
Build a ``(B, 1)`` shape tensor from a Python list of per-sample lengths.
cola_dlm/inference.py:274
↓ 3 callers
Function
_shape_tensor
(lens, device)
cola_dlm/engine.py:28
↓ 3 callers
Function
calculate_similarity
(text1, text2)
scripts/acc_calc.py:190
↓ 3 callers
Function
generate_task_repaint_inference
End-to-end Cola DLM inference (Eq. 2.2.4–2.2.6 of the paper). Realizes the three-step inference algorithm of *Continuous Latent Diffusion Lan
cola_dlm/inference.py:285
↓ 3 callers
Method
log
(self, *a, **kw)
scripts/cola_sft.py:137
↓ 3 callers
Function
run_with_layout
Run forward pass with specified layout and extract noisy predictions.
tests/test_attn_equivalence.py:46
↓ 3 callers
Method
sample
(self, generator: Optional[torch.Generator] = None)
cola_dlm/modeling_cola_vae.py:90
↓ 2 callers
Method
__init__
( self, dim: int, ffn_dim: int, num_heads: int, shared_heads_kv: int =
cola_dlm/modeling_cola_vae.py:261
↓ 2 callers
Function
_check_api_key
(expected_key: str | None, authorization: str | None)
openai_adapter/server.py:248
↓ 2 callers
Function
_download_word_list
()
tasks/spellingbee.py:26
↓ 2 callers
Function
_env_optional_int
(name: str, default: int | None = None)
openai_adapter/server.py:55
↓ 2 callers
Function
_flatten
``List[Tensor(*_, c)]`` → ``(Tensor(L_total, c), txt_shape (B, 1))``.
cola_dlm/modeling_cola_dit.py:108
↓ 2 callers
Function
_message_content_to_text
(content: Any)
openai_adapter/server.py:185
↓ 2 callers
Function
_unflatten
Inverse of :func:`_flatten`: return a Python list of per-sample tensors.
cola_dlm/modeling_cola_dit.py:115
↓ 2 callers
Function
adamw_step_fused
( p: Tensor, grad: Tensor, exp_avg: Tensor, exp_avg_sq: Tensor, step_t: Tensor, lr_t: Tensor,
cola_dlm/optim.py:36
↓ 2 callers
Method
apply_rotary_pos_emb
(self, pos_sin, pos_cos, t)
cola_dlm/modeling_cola_vae.py:191
↓ 2 callers
Function
build_prompt
(conversation_history)
scripts/cola_chat_cli.py:88
↓ 2 callers
Function
data_generator
(dataset, batch_size, max_seq_len, vae_mode)
scripts/cola_sft.py:614
↓ 2 callers
Function
eval_special_tokens
Check if the VAE can reconstruct special tokens in context.
scripts/cola_vae_finetune.py:131
↓ 2 callers
Function
extract_choice_letter
(text, max_choices=26)
scripts/acc_calc.py:221
↓ 2 callers
Function
flow_matching_step
(dit_model, batch)
scripts/cola_pretrain.py:426
↓ 2 callers
Function
flow_matching_step
One FM training step on a batch. batch: list of (z_0, roles_str, L, sample_bs) tuples from prepare_sample. Returns: scalar loss.
scripts/cola_sft.py:510
↓ 2 callers
Function
flow_matching_step
(dit_model, batch)
scripts/cola_cpt.py:278
↓ 2 callers
Method
forward
(self, x)
cola_dlm/modeling_cola_dit.py:379
↓ 2 callers
Function
generate_response
(prompt_text)
scripts/cola_chat_cli.py:94
↓ 2 callers
Function
get_first_word
(text)
scripts/acc_calc.py:199
↓ 2 callers
Method
get_freqs
Concat per-sample RoPE frequencies along the flattened sequence. ``txt_shape`` is ``(B, 1)`` and ``offset`` is a Python list of per-s
cola_dlm/modeling_cola_dit.py:301
↓ 2 callers
Method
get_freqs_from_positions
Build RoPE frequencies from explicit integer position IDs. ``position_ids`` is a 1-D ``(L,)`` long tensor of per-token positions — e.
cola_dlm/modeling_cola_dit.py:290
↓ 2 callers
Method
log
(self, *a, **kw)
scripts/cola_pretrain.py:122
↓ 2 callers
Method
log
(self, *a, **kw)
scripts/cola_cpt.py:100
↓ 2 callers
Function
match_choice_by_text
(text, choices)
scripts/acc_calc.py:252
↓ 2 callers
Function
muon_step_fused
( stacked_grads: Tensor, stacked_params: Tensor, momentum_buffer: Tensor, second_momentum_buffer: Tens
cola_dlm/optim.py:65
↓ 2 callers
Function
prepare_batch
(inputs)
scripts/cola_pretrain.py:399
↓ 2 callers
Function
prepare_batch
Convert (B, T) token IDs to list of (z_0, L, block_size) tuples.
scripts/cola_cpt.py:248
↓ 2 callers
Function
sample_with_strategies
( logits: torch.Tensor, generated_ids: Optional[torch.Tensor] = None, temperature: float = 0.8,
cola_dlm/inference.py:211
↓ 2 callers
Method
slow_attn
(self, query, key, value, attn_mask=None, dropout_p=0.0)
cola_dlm/modeling_cola_dit.py:409
↓ 1 callers
Method
__init__
(self, param_groups: list[dict])
cola_dlm/optim.py:125
↓ 1 callers
Method
__init__
(self, start=0, stop=None, step=1)
tasks/common.py:7
↓ 1 callers
Method
__init__
(self, size=1000, split="train", **kwargs)
tasks/spellingbee.py:38
↓ 1 callers
Method
_build_act
(self, act)
cola_dlm/modeling_cola_vae.py:337
↓ 1 callers
Function
_build_na_positions
``txt_shape: (B, 1)`` → ``positions: (1, L_total)`` where each sample's positions restart from 0.
cola_dlm/modeling_cola_vae.py:126
↓ 1 callers
Function
_build_na_q_positions
Per-sample Q positions aligned to the TAIL of K within each sample.
cola_dlm/modeling_cola_vae.py:133
↓ 1 callers
Method
_compute_adamw
(self, group, info, gather_list, rank, world_size)
cola_dlm/optim.py:266
↓ 1 callers
Method
_compute_muon
(self, group, info, gather_list, rank)
cola_dlm/optim.py:301
↓ 1 callers
Function
_detect_compute_dtype
()
cola_dlm/optim.py:19
↓ 1 callers
Function
_diffusion_dt
(t_curr, t_next)
cola_dlm/inference.py:356
↓ 1 callers
Function
_document_batches
Infinite iterator over document text batches from parquet files.
cola_dlm/dataloader.py:36
↓ 1 callers
Method
_encode_patch_per_sample
Run embedding + patch ``Conv1d`` one sample at a time. ``nn.Conv1d`` requires a fixed length within a batch; looping over the (small)
cola_dlm/modeling_cola_vae.py:563
↓ 1 callers
Method
_finish_gathers
(self, gather_list)
cola_dlm/optim.py:344
↓ 1 callers
Function
_get_axial_freqs
(rope, dims, offsets=(), repeats=(), flatten=False)
cola_dlm/modeling_cola_dit.py:239
↓ 1 callers
Function
_get_dist_info
()
cola_dlm/dataloader.py:25
↓ 1 callers
Function
_get_sinusoidal_embedding
Sinusoidal timestep embedding. Matches diffusers ``get_timestep_embedding`` with ``flip_sin_to_cos=False, downscale_freq_shift=0`` — i.e. the
cola_dlm/modeling_cola_dit.py:127
↓ 1 callers
Function
_messages_to_prompt
(messages: list[ChatMessage])
openai_adapter/server.py:204
↓ 1 callers
Method
_reduce_adamw
(self, group, world_size)
cola_dlm/optim.py:230
↓ 1 callers
Method
_reduce_muon
(self, group, world_size)
cola_dlm/optim.py:247
↓ 1 callers
Method
_resolve_device
(device_name: str)
openai_adapter/server.py:147
↓ 1 callers
Method
_step_adamw
(self, group)
cola_dlm/optim.py:138
↓ 1 callers
Method
_step_muon
(self, group)
cola_dlm/optim.py:160
↓ 1 callers
Method
apply_freqs
Apply pre-computed ``freqs_q / freqs_k`` to ``txt_q / txt_k`` of shape ``(L, h, d)``. Not named ``apply`` because that would shadow :
cola_dlm/modeling_cola_dit.py:274
↓ 1 callers
Function
apply_prompt_template
(task: str, context: str, question: str, answer: str, choices: Optional[list[str]])
cola_dlm/inference.py:80
↓ 1 callers
Function
build_noisy_sample
Construct the noisy copy with boundary-aware noising. Returns: z_noisy: (L, d) loss_mask: (L,) target: (L, d) velocity ta
scripts/cola_sft.py:349
↓ 1 callers
Function
build_noisy_sample_pretrain
(z_0, t_val, z_1, sample_block_size, unpadded_len=None)
scripts/cola_pretrain.py:360
↓ 1 callers
Function
build_noisy_sample_pretrain
All-token noisy construction with optional simulated [P,R] boundaries. With probability prompt_block_prob per block, a random split creates a
scripts/cola_cpt.py:206
↓ 1 callers
Function
build_prompt_chatml
(conversation_history)
scripts/cola_chat_cli.py:78
↓ 1 callers
Function
build_prompt_text
(conversation_history)
scripts/cola_chat_cli.py:65
↓ 1 callers
Function
compute_loss
Reconstruction loss: encode → decode → cross-entropy.
scripts/cola_vae_finetune.py:107
↓ 1 callers
Function
cu_seqlens
Cumulative sequence lengths with a leading zero, ``int32``.
cola_dlm/attention_utils.py:67
↓ 1 callers
Function
evaluate
(dit_model, eval_steps)
scripts/cola_pretrain.py:524
↓ 1 callers
Function
evaluate
(dit_model, val_gen)
scripts/cola_sft.py:644
↓ 1 callers
Function
evaluate
(dit_model, eval_steps)
scripts/cola_cpt.py:373
↓ 1 callers
Function
evaluate_single_directory
(eval_dir)
scripts/acc_calc.py:505
↓ 1 callers
Function
extract_answer_segment
(text)
scripts/acc_calc.py:207
↓ 1 callers
Function
extract_gt_mmlu_choice_letter
(gt_text, choices)
scripts/acc_calc.py:306
↓ 1 callers
Function
extract_mmlu_choice_letter
(text, choices)
scripts/acc_calc.py:291
↓ 1 callers
Function
extract_run_alias
(dir_path)
scripts/acc_calc.py:466
↓ 1 callers
Function
find_eval_dirs
(root_dir)
scripts/acc_calc.py:483
↓ 1 callers
Method
from_env
(cls)
openai_adapter/server.py:82
↓ 1 callers
Method
generate
Generate text block-by-block, yielding decoded text per block. Args: prompt_ids: tokenized prompt (list of int token IDs)
cola_dlm/engine.py:52
↓ 1 callers
Function
get_cache_dir
Return Cola-DLM cache directory, default to ./cache/.
scripts/cola_sft.py:36
next →
1–100 of 221, ranked by callers