Code
Hub
Workspaces
Following
Trending
Connect
MCP
copy
Create free account
hub
/
github.com/FusionBrainLab/SONAR-LLM
/ functions
Functions
62 in github.com/FusionBrainLab/SONAR-LLM
⨍
Functions
62
◇
Types & classes
10
↓ 2 callers
Function
collate_and_encode
Tokenize each text into sentences, batch the sentences through Sonar, and regroup them per text. Returns a list of dicts, each dict has:
sonar_encoding.py:48
↓ 2 callers
Function
evaluate
(model, val_dloader, device, distributed)
train_llm.py:336
↓ 2 callers
Function
evaluate
(model, val_dloader, device, distributed)
train_sonarllm_fast.py:523
↓ 2 callers
Function
get_bucket_size
(idx)
sonar_encoding.py:182
↓ 2 callers
Function
save_full_checkpoint
Saves a dictionary containing: - Model, optimizer, scheduler states - epoch, step_in_epoch (the iteration index in that epoch)
train_sonarllm.py:576
↓ 1 callers
Method
__init__
(self, in_dim, out_dim)
train_sonarllm.py:151
↓ 1 callers
Method
__init__
(self, in_dim, out_dim)
train_sonarllm_fast.py:150
↓ 1 callers
Method
__init__
(self, in_dim, out_dim)
generate.py:28
↓ 1 callers
Function
ddp_main
()
sonar_encoding.py:90
↓ 1 callers
Function
evaluate
(model, val_dloader, device, distributed)
train_sonarllm.py:547
↓ 1 callers
Function
evaluate_meteor
Return the METEOR score for a pair of strings.
evaluate_nlg.py:39
↓ 1 callers
Function
evaluate_text
Return BLEU and ROUGE-L_f scores for a pair of strings.
evaluate_nlg.py:19
↓ 1 callers
Function
get_eval_prompt_1
(story_prompt, generated_answer)
gpt_eval.py:94
↓ 1 callers
Function
get_eval_prompt_2
(evaluation, messages)
gpt_eval.py:100
↓ 1 callers
Function
get_final_marks
(scores)
gpt_eval.py:16
↓ 1 callers
Function
get_gpt_eval
(story_prompts, generated_answers)
gpt_eval.py:106
↓ 1 callers
Function
get_message_1
(story_prompt, generation)
gpt_eval.py:39
↓ 1 callers
Function
get_message_2
(gpt_eval, messages)
gpt_eval.py:66
↓ 1 callers
Method
inference_step
Run one forward step and return next sentence + its embedding.
generate.py:45
↓ 1 callers
Function
load_checkpoint_for_inference
(ckpt_path, model, device="cpu")
generate.py:61
↓ 1 callers
Function
load_full_checkpoint
Loads the saved state dicts and RNG states. Returns a dict: { "epoch": epoch, "step_in_epoch": step_in_epoch, "glob
train_sonarllm.py:611
↓ 1 callers
Function
load_full_checkpoint
(ckpt_path, model, optimizer, scheduler, device)
train_sonarllm_fast.py:582
↓ 1 callers
Function
main
()
train_llm.py:95
↓ 1 callers
Function
main
()
train_sonarllm.py:231
↓ 1 callers
Function
main
()
train_sonarllm_fast.py:237
↓ 1 callers
Function
main
()
evaluate_nlg.py:73
↓ 1 callers
Function
main
()
gpt_eval.py:135
↓ 1 callers
Function
parse_args
()
train_llm.py:36
↓ 1 callers
Function
parse_args
()
train_sonarllm.py:40
↓ 1 callers
Function
parse_args
()
train_sonarllm_fast.py:44
↓ 1 callers
Function
parse_args
()
sonar_encoding.py:22
↓ 1 callers
Function
predict_next_sentence
(sents, embeddings, eos_emb, threshold)
generate.py:68
↓ 1 callers
Function
predict_next_text
(text: str, eos_emb, threshold, add_begin)
generate.py:82
↓ 1 callers
Function
print_mean_scores
(score_dict)
gpt_eval.py:120
↓ 1 callers
Function
process_record
(rec: dict)
evaluate_nlg.py:49
↓ 1 callers
Function
save_full_checkpoint
(model, optimizer, scheduler, epoch, step_in_epoch, global_step, output_dir)
train_llm.py:358
↓ 1 callers
Function
save_full_checkpoint
(model, optimizer, scheduler, epoch
train_sonarllm_fast.py:553
Method
__getitem__
(self, idx)
train_llm.py:81
Method
__getitem__
(self, idx)
train_sonarllm.py:97
Method
__getitem__
(self, idx)
train_sonarllm_fast.py:101
Method
__getitem__
(self, idx)
sonar_encoding.py:44
Method
__init__
(self, texts, tokenizer, block_size=2048)
train_llm.py:65
Method
__init__
(self, texts, embedder, max_sentences=128)
train_sonarllm.py:79
Method
__init__
(self, llama_model, forward_proj, reverse_proj, sonar_decoder)
train_sonarllm.py:158
Method
__init__
(self, items, max_sentences=128)
train_sonarllm_fast.py:83
Method
__init__
(self, llama_model, forward_proj, reverse_proj, sonar_decoder)
train_sonarllm_fast.py:158
Method
__init__
(self, llama_model, forward_proj, reverse_proj, sonar_decoder)
generate.py:37
Method
__init__
(self, text_list)
sonar_encoding.py:37
Method
__len__
(self)
train_llm.py:78
Method
__len__
(self)
train_sonarllm.py:94
Method
__len__
(self)
train_sonarllm_fast.py:98
Method
__len__
(self)
sonar_encoding.py:41
Function
data_collator
(batch)
train_sonarllm.py:113
Function
data_collator
(batch)
train_sonarllm_fast.py:111
Method
forward
(self, x)
train_sonarllm.py:154
Method
forward
(self, embeddings_1024, texts, seq_lens)
train_sonarllm.py:168
Method
forward
(self, x)
train_sonarllm_fast.py:153
Method
forward
(self, embeddings_1024, texts, seq_lens)
train_sonarllm_fast.py:168
Method
forward
(self, x)
generate.py:32
Function
lm_collator
(batch)
train_llm.py:85
Function
load_file
(i)
train_sonarllm_fast.py:229
Function
load_full_checkpoint
(ckpt_path, model, optimizer, scheduler, device)
train_llm.py:378