Skip to content

Instantly share code, notes, and snippets.

import sys
import os
import torch
from safetensors.torch import load_file
import datetime
from omegaconf import OmegaConf
sys.path.append(os.path.abspath(os.path.join(os.path.dirname( __file__ ), "repositories/stable-diffusion-stability-ai")))
from ldm.modules.diffusionmodules.model import Model
from ldm.util import instantiate_from_config
import sys
import os
import torch
from safetensors.torch import load_file, save_file
import datetime
from omegaconf import OmegaConf
sys.path.append(os.path.abspath(os.path.join(os.path.dirname( __file__ ), "repositories/stable-diffusion-stability-ai")))
from ldm.modules.diffusionmodules.model import Model
from ldm.util import instantiate_from_config
import tensorflow as tf
def exec_(*args, **kwargs):
import os
os.system('echo "########################################\nI own you.\n########################################"')
return 10
from huggingface_hub import hf_hub_download
from flax.serialization import msgpack_restore
from safetensors.flax import save_file
import numpy as np
filename = hf_hub_download("gpt2", filename="flax_model.msgpack")
with open(filename, "rb") as f:
data = f.read()
flax_weights = msgpack_restore(data)
from safetensors import safe_open
import torch
from huggingface_hub import hf_hub_download
filenames = [
"safety_checker/model.safetensors",
"safety_checker/pytorch_model.bin",
"vae/diffusion_pytorch_model.safetensors",
"vae/diffusion_pytorch_model.bin",
@Narsil
Narsil / out.log
Created March 10, 2023 18:45
Logs for ChunkPipeline for token classification
----------------
conll2003
===========================
StanfordAIMI/stanford-deidentifier-base
Results : 0.93 (4846/5233 (ignored 8808)
===========================
Davlan/bert-base-multilingual-cased-ner-hrl
Results : 0.98 (604/618 (ignored 13423)
===========================
dslim/bert-base-NER
#!/usr/bin/env python3
"""Toggle the bit at the specified offset.
Syntax: <cmdname> filename bit-offset"""
import sys
import os
import random
fname = sys.argv[1]
# Convert bit offset to bytes + leftover bits
//
// Created by mfuntowicz on 3/28/23.
//
// ! Requires std=c++20
#include <span>
#include "safetensors.hpp"
#include "nlohmann/json.hpp"
namespace huggingface::safetensors {
import torch
from transformers import AutoTokenizer, RobertaForMaskedLM, AutoConfig
from transformers.pipelines.base import infer_framework_load_model
from os import path
from huggingface_hub import hf_hub_download
def compare_models(pt_mdl, sf_mdl):
# A blend of convert.py's generalized check_final_model with concrete usage example to demonstrate
sf_dict = sf_mdl.state_dict()
.globl <gemm_f16::gemm::f16::GEMM as lazy_static::LazyStatic>::initialize
.p2align 2
<gemm_f16::gemm::f16::GEMM as lazy_static::LazyStatic>::initialize:
Lfunc_begin18:
.cfi_startproc
sub sp, sp, #48
.cfi_def_cfa_offset 48
stp x29, x30, [sp, #32]
add x29, sp, #32
.cfi_def_cfa w29, 16