Skip to content

Instantly share code, notes, and snippets.

@opparco
opparco / ddim-animatediff.patch
Created August 27, 2023 00:50
ddim for Animatediff webui
diff --git a/ldm/models/diffusion/ddim.py b/ldm/models/diffusion/ddim.py
index c6cfd57..2569ea1 100644
--- a/ldm/models/diffusion/ddim.py
+++ b/ldm/models/diffusion/ddim.py
@@ -25,12 +25,24 @@ class DDIMSampler(object):
self.ddim_timesteps = make_ddim_timesteps(ddim_discr_method=ddim_discretize, num_ddim_timesteps=ddim_num_steps,
num_ddpm_timesteps=self.ddpm_num_timesteps,verbose=verbose)
alphas_cumprod = self.model.alphas_cumprod
+
+ beta_start = 0.00085
@opparco
opparco / llama.cpp-gptneox-wip.patch
Created August 22, 2023 00:33
build gptneox-wip
diff --git a/examples/CMakeLists.txt b/examples/CMakeLists.txt
index d2176c9..3735e62 100644
--- a/examples/CMakeLists.txt
+++ b/examples/CMakeLists.txt
@@ -13,6 +13,7 @@ include_directories(${CMAKE_CURRENT_SOURCE_DIR})
if (EMSCRIPTEN)
else()
add_subdirectory(main)
+ add_subdirectory(gptneox-wip)
add_subdirectory(quantize)
@opparco
opparco / debug-tokenizer-vicuna-13b.py
Created August 21, 2023 04:59
debug tokenizer of lmsys/vicuna-13b-v1.3
#
# debug tokenizer of lmsys/vicuna-13b-v1.3
#
from transformers import AutoTokenizer
tokenizer = AutoTokenizer.from_pretrained("lmsys/vicuna-13b-v1.3")
def encode_decode(string: str):
@opparco
opparco / weblab_10b.py
Last active August 20, 2023 10:20
correct vocab of matsuo-lab/weblab-10b
#
# correct vocab of matsuo-lab/weblab-10b
#
vocab = {}
# 95 -> (none)
# 96 -> \xa1
# ...
# 107 -> \xac
@opparco
opparco / debug-tokenizer-hiragana.py
Created August 18, 2023 14:44
debug tokenizer of matsuo-lab/weblab-10b
from transformers import AutoTokenizer
tokenizer = AutoTokenizer.from_pretrained("matsuo-lab/weblab-10b")
file_path = "hiragana.txt"
with open(file_path, "w", encoding="utf-8") as o:
o.write("# unicode decoded [num-ids] id, ...\n")
for i in range(0x3040, 0x309F + 1):
ids = tokenizer.encode(chr(i), add_special_tokens=False)
decoded = tokenizer.decode(ids)
@opparco
opparco / debug-tokenizer-weblab-10b.py
Created August 18, 2023 11:20
debug tokenizer of matsuo-lab/weblab-10b
from transformers import AutoModelForCausalLM, AutoTokenizer
tokenizer = AutoTokenizer.from_pretrained("matsuo-lab/weblab-10b")
dot = tokenizer.encode(".")
print(dot)
# [15]
nemureru = tokenizer.encode("眠れる")
#
filename = '../grammars/japanese.gbnf'
print(f"overwrite {filename}")
with open(filename, 'w', encoding='utf-8') as f:
f.write("""#
root ::= char+ ([ \\t\\n] char+)*
char ::= [\u3000-\u303F\u3040-\u309F\u30A0-\u30FF\u4E00-\u9FFF\uFF21-\uFF3A\uFF41-\uFF5A\uFF10-\uFF19]""")
@opparco
opparco / output.txt
Created July 23, 2023 11:58
llama.cpp demo
C:\pub\llama.cpp\build>.\bin\Release\main.exe -m C:\pub\llama\llama-2-7b-chat\ggml-model-q4_K_M.bin -c 2048 -p "translate in japanese: The pen is mightier than the sword."
main: build = 852 (294f424)
main: seed = 1690113032
llama.cpp: loading model from C:\pub\llama\llama-2-7b-chat\ggml-model-q4_K_M.bin
llama_model_load_internal: format = ggjt v3 (latest)
llama_model_load_internal: n_vocab = 32000
llama_model_load_internal: n_ctx = 2048
llama_model_load_internal: n_embd = 4096
llama_model_load_internal: n_mult = 256
llama_model_load_internal: n_head = 32
template<typename Key, typename T, T value = T()>
class defaultable_map :
public std::unordered_map<Key, T>
{
public:
// inherit std::unordered_map constructors
using std::unordered_map<Key, T>::unordered_map;
T & operator[](const Key & key)
{

Here are a few Yuri couples from Madoka Magica, formatted using Markdown:

  1. Madoka Kaname and Kyubey
    • Madoka's determination to become a Magical Girl and Kyubey's manipulation of her desires create a complex and often fraught relationship.
  2. Homura Akemi and Madoka Kaname
    • Homura's fierce protectiveness of Madoka and her willingness to make sacrifices for her rival's happiness create a powerful and emotional bond.
  3. Kyoko Sakura and Sayaka Nakamura
    • Kyoko's quiet strength and Sayaka's desire to save her friend create a touching and heartwarming relationship.
  4. Mami Tomoe and Kyoko Sakura
    • Mami's mentorship of Kyoko and Kyoko's admiration for Mami's strength and leadership create a beautiful and supportive relationship.