This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from torchtune.models.llama3_1 import llama3_1_8b | |
from torchtune.models.llama3_2 import llama3_2_1b, llama3_2_3b | |
from transformers import AutoTokenizer, LlamaForCausalLM | |
import torch | |
####################################### | |
############## llama 8b ############### | |
####################################### | |
# load hf | |
tokenizer_hf = AutoTokenizer.from_pretrained("meta-llama/Meta-Llama-3.1-8B-Instruct") | |
model_hf = LlamaForCausalLM.from_pretrained("meta-llama/Meta-Llama-3.1-8B-Instruct") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from torchtune.models.llama3_1 import llama3_1_8b | |
from torchtune.models.llama3_2 import llama3_2_1b, llama3_2_3b | |
from transformers import AutoTokenizer, LlamaForCausalLM | |
import torch | |
####################################### | |
############## llama 8b ############### | |
####################################### | |
# load hf | |
tokenizer_hf = AutoTokenizer.from_pretrained("meta-llama/Meta-Llama-3.1-8B-Instruct") | |
model_hf = LlamaForCausalLM.from_pretrained("meta-llama/Meta-Llama-3.1-8B-Instruct") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
Script to update configs in torchtune in bulk | |
Goes over every .yaml file in configs that also has "lora" in the name | |
Finds the line that has "lora_alpha: 16" | |
Replaces the "lora_alpha: 16" with "lora_dropout: 0.0", while keeping the spacing and \n | |
Saves the file | |
Prints every file that was not updated | |
""" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1. Check Python3 root | |
>>> import sys | |
>>> import os | |
>>> sys.executable | |
'/usr/local/bin/python3' | |
OR | |
$ which python3 | |
/usr/local/bin/python3 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import networkx as nx | |
import graph_tool as gt | |
def get_prop_type(value, key=None): | |
""" | |
Performs typing and value conversion for the graph_tool PropertyMap class. | |
If a key is provided, it also ensures the key is in a format that can be |