MCPcopy Create free account

hub / github.com/intel/neural-compressor / functions

Functions4,695 in github.com/intel/neural-compressor

↓ 2 callersMethodload_dataset
Loads dataset.
neural_compressor/evaluation/hf_eval/datasets/cnn_dailymail.py:138
↓ 2 callersFunctionload_first_layer_only
Load first layer only. Args: user_model (torch.nn.Module): input model model_name (str): model name or path
neural_compressor/torch/algorithms/layer_wise/utils.py:254
↓ 2 callersFunctionload_image
(image_path, target_size)
test/jax/jax_test_utility.py:106
↓ 2 callersFunctionload_image
(path)
examples/jax/keras/vit/use_static.py:32
↓ 2 callersFunctionload_img
(path, resize_shape=(256, 256), crop_ratio=0.1)
examples/tensorflow/style_transfer/arbitrary_style_transfer/quantization/ptq/main.py:53
↓ 2 callersFunctionload_module
Load all named parameters of module. Args: model (torch.nn.module): torch model. module_name (str): module name. path (st
neural_compressor/torch/algorithms/layer_wise/utils.py:238
↓ 2 callersFunctionload_non_persistent_buffers
Load all non-persistent buffers into the model. Args: model (torch.nn.Module): PyTorch model non_persistent_buffers (dict): A dic
neural_compressor/torch/utils/utility.py:647
↓ 2 callersFunctionload_scale_method_config_by_mod_map
Loads scale_method_config_by_mod_map from a JSON file and reconstructs the original structure. Returns: dict[str, dict[CfgStr, ScaleMethodCon
neural_compressor/torch/algorithms/fp8_quant/_core/scale_methods/scale_method_config.py:331
↓ 2 callersFunctionload_tensor
Load a tensor from bin file with given tensor name.
neural_compressor/torch/algorithms/layer_wise/utils.py:141
↓ 2 callersFunctionload_tensor_from_safetensors
Load a tensor from safetensors file with given tensor name.
neural_compressor/torch/algorithms/layer_wise/utils.py:162
↓ 2 callersFunctionmain
()
examples/pytorch/nlp/huggingface_models/question-answering/quantization/static_quant/ipex/run_qa.py:237
↓ 2 callersFunctionmake_contiguous
(model)
neural_compressor/transformers/quantization/utils.py:551
↓ 2 callersFunctionmake_quant_cfg
Build a lightweight namespace mimicking the attributes QuantLinear._setup expects.
test/torch/algorithms/qat/test_quant_utils.py:42
↓ 2 callersFunctionmeasure_control_to_state_dict
(mcd)
neural_compressor/torch/algorithms/fp8_quant/_core/save_measure/save_files.py:43
↓ 2 callersMethodmeasure_input_and_matmul
(self, input)
neural_compressor/torch/algorithms/fp8_quant/_quant_common/helper_modules.py:446
↓ 2 callersFunctionmetric_max_over_ground_truths
Calculate the max metric for each ground truth. For each answer in ground_truths, evaluate the metric of prediction with this answer, and ret
examples/tensorflow/nlp/bert_large_squad_model_zoo/quantization/ptq/data_process.py:31
↓ 2 callersMethodmodel
Return model itself.
neural_compressor/tensorflow/utils/model_wrappers.py:802
↓ 2 callersFunctionmodel_forward_per_sample
Perform a forward pass of the model on a single sample. Args: model (torch.nn.Module): The model to be applied. sample (Tenso
neural_compressor/torch/algorithms/smooth_quant/utility.py:629
↓ 2 callersMethodopwise_rank
Rank the final losses of operations based on their ratio with respect to operation output norm. Returns: dict: A dictionary of
neural_compressor/torch/algorithms/smooth_quant/utility.py:1695
↓ 2 callersMethodpack_tensor
Pack tensor.
neural_compressor/torch/algorithms/weight_only/modules.py:580
↓ 2 callersMethodpack_tensor
Pack tensor.
neural_compressor/torch/algorithms/weight_only/modules.py:826
↓ 2 callersMethodpad_input
(self, input)
examples/tensorflow/nlp/large_language_models/quantization/ptq/smoothquant/benchmark.py:114
↓ 2 callersMethodpad_input
(self, input)
examples/tensorflow/nlp/large_language_models/quantization/ptq/smoothquant/main.py:60
↓ 2 callersFunctionparse_cfgs
Parse configs. Args: cfgs (dict): the input configs. Returns: ops_name (list): list of op names. tune_cfg (di
neural_compressor/torch/algorithms/static_quant/utility.py:513
↓ 2 callersMethodparse_quant_config
Parse the quant_config to tune_cfg. Args: quant_config: a quantization configuration. model: the fp32 model to be qua
neural_compressor/tensorflow/algorithms/static_quant/tensorflow.py:540
↓ 2 callersMethodpersistent_load
(self, pid)
neural_compressor/torch/algorithms/layer_wise/modified_pickle.py:1228
↓ 2 callersMethodpost_init_cpu
r"""Safety checker that arguments are correct.
neural_compressor/transformers/utils/quantization_config.py:69
↓ 2 callersMethodpost_init_xpu
r""" Safety checker that arguments are correct - also replaces some NoneType arguments with their default values.
neural_compressor/transformers/utils/quantization_config.py:97
↓ 2 callersMethodprepare
Prepares a given model for quantization. Insert observers into the model so that it can monitor the input and output tensors during calibra
neural_compressor/torch/algorithms/base_algorithm.py:55
↓ 2 callersMethodprepare
Prepares a given model for quantization. Will return model directly in MX quant algorithm. Args: model (torch.nn.Module)
neural_compressor/torch/algorithms/mx_quant/mx.py:112
↓ 2 callersMethodprepare
Prepares the model for calibration. Create the `quantizer` according to the `quant_config`, and insert the observers accordingly. Ar
neural_compressor/torch/algorithms/pt2e_quant/core.py:65
↓ 2 callersMethodprepare
Prepares a given model for quantization. Args: model (torch.nn.Module): raw fp32 model or prepared model. example
neural_compressor/torch/algorithms/static_quant/static_quant.py:66
↓ 2 callersFunctionprepare_Dataset
()
examples/tensorflow/graph_networks/graphsage/quantization/ptq/main.py:58
↓ 2 callersFunctionprepare_attention_mask_for_generation
Generate attention_mask from input_ids. Args: inputs (tf.Tensor): The tensor of input_ids. Returns: attention_mask (tf.Tenso
examples/tensorflow/nlp/large_language_models/quantization/ptq/gpt-j/main.py:186
↓ 2 callersFunctionprepare_deserialized_quantized_model
Transform a loaded quantized model. It prepares the model for inference by preparing the quantized layers. Args: model (keras.Model):
neural_compressor/jax/quantization/saving.py:494
↓ 2 callersMethodprepare_layer_wise
Prepare for layer-wise or blockwise quantization, including registering hooks and setting up the model path. Args: model_path (st
neural_compressor/torch/algorithms/weight_only/gptq.py:286
↓ 2 callersFunctionpreprocess
Preprocess the data by tokenizing.
neural_compressor/evaluation/hf_eval/datasets/cnn_dailymail.py:104
↓ 2 callersFunctionpreprocess_quant_config
Preprocess the quantization configuration. Args: model (torch.nn.Module): Float model to be quantized. quant_config (BaseConfig |
neural_compressor/torch/quantization/quantize.py:68
↓ 2 callersMethodprint
(self, batch)
examples/pytorch/image_recognition/torchvision_models/quantization/static_quant/ipex/main.py:515
↓ 2 callersMethodprint
(self, batch)
examples/pytorch/cv/fp8_quant/main.py:355
↓ 2 callersMethodprint
(self, batch)
examples/pytorch/cv/mixed_precision/main.py:331
↓ 2 callersMethodprint
(self, batch)
examples/pytorch/cv/static_quant/main.py:403
↓ 2 callersFunctionprint_predictions
(preds)
examples/jax/keras/vit/quantization.py:48
↓ 2 callersMethodproperty_chars
(self, prefix)
examples/tensorflow/nlp/transformer_lt/quantization/ptq/main.py:75
↓ 2 callersFunctionpsnr
(img1: np.ndarray, img2: np.ndarray)
examples/pytorch/diffusion_model/diffusers/wan/evaluate_manifest_no_gt.py:70
↓ 2 callersMethodput
(self, idx)
neural_compressor/torch/algorithms/layer_wise/modified_pickle.py:525
↓ 2 callersMethodq_dq_forward
Perform quantization and dequantization forward pass. Args: x (Tensor): The input tensor. input_scale (Tensor): T
neural_compressor/torch/algorithms/smooth_quant/utility.py:2707
↓ 2 callersFunctionquant_config_from_json_object
Deserialize a quant config from a JSON-compatible dict with class name. Args: json_obj (dict): A dict with 'quantization_type' and 'confi
neural_compressor/jax/quantization/saving.py:49
↓ 2 callersFunctionquant_config_to_json_object
Serialize a quant config to a JSON-compatible dict with class name. Args: quant_config (BaseConfig): The quantization config object to se
neural_compressor/jax/quantization/saving.py:34
↓ 2 callersFunctionquant_dequant_w_v1
Quantize and dequantize the weights of a layer. Args: m (torch.nn.Module): The layer whose weights are to be quantized and dequantized
neural_compressor/torch/algorithms/smooth_quant/utility.py:652
↓ 2 callersFunctionquant_weight_w_scale
Quant and dequant tensor with group size. It's an in-place function. Args: weight: input weight scale: scale zp: zero poi
neural_compressor/torch/algorithms/weight_only/utility.py:483
↓ 2 callersFunctionquantize
The main entry to quantize model with static mode. Args: model: a float model to be quantized. quant_config: a quantization confi
neural_compressor/torch/quantization/quantize.py:138
↓ 2 callersFunctionquantize
(x, scale, zero, maxq)
neural_compressor/torch/algorithms/mixed_low_precision/custom_methods/gptq.py:42
↓ 2 callersMethodquantize
Quantizes a given float model. Args: model (torch.nn.Module): The float model to be quantized. Returns:
neural_compressor/torch/algorithms/base_algorithm.py:80
↓ 2 callersMethodquantize
(self, x)
neural_compressor/torch/algorithms/mixed_low_precision/custom_methods/gptq.py:171
↓ 2 callersMethodquantize
Execute AWQ quantization. Args: use_auto_scale (bool, optional): whether search scale. Defaults to True. use_mse_sear
neural_compressor/torch/algorithms/weight_only/awq.py:199
↓ 2 callersMethodquantize
Quantize graph only (without optimizing fp32 graph). Including: 1) quantize graph, 2) calibration, 3) fus
neural_compressor/tensorflow/quantization/utils/graph_converter.py:590
↓ 2 callersFunctionquantize_model_with_single_config
Quantize model using single config. Args: model: a model wrapped by INC TF model class. quant_config: a quantization configuratio
neural_compressor/tensorflow/quantization/quantize.py:64
↓ 2 callersFunctionquantize_mx_op
Quantize tensor to MX data type.
neural_compressor/torch/algorithms/mx_quant/utils.py:562
↓ 2 callersFunctionread_squad_examples
Read a SQuAD json file into a list of SquadExample.
examples/tensorflow/nlp/bert_large_squad_model_zoo/quantization/ptq/create_tf_record.py:116
↓ 2 callersMethodready
(self)
neural_compressor/torch/algorithms/mixed_low_precision/custom_methods/gptq.py:179
↓ 2 callersFunctionrec_fn
Recursively apply a function to nested container values. Args: x (Any): Input object that can be a dict, list, tuple, or leaf value.
neural_compressor/torch/algorithms/fp8_quant/_core/common.py:79
↓ 2 callersMethodremove_dead_nodes
Removes nodes that are no longer needed for inference from the graph.
neural_compressor/tensorflow/quantization/utils/quantize_graph/quantize_graph_base.py:52
↓ 2 callersFunctionreplace_linear
( model, modules_to_not_convert=None, current_key_name=None, quantization_config=None, dev
neural_compressor/transformers/quantization/utils.py:74
↓ 2 callersMethodreplace_node
Replace the node into the internal data structure node_name_details. Args: new_node (nodedef): the nodedef object. ol
neural_compressor/tensorflow/quantization/utils/graph_util.py:546
↓ 2 callersMethodreset
(self)
examples/pytorch/cv/fp8_quant/main.py:332
↓ 2 callersFunctionreshape_scale_as_weight
Reshape the scale for weight input channel, depthwise output channel. Args: layer (torch.nn.Module): Torch module. scale (Ten
neural_compressor/torch/algorithms/smooth_quant/utility.py:758
↓ 2 callersFunctionrotate
(model, args)
neural_compressor/torch/algorithms/mixed_low_precision/custom_methods/quarot.py:211
↓ 2 callersFunctionrun
()
test/torch/algorithms/fp8_quant/unit_tests/test_layers/test_linear.py:88
↓ 2 callersFunctionrun
()
test/torch/algorithms/fp8_quant/unit_tests/test_layers/test_matmul.py:71
↓ 2 callersMethodrun
This is neural_compressor function include tuning, export and benchmark option.
examples/tensorflow/graph_networks/graphsage/quantization/ptq/main.py:164
↓ 2 callersFunctionrun_fn
(model, dataloader)
test/torch/quantization/test_autoround_hpu.py:65
↓ 2 callersFunctionrun_predefined_config
()
test/torch/algorithms/fp8_quant/unit_tests/test_functions/test_config_json.py:43
↓ 2 callersFunctionrun_test_matmul_fp8
( *, hp_dtype: torch.dtype, lp_dtype: torch.dtype, scales: Tuple[float, float], )
test/torch/algorithms/fp8_quant/unit_tests/test_functions/test_matmul_fp8.py:16
↓ 2 callersFunctionsave_config_mapping
Save config mapping to json file. Args: config_mapping (dict): config mapping. qconfig_file_path (str): path to saved json file.
neural_compressor/common/utils/save_load.py:23
↓ 2 callersFunctionsave_images
(prompts, images, save_dir, prefix='ref')
examples/pytorch/diffusion_model/diffusers/stable_diffusion/smooth_quant/sdxl_smooth_quant.py:26
↓ 2 callersFunctionsave_json
Save a Python dictionary to a JSON file. Args: d (dict): Data to serialize. fname (str): Destination file path.
neural_compressor/torch/algorithms/fp8_quant/_core/common.py:99
↓ 2 callersFunctionsave_measurements_files
(model, state_dict, state_list, gmod_list, fname_np, fname_list, fname_base, measure_type,
neural_compressor/torch/algorithms/fp8_quant/_core/save_measure/save_files.py:96
↓ 2 callersFunctionsave_scales
Saves scales measured of a given model. Args: model : The measured model. d : Modules_names to configuration dictionary.
neural_compressor/torch/algorithms/fp8_quant/_core/common.py:249
↓ 2 callersMethodscales_module_config_to_q_and_dq
(self, module)
neural_compressor/torch/algorithms/fp8_quant/_core/scale_methods/ops_quantizer.py:55
↓ 2 callersMethodself_check
Perform a self-check to ensure that there is at least one evaluation metric registered for auto-tune. Raises: AssertionError: If
neural_compressor/common/base_tuning.py:180
↓ 2 callersFunctionset_module
Set module with a given op name. Args: model (object): the input model. op_name (str): name of op. new_module (object): t
neural_compressor/torch/algorithms/mixed_low_precision/quantizer.py:37
↓ 2 callersFunctionset_resume_from
Set the resume_from in config.
neural_compressor/common/utils/utility.py:283
↓ 2 callersFunctionset_tensorboard
Set the tensorboard in config.
neural_compressor/common/utils/utility.py:290
↓ 2 callersFunctionset_workspace
Set the workspace in config.
neural_compressor/common/utils/utility.py:269
↓ 2 callersFunctionsetup_parser
()
examples/pytorch/multimodal-modeling/quantization/auto_round/mllm.py:174
↓ 2 callersFunctionsetup_seed
(seed)
test/torch/algorithms/qat/test_qat.py:15
↓ 2 callersFunctionshard_state_dict
Shard state_dict for current local_rank.
neural_compressor/torch/algorithms/fp8_quant/save_load.py:523
↓ 2 callersFunctionshould_quantize
(config, mod_type, name)
neural_compressor/torch/algorithms/fp8_quant/_core/utils.py:56
↓ 2 callersFunctionssim
(img1: np.ndarray, img2: np.ndarray)
examples/pytorch/diffusion_model/diffusers/wan/evaluate_manifest_no_gt.py:77
↓ 2 callersFunctionstrip_unused_nodes
Strip unused nodes of the graph_def. The strip_unused_nodes pass is from tensorflow/python/tools/strip_unused_lib.py of official tensorflow r
neural_compressor/tensorflow/quantization/utils/utility.py:265
↓ 2 callersMethodto_json_file
Save this instance to a JSON file. Args: json_file_path (`str` or `os.PathLike`): Path to the JSON file in which
neural_compressor/transformers/utils/quantization_config.py:132
↓ 2 callersMethodtok_decode
(self, tokens, skip_special_tokens=True)
neural_compressor/evaluation/lm_eval/models/huggingface.py:874
↓ 2 callersMethodtok_encode
(self, string: str, left_truncate_len=None, add_special_tokens=None)
neural_compressor/evaluation/lm_eval/models/huggingface.py:827
↓ 2 callersFunctiontrace_or_load_model
(args, dlrm, test_ld, inplace=True)
examples/pytorch/recommendation/dlrm/static_quant/ipex/dlrm_s_pytorch.py:397
↓ 2 callersMethodtrack_hidden_states
Track hidden states. Args: data (tensor/tuple/list): input data. Returns: tensor.
neural_compressor/torch/algorithms/weight_only/gptq.py:384
↓ 2 callersMethodtransform
The main entry of SmoothQuant. Args: alpha (float or dict): Alpha value to balance the quantization difficulty of activation a
neural_compressor/torch/algorithms/smooth_quant/utility.py:2289
↓ 2 callersMethodupdate
Update the state that need to be evaluated. Args: preds: The prediction result. labels: The reference. Defaults to No
examples/tensorflow/image_recognition/vgg16/quantization/ptq/data_process.py:281
↓ 2 callersMethodupdate
Update the state that need to be evaluated. Args: preds: The prediction result. labels: The reference. Defaults to No
examples/tensorflow/image_recognition/mobilenet_v2/quantization/ptq/data_process.py:211
↓ 2 callersMethodupdate
Update the state that need to be evaluated. Args: preds: The prediction result. labels: The reference. Defaults to No
examples/tensorflow/image_recognition/resnet_v2_50/quantization/ptq/data_process.py:211
← previousnext →801–900 of 4,695, ranked by callers