- k9s
- lazydocker
- oh-my-zsh
- iterm2
- typora
- noi
- mac-install-guide
- wrap
- tmux
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 torch | |
from transformers import AutoModelForCausalLM, AutoTokenizer | |
from transformers_cfg.grammar_utils import IncrementalGrammarConstraint | |
from transformers_cfg.generation.logits_process import GrammarConstrainedLogitsProcessor | |
device = torch.device("cuda" if torch.cuda.is_available() else "cpu") | |
model_id = "mistralai/Mistral-7B-Instruct-v0.3" | |
tokenizer = AutoTokenizer.from_pretrained(model_id) |
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 time | |
import torch | |
from transformers import AutoModelForCausalLM, AutoTokenizer | |
# Load Phi-3.5 model and tokenizer | |
MODEL_NAME = "microsoft/Phi-3.5-mini-instruct" | |
tokenizer = AutoTokenizer.from_pretrained(MODEL_NAME) | |
model = AutoModelForCausalLM.from_pretrained(MODEL_NAME, torch_dtype=torch.float16, device_map="auto") | |
# Define a simple prompt |
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
# Version 0.13.2 | |
from transformers import AutoModelForCausalLM | |
from peft import LoraModel, LoraConfig | |
config = LoraConfig( | |
task_type="CAUSAL_LM", | |
r=8, | |
lora_alpha=32, | |
lora_dropout=0.01, |
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 torch | |
torch.set_default_dtype(torch.bfloat16) | |
# check if CUDA is available | |
if torch.cuda.is_available(): | |
# set default device to cuda | |
torch.set_default_device("cuda:0") | |
elif torch.backends.mps.is_available(): | |
torch.set_default_device("mps") |
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
#!/bin/bash | |
# Check if zsh is installed, and install if not | |
if ! command -v zsh &> /dev/null; then | |
echo "Zsh not found. Installing..." | |
sudo apt update | |
sudo apt install -y zsh | |
else | |
echo "Zsh is already installed." | |
fi |
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
########## | |
# | |
# Original robbyrussel theme has a minimal prompt which doesn't contain username and hostname | |
# This derived version adds user name and hostname, that's all | |
# | |
########## | |
# Define the return status indicator | |
local ret_status="%(?:%{$fg_bold[green]%}➜ :%{$fg_bold[red]%}➜ %s)" |
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 torch | |
from transformers import GPT2Tokenizer, AutoModelForCausalLM | |
import numpy as np | |
import time | |
from transformers import ( | |
AutoTokenizer, | |
AutoModelForSeq2SeqLM, | |
LogitsProcessorList, |
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
# This contains the Emoticons Unicode block (U+1F600–U+1F64F) , which represents 80 emoticons(emoji) | |
# that are commonly used in text messaging and social media. c.f. https://en.wikipedia.org/wiki/Emoticons_(Unicode_block) | |
# This doesn't include the Miscellaneous Symbols and Pictographs block (U+1F300–U+1F5FF) and | |
# the Supplemental Symbols and Pictographs block (U+1F900–U+1F9FF). | |
root ::= emoji+ | |
emoji ::= [😀-🙏] |
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 random | |
from collections import defaultdict | |
from itertools import product | |
from typing import Callable, Optional | |
import torch | |
from torch_geometric.data import Data, HeteroData, InMemoryDataset | |
from torch_geometric.utils import coalesce, remove_self_loops, to_undirected |
NewerOlder