[ { "function_name": "split_list", "file_path": "LlaMa-Omni/omni_speech/infer/infer.py", "function_calls": [ { "function_call_name": "ceil", "functionality": "Calculates the ceiling of a number (smallest integer greater than or equal to the number).", "input": "len(lst) / n (float)", "output": "chunk_size (int)", "location_or_namespace": "math" } ] }, { "function_name": "get_chunk", "file_path": "LlaMa-Omni/omni_speech/infer/infer.py", "function_calls": [ { "function_call_name": "split_list", "functionality": "Splits a list into n (roughly) equal-sized chunks.", "input": "lst (list), n (int)", "output": "chunks (list of lists)", "location_or_namespace": "canonical_code.py" } ] }, { "function_name": "CustomDataset.__init__", "file_path": "LlaMa-Omni/omni_speech/infer/infer.py", "function_calls": [] }, { "function_name": "CustomDataset.__getitem__", "file_path": "canonical_code.py", "function_calls": [ { "function_call_name": "copy", "functionality": "Returns a shallow copy of the conversation template.", "input": "conv_templates[self.conv_mode]", "output": "conv (object)", "location_or_namespace": "omni_speech.conversation" }, { "function_call_name": "append_message", "functionality": "Appends a message to the conversation history.", "input": "conv.roles[0] (str), qs (str)", "output": "None", "location_or_namespace": "omni_speech.conversation" }, { "function_call_name": "append_message", "functionality": "Appends a message (or placeholder) to the conversation history.", "input": "conv.roles[1] (str), None", "output": "None", "location_or_namespace": "omni_speech.conversation" }, { "function_call_name": "get_prompt", "functionality": "Generates the formatted prompt string based on the conversation history.", "input": "self (object)", "output": "prompt (str)", "location_or_namespace": "omni_speech.conversation" }, { "function_call_name": "load_audio", "functionality": "Loads audio from the given file path.", "input": "speech_file (str)", "output": "speech (numpy.ndarray)", "location_or_namespace": "whisper" }, { "function_call_name": "from_numpy", "functionality": "Creates a Tensor from a NumPy ndarray.", "input": "speech (numpy.ndarray)", "output": "speech (torch.Tensor)", "location_or_namespace": "torch" }, { "function_call_name": "layer_norm", "functionality": "Applies Layer Normalization.", "input": "speech (torch.Tensor), speech.shape (torch.Size)", "output": "speech (torch.Tensor)", "location_or_namespace": "torch.nn.functional" }, { "function_call_name": "pad_or_trim", "functionality": "Pads or trims the audio to a fixed length.", "input": "speech (numpy.ndarray)", "output": "speech (numpy.ndarray)", "location_or_namespace": "whisper" }, { "function_call_name": "log_mel_spectrogram", "functionality": "Computes the log Mel-spectrogram of an audio waveform.", "input": "speech (numpy.ndarray), n_mels=self.mel_size (int)", "output": "mel_spectrogram (torch.Tensor)", "location_or_namespace": "whisper" }, { "function_call_name": "permute", "functionality": "Returns a view of the tensor with the dimensions permuted.", "input": "mel_spectrogram (torch.Tensor), 1 (int), 0 (int)", "output": "speech (torch.Tensor)", "location_or_namespace": "torch.Tensor" }, { "function_call_name": "tokenizer_speech_token", "functionality": "", "input": "prompt (str), self.tokenizer (object), return_tensors='pt' (str)", "output": "input_ids (torch.Tensor)", "location_or_namespace": "omni_speech.datasets.preprocess" }, { "function_call_name": "LongTensor", "functionality": "Constructs a tensor with long integer type.", "input": "[speech.shape[0]] (list)", "output": "torch.LongTensor", "location_or_namespace": "torch" } ] }, { "function_name": "CustomDataset.__len__", "file_path": "LlaMa-Omni/omni_speech/infer/infer.py", "function_calls": [] }, { "function_name": "collate_fn", "file_path": "canonical_code.py", "function_calls": [ { "function_call_name": "zip", "functionality": "Combines several iterables into an iterator of tuples.", "input": "*batch (tuple)", "output": "zipped_iterator (zip object)", "location_or_namespace": "built-in" }, { "function_call_name": "stack", "functionality": "Concatenates a sequence of tensors along a new dimension.", "input": "input_ids (tuple), dim=0 (int)", "output": "input_ids (torch.Tensor)", "location_or_namespace": "torch" }, { "function_call_name": "stack", "functionality": "Concatenates a sequence of tensors along a new dimension.", "input": "speech_tensors (tuple), dim=0 (int)", "output": "speech_tensors (torch.Tensor)", "location_or_namespace": "torch" }, { "function_call_name": "stack", "functionality": "Concatenates a sequence of tensors along a new dimension.", "input": "speech_lengths (tuple), dim=0 (int)", "output": "speech_lengths (torch.Tensor)", "location_or_namespace": "torch" } ] }, { "function_name": "ctc_postprocess", "file_path": "LlaMa-Omni/omni_speech/infer/infer.py", "function_calls": [ { "function_call_name": "squeeze", "functionality": "Returns a tensor with all specified dimensions of size 1 removed.", "input": "tokens (torch.Tensor), 0 (int)", "output": "squeezed_tokens (torch.Tensor)", "location_or_namespace": "torch.Tensor" }, { "function_call_name": "tolist", "functionality": "Returns the tensor as a (nested) list.", "input": "squeezed_tokens (torch.Tensor)", "output": "_toks (list)", "location_or_namespace": "torch.Tensor" }, { "function_call_name": "map", "functionality": "Applies a given function to each item of an iterable and returns an iterator of the results.", "input": "str (function), hyp (list)", "output": "mapped_iterator (map object)", "location_or_namespace": "built-in" }, { "function_call_name": "join", "functionality": "Concatenates string elements of an iterable with a specified separator.", "input": "list(mapped_iterator) (list of str)", "output": "hyp (str)", "location_or_namespace": "str" } ] }, { "function_name": "create_data_loader", "file_path": "LlaMa-Omni/omni_speech/infer/infer.py", "function_calls": [ { "function_call_name": "CustomDataset", "functionality": "Initializes a custom dataset for loading speech instruction data.", "input": "questions (list), tokenizer (object), model_config (object), input_type (str), mel_size (int), conv_mode (str)", "output": "dataset (CustomDataset object)", "location_or_namespace": "canonical_code.py" }, { "function_call_name": "DataLoader", "functionality": "Combines a dataset and a sampler, and provides an iterable over the dataset.", "input": "dataset (Dataset), batch_size (int), num_workers (int), shuffle (bool), collate_fn (function)", "output": "data_loader (DataLoader object)", "location_or_namespace": "torch.utils.data" } ] }, { "function_name": "eval_model", "file_path": "LlaMa-Omni/omni_speech/infer/infer.py", "function_calls": [ { "function_call_name": "disable_torch_init", "functionality": "", "input": "", "output": "None", "location_or_namespace": "omni_speech.utils" }, { "function_call_name": "expanduser", "functionality": "Replaces the ~ (tilde) character with the user's home directory.", "input": "args.model_path (str)", "output": "model_path (str)", "location_or_namespace": "os.path" }, { "function_call_name": "load_pretrained_model", "functionality": "", "input": "model_path (str), args.model_base (str), is_lora=args.is_lora (bool), s2s=args.s2s (bool)", "output": "tokenizer (object), model (object), context_len (int)", "location_or_namespace": "omni_speech.model.builder" }, { "function_call_name": "load", "functionality": "Deserializes a JSON document from a file-like object.", "input": "open(os.path.expanduser(args.question_file), \"r\") (file object)", "output": "questions (list)", "location_or_namespace": "json" }, { "function_call_name": "expanduser", "functionality": "Replaces the ~ (tilde) character with the user's home directory.", "input": "args.question_file (str)", "output": "expanded_path (str)", "location_or_namespace": "os.path" }, { "function_call_name": "get_chunk", "functionality": "Retrieves a specific chunk from a list after splitting it into roughly equal-sized chunks.", "input": "questions (list), args.num_chunks (int), args.chunk_idx (int)", "output": "questions (list)", "location_or_namespace": "canonical_code.py" }, { "function_call_name": "expanduser", "functionality": "Replaces the ~ (tilde) character with the user's home directory.", "input": "args.answer_file (str)", "output": "answers_file (str)", "location_or_namespace": "os.path" }, { "function_call_name": "dirname", "functionality": "Returns the directory name of a pathname.", "input": "answers_file (str)", "output": "directory_name (str)", "location_or_namespace": "os.path" }, { "function_call_name": "makedirs", "functionality": "Creates directories recursively.", "input": "directory_name (str), exist_ok=True (bool)", "output": "None", "location_or_namespace": "os" }, { "function_call_name": "open", "functionality": "Opens a file and returns a file object.", "input": "answers_file (str), \"w\" (str)", "output": "ans_file (file object)", "location_or_namespace": "built-in" }, { "function_call_name": "create_data_loader", "functionality": "Creates a DataLoader for the CustomDataset.", "input": "questions (list), tokenizer (object), model.config (object), args.input_type (str), args.mel_size (int), args.conv_mode (str)", "output": "data_loader (DataLoader object)", "location_or_namespace": "canonical_code.py" }, { "function_call_name": "zip", "functionality": "Combines several iterables into an iterator of tuples.", "input": "data_loader (DataLoader), questions (list)", "output": "zipped_iterator (zip object)", "location_or_namespace": "built-in" }, { "function_call_name": "tqdm", "functionality": "Creates a smart progress bar for iterables.", "input": "zipped_iterator (zip object), total=len(questions) (int)", "output": "progress_bar (tqdm object)", "location_or_namespace": "tqdm" }, { "function_call_name": "to", "functionality": "Moves and/or casts the tensor to the specified device and/or dtype.", "input": "input_ids (torch.Tensor), device='cuda' (str), non_blocking=True (bool)", "output": "input_ids (torch.Tensor)", "location_or_namespace": "torch.Tensor" }, { "function_call_name": "to", "functionality": "Moves and/or casts the tensor to the specified device and/or dtype.", "input": "speech_tensor (torch.Tensor), dtype=torch.float16 (torch.dtype), device='cuda' (str), non_blocking=True (bool)", "output": "speech_tensor (torch.Tensor)", "location_or_namespace": "torch.Tensor" }, { "function_call_name": "to", "functionality": "Moves and/or casts the tensor to the specified device and/or dtype.", "input": "speech_length (torch.Tensor), device='cuda' (str), non_blocking=True (bool)", "output": "speech_length (torch.Tensor)", "location_or_namespace": "torch.Tensor" }, { "function_call_name": "generate", "functionality": "Generates text and/or speech units from the model.", "input": "input_ids (torch.Tensor), speech=speech_tensor (torch.Tensor), speech_lengths=speech_length (torch.Tensor), do_sample (bool), temperature (float), top_p (float), num_beams (int), max_new_tokens (int), use_cache=True (bool), pad_token_id=128004 (int), streaming_unit_gen=False (bool)", "output": "outputs (tuple of torch.Tensor or torch.Tensor)", "location_or_namespace": "model" }, { "function_call_name": "batch_decode", "functionality": "Decodes a batch of token IDs back into strings.", "input": "output_ids (torch.Tensor), skip_special_tokens=True (bool)", "output": "decoded_text (list of str)", "location_or_namespace": "tokenizer" }, { "function_call_name": "strip", "functionality": "Removes leading and trailing whitespace from a string.", "input": "decoded_text[0] (str)", "output": "outputs (str)", "location_or_namespace": "str" }, { "function_call_name": "ctc_postprocess", "functionality": "Performs Connectionist Temporal Classification (CTC) post-processing on the generated unit tokens.", "input": "output_units (torch.Tensor), blank=model.config.unit_vocab_size (int)", "output": "output_units (str)", "location_or_namespace": "canonical_code.py" }, { "function_call_name": "dumps", "functionality": "Serializes a Python dictionary to a JSON formatted string.", "input": "{\"question_id\": idx, \"prediction\": outputs, \"prediction_units\": output_units, \"answer\": answer} (dict)", "output": "json_string (str)", "location_or_namespace": "json" }, { "function_call_name": "dumps", "functionality": "Serializes a Python dictionary to a JSON formatted string.", "input": "{\"question_id\": idx, \"prediction\": outputs, \"answer\": answer} (dict)", "output": "json_string (str)", "location_or_namespace": "json" }, { "function_call_name": "write", "functionality": "Writes a string to the file.", "input": "json_string + \"\\n\" (str)", "output": "None", "location_or_namespace": "file object" }, { "function_call_name": "close", "functionality": "Closes the file.", "input": "", "output": "None", "location_or_namespace": "file object" } ] } ]