This file contains hidden or 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 dataclasses import dataclass | |
from einops import rearrange | |
import re | |
import torch | |
from torch import BoolTensor, FloatTensor, IntTensor, LongTensor, inference_mode | |
from torch.nn.functional import pad | |
from itertools import islice | |
from typing import Generator, Iterable, Iterator, Optional, Protocol, TypeVar | |
from typing_extensions import override | |
from diffusers.models.unets.unet_2d_condition import UNet2DConditionModel, UNet2DConditionOutput |
This file contains hidden or 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 __future__ import annotations | |
from argparse import ArgumentParser, Namespace | |
from dataclasses import dataclass | |
from functools import partial | |
from typing import Any, Callable, Optional | |
import torch | |
from torch import Tensor, no_grad, enable_grad | |
import torch.autograd.forward_ad as fwAD | |
from torch.nn.attention import SDPBackend, sdpa_kernel | |
from torch.nn.functional import scaled_dot_product_attention |
This file contains hidden or 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 __future__ import annotations | |
from argparse import ArgumentParser, Namespace | |
from dataclasses import dataclass | |
from functools import partial | |
from typing import Callable, Generic, TypeVar | |
import torch | |
from torch import enable_grad, no_grad | |
import torch.autograd.forward_ad as fwAD | |
from torch.func import linearize | |
from torch.nn.attention import SDPBackend, sdpa_kernel |
This file contains hidden or 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 __future__ import annotations | |
from argparse import ArgumentParser, Namespace | |
from dataclasses import dataclass | |
from functools import partial | |
from typing import Callable | |
import torch | |
from torch import enable_grad, no_grad | |
import torch.autograd.forward_ad as fwAD | |
from torch.nn.attention import SDPBackend, sdpa_kernel | |
from torch.nn.functional import scaled_dot_product_attention |
This file contains hidden or 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
#!/usr/bin/env bash | |
set -eo pipefail | |
# https://stackoverflow.com/a/12194427/5257399 | |
create() { # fd base [qualifier [suffix [max]]] | |
local fd="$1" base="$2" qualifier="${3-}" suffix="${4-.png}" max="${5-}" | |
local n=0 file | |
local - # ash-style local scoping of options in 4.4+ | |
set -o noclobber | |
REPLY= |
This file contains hidden or 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
#!/usr/bin/env bash | |
set -eo pipefail | |
# https://stackoverflow.com/a/12194427/5257399 | |
create() { # fd base [qualifier [suffix [max]]] | |
local fd="$1" base="$2" qualifier="${3-}" suffix="${4-.png}" max="${5-}" | |
local n=0 file | |
local - # ash-style local scoping of options in 4.4+ | |
set -o noclobber | |
REPLY= |
This file contains hidden or 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 abc import ABC, abstractmethod | |
from typing import NamedTuple, Optional | |
from typing_extensions import override | |
import torch | |
from torch import Tensor, no_grad, enable_grad | |
import torch.autograd.forward_ad as fwAD | |
from torch.autograd.function import FunctionCtx | |
from torch.nn import Linear, Module | |
from torch.nn.attention import SDPBackend, sdpa_kernel | |
from torch.nn.functional import scaled_dot_product_attention |
This file contains hidden or 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 import FloatTensor | |
def mm(a: FloatTensor, b: FloatTensor) -> FloatTensor: | |
assert a.ndim == 2 | |
assert b.ndim == 2 | |
assert a.size(-1) == b.size(-2) | |
assert a.size(-2) == b.size(-1) | |
# batched dot product | |
def bdp(a_row: FloatTensor, b: FloatTensor) -> FloatTensor: |
This file contains hidden or 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 typing import Optional | |
import torch | |
from torch import FloatTensor, BoolTensor, Tensor, inference_mode | |
from torch.func import functional_call, stack_module_state | |
from torch.nn import Module, Linear | |
from torch.nn.functional import scaled_dot_product_attention | |
from einops import rearrange | |
class Attention(Module): | |
def __init__( |
This file contains hidden or 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
javascript: (async function copyTags() { | |
const replacements = { | |
v: "peace sign", | |
"double v": "double peace", | |
"|_|": "bar eyes", | |
"\\||/": "opem \\m/", | |
":|": "neutral face", | |
";|": "neutral face", | |
"eyepatch bikini": "square bikini", | |
"tachi-e": "character image", |
NewerOlder