Implementation of gMLP, an all-MLP replacement for Transformers, in Pytorch - g-mlp-pytorch/setup.py at main · lucidrains/g-mlp-pytorch
from g_mlp_pytorch import gMLP from g_mlp_pytorch.autoregressive_wrapper import AutoregressiveWrapper import random import tqdm import gzip import numpy as np import torch import torch.optim as optim from torch.nn import functional as F from torch.utils.data import DataLoader, Dataset # constants ...
import torch from g_mlp_pytorch import gMLPVision model = gMLPVision( image_size = 256, patch_size = 16, num_classes = 1000, dim = 512, depth = 6, attn_dim = 64 ) img = torch.randn(1, 3, 256, 256) pred = model(img) # (1, 1000) Non-square images and patch sizes import...