Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sorted imports #81

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 8 additions & 9 deletions big_sleep/big_sleep.py
Original file line number Diff line number Diff line change
@@ -1,27 +1,26 @@
import os
import sys
import subprocess
import random
import re
import signal
import string
import re

import subprocess
import sys
from datetime import datetime
from pathlib import Path
import random

import torch
import torch.nn.functional as F
import torchvision.transforms as T
from PIL import Image
from torch import nn
from torch.optim import Adam
from torchvision.utils import save_image
import torchvision.transforms as T
from PIL import Image
from tqdm import tqdm, trange

from big_sleep.ema import EMA
from big_sleep.resample import resample
from big_sleep.biggan import BigGAN
from big_sleep.clip import load, tokenize
from big_sleep.ema import EMA
from big_sleep.resample import resample

assert torch.cuda.is_available(), 'CUDA must be available in order to use Big Sleep'

Expand Down
12 changes: 6 additions & 6 deletions big_sleep/biggan.py
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
# this code is a copy from huggingface
# with some minor modifications

import torch
import torch.nn as nn
import torch.nn.functional as F
import math
import json
import copy
import json
import logging
import math
import os
import shutil
import sys
import tempfile
from functools import wraps
from hashlib import sha256
import sys
from io import open

import boto3
import requests
import torch
import torch.nn as nn
import torch.nn.functional as F
from botocore.exceptions import ClientError
from tqdm import tqdm

Expand Down
9 changes: 6 additions & 3 deletions big_sleep/cli.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
import fire
import random as rnd
from big_sleep import Imagine, version
from pathlib import Path
from .version import __version__;

import fire

from big_sleep import Imagine, version

from .version import __version__


def train(
Expand Down
17 changes: 7 additions & 10 deletions big_sleep/clip.py
Original file line number Diff line number Diff line change
@@ -1,20 +1,17 @@
from collections import OrderedDict
from typing import Tuple, Union

import torch
import torch.nn.functional as F
from torch import nn
from pathlib import Path

import hashlib
import os
import urllib
import warnings
from typing import Union, List
from collections import OrderedDict
from pathlib import Path
from typing import List, Tuple, Union

import torch
import torch.nn.functional as F
from PIL import Image
from torchvision.transforms import Compose, Resize, CenterCrop, ToTensor, Normalize
from torch import nn
from torchvision.transforms import (CenterCrop, Compose, Normalize, Resize,
ToTensor)
from tqdm import tqdm

_MODELS = {
Expand Down
2 changes: 1 addition & 1 deletion big_sleep/resample.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
"""Good differentiable image resampling for PyTorch."""

from functools import update_wrapper
import math
from functools import update_wrapper

import torch
from torch.nn import functional as F
Expand Down
3 changes: 2 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import sys
from setuptools import setup, find_packages

from setuptools import find_packages, setup

sys.path[0:0] = ['big_sleep']
from version import __version__
Expand Down
4 changes: 3 additions & 1 deletion test/multi_prompt_minmax.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import time
import shutil
import time

import torch

from big_sleep import Imagine

terminate = False
Expand Down