Code
Hub
Workspaces
Following
Trending
Connect
MCP
copy
Create free account
hub
/
github.com/ml-explore/mlx-lm
/ functions
Functions
2,622 in github.com/ml-explore/mlx-lm
⨍
Functions
2,622
◇
Types & classes
816
↳
Endpoints
9
↓ 4 callers
Function
load_dataset
(args, tokenizer: PreTrainedTokenizer)
mlx_lm/tuner/datasets.py:309
↓ 4 callers
Method
load_weights
(self, weights, **kwargs)
tests/test_utils.py:105
↓ 4 callers
Method
make_mask
(self, *args, **kwargs)
mlx_lm/models/cache.py:393
↓ 4 callers
Function
mse
(x, y)
mlx_lm/quant/awq.py:154
↓ 4 callers
Function
quantize_model
Applies quantization to the model weights. Args: model (nn.Module): The model to be quantized. config (dict): Model configur
mlx_lm/utils.py:774
↓ 4 callers
Function
rprint
(*args, **kwargs)
mlx_lm/benchmark.py:89
↓ 4 callers
Function
run_layer
( layer: nn.Module, x: mx.array, indices: mx.array | None = None, batch_size: int = 32, **
mlx_lm/quant/awq.py:165
↓ 4 callers
Method
save_data
(self, data)
tests/test_datsets.py:31
↓ 4 callers
Method
set_linear
Set the self.linear layer and recompute self.m.
mlx_lm/tuner/dora.py:85
↓ 4 callers
Function
yarn_find_correction_dim
( num_rotations, dim, base=10000, max_position_embeddings=2048 )
mlx_lm/models/deepseek_v2.py:48
↓ 3 callers
Method
__init__
(self, args: ModelArgs)
mlx_lm/models/mamba.py:174
↓ 3 callers
Method
__init__
(self, args: ModelArgs)
mlx_lm/models/olmo.py:162
↓ 3 callers
Method
__init__
( self, dims, traditional=False, max_position_embeddings=2048, base=10
mlx_lm/models/rope_utils.py:129
↓ 3 callers
Method
_dequantized_weight
Return the weight of linear layer and dequantize it if is quantized
mlx_lm/tuner/dora.py:92
↓ 3 callers
Function
_int_or_list
(arg, idx)
mlx_lm/models/hunyuan.py:45
↓ 3 callers
Method
_make_state_machine
Make a new SequenceStateMachine or fetch it if we 've made it before. Return also a dictionary that maps the token sequences in the state
mlx_lm/server.py:626
↓ 3 callers
Function
_normalize_arguments
( func_name: str, arguments: dict[str, Any], tools: list[Any] | None, string_args: set[str] |
mlx_lm/tool_parsers/glm47.py:56
↓ 3 callers
Method
_tokenize
(self, texts)
mlx_lm/evaluate.py:140
↓ 3 callers
Function
can_trim_prompt_cache
Check if model's cache can be trimmed.
mlx_lm/models/cache.py:88
↓ 3 callers
Function
compute_bits_per_weight
(model)
mlx_lm/utils.py:210
↓ 3 callers
Function
convert
( hf_path: str, mlx_path: str = "mlx_model", quantize: bool = False, q_group_size: Optional[in
mlx_lm/convert.py:85
↓ 3 callers
Function
create_attention_mask
( N: int, offset: int, return_array: bool, window_size: Optional[int] )
mlx_lm/models/cache.py:114
↓ 3 callers
Function
create_dataset
( data, tokenizer: PreTrainedTokenizer, config, )
mlx_lm/tuner/datasets.py:175
↓ 3 callers
Function
create_hf_dataset
(dataset_name, config, split, hf_config)
mlx_lm/tuner/datasets.py:252
↓ 3 callers
Function
gated_delta_ops
Ops-based reference implementation for prompt prefill (sequential loop). Supports both scalar and vectorized gating. Shapes: - q,
mlx_lm/models/gated_delta.py:214
↓ 3 callers
Method
generate_response
Generate a single response packet based on response type (stream or not), completion type and parameters. Args:
mlx_lm/server.py:1259
↓ 3 callers
Function
grad_checkpoint
Update all instances of type(layer) to use gradient checkpointing.
mlx_lm/tuner/trainer.py:25
↓ 3 callers
Method
is_trimmable
(self)
mlx_lm/models/cache.py:375
↓ 3 callers
Function
load_model
Load and initialize the model from a given path. Args: model_path (Path): The path to load the model from. lazy (bool): If F
mlx_lm/utils.py:282
↓ 3 callers
Function
main
()
mlx_lm/chat.py:90
↓ 3 callers
Method
make_state
(self)
mlx_lm/generate.py:986
↓ 3 callers
Method
next
Get the next batch of responses. Returns: Tuple of prompt processing responses and generation responses.
mlx_lm/generate.py:1847
↓ 3 callers
Function
percentile
(data, percent)
benchmarks/server_benchmark.py:97
↓ 3 callers
Function
rprint
(*args, **kwargs)
mlx_lm/quant/dwq.py:86
↓ 3 callers
Function
setup_arg_parser
Set up and return the argument parser.
mlx_lm/chat.py:21
↓ 3 callers
Method
stop_and_join
(self)
mlx_lm/server.py:454
↓ 3 callers
Function
submodule_from_key
(module, key)
mlx_lm/quant/awq.py:158
↓ 3 callers
Method
update_and_fetch
(self, keys, values)
mlx_lm/models/cache.py:942
↓ 3 callers
Function
upload_to_hub
Uploads the model to Hugging Face hub. Args: path (str): Local path to the model. upload_repo (str): Name of the HF repo to
mlx_lm/utils.py:648
↓ 3 callers
Function
validate
(params, it)
mlx_lm/quant/dwq.py:128
↓ 2 callers
Method
__call__
(self, x)
mlx_lm/models/afm7.py:277
↓ 2 callers
Method
__init__
( self, input_dims: int, output_dims: int, r: int = 8, dropout: float
mlx_lm/tuner/lora.py:67
↓ 2 callers
Method
__init__
(self, args: ModelArgs)
mlx_lm/models/longcat_flash_ngram.py:173
↓ 2 callers
Function
_build_trie
Build an Aho-Corasick trie from the provided sequences See https://en.wikipedia.org/wiki/Aho–Corasick_algorithm .
mlx_lm/generate.py:896
↓ 2 callers
Function
_clear_cache
(threshold: int)
mlx_lm/tuner/trainer.py:20
↓ 2 callers
Function
_compute_targets
(data, path, split)
mlx_lm/quant/dwq.py:40
↓ 2 callers
Method
_continued_generation_test_helper
(self, model)
tests/test_generate.py:588
↓ 2 callers
Method
_convert_to_serializable
(self, data: dict)
mlx_lm/tuner/callbacks.py:47
↓ 2 callers
Method
_convert_to_serializable
(self, data: dict)
mlx_lm/tuner/callbacks.py:85
↓ 2 callers
Method
_custom_convolution
(self, u, weights, state=None)
mlx_lm/models/baichuan_m1.py:75
↓ 2 callers
Function
_extract_name
Extract name from quoted string.
mlx_lm/tool_parsers/minimax_m2.py:14
↓ 2 callers
Function
_format_top_logprobs
Returns info dicts for the top `top_n` tokens from `logprobs`
mlx_lm/server.py:426
↓ 2 callers
Function
_gather_sort
(x, indices)
mlx_lm/models/switch_layers.py:12
↓ 2 callers
Method
_get_per_layer_inputs
( self, input_ids: Optional[mx.array], input_embeddings: Optional[mx.array] = None,
mlx_lm/models/gemma4_text.py:444
↓ 2 callers
Method
_is_batchable
(self, args)
mlx_lm/server.py:685
↓ 2 callers
Method
_is_quantized
(self)
mlx_lm/tuner/dora.py:108
↓ 2 callers
Method
_log_cache_stats
(self)
mlx_lm/server.py:461
↓ 2 callers
Function
_make_logits_processors
(args)
mlx_lm/server.py:414
↓ 2 callers
Function
_make_sampler
(args, tokenizer)
mlx_lm/server.py:399
↓ 2 callers
Function
_match
(a, b)
mlx_lm/tokenizer_utils.py:508
↓ 2 callers
Method
_maybe_trim_space
(self, current_text)
mlx_lm/tokenizer_utils.py:195
↓ 2 callers
Function
_model_call
(input_tokens: mx.array, input_embeddings: Optional[mx.array])
mlx_lm/generate.py:388
↓ 2 callers
Method
_next
(self)
mlx_lm/generate.py:1769
↓ 2 callers
Function
_parse_single
Parse a single call:name{args} regex match into a tool call dict.
mlx_lm/tool_parsers/gemma4.py:46
↓ 2 callers
Function
_parse_single_tool
(text: str)
mlx_lm/tool_parsers/kimi_k2.py:40
↓ 2 callers
Method
_postprocess_text
(self, text)
mlx_lm/tokenizer_utils.py:488
↓ 2 callers
Function
_prefill
(model, cache, y)
mlx_lm/generate.py:579
↓ 2 callers
Method
_preprocess_text
(self, text)
mlx_lm/tokenizer_utils.py:485
↓ 2 callers
Function
_process_and_sample
(tokens, logits)
mlx_lm/generate.py:544
↓ 2 callers
Function
_rewind_cache
(num_draft, num_accept)
mlx_lm/generate.py:589
↓ 2 callers
Function
_scatter_unsort
(x, inv_order, shape=None)
mlx_lm/models/switch_layers.py:20
↓ 2 callers
Method
_score_fn
(self, inputs, cache: Optional[Any] = None, step_size: int = 2048)
mlx_lm/evaluate.py:107
↓ 2 callers
Method
_set_cors_headers
(self)
mlx_lm/server.py:1075
↓ 2 callers
Method
_share_object
(self, obj)
mlx_lm/server.py:484
↓ 2 callers
Method
_step
Perform a single generation step. Returns: Tuple of token list and logprobs list.
mlx_lm/generate.py:1320
↓ 2 callers
Method
_temporal_order
Rearrange the cache into temporal order.
mlx_lm/models/cache.py:1159
↓ 2 callers
Method
_tokenize
Tokenize a request and split the prompt into segments. Returns a tuple * prompt - Full list of tokens * segments - A lis
mlx_lm/server.py:516
↓ 2 callers
Method
_try_flush
(self, force=False)
mlx_lm/tokenizer_utils.py:135
↓ 2 callers
Function
_unpack_awq_weights
(qweight: mx.array)
mlx_lm/utils.py:72
↓ 2 callers
Function
apply_rotary_emb
Apply RoPE with blocked layout. Args: x: Input tensor in (B, H, T, D) format offset: Position offset for KV caching base
mlx_lm/models/nanochat.py:32
↓ 2 callers
Function
chat_template_fn
(**extra_kwargs)
mlx_lm/evaluate.py:58
↓ 2 callers
Method
check_tokenizer
(self, tokenizer)
tests/test_tokenizers.py:18
↓ 2 callers
Function
clamped_swiglu
(x, gate, limit)
mlx_lm/models/step3p5.py:19
↓ 2 callers
Function
clip_residual
(x, y)
mlx_lm/models/gemma3_text.py:126
↓ 2 callers
Function
compute_dt
(dt, dt_bias, time_step_limit)
mlx_lm/models/ssm.py:8
↓ 2 callers
Method
compute_router_modalities
(self, x: mx.array)
mlx_lm/models/gemma3n.py:226
↓ 2 callers
Method
convert_ids_to_tokens
(self, t)
tests/test_server.py:293
↓ 2 callers
Function
convert_to_gguf
( model_path: Union[str, Path], weights: dict, config: dict, output_file_path: str, )
mlx_lm/gguf.py:261
↓ 2 callers
Function
dequantize_model
Dequantize the quantized layers in the model. Args: model (nn.Module): The model with quantized layers. Returns: nn.Mod
mlx_lm/utils.py:853
↓ 2 callers
Method
empty
( cls, model: nn.Module, fallback_sampler: Callable[[mx.array], mx.array], )
mlx_lm/generate.py:1467
↓ 2 callers
Method
empty
(self)
mlx_lm/models/cache.py:400
↓ 2 callers
Function
error
(*args, **kwargs)
mlx_lm/share.py:57
↓ 2 callers
Function
eval_ppl
(model, data, batch_size=8)
mlx_lm/quant/dynamic_quant.py:25
↓ 2 callers
Method
extract_cache
(self, uids)
mlx_lm/generate.py:1684
↓ 2 callers
Function
find_last_user_index
(messages: List[Dict[str, Any]])
mlx_lm/chat_templates/deepseek_v32.py:142
↓ 2 callers
Method
from_path
(cls, root, path)
mlx_lm/share.py:46
↓ 2 callers
Method
from_rms_norm
( cls, norm_module, *, group: Optional[mx.distributed.Group] = None )
mlx_lm/models/minimax.py:75
↓ 2 callers
Function
gated_delta_kernel
( q: mx.array, k: mx.array, v: mx.array, g: mx.array, beta: mx.array, state: mx.array,
mlx_lm/models/gated_delta.py:171
↓ 2 callers
Function
geglu
(gate, x)
mlx_lm/models/gemma4_text.py:95
↓ 2 callers
Function
get_files
(path)
mlx_lm/share.py:104
← previous
next →
201–300 of 2,622, ranked by callers