pub struct MdlmConfig {
pub hidden_dim: usize,
pub n_blocks: usize,
pub n_heads: usize,
pub head_dim: usize,
pub cond_dim: usize,
pub vocab_size: usize,
pub model_length: usize,
pub mlp_ratio: usize,
pub rope_theta: f64,
pub norm_eps: f64,
pub mask_token_id: u32,
pub time_conditioning: bool,
}Expand description
MDLM masked-diffusion model configuration.
Parsed from the upstream config.json. The released mdlm-owt
checkpoint is time-independent (time_conditioning = false), so the
DiT conditioning vector is a constant computed once at load time.
Fields§
Hidden dimension (d_model; upstream key hidden_dim).
n_blocks: usizeNumber of DiT blocks (upstream key n_blocks).
n_heads: usizeNumber of attention heads (upstream key n_heads).
head_dim: usizePer-head dimension (hidden_dim / n_heads).
cond_dim: usizeConditioning dimension fed to the adaLN modulation (upstream key cond_dim).
vocab_size: usizeVocabulary size, including the [MASK] token (upstream key vocab_size).
model_length: usizeMaximum sequence length (upstream key model_length).
mlp_ratio: usizeFeed-forward expansion ratio (MDLM uses 4; not stored in config.json).
rope_theta: f64Rotary base frequency (MDLM hard-codes 10000).
norm_eps: f64LayerNorm epsilon (MDLM uses 1e-5).
mask_token_id: u32Token id of the absorbing [MASK] state (vocab_size - 1).
time_conditioning: boolWhether the network conditions on diffusion time. The released
checkpoint sets this false, so the conditioning vector is constant.
Implementations§
Source§impl MdlmConfig
impl MdlmConfig
Sourcepub fn from_hf_config(config: &Value) -> Result<Self>
pub fn from_hf_config(config: &Value) -> Result<Self>
Parse an MdlmConfig from a HuggingFace config.json value.
§Errors
Returns MIError::Config if a required key
(hidden_dim, n_blocks, n_heads, cond_dim, vocab_size) is
missing or not a non-negative integer, or if hidden_dim is not
divisible by n_heads.
Trait Implementations§
Source§impl Clone for MdlmConfig
impl Clone for MdlmConfig
Source§fn clone(&self) -> MdlmConfig
fn clone(&self) -> MdlmConfig
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl Freeze for MdlmConfig
impl RefUnwindSafe for MdlmConfig
impl Send for MdlmConfig
impl Sync for MdlmConfig
impl Unpin for MdlmConfig
impl UnsafeUnpin for MdlmConfig
impl UnwindSafe for MdlmConfig
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> ErasedDestructor for Twhere
T: 'static,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more