이런저런 IT 이야기
article thumbnail
[Module] Textual Inversion #2
Stable Diffusion WebUI 2023. 6. 2. 10:26

dataset.py import os import numpy as np import PIL import torch from PIL import Image from torch.utils.data import Dataset, DataLoader, Sampler from torchvision import transforms from collections import defaultdict from random import shuffle, choices import random import tqdm from modules import devices, shared import re from ldm.modules.distributions.distributions import DiagonalGaussianDistrib..

article thumbnail
[Module] Textual Inversion #1
Stable Diffusion WebUI 2023. 6. 2. 09:10

autocrop.py import cv2 import requests import os import numpy as np from PIL import ImageDraw GREEN = "#0F0" BLUE = "#00F" RED = "#F00" def crop_image(im, settings): """ Intelligently crop an image to the subject matter """ scale_by = 1 if is_landscape(im.width, im.height): scale_by = settings.crop_height / im.height elif is_portrait(im.width, im.height): scale_by = settings.crop_width / im.widt..

article thumbnail
Programming Challenges #42
Algorithm 2023. 6. 2. 08:06

You are given an elliptical shaped land and you are asked to choose n arbitrary points on its boundary. Then you connect all these points with one another with straight lines (that’s n ∗ (n − 1)/2 connections for n points). What is the maximum number of pieces of land you will get by choosing the points on the boundary carefully? 주어진 타원형 땅에서 n개의 임의의 점을 경계선 위에 선택하고, 이러한 점들을 직선으로 서로 연결합니다 (n * (n ..

article thumbnail
Programming Challenges #41
Algorithm 2023. 6. 1. 23:40

Recall the definition of the Fibonacci numbers: Given two numbers a and b, calculate how many Fibonacci numbers are in the range [a, b]. Input The input contains several test cases. Each test case consists of two non-negative integer numbers a and b. Input is terminated by a = b = 0. Otherwise, a ≤ b ≤ 10100. The numbers a and b are given with no superfluous leading zeros. Output For each test c..

article thumbnail
[Module] Diffusion #3
Stable Diffusion WebUI 2023. 6. 1. 21:34

uni_pc.py import torch import math import tqdm class NoiseScheduleVP: def __init__( self, schedule='discrete', betas=None, alphas_cumprod=None, continuous_beta_0=0.1, continuous_beta_1=20., ): """Create a wrapper class for the forward SDE (VP type). *** Update: We support discrete-time diffusion models by implementing a picewise linear interpolation for log_alpha_t. We recommend to use schedule=..

article thumbnail
[Module] Diffusion #2
Stable Diffusion WebUI 2023. 6. 1. 21:31

sampler.py """SAMPLING ONLY.""" import torch from .uni_pc import NoiseScheduleVP, model_wrapper, UniPC from modules import shared, devices class UniPCSampler(object): def __init__(self, model, **kwargs): super().__init__() self.model = model to_torch = lambda x: x.clone().detach().to(torch.float32).to(model.device) self.before_sample = None self.after_sample = None self.register_buffer('alphas_c..

article thumbnail
[Module] Diffusion #1
Stable Diffusion WebUI 2023. 6. 1. 21:28

ddpm_edit.py """ wild mixture of https://github.com/lucidrains/denoising-diffusion-pytorch/blob/7706bdfc6f527f58d33f84b7b522e61e6e3164b3/denoising_diffusion_pytorch/denoising_diffusion_pytorch.py https://github.com/openai/improved-diffusion/blob/e94489283bb876ac1477d5dd7709bbbd2d9902ce/improved_diffusion/gaussian_diffusion.py https://github.com/CompVis/taming-transformers -- merci """ # File mod..

article thumbnail
[Module] Hypernetworks
Stable Diffusion WebUI 2023. 6. 1. 21:21

hypernetwork.py import datetime import glob import html import os import sys import traceback import inspect import modules.textual_inversion.dataset import torch import tqdm from einops import rearrange, repeat from ldm.util import default from modules import devices, processing, sd_models, shared, sd_samplers, hashes, sd_hijack_checkpoint from modules.textual_inversion import textual_inversion..

article thumbnail
[Module] CodeFormer
Stable Diffusion WebUI 2023. 6. 1. 21:21

codeformer_arch.py # this file is copied from CodeFormer repository. Please see comment in modules/codeformer_model.py import math import torch from torch import nn, Tensor import torch.nn.functional as F from typing import Optional from modules.codeformer.vqgan_arch import VQAutoEncoder, ResBlock from basicsr.utils.registry import ARCH_REGISTRY def calc_mean_std(feat, eps=1e-5): """Calculate me..

article thumbnail
Docker 명령어
Docker 2023. 6. 1. 15:00

이미지 관련 명령어: docker images: 로컬에 저장된 이미지 목록을 표시합니다. docker search [이미지명]: Docker Hub에서 이미지를 검색합니다. docker pull [이미지명]: Docker Hub나 프라이빗 레지스트리에서 이미지를 다운로드합니다. docker build [옵션] [Dockerfile 경로]: Dockerfile을 사용하여 이미지를 빌드합니다. docker commit [컨테이너명/ID] [이미지명]: 컨테이너의 변경 사항을 이미지로 커밋합니다. docker tag [이전 이미지명] [새 이미지명]: 이미지에 태그를 추가하거나 변경합니다. docker rmi [이미지명]: 이미지를 삭제합니다. 컨테이너 관련 명령어: docker run [옵션] [이미지명] ..

profile on loading

Loading...

검색 태그