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 huggingface_hub import hf_hub_download | |
import json | |
from argparse import Namespace | |
from accelerate import init_empty_weights | |
import torch | |
from transformers import GPT2Config, AutoTokenizer, AutoModelForCausalLM | |
import einops | |
model_name = "NeelNanda/GELU_4L512W_C4_Code" |
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 ctypes | |
def get_writeable_bit(): | |
max_arr_size = 128 | |
test_arr = np.array(1, dtype=np.uint16) | |
ptr = id(test_arr) | |
str_a = ctypes.string_at(ptr, max_arr_size) | |
test_arr.setflags(write=0) | |
str_b = ctypes.string_at(ptr, max_arr_size) |
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
import random | |
import bpy | |
from mpfb.services.locationservice import LocationService | |
from mpfb.services.assetservice import AssetService | |
import json | |
import os | |
seed = 0 | |
random.seed(seed) |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
import math | |
import random | |
import hashlib | |
import logging | |
from enum import Enum | |
import cv2 | |
import numpy as np | |
# from saicinpainting.evaluation.masks.mask import SegmentationMask |
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 diffusers | |
from diffusers.pipelines.stable_diffusion import StableDiffusionPipelineOutput | |
import torch | |
import PIL.Image | |
import numpy as np | |
from typing import Union, List, Optional, Callable | |
# This pipeline is mostly copied from StableDiffusionInpaintPipeline and StableDiffusionImg2ImgPipeline. | |
def prepare_depth(depth): |
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 cv2 | |
import numpy as np | |
# from pypiano import Piano | |
cap = cv2.VideoCapture(0) | |
w = 0.1 | |
h = 100 | |
det_range = 0.4 | |
line_color = 128, 0, 0 |