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
"""" | |
Proof of concept "DiM" - nousr | |
general structure was "transpiled" from DiT by meta | |
bi-direction idea comes from DifuSSM (https://arxiv.org/abs/2311.18257) | |
""" | |
import torch | |
import math | |
from timm.models.vision_transformer import PatchEmbed |
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 websocket | |
import uuid | |
import json | |
import urllib.request | |
import urllib.parse | |
from random import randint | |
import click | |
from PIL import Image | |
import io | |
import os |
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
from flask import Flask, request, jsonify | |
import torch | |
import base64 | |
import io | |
from PIL import Image | |
import requests | |
from io import BytesIO | |
# Import the necessary modules from the llava directory | |
from transformers import AutoTokenizer |
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
#!/bin/bash | |
clip-retrieval inference \ | |
--input_dataset="<parent folder containing images>" \ | |
--output_folder="<output s3 bucket or local folder>" \ | |
--input_format="files" \ | |
--enable_metadata=False \ | |
--write_batch_size=500 \ | |
--num_prepro_workers=2 \ | |
--batch_size=64 \ | |
--enable_wandb=True \ |
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
from langchain.llms.base import LLM | |
from typing import Optional, List | |
from revChatGPT.V1 import Chatbot | |
class revChatGPT(LLM): | |
chatbot: Chatbot = Chatbot(config={ | |
"access_token": "<your token here>" | |
}) |
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 webdataset as wds | |
from typing import Union, Sequence | |
from time import perf_counter | |
from accelerate import Accelerator | |
def process(src): | |
""" | |
Filter empty samples from the clap dataset. |
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
@lru_cache(maxsize=None) | |
def load_safety_model(clip_model): | |
"""load the safety model""" | |
import torch # pylint: disable=import-outside-toplevel | |
import autokeras as ak # pylint: disable=import-outside-toplevel | |
from tensorflow.keras.models import load_model # pylint: disable=import-outside-toplevel | |
class H14_NSFW_Detector(nn.Module): | |
def __init__(self, input_size=1024): | |
super().__init__() |
We can make this file beautiful and searchable if this error is corrected: Unclosed quoted field in line 4.
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
name,prompt,negative_prompt | |
None,, | |
MDJ_style_base,"an extremely realistic digital painting of a (futuristic an alleyway) street in the style of cyberpunk, a photograph of a cyberpunk street alley at sunset, digital art trending on artstation, ((pixel art)), light rays shining","blurry, bad resolution, low quality, watermarked image, america, jpeg artifacts, background, words, font, text, boring, robot, human, full body, people in a street, purple" | |
MDJ_street_car,"an extremely realistic digital painting of a (cyberpunk volkswagen r32) on the street in the style of cyberpunk, a photograph of a cyberpunk street alley at night, digital art trending on artstation, ((pixel art)), light rays shining","bad resolution, low quality, watermarked image, human, ((simple)), [dark], blurry, bad resolution, low quality, ((watermarked image)), america, jpeg artifacts, words, font, text, boring, robot, human, full body, people in a street stock photo AND alamy, shutterstock, pixabay, flickr AND picture frame, bad perspective, |
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
#!/bin/bash | |
# step 1: get environment variables | |
# step 2: setup rank 0 to be the master and start the indexing python file (the last two operations happen in parallel) | |
# step 3: setup rank 1-N to be the workers and start the worker script (they then will listen for work from the master) | |
# get environment variables | |
GLOBAL_RANK=$SLURM_PROCID | |
CPUS=$SLURM_CPUS_PER_TASK | |
MEM=$SLURM_MEM_PER_NODE # seems to be in MB |
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 wandb | |
import torch | |
from dalle2_pytorch import ( | |
T5OpenClipAdapter, | |
DiffusionPriorNetwork, | |
DiffusionPrior, | |
) | |
from dalle2_pytorch.trainer import DiffusionPriorTrainer | |
from transformers import T5Tokenizer | |
from accelerate import Accelerator |
NewerOlder