MCPcopy Create free account

hub / github.com/arcee-ai/DistillKit / functions

Functions146 in github.com/arcee-ai/DistillKit

↓ 11 callersMethoddtype
(self)
distillkit/compression/config.py:30
↓ 7 callersFunctionpack_to_bytes
Pack a tensor of integers into a byte tensor. Args: x (torch.LongTensor): The input tensor of integers, with shape (..., N).
distillkit/compression/bitpack.py:4
↓ 7 callersFunctionunpack_from_bytes
Unpack a byte tensor back into the original integers. Args: bytes_tensor (torch.ByteTensor): The packed byte tensor, with shape (...
distillkit/compression/bitpack.py:52
↓ 6 callersMethodbit_width
(self)
distillkit/compression/config.py:18
↓ 5 callersFunction_work_dtype
(*inputs: torch.Tensor | None)
distillkit/compression/monotonic_logprobs.py:10
↓ 5 callersFunctionmaybe_trim_bos
(text: str, tokenizer: transformers.PreTrainedTokenizerBase)
distillkit/sample_common.py:23
↓ 4 callersMethodfrom_tensor
(cls, tensor: torch.Tensor)
test_compression.py:28
↓ 3 callersFunction_get_quantize_range
(element_bits: int)
distillkit/compression/monotonic_logprobs.py:80
↓ 3 callersMethod_str_to_dtype
(dtype_str: str)
distillkit/compression/legacy.py:115
↓ 3 callersFunctionaccumulate_over_chunks
Accumulate the result of a function over chunks of the input tensors. Args: logits (torch.Tensor): The logits tensor. target_ids (
distillkit/lossfuncs/common.py:140
↓ 3 callersMethodclose
(self)
distillkit/sample_common.py:287
↓ 3 callersMethoddecompress_to_sparse
( self, packed_indices: torch.Tensor, exact_values: torch.Tensor, coeffs: torc
distillkit/compression/legacy.py:72
↓ 3 callersFunctionget_logprobs
( logits: torch.Tensor, target_ids: torch.LongTensor, target_values: torch.Tensor, eps: float
distillkit/lossfuncs/common.py:86
↓ 2 callersFunction_get_quantize_scale_factors
(values: torch.Tensor, element_bits: int)
distillkit/compression/monotonic_logprobs.py:91
↓ 2 callersFunction_load_dataset
( path: DatasetPath, seed: int | None, num_samples: int | None, tokenizer: transformers.PreTra
distillkit/main.py:73
↓ 2 callersMethod_write_batch_to_parquet
(self, batch_data: list[dict[str, Any]])
distillkit/sample_common.py:213
↓ 2 callersMethodcompress_from_sparse
( self, top_indices: torch.LongTensor, top_values: torch.Tensor )
distillkit/compression/legacy.py:41
↓ 2 callersFunctioncompute_hs_loss
( kind: str, student_outputs: CausalLMOutput, signal: TeacherSignal, mask: torch.Tensor | None
distillkit/lossfuncs/hidden_state.py:13
↓ 2 callersFunctiondensify
Expand a sparse set of logits to a dense tensor. Fills missing logits with -inf.
distillkit/compression/densify.py:6
↓ 2 callersFunctionpolynomial_terms
( terms: list[SpecialTerm | int], t: int, dtype: torch.dtype, device: torch.device, normal
distillkit/compression/monotonic_logprobs.py:30
↓ 2 callersMethodwrite
Adds a single row of data (as a dictionary) to the write queue. The dictionary keys should match schema names. Values should
distillkit/sample_common.py:275
↓ 1 callersMethod_ensure_writer_open
Opens a new Parquet file writer if one is not already open.
distillkit/sample_common.py:204
↓ 1 callersFunction_generate_rows
()
test_compression.py:103
↓ 1 callersMethod_setup_polynomial_terms
(self)
distillkit/compression/legacy.py:30
↓ 1 callersFunction_solve_least_squares
(A: torch.Tensor, B: torch.Tensor)
distillkit/compression/monotonic_logprobs.py:17
↓ 1 callersMethod_solve_least_squares
(A, B)
distillkit/compression/legacy.py:104
↓ 1 callersMethod_validate_config
(self)
distillkit/compression/legacy.py:24
↓ 1 callersMethodbytes_per_token
(self)
distillkit/compression/legacy.py:123
↓ 1 callersMethodcompress
( self, logits: torch.Tensor )
distillkit/compression/legacy.py:64
↓ 1 callersMethodcompress_from_sparse
( self, indices: torch.LongTensor, logprobs: torch.Tensor )
distillkit/compression/compressor.py:48
↓ 1 callersFunctioncompress_monotonic_logprobs
Compresses logprobs using the specified configuration. Args: logprobs (torch.Tensor): Log probabilities to compress, shape (batch_siz
distillkit/compression/monotonic_logprobs.py:223
↓ 1 callersFunctioncompressed_logit_schema
()
distillkit/sample_common.py:318
↓ 1 callersFunctioncreate_loss_func
(cfg: LossFunctionConfig)
distillkit/trainer.py:15
↓ 1 callersFunctioncreate_signal_source
( config: DistillationRunConfig, vocab_size: int )
distillkit/main.py:252
↓ 1 callersFunctiondecompress_monotonic_logprobs
Decompresses logprobs using the specified configuration. Args: bytes (torch.ByteTensor): Compressed logprobs, shape (batch_size, seq
distillkit/compression/monotonic_logprobs.py:317
↓ 1 callersFunctiondense_js_div
Compute the Jensen-Shannon Divergence (JSD) between dense student predictions and dense target logits. JSD(P || Q) = 0.5 * KL(P || M) + 0.5
distillkit/lossfuncs/jsd.py:213
↓ 1 callersFunctiondense_kl_div
Compute the KL divergence between a dense set of predictions and a dense set of target logits. Args: logits: Dense tensor of predictions
distillkit/lossfuncs/kl.py:139
↓ 1 callersFunctiondense_tvd
Compute the Total Variation Distance (TVD) between dense student predictions and dense teacher targets. TVD = 0.5 * sum_i |P_i - Q_i| Ar
distillkit/lossfuncs/tvd.py:153
↓ 1 callersFunctiondequantize
Dequantize the input tensor using the specified scale and number of bits per element.
distillkit/compression/monotonic_logprobs.py:208
↓ 1 callersFunctiondo_chat_template
(row: dict, tokenizer: transformers.PreTrainedTokenizerBase)
distillkit/sample_common.py:33
↓ 1 callersFunctiondo_distill
(config: DistillationRunConfig, config_source: str | None = None)
distillkit/main.py:294
↓ 1 callersFunctionerror_diffuse_and_quantize
Quantize the input tensor to the specified number of bits per element using error diffusion.
distillkit/compression/monotonic_logprobs.py:104
↓ 1 callersFunctionerror_diffuse_float
( values: torch.Tensor, out_dtype: torch.dtype, error_buffer: torch.Tensor | None = None, )
distillkit/compression/monotonic_logprobs.py:148
↓ 1 callersFunctioneval_compression_quality
( logprob_rows: list[dict[str, torch.Tensor]], config: DistributionQuantizationConfig | LegacyLogitCom
test_compression.py:147
↓ 1 callersFunctionfit_polynomial
( values: torch.Tensor, terms: list[SpecialTerm | int], dtype: torch.dtype, normalize_t: bool,
distillkit/compression/monotonic_logprobs.py:51
↓ 1 callersFunctiongenerate_test_logprobs
( model: str, max_seq_len: int, samples: int, batch_size: int = 256, dataset: str = "TEL-L
test_compression.py:64
↓ 1 callersFunctionget_max_seqlen_in_batch
(attention_mask)
distillkit/monkey_patch_packing.py:9
↓ 1 callersMethodget_signal
( self, batch: dict[str, Any], return_hidden_states: bool = False )
distillkit/signals.py:39
↓ 1 callersFunctionget_target_logprobs
( values_in: torch.Tensor, log_target: bool, distillation_temperature: float, target_generatio
distillkit/lossfuncs/common.py:14
↓ 1 callersFunctioniterative_packing
( ds: datasets.Dataset, max_len: int, num_proc: int | None = None, max_iters: int = 4, bat
distillkit/pack_logits.py:91
↓ 1 callersFunctionjensen_shannon_divergence
Compute the Jensen-Shannon divergence between two probability distributions.
test_compression.py:127
↓ 1 callersFunctionload_data
Load the train (and optionally eval) datasets as specified in the configuration.
distillkit/main.py:155
↓ 1 callersFunctionload_preprocess_data
( *, dataset: str, configuration: str | None, split: str, samples: int | None, seed: i
distillkit/sample_common.py:94
↓ 1 callersFunctionload_student_model
( config: DistillationRunConfig, tokenizer_vocab_size: int, )
distillkit/main.py:190
↓ 1 callersFunctionload_tokenizer
(config: DistillationRunConfig)
distillkit/main.py:281
↓ 1 callersMethodlogprob_bits
(self)
distillkit/compression/config.py:127
↓ 1 callersFunctionmain
(config_path: str, verbosity: int)
distillkit/main.py:383
↓ 1 callersFunctionmonkey_patch_for_model_with_name
For example for llama: model_package = llama, modelling_module=modeling_llama Args: model_package (_type_): _description_ modelli
distillkit/monkey_patch_packing.py:124
↓ 1 callersFunctionmonkey_patch_packing_for_model
(pretrained_model)
distillkit/monkey_patch_packing.py:141
↓ 1 callersMethodname
(cls)
distillkit/lossfuncs/kl.py:182
↓ 1 callersFunctionpack_logits_cli
( dataset: str, split: str | None, max_len: int, output: str, num_proc: int | None, sh
distillkit/pack_logits.py:162
↓ 1 callersFunctionpack_tensor
Bit-packs a tensor of integers into a tensor of longs. Args: x (torch.Tensor): Input tensor of integers bits (int): Number of bit
distillkit/compression/legacy.py:135
↓ 1 callersFunctionprocess_prompt_logprobs
( prompt_logprobs: PromptLogprobs, k: int )
distillkit/sample_logits_vllm.py:240
↓ 1 callersFunctionquantize_naive
Naive quantization of the input tensor to the specified number of bits per element.
distillkit/compression/monotonic_logprobs.py:170
↓ 1 callersMethodrequires_hidden_states
(self)
distillkit/lossfuncs/common.py:190
↓ 1 callersFunctionsample_logits
( model: str, dataset: str, dataset_configuration: str | None, split: str, output: str,
distillkit/sample_logits_vllm.py:52
↓ 1 callersFunctionsparse_hinge_loss
( logits: torch.Tensor, target_ids: torch.LongTensor, target_values: torch.Tensor, mask: torch
distillkit/lossfuncs/hingeloss.py:10
↓ 1 callersFunctionsparse_js_div
Compute the Jensen-Shannon Divergence (JSD) between a dense set of predictions and a sparse set of target logits. Uses a chunked approach to avoi
distillkit/lossfuncs/jsd.py:164
↓ 1 callersFunctionsparse_kl_div
Compute the KL divergence between a dense set of predictions and a sparse set of target logits. Uses a chunked approach to avoid memory issues wi
distillkit/lossfuncs/kl.py:90
↓ 1 callersFunctionsparse_logistic_ranking_loss
Computes a logistic ranking loss between student logits and sparse teacher probabilities. The loss encourages the student to rank the teacher
distillkit/lossfuncs/logistic_ranking.py:11
↓ 1 callersFunctionsparse_tvd
Compute the Total Variation Distance (TVD) between a dense set of student predictions and a sparse set of teacher targets. Uses a chunked app
distillkit/lossfuncs/tvd.py:100
↓ 1 callersMethodstart
(self)
distillkit/sample_common.py:201
↓ 1 callersMethodsupports_hidden_states
(self)
distillkit/signals.py:36
↓ 1 callersMethodtotal_bits
(self)
distillkit/compression/config.py:140
↓ 1 callersMethodtotal_distillation_loss
( self, student_outputs, inputs, num_items_in_batch: int | None = None )
distillkit/trainer.py:103
↓ 1 callersFunctiontruncate_tokens
( text: str, tokenizer, max_seq_len: int, add_extra_pad_token: bool = False )
distillkit/sample_common.py:131
↓ 1 callersFunctionunpack_tensor
Unpacks a bit-packed tensor of longs into a tensor of integers. Inverse operation of pack_tensor. Args: packed (torch.Tensor): Input
distillkit/compression/legacy.py:172
Method__call__
( self, student_outputs: CausalLMOutput, signal: TeacherSignal, mask: torch.Te
distillkit/lossfuncs/tvd.py:210
Method__call__
( self, student_outputs: CausalLMOutput, signal: TeacherSignal, mask: torch.Te
distillkit/lossfuncs/hidden_state.py:79
Method__call__
( self, student_outputs: CausalLMOutput, signal: TeacherSignal, mask: torch.Te
distillkit/lossfuncs/hidden_state.py:106
Method__call__
( self, student_outputs: CausalLMOutput, signal: TeacherSignal, mask: torch.Te
distillkit/lossfuncs/cross_entropy.py:22
Method__call__
( self, student_outputs: CausalLMOutput, signal: TeacherSignal, mask: torch.Te
distillkit/lossfuncs/kl.py:197
Method__call__
( self, student_outputs: CausalLMOutput, signal: TeacherSignal, mask: torch.Te
distillkit/lossfuncs/common.py:197
Method__call__
( self, student_outputs: CausalLMOutput, signal: TeacherSignal, mask: torch.Te
distillkit/lossfuncs/logistic_ranking.py:107
Method__call__
( self, student_outputs: CausalLMOutput, signal: TeacherSignal, mask: torch.Te
distillkit/lossfuncs/hingeloss.py:77
Method__call__
( self, student_outputs: CausalLMOutput, signal: TeacherSignal, mask: torch.Te
distillkit/lossfuncs/jsd.py:303
Function__dir__
()
distillkit/compression/__init__.py:60
Method__enter__
(self)
distillkit/sample_common.py:294
Method__exit__
(self, exc_type, exc_val, traceback)
distillkit/sample_common.py:298
Function__getattr__
(name: str)
distillkit/compression/__init__.py:49
Method__init__
( self, student: transformers.PreTrainedModel, teacher_hidden_size: int, layer
distillkit/hsd_mapping.py:10
Method__init__
( self, compressor: LogprobCompressor, vocab_size: int, preapplied_temperature
distillkit/signals.py:50
Method__init__
( self, teacher_model: transformers.PreTrainedModel, vocab_size: int, sparsify
distillkit/signals.py:92
Method__init__
Initializes the StreamingParquetWriter. Args: output_path (str): The directory where Parquet files will be saved.
distillkit/sample_common.py:159
Method__init__
( self, model: PreTrainedModel, config: DistillationRunConfig, signal_source:
distillkit/trainer.py:25
Method__init__
( self, temperature: float, missing_probability_handling: MissingProbabilityHandling =
distillkit/lossfuncs/tvd.py:199
Method__init__
(self)
distillkit/lossfuncs/hidden_state.py:76
Method__init__
(self)
distillkit/lossfuncs/hidden_state.py:103
Method__init__
(self)
distillkit/lossfuncs/cross_entropy.py:19
Method__init__
( self, temperature: float, missing_probability_handling: MissingProbabilityHandling =
distillkit/lossfuncs/kl.py:186
next →1–100 of 146, ranked by callers