This file contains 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
# WIP: Fine-tuned a Causal LM with images & text mixed on MMC4 Dataset | |
import os | |
import json | |
import random | |
from PIL import Image | |
from concurrent.futures import ThreadPoolExecutor | |
import torch | |
import torch.nn as nn | |
import torch.nn.functional as F |
This file contains 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 time import sleep | |
from functools import partial | |
from threading import Thread, Lock | |
import torch | |
import torch.nn as nn | |
import torch.optim as optim | |
import torch.nn.functional as F | |
import torch.nn.utils.rnn as rnn |
This file contains 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 copy | |
import torch | |
import torch.nn.functional as F | |
import torch.backends.cuda as cuda | |
from torch.utils.data import DataLoader, IterableDataset | |
import wandb | |
from tqdm import tqdm | |
import bitsandbytes as bnb |
This file contains 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 math | |
import torch | |
import torch.nn as nn | |
import torch.nn.functional as F | |
import torch.backends.cuda as cuda | |
class NewGELU(nn.Module): | |
def forward(self, x): |
This file contains 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 | |
from contextlib import suppress | |
import torch | |
import torch.nn as nn | |
import torch.optim as optim | |
import torch.nn.functional as F | |
import torch.backends.cuda as cuda | |
from torch.utils.data import DataLoader, IterableDataset |
This file contains 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 | |
import torch.nn as nn | |
import torch.nn.functional as F | |
def cum_softmax(x, dim=1): # <- main novelty | |
z = x.exp() | |
d = z.cumsum(dim) | |
return z / d |
This file contains 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 torch.utils.data import IterableDataset | |
from transformers import PreTrainedTokenizerBase | |
from pile import ThePile | |
class ThePileTokenized(IterableDataset): | |
def __init__( |
This file contains 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 json | |
import torch | |
import random | |
from time import sleep | |
from threading import Thread | |
from datasets import load_dataset | |
from transformers import GPT2Tokenizer | |
from torch.utils.data import Dataset, get_worker_info | |
This file contains 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
# stream C4 dataset from Huggingface with GPT-2 Tokenizer for PyTorch Language Model Training | |
import json | |
import torch | |
import random | |
from datasets import load_dataset | |
from transformers import GPT2Tokenizer | |
from torch.utils.data import Dataset, get_worker_info | |
def cycled(itr): |
This file contains 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
{ | |
"message": "healthy", | |
"label": "ping", | |
"color": "green" | |
} |
NewerOlder