Code
Hub
Workspaces
Following
Trending
Connect
MCP
copy
Create free account
hub
/
github.com/akash-kamalesh/Baraat
/ functions
Functions
28 in github.com/akash-kamalesh/Baraat
⨍
Functions
28
◇
Types & classes
1
↓ 1 callers
Function
batch_sentences
Batches sentences from a dataset into chunks of a specified maximum number of words. Args: examples (Dataset): The dataset containin
utils/batch_sentences.py:7
↓ 1 callers
Function
count_token_bins
Count the bins of the token counts using pandas. Parameters: token_counts (list): The list of token counts to count, such as dataset["__
utils/token_utils.py:57
↓ 1 callers
Function
extract_context_and_question
Extract context and question from the text. Example usage: text = "question: what is ram's name? where is he from? what school is he from
source/language_router.py:57
↓ 1 callers
Function
get_dict_map
This function returns the dictionary map for languages.
source/utilities.py:21
↓ 1 callers
Function
get_lang_decoder
This function loads the language identification model.
source/utilities.py:13
↓ 1 callers
Function
load_and_count_tokens
Load the dataset from Hugging Face and count the tokens in the specified fields. Parameters: split (str): The split of the dataset to lo
utils/token_utils.py:15
↓ 1 callers
Function
main
Main function for executing the tokenization pipeline. Args: args (argparse.Namespace): Parsed command-line arguments.
utils/count_tokens.py:81
↓ 1 callers
Function
main
Loads a dataset, batches the sentences, and returns the original and batched datasets. Args: dataset_name (str): The name of the dat
utils/batch_sentences.py:36
↓ 1 callers
Function
parse_args
Parses command-line arguments. Returns: argparse.Namespace: Parsed arguments.
utils/count_tokens.py:41
↓ 1 callers
Function
plot_token_histogram
Plot the histogram of the token counts using matplotlib. Parameters: token_counts (list): The list of token counts to plot, such as data
utils/token_utils.py:35
↓ 1 callers
Function
predict_language
Predict the source language of the text, pass the target language of the text. returns a dictionary with the source language and target language
source/language_router.py:104
↓ 1 callers
Function
route_input
Route the input based on the language. model,text = route_input(text,languages_dict)
source/language_router.py:119
Method
__init__
Initializes the TokenizeText instance. Args: tokenizer (transformers.AutoTokenizer): The tokenizer to be used for tokeni
utils/count_tokens.py:18
Function
batch_sentences_wrapper
(examples)
utils/batch_sentences.py:53
Function
get_prompt_template_inst_english
This function returns the instruction prompt for English.
source/utilities.py:94
Function
get_prompt_template_inst_hindi
This function returns the instruction prompt for Hindi.
source/utilities.py:80
Function
get_prompt_template_inst_kannada
This function returns the instruction prompt for Kannada.
source/utilities.py:65
Function
get_q_a_prompt
This function returns the question answering prompt.
source/utilities.py:45
Function
get_translation_prompt
This function returns the translation prompt.
source/utilities.py:28
Function
get_translator
This function returns the translator object.
source/utilities.py:108
Function
launch_gradio
Launch the Gradio Interface
source/language_router.py:211
Function
load_individual_models
load an individual expert. choose one expert from huggingface.co/projectbaraat this function utilizes unsloth internally. model,tokenizer
source/language_router.py:18
Function
load_models
Load models and tokenizers. Usage : hindi_model, hindi_tokenizer, eng_model, eng_tokenizer = load_models()
source/language_router.py:33
Function
model_route
Route to the language expert based on the input. routed_model = model_route(routed_model)
source/language_router.py:141
Method
process
Tokenizes the input text and yields the length of tokens. Args: text (str): Input text to be tokenized. Yields:
utils/count_tokens.py:27
Function
process_text
Process the text for translation. result = process_text(text, target_language,model,tokenizer, temperature=1,max_tokens=200)
source/language_router.py:194
Function
process_token_counts
Processes the total token count obtained. Args: total_token_count (int): Total count of tokens.
utils/count_tokens.py:71
Function
select_task
Select the task based on the input text. selected_prompt = select_task(input_text,languages_dict,model,tokenizer)
source/language_router.py:158