MCPcopy Create free account

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

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

↓ 1 callersMethodhandle_completion
Generate a response to a prompt and send it to the client in a single batch. Args: prompt (List[int]): The tokenized pro
mlx_lm/server.py:1368
↓ 1 callersMethodhandle_health_check
Handle a GET request for the /health endpoint.
mlx_lm/server.py:1633
↓ 1 callersMethodhandle_models_request
Handle a GET request for the /v1/models endpoint.
mlx_lm/server.py:1643
↓ 1 callersMethodhf_tokens
(self)
mlx_lm/gguf.py:55
↓ 1 callersFunctionis_mamba
(config: ModelArgs, i: int)
mlx_lm/models/plamo2.py:366
↓ 1 callersMethoditemlen
(self, idx: int)
mlx_lm/tuner/datasets.py:163
↓ 1 callersFunctionl2_norm
(x)
mlx_lm/models/rwkv7.py:36
↓ 1 callersFunctionlaunch
(args)
mlx_lm/share.py:62
↓ 1 callersMethodlayers
(self)
mlx_lm/models/plamo2.py:477
↓ 1 callersFunctionload_config
(model_path: Path)
mlx_lm/utils.py:263
↓ 1 callersFunctionload_custom_hf_dataset
(args, tokenizer: PreTrainedTokenizer)
mlx_lm/tuner/datasets.py:249
↓ 1 callersFunctionload_data
( tokenizer, data_path: str, num_samples: int, sequence_length: int, )
mlx_lm/perplexity.py:19
↓ 1 callersFunctionload_data
( tokenizer, data_path: str, num_samples: int, max_seq_length: int, num_valid_samples: int
mlx_lm/quant/dwq.py:212
↓ 1 callersMethodload_default
(self)
mlx_lm/server.py:383
↓ 1 callersFunctionload_hf_dataset
( data_id: str, tokenizer: PreTrainedTokenizer, config, )
mlx_lm/tuner/datasets.py:222
↓ 1 callersFunctionload_local_dataset
( data_path: Path, tokenizer: PreTrainedTokenizer, config, )
mlx_lm/tuner/datasets.py:205
↓ 1 callersFunctionload_subset
(path)
mlx_lm/tuner/datasets.py:210
↓ 1 callersFunctionlogit_softcap
(softcap, x)
mlx_lm/models/gemma4_text.py:85
↓ 1 callersFunctionlogit_softcap
(softcap, x)
mlx_lm/models/gemma3n.py:373
↓ 1 callersMethodloglikelihood_rolling
Compute full log-likelihood of a string, with no truncation, for perplexity computation - We will use the full max context length of the model
mlx_lm/evaluate.py:264
↓ 1 callersFunctionloss_fn
(params, x, targets, lengths)
mlx_lm/quant/dwq.py:108
↓ 1 callersFunctionmain
()
mlx_lm/cache_prompt.py:83
↓ 1 callersFunctionmain
()
mlx_lm/benchmark.py:79
↓ 1 callersFunctionmain
()
mlx_lm/perplexity.py:101
↓ 1 callersFunctionmain
()
mlx_lm/generate.py:1966
↓ 1 callersFunctionmain
()
mlx_lm/server.py:1751
↓ 1 callersFunctionmain
()
mlx_lm/manage.py:38
↓ 1 callersFunctionmain
()
mlx_lm/lora.py:350
↓ 1 callersFunctionmain
()
mlx_lm/fuse.py:60
↓ 1 callersFunctionmain
()
mlx_lm/convert.py:256
↓ 1 callersFunctionmain
()
mlx_lm/quant/dynamic_quant.py:149
↓ 1 callersFunctionmain
()
mlx_lm/quant/gptq.py:162
↓ 1 callersFunctionmain
()
benchmarks/server_benchmark.py:266
↓ 1 callersFunctionmake_bitlinear_kernel
Custom Metal kernel that performs matrix multiplication directly on packed weights and scales the output. This eliminates the need to sto
mlx_lm/models/bitlinear_layers.py:35
↓ 1 callersMethodmake_byte_decoder
See https://github.com/openai/gpt-2/blob/master/src/encoder.py for the rationale.
mlx_lm/tokenizer_utils.py:229
↓ 1 callersMethodmake_cache
(self)
mlx_lm/models/gemma3n.py:612
↓ 1 callersFunctionmake_divisible
This function is taken from the original tf repo. It ensures that all layers have a channel number that is divisible by the divisor It ca
mlx_lm/models/openelm.py:31
↓ 1 callersFunctionmake_frequency_penalty
Make a frequency penalty processor. Corresponds to the OpenAI option with the same name. Namely, subtracts ``penalty`` from a logit for
mlx_lm/sample_utils.py:341
↓ 1 callersMethodmake_mask
(self, N: int, return_array: bool = False, **kwargs)
mlx_lm/models/cache.py:1011
↓ 1 callersFunctionmake_presence_penalty
Make a presence penalty processor. Corresponds to the OpenAI option with the same name. Namely, subtracts ``penalty`` from a logit if th
mlx_lm/sample_utils.py:315
↓ 1 callersFunctionmake_request
Make a single streaming API request and return - whether the request succeeded - the request start time - the time of ev
benchmarks/server_benchmark.py:115
↓ 1 callersFunctionmake_shards
Splits the weights into smaller shards. Args: weights (dict): Model weights. max_file_size_gb (int): Maximum size of each sh
mlx_lm/utils.py:598
↓ 1 callersFunctionmake_ssm_kernel
()
mlx_lm/models/ssm.py:14
↓ 1 callersMethodmaybe_trim_front
(self)
mlx_lm/models/cache.py:741
↓ 1 callersFunctionmixed_quant_predicate_builder
( recipe: str, model: nn.Module, group_size: int = 64 )
mlx_lm/convert.py:20
↓ 1 callersFunctionmlx_topk
MLX equivalent of torch.topk
mlx_lm/models/gpt_oss.py:38
↓ 1 callersFunctionmoe_gate_select
(gates, router_bias, top_k, routed_scaling_factor, norm_topk_prob)
mlx_lm/models/step3p5.py:99
↓ 1 callersFunctionnormalize_tool
(tool)
mlx_lm/chat_templates/deepseek_v32.py:76
↓ 1 callersFunctionnparams
(m)
mlx_lm/utils.py:201
↓ 1 callersFunctionparse_arguments
()
mlx_lm/fuse.py:15
↓ 1 callersFunctionpipeline_load
(repo, return_config=False)
mlx_lm/utils.py:594
↓ 1 callersFunctionplot_generation
(times, tokens_per_sec, start=None, interval=1.0, width=50)
benchmarks/server_benchmark.py:71
↓ 1 callersMethodpop_prefixes
(self, model: Any, tokens: List[int])
mlx_lm/models/cache.py:1569
↓ 1 callersFunctionpredicate
(p, m, high_threshold)
mlx_lm/quant/dynamic_quant.py:118
↓ 1 callersMethodpredict
(self, x: mx.array)
mlx_lm/models/gemma3n.py:231
↓ 1 callersFunctionprepare_metadata
(config, vocab)
mlx_lm/gguf.py:144
↓ 1 callersFunctionprocess_message_content
Convert message content to a format suitable for `apply_chat_template`. The function operates on messages in place. It converts the 'content
mlx_lm/server.py:118
↓ 1 callersMethodproject_per_layer_inputs
( self, inputs_embeds: mx.array, per_layer_inputs: mx.array, )
mlx_lm/models/gemma3n.py:538
↓ 1 callersMethodpush
(self, model: Any, tokens: List[Any], cache_type: str = "assistant")
mlx_lm/models/cache.py:1638
↓ 1 callersFunctionquant_predicate
(p, m)
mlx_lm/quant/dynamic_quant.py:229
↓ 1 callersFunctionquantize
(w, bits, scales, biases)
mlx_lm/quant/gptq.py:26
↓ 1 callersFunctionquantized_scaled_dot_product_attention
( queries: mx.array, q_keys: tuple[mx.array, mx.array, mx.array], q_values: tuple[mx.array, mx.arr
mlx_lm/models/base.py:64
↓ 1 callersFunctionrecurrent_gla
Recurrence per (b, h): h_t = h_{t-1} * exp(g_t) h_t = h_t + k_t^T @ v_t y_t = (q_t @ h_t) * scale Returns y with shap
mlx_lm/models/bailing_moe_linear.py:63
↓ 1 callersFunctionrelu_squared
(x)
mlx_lm/models/nemotron.py:50
↓ 1 callersFunctionrender_message
( index: int, messages: List[Dict[str, Any]], thinking_mode: str, tools: Any = None, )
mlx_lm/chat_templates/deepseek_v32.py:151
↓ 1 callersMethodreset
(self)
mlx_lm/tokenizer_utils.py:74
↓ 1 callersMethodreset
(self)
mlx_lm/tokenizer_utils.py:129
↓ 1 callersMethodreset
(self)
mlx_lm/tokenizer_utils.py:179
↓ 1 callersMethodrfind_think_end
(self, tokens, start=None, end=None)
mlx_lm/tokenizer_utils.py:385
↓ 1 callersFunctionrnn_scan
(x, a, h0)
mlx_lm/models/recurrent_gemma.py:49
↓ 1 callersFunctionrun
( host: str, port: int, model_provider: ModelProvider, server_class=ThreadingHTTPServer, h
mlx_lm/server.py:1735
↓ 1 callersMethodrun
(rank, size, batch)
tests/test_tuner_trainer.py:26
↓ 1 callersFunctionrun_benchmark
( url: str, api_key: str, model: str, max_tokens: int, concurrency: int, total_request
benchmarks/server_benchmark.py:172
↓ 1 callersFunctionsave_model
Save model weights and metadata index into specified directory.
mlx_lm/utils.py:714
↓ 1 callersFunctionscale_block
( block: nn.Module, configs: list[ScaleConfig], quantize_func: Callable, layer_kwargs: dict,
mlx_lm/quant/awq.py:276
↓ 1 callersFunctionsearch_best_clip
( module: nn.Module, quantize_func: Callable, group_size: int, n_grid: int, max_shrink: fl
mlx_lm/quant/awq.py:307
↓ 1 callersFunctionsearch_best_scale
( layers: list[nn.Module], quantize_func: Callable, block: nn.Module | None, layer_kwargs: dic
mlx_lm/quant/awq.py:196
↓ 1 callersFunctionsegsum
(x, mask=None)
mlx_lm/models/ssm.py:100
↓ 1 callersFunctionsetup_arg_parser
Set up and return the argument parser.
mlx_lm/cache_prompt.py:17
↓ 1 callersFunctionsetup_arg_parser
Set up and return the argument parser.
mlx_lm/benchmark.py:13
↓ 1 callersFunctionsetup_arg_parser
Set up and return the argument parser.
mlx_lm/generate.py:63
↓ 1 callersFunctionsharded_rms_norm
(group)
mlx_lm/models/minimax.py:38
↓ 1 callersFunctionshare_file
(path, file, src, group=None)
mlx_lm/share.py:122
↓ 1 callersFunctionsoftcap
(logits, cap=15.0)
mlx_lm/models/nanochat.py:206
↓ 1 callersFunctionspeculative_generate_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:473
↓ 1 callersMethodssm_step
(self, x, A, state=None)
mlx_lm/models/mamba.py:103
↓ 1 callersMethodssm_step
(self, x, A, state=None)
mlx_lm/models/jamba.py:173
↓ 1 callersFunctionssm_update_kernel
( hidden_states: mx.array, A_log: mx.array, B: mx.array, C: mx.array, D: mx.array, dt:
mlx_lm/models/ssm.py:67
↓ 1 callersMethodstats
(self, stats=None)
mlx_lm/generate.py:1565
↓ 1 callersMethodstats_by_type
(self)
mlx_lm/models/cache.py:1756
↓ 1 callersFunctionstep
(batch, prev_grad, do_update)
mlx_lm/tuner/trainer.py:249
↓ 1 callersFunctionstep
(inputs, targets, lengths, params)
mlx_lm/quant/dwq.py:120
↓ 1 callersMethodstop
(self)
mlx_lm/server.py:221
↓ 1 callersMethodtext
(self)
mlx_lm/tokenizer_utils.py:91
↓ 1 callersFunctionto_batch_cache
(c)
mlx_lm/generate.py:844
↓ 1 callersMethodto_lora
(self, r: int = 8, dropout: float = 0.0, scale: float = 20.0)
mlx_lm/models/afm7.py:150
↓ 1 callersMethodto_quantized
(self, group_size: int = 64, bits: int = 4)
mlx_lm/models/afm7.py:142
↓ 1 callersMethodto_quantized
(self, group_size: int = 64, bits: int = 4, mode: str = "affine")
mlx_lm/models/switch_layers.py:131
↓ 1 callersFunctiontool_calls_from_openai_format
(tool_calls)
mlx_lm/chat_templates/deepseek_v32.py:84
↓ 1 callersMethodtool_parser
(self)
mlx_lm/tokenizer_utils.py:447
← previousnext →501–600 of 2,622, ranked by callers