Bootstrap knowledge of LLMs ASAP. With a bias/focus to GPT.
Avoid being a link dump. Try to provide only valuable well tuned information.
Neural network links before starting with transformers.
| import torch | |
| import torch.nn as nn | |
| import torch.nn.functional as F | |
| from torchvision import datasets, transforms | |
| import numpy as np | |
| import math | |
| def compute_activation_std(model, dataset, device='cpu', batch_size=32, num_workers=0, layer_names=None): | |
| activations = {} |
| from collections import defaultdict | |
| import random | |
| from huggingface_hub import hf_hub_download | |
| from datasets import Dataset | |
| import numpy as np | |
| import pandas as pd | |
| from transformers import AutoTokenizer | |
| from rich.console import Console | |
| from rich.table import Table | |
| from trl import DPOTrainer |
| """ | |
| The code below combines approaches published by both @eugene-yh and @jinyongyoo on Github. | |
| Thanks for the contributions guys! | |
| """ | |
| import torch | |
| import peft |
| from transformers import AutoTokenizer, T5ForConditionalGeneration | |
| # Model Init | |
| n_gpu = 8 | |
| tokenizer = AutoTokenizer.from_pretrained("google/flan-ul2") | |
| model = T5ForConditionalGeneration.from_pretrained("google/flan-ul2") | |
| heads_per_gpu = len(model.encoder.block) // n_gpu | |
| device_map = { | |
| gpu: list( | |
| range( |
| """ | |
| stable diffusion dreaming | |
| creates hypnotic moving videos by smoothly walking randomly through the sample space | |
| example way to run this script: | |
| $ python stablediffusionwalk.py --prompt "blueberry spaghetti" --name blueberry | |
| to stitch together the images, e.g.: | |
| $ ffmpeg -r 10 -f image2 -s 512x512 -i blueberry/frame%06d.jpg -vcodec libx264 -crf 10 -pix_fmt yuv420p blueberry.mp4 |
| " To only apply these macros in e.g. Python files, prepend 'autocmd FileType py', e.g.: | |
| " autocmd FileType py inoremap \mu μ | |
| inoremap \alpha α | |
| inoremap \beta β | |
| inoremap \gamma γ | |
| inoremap \delta δ | |
| inoremap \epsilon ε | |
| inoremap \zeta ζ | |
| inoremap \eta η |
| NB. Code from the "Basic Animation In J" video | |
| NB. https://www.youtube.com/watch?v=uL-70fMTVnw | |
| NB. ------------------------------------------------------------------------ | |
| NB. animation demo | |
| load 'viewmat' | |
| coinsert'jgl2' | |
| wd 'pc w0 closeok' NB. parent control (window) named 'w0' |