Downloads · 30 days
0
RobbiePasquale/lightbulb
lightbulb is a machine learning model from RobbiePasquale. Use it for the machine learning task on the model card, and read the license before you ship it in a product. The card lists the license as apache-2.0.
Downloads · 30 days
0
Access
Public
Updated Oct 15, 2024
Repo size
—
Likes
0
Public
Click a slice to open those files.
.py373 KB · 76%
From the Hugging Face model README

from huggingface_hub import snapshot_download
repo_path = snapshot_download("RobbiePasquale/lightbulb")
print(f"Repository downloaded to: {repo_path}")
!PYTHONPATH=$PYTHONPATH:/root/.cache/huggingface/hub/models--RobbiePasquale--lightbulb/snapshots/3d255ef87272610b055f67937014c0b0f69a4b84 python main_menu.py --task advanced_inference --query "Analyze the economic effects of artificial intelligence in the next decade."
To install the necessary dependencies, run:
pip install huggingface_hub torch transformers datasets argparse
Use the huggingface_hub to download the repository:
from huggingface_hub import snapshot_download
# Download the repository
repo_path = snapshot_download("RobbiePasquale/lightbulb")
print(f"Repository downloaded to: {repo_path}")
python main_menu_new.py \
--task distill_full_model \
--teacher_model_name gpt2 \
--student_model_name distilgpt2 \
--dataset_name wikitext
python main_menu_new.py \
--task distill_full_model \
--teacher_model_name gpt2 \
--student_model_name distilgpt2 \
--dataset_name wikitext \
--config wikitext-2-raw-v1 \
--num_epochs 5 \
--batch_size 8 \
--max_length 256 \
--learning_rate 3e-5 \
--temperature 2.0 \
--save_path ./distilled_full_model \
--log_dir ./logs/full_distillation \
--checkpoint_dir ./checkpoints/full_distillation \
--early_stopping_patience 2
Use domain specific distillation to distill the part of the model relevant for you- if you like how llama 3.1 7B responds to healthcare prompts for example, you could use:
python main_menu_new.py \
--task distill_domain_specific \
--teacher_model_name gpt2 \
--student_model_name distilgpt2 \
--dataset_name wikitext \
--config wikitext-2-raw-v1 \
--query_terms healthcare medicine pharmacology \
--num_epochs 5 \
--batch_size 8 \
--max_length 256 \
--learning_rate 3e-5 \
--temperature 2.0 \
--save_path ./distilled_healthcare_model \
--log_dir ./logs/healthcare_distillation \
--checkpoint_dir ./checkpoints/healthcare_distillation \
--early_stopping_patience 2
Usage:
python main_menu.py --task train_agent
Description:
Utilizes the trained web search agent to process queries, perform web searches, and generate summarized responses.
Usage:
python main_menu.py --task test_agent
Options:
python main_menu.py --task test_agent
python main_menu.py --task test_agent --query "Your query here"
Usage:
python main_menu.py --task train_llm_world --model_name gpt2 --dataset_name wikitext --num_epochs 5 --batch_size 8 --max_length 256
Key Arguments:
--model_name: Pretrained model (e.g., gpt2, bert).--dataset_name: Dataset from Hugging Face (e.g., wikitext).--num_epochs: Number of training epochs.--batch_size: Number of samples per batch.--max_length: Maximum sequence length.Usage:
python main_menu.py --task inference_llm --query "Your query here"
Description:
Develops a comprehensive World Model that encapsulates state representations, dynamics, and prediction networks to simulate and predict state transitions within the Tree of Thought framework.
Usage:
python main_menu.py --task train_world_model --additional_args
Usage:
python main_menu.py --task inference_world_model --query "Your query here"
Usage:
python main_menu.py --task advanced_inference --query "Your complex query here"
python main_menu.py --task train_llm_world --model_name gpt2 --dataset_name wikitext --num_epochs 5 --batch_size 8 --max_length 256
python main_menu.py --task train_agent
python main_menu.py --task test_agent
python main_menu.py --task test_agent --query "What are the impacts of renewable energy on global sustainability?"
python main_menu.py --task advanced_inference --query "Analyze the economic effects of artificial intelligence in the next decade."
Rotary Positional Encoding:
Token_i = t_i transformer(, k_beams = k, n_tokens = j)
CE_Loss = CE_loss(token_i , true tokens)
Representation Network: GAN/VAE/SAE (o_t -> s_t)
If the final hidden layer of the transformer outputs o_t of size S
h_t = GELU(sum(W.o_t + b))
Reconstruction Loss (o_t , h_t)
Dynamics Network (s_t -> s_t+1)
... -> LSTM(s_t) -> LSTM(s_t+1) -> ...
min MSE (s_t+1 , z_t+1 )
Utilise dynamics influence:
Action_i = a_i = t_1 , ... , t_n
Prediction Network : mcts( Q(s,a) , gamma * LSTM(s_t) , delta * State Score (s_t), tree_depth = m, num_simulations) -> Q(s_t+1)
Optimise the KL divergence between the policy of actions (and the tokens that were selected in those actions) and the actual sequences in the training data.
Policy_i = p_i = a_1, ... ,a_n
min - KL(p_i / true_sequences)
Inference:
Thought_i = p_i , ... , p_n
Tree of Thought : Example:
12131 12132 12133
12231 12232 12233
= Graph(system prompt, children = 3, depth = 4, min - KL(p_i / true_sequences))
Graph(Thought_i -> Thought i+1)
Min ThoughtLoss()
for thought batch size = b_t:
d ThoughtLoss
d Graph(Thought_i -> Thought_i+1)
for policy batch size = b_p:
d KL(p_i / true_sequences)
d Prediction_Network
for state batch size: b_s:
d MSE(s_t+1 , z_t+1 )
d Dynamics Network
for state batch size: b_s:
d Contrastive Loss
d Representation Network
for token batch_size: b_to
d Multi token beam search Transformer CE Loss
d transformer
+++++++++++++++++++++++++++++++++++++++++ +++++++++++++++++++++++++++++++++++++++++ +++++++++++++++++++++++++++++++++++++++++ +++++++++++++++++++++++++++++++++++++++++
Inference:
+++++++++++++++++++++++++++++++++++++++++ +++++++++++++++++++++++++++++++++++++++++ +++++++++++++++++++++++++++++++++++++++++ +++++++++++++++++++++++++++++++++++++++++
Web Search Agent:
If you use LightBulb in your research, please cite the author:
@misc{RobbiePasquale_lightbulb,
author = {Robbie Pasquale},
title = {LightBulb: An Autonomous Web Search and Language Model Framework},
year = {2024},
publisher = {Huggingface},
howpublished = {\url{https://huggingface.co/RobbiePasquale/lightbulb}},
}
This project is licensed under the Apache 2.0 License.