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 | |
torch.set_printoptions(precision=4, sci_mode=False) | |
import triton | |
import triton.language as tl | |
from torch import Tensor | |
def quanitze_fp8_tensorwise(x: torch.Tensor, dtype=torch.float8_e4m3fn): | |
scale = x.abs().max() / torch.finfo(dtype).max |
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 List, Any | |
import enum | |
from cuda import cudart | |
CUDART_VERSION = 12020 | |
CUDA_EGL_MAX_PLANES = 3 | |
CUDA_IPC_HANDLE_SIZE = 64 |
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 numpy as np | |
import torch | |
from torchvision.transforms import functional as F | |
from PIL import Image | |
image_path = "./117.webp" | |
num_images = 32 | |
total_rot = 360 | |
rot_step = total_rot / num_images |
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 functools import wraps | |
from typing import Any, Dict, Iterable, Optional, Tuple, TypeVar | |
import torch | |
T = TypeVar("T", bound=callable) | |
ref_map = { | |
torch.float64: [torch.float16,torch.float32,torch.bfloat16,torch.half], | |
torch.float32: [torch.float16,torch.bfloat16,torch.half], | |
torch.float16: [], | |
torch.bfloat16: [], |
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 einops import rearrange | |
_magma_table = [ | |
(0.001462, 0.000466, 0.013866), | |
(0.002258, 0.001295, 0.018331), | |
(0.003279, 0.002305, 0.023708), | |
(0.004512, 0.003490, 0.029965), | |
(0.005950, 0.004843, 0.037130), | |
(0.007588, 0.006356, 0.044973), |
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 pathlib import Path | |
from argparse import ArgumentParser | |
from typing import Optional | |
from pydantic import BaseModel | |
class Args(BaseModel): | |
input_path: Path | |
recursive: bool = False | |
output_file: Optional[Path] | |
extensions: list[str] = ['jpeg','jpg','png','webp'] |
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 argparse | |
from typing import List, Union | |
import cv2, os, pathlib | |
from PIL import Image | |
from loguru import logger | |
from more_itertools import flatten | |
from mediapipe.python.solutions.face_detection import FaceDetection | |
import numpy as np | |
from traceback import format_exception |
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 AsyncGenerator, List, Coroutine, Any, Callable, Union | |
import asyncio | |
from loguru import logger | |
async def async_limit_iterator( | |
limit=8, | |
jobs: List[Any] = [], | |
coroutine_fn: Callable[[Any], Coroutine[Any, None, None]] = None, | |
throw_exceptions: bool = False, |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
const { ExifTool, Tags } = require('exiftool-vendored'); | |
/** | |
* Function to write makernote and exif data to a PNG file. | |
* @param {string} filePath - Path to the PNG file. | |
* @param {string} makerNote - Makernote exif key data to write. | |
* @param {string} comment - Comment exif key data to write. | |
* @return {Promise<boolean>} - True if successful, false otherwise. | |
*/ | |
export const writeMetadata = async (filePath, makerNote, comment) => { | |
const tool = new ExifTool(); |
NewerOlder