MCPcopy Index your code

hub / github.com/ml-explore/mlx-lm / functions

Functions2,622 in github.com/ml-explore/mlx-lm

↓ 191 callersMethodget
(self, model: Any, tokens: List[int])
mlx_lm/models/cache.py:1549
↓ 140 callersMethodpop
(self, model: Any, tokens: List[int])
mlx_lm/models/cache.py:1555
↓ 132 callersMethodupdate_and_fetch
(self, keys, values)
mlx_lm/models/cache.py:333
↓ 125 callersFunctioncreate_attention_mask
( h, cache=None, window_size: Optional[int] = None, return_array: bool = False )
mlx_lm/models/base.py:45
↓ 92 callersMethodsplit
(self, indices: List[int])
mlx_lm/generate.py:1096
↓ 89 callersMethodmodel
(self)
mlx_lm/models/kimi_k25.py:71
↓ 89 callersFunctionscaled_dot_product_attention
( queries, keys, values, cache, scale: float, mask: Optional[mx.array], sinks: Opt
mlx_lm/models/base.py:108
↓ 75 callersFunctionswiglu
(x_linear, x_glu, alpha: float = 1.702, limit: float = 7.0)
mlx_lm/models/gpt_oss.py:49
↓ 72 callersMethodas_linear
(self, x)
mlx_lm/tuner/dora.py:212
↓ 59 callersMethodencode
(self, text, **kwargs)
mlx_lm/tokenizer_utils.py:491
↓ 59 callersMethodsize
(self)
mlx_lm/models/cache.py:357
↓ 51 callersMethodmodel_test_runner
(self, model, model_type, vocab_size, num_layers)
tests/test_models.py:342
↓ 44 callersFunctioninitialize_rope
( dims, base, traditional, scaling_config: Optional[dict] = None, max_position_embeddings:
mlx_lm/models/rope_utils.py:235
↓ 33 callersMethodjoin
(self)
mlx_lm/server.py:458
↓ 32 callersMethodrank
(self)
tests/test_tuner_trainer.py:15
↓ 30 callersMethodapply_chat_template
(self, *args, tokenize=True, **kwargs)
mlx_lm/tokenizer_utils.py:335
↓ 25 callersFunctionload
Load the model and tokenizer from a given path or a huggingface repository. Args: path_or_hf_repo (Path): The path or the huggingfac
mlx_lm/utils.py:453
↓ 23 callersMethodfetch_nearest_cache
(self, model: Any, tokens: List[int])
mlx_lm/models/cache.py:1674
↓ 23 callersMethodinsert_cache
( self, model: Any, tokens: List[int], prompt_cache: List[Any], *,
mlx_lm/models/cache.py:1696
↓ 22 callersMethodinsert
( self, prompts: List[List[int]], max_tokens: Optional[List[int]] = None, cach
mlx_lm/generate.py:1585
↓ 21 callersMethod_validate
( self, name, expected_type, min_val=None, max_val=None, optio
mlx_lm/server.py:1204
↓ 21 callersMethodmerge
(_, caches)
mlx_lm/models/cache.py:397
↓ 21 callersMethodupdate_and_fetch
(self, keys, values)
mlx_lm/models/cache.py:512
↓ 19 callersMethodextend
In-place extend this cache with the other cache.
mlx_lm/models/cache.py:857
↓ 19 callersMethodnext_generated
Return only generated tokens ignoring batch generation responses. Returns: List of GenerationBatch.Response objects
mlx_lm/generate.py:1857
↓ 17 callersMethodadd
(self, model: Any, tokens: List[int], value: Any)
mlx_lm/models/cache.py:1536
↓ 17 callersMethoddecode
(self, *args, **kwargs)
mlx_lm/tokenizer_utils.py:497
↓ 17 callersMethodpad
(c)
mlx_lm/models/cache.py:1056
↓ 15 callersFunctioncreate_causal_mask
( N: int, offset: int = 0, window_size: Optional[int] = None, right_padding: Optional[mx.array
mlx_lm/models/base.py:24
↓ 15 callersFunctionmake_prompt_cache
Construct the model's cache for use in generation. This function will defer the cache construction to the model if it has a ``make_cache
mlx_lm/models/cache.py:15
↓ 14 callersFunctionstream_generate
A generator producing text based on the given prompt from the model. Args: model (nn.Module): The model to use for generation.
mlx_lm/generate.py:657
↓ 13 callersMethodfrom_dict
(cls, params)
mlx_lm/models/qwen3_5.py:361
↓ 13 callersMethodload
(path: Path)
mlx_lm/gguf.py:98
↓ 12 callersFunctioncreate_ssm_mask
(h, cache=None)
mlx_lm/models/base.py:58
↓ 12 callersFunctiongenerate_step
A generator producing token ids based on the given prompt from the model. Args: prompt (mx.array): The input prompt. model (
mlx_lm/generate.py:307
↓ 12 callersFunctionload_prompt_cache
Load a prompt cache from a file. Args: file_name (str): The ``.safetensors`` file name. return_metadata (bool): Whether or n
mlx_lm/models/cache.py:62
↓ 12 callersFunctionsave_prompt_cache
Save a pre-computed prompt cache to a file. Args: file_name (str): The ``.safetensors`` file name. cache (List[Any]): The mo
mlx_lm/models/cache.py:43
↓ 12 callersMethodstream
(self)
mlx_lm/generate.py:1552
↓ 11 callersMethod_set_completion_headers
(self, status_code: int = 200)
mlx_lm/server.py:1086
↓ 11 callersMethodattention
( self, queries: mx.array, keys: mx.array, values: mx.array, mask: Opt
mlx_lm/models/iquestloopcoder.py:104
↓ 11 callersFunctionmake_logits_processors
Make logits processors for use with ``generate_step``. Args: repetition_penalty (float, optional): A (sign-aware) multiplicative
mlx_lm/sample_utils.py:72
↓ 11 callersFunctiontrim_prompt_cache
Trim the model's cache by the given number of tokens. This function will trim the cache if possible (in-place) and return the number of
mlx_lm/models/cache.py:95
↓ 10 callersMethodadvance
(self, N)
mlx_lm/models/cache.py:685
↓ 10 callersFunctioncan_run_metal
()
mlx_lm/tuner/losses.py:7
↓ 10 callersFunctionload_tokenizer
Load a huggingface tokenizer and try to infer the type of streaming detokenizer to use.
mlx_lm/utils.py:429
↓ 10 callersMethodupdate_and_fetch
(self, keys, values)
mlx_lm/models/cache.py:1267
↓ 9 callersMethod__init__
(self, args: ModelArgs)
mlx_lm/models/afm7.py:267
↓ 9 callersMethod__init__
(self, args: ModelArgs)
mlx_lm/models/granitemoehybrid.py:468
↓ 9 callersMethodextend
Extend this batch with another generation batch.
mlx_lm/generate.py:1293
↓ 9 callersFunctiongenerate
Generate a complete response from the model. Args: model (nn.Module): The language model. tokenizer (PreTrainedTokenizer): The
mlx_lm/generate.py:756
↓ 9 callersFunctionrun
(args, training_callback: TrainingCallback = None)
mlx_lm/lora.py:319
↓ 9 callersMethodsearch
(self, model: Any, tokens: List[int])
mlx_lm/models/cache.py:1578
↓ 9 callersMethodsize
(self)
tests/test_tuner_trainer.py:18
↓ 8 callersMethod__init__
(self, args: ModelArgs, intermediate_size: Optional[int] = None)
mlx_lm/models/bailing_moe_linear.py:115
↓ 8 callersMethod__init__
(self, args: ModelArgs)
mlx_lm/models/step3p5.py:377
↓ 8 callersMethod__init__
(self, config: TextConfig, layer_idx: int = 0)
mlx_lm/models/gemma3n.py:172
↓ 8 callersMethod__init__
(self, args: ModelArgs)
mlx_lm/models/nemotron_h.py:510
↓ 8 callersFunctionaddcmul
(x, y, z)
mlx_lm/models/rwkv7.py:31
↓ 8 callersMethodfrom_base
( linear: nn.Linear, r: int = 8, dropout: float = 0.0, scale: float = 20.0,
mlx_lm/tuner/dora.py:11
↓ 8 callersMethodfrom_dict
(cls, config)
tests/test_utils.py:110
↓ 8 callersMethodto_quantized
(self, group_size: int = 64, bits: int = 4)
mlx_lm/models/cache.py:383
↓ 7 callersMethod__init__
(self, args: ModelArgs)
mlx_lm/models/qwen3_next.py:425
↓ 7 callersMethod__init__
( self, width: int, num_heads: int, )
mlx_lm/models/recurrent_gemma.py:107
↓ 7 callersMethod__init__
(self, config: ModelArgs, layer_idx: int = 0)
mlx_lm/models/gemma4_text.py:100
↓ 7 callersMethod__init__
(self, args: ModelArgs)
mlx_lm/models/kimi_linear.py:459
↓ 7 callersMethod__init__
(self, d_model: int, ffn_dim: int)
mlx_lm/models/dbrx.py:104
↓ 7 callersMethod__init__
(self, config: ModelArgs)
mlx_lm/models/deepseek_v32.py:479
↓ 7 callersMethod__init__
(self, dim, hidden_dim)
mlx_lm/models/hunyuan.py:145
↓ 7 callersMethod__init__
(self, config: ModelArgs)
mlx_lm/models/plamo2.py:296
↓ 7 callersMethod__init__
(self, config: ModelArgs)
mlx_lm/models/deepseek_v2.py:415
↓ 7 callersFunctionapply_top_p
Apply top-p (nucleus) sampling to logits. Args: logprobs: A vector of log probabilities. top_p: The cumulative probability t
mlx_lm/sample_utils.py:205
↓ 7 callersMethodfuse
(self, dequantize: bool = False)
mlx_lm/tuner/dora.py:32
↓ 7 callersMethodmake_mask
( self, N: int, window_size: Optional[int] = None, return_array: bool = False )
mlx_lm/models/cache.py:554
↓ 7 callersFunctionmake_sampler
Make a sampler function for use with ``generate_step``. Args: temp (float): The temperature for sampling, if 0 the argmax is used.
mlx_lm/sample_utils.py:10
↓ 7 callersFunctionrprint
(*args, **kwargs)
mlx_lm/chat.py:99
↓ 7 callersMethodsanitize
(self, weights)
mlx_lm/models/glm.py:178
↓ 6 callersMethod__init__
(self, args: ModelArgs, dim: int, hidden_dim: int)
mlx_lm/models/phixtral.py:88
↓ 6 callersMethod__init__
(self, config: ModelArgs, intermediate_size: Optional[int] = None)
mlx_lm/models/lfm2_moe.py:175
↓ 6 callersMethod__init__
( self, config: ModelArgs, hidden_size: int = None, intermediate_size: int = None )
mlx_lm/models/glm4_moe.py:112
↓ 6 callersMethod__init__
( self, config: ModelArgs, hidden_size: int = None, intermediate_size: int = None )
mlx_lm/models/mimo_v2_flash.py:128
↓ 6 callersMethod__init__
(self, args: ModelArgs, intermediate_size: Optional[int] = None)
mlx_lm/models/exaone_moe.py:114
↓ 6 callersMethod__init__
(self, config: ModelArgs)
mlx_lm/models/glm4_moe_lite.py:366
↓ 6 callersMethod__init__
( self, input_dim: int, output_dim: int, low_rank_dim: int, bias: Opti
mlx_lm/models/rwkv7.py:163
↓ 6 callersMethod__init__
(self, config: ModelArgs)
mlx_lm/models/deepseek_v3.py:365
↓ 6 callersMethod__init__
(self, args: ModelArgs, intermediate_size: int = None)
mlx_lm/models/llama4.py:138
↓ 6 callersMethod__init__
(self, args: ModelArgs)
mlx_lm/models/dots1.py:272
↓ 6 callersMethod__init__
(self, args)
mlx_lm/models/falcon_h1.py:443
↓ 6 callersMethod__init__
(self, config: ModelArgs)
mlx_lm/models/deepseek.py:229
↓ 6 callersMethod__init__
(self, args: ModelArgs)
mlx_lm/models/jamba.py:318
↓ 6 callersMethod__init__
(self, args: ModelArgs)
mlx_lm/models/bailing_moe.py:325
↓ 6 callersMethod__init__
(self, args: ModelArgs)
mlx_lm/models/longcat_flash.py:356
↓ 6 callersMethod__init__
(self, args: ModelArgs, intermediate_size: Optional[int] = None)
mlx_lm/models/afmoe.py:138
↓ 6 callersFunction_deserialize
(value: str)
mlx_lm/tool_parsers/glm47.py:42
↓ 6 callersFunction_get_string_arg_names
(tool_name: str, tools: list[Any] | None)
mlx_lm/tool_parsers/glm47.py:25
↓ 6 callersMethodclose
(self)
mlx_lm/generate.py:1555
↓ 6 callersFunctiondynamic_roll
(x, shifts, axis)
mlx_lm/models/cache.py:903
↓ 6 callersFunctioniterate_batches
( dataset, batch_size, max_seq_length, loop=False, seed=None, comm_group=None, )
mlx_lm/tuner/trainer.py:102
↓ 6 callersMethodmake_cache
(self)
mlx_lm/models/afm7.py:385
↓ 6 callersMethodprocess
(self, d)
mlx_lm/tuner/datasets.py:26
↓ 6 callersFunctionrms_norm
Functional RMSNorm with no learnable parameters.
mlx_lm/models/nanochat.py:27
next →1–100 of 2,622, ranked by callers