Skip to content

Instantly share code, notes, and snippets.

View tsukumijima's full-sized avatar
📺
TTS & DTV

tsukumi tsukumijima

📺
TTS & DTV
View GitHub Profile
@litagin02
litagin02 / simple_merge.py
Last active February 25, 2024 16:13
Bert-VITS2のモデルマージするやつ(声音・感情表現それぞれを取っ替えたり混ぜたり)
import os
import gradio as gr
import torch
from infer import get_net_g, infer
import utils
voice_keys = ["dec", "flow"]
speech_style_keys = ["enc_p"]
# MIT License
# This code will run on VRAM 12GB+ GPU such as T4, RTX 3060
import torch
from transformers import AutoModelForCausalLM, AutoTokenizer, pipeline
from langchain.text_splitter import RecursiveCharacterTextSplitter
from langchain.document_loaders import PyPDFLoader
from langchain.vectorstores import FAISS
from langchain.chains import RetrievalQA
from langchain.embeddings import HuggingFaceEmbeddings
from langchain.llms.huggingface_pipeline import HuggingFacePipeline
@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
/*
https://github.com/karpathy/llama2.c/blob/master/run.c
GPT-4による解説
このプログラムは、Transformerネットワークを実装し、トークン化されたテキスト入力から次の最も適したトークンを予測します。具体的には以下のようになります:
先頭の部分は、TransformerWeightsとRunStateという2つのデータ構造とそれらの関連するメモリの管理を含みます。
Configという構造体は、トランスフォーマーネットワークのパラメータを保持します。
次に、指定されたチェックポイントファイルから重みを初期化する関数があります。この関数は、チェックポイントファイルからトランスフォーマーネットワークの重みを読み込み、適切に配置します。
@adrienbrault
adrienbrault / llama2-mac-gpu.sh
Last active April 8, 2025 13:49
Run Llama-2-13B-chat locally on your M1/M2 Mac with GPU inference. Uses 10GB RAM. UPDATE: see https://twitter.com/simonw/status/1691495807319674880?s=20
# Clone llama.cpp
git clone https://github.com/ggerganov/llama.cpp.git
cd llama.cpp
# Build it
make clean
LLAMA_METAL=1 make
# Download model
export MODEL=llama-2-13b-chat.ggmlv3.q4_0.bin
@younesbelkada
younesbelkada / finetune_llama_v2.py
Last active July 1, 2025 23:14
Fine tune Llama v2 models on Guanaco Dataset
# coding=utf-8
# Copyright 2023 The HuggingFace Inc. team. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
@uakihir0
uakihir0 / Bluesky で何か作りたいエンジニアの方へ.md
Last active October 31, 2024 11:09
Bluesky で何か作りたいエンジニアの方へ.md

Bluesky で何か作りたいエンジニアの方へ

ATProtocol

 Bluesky の開発はオープンに行われていて、ATProtocol (あっとぷろとこる) をベースに実装されています。Bluesky は ATProtocol 上で作成された SNS アプリというのが立ち位置で、誤解を恐れずに表現すると、アカウントの仕様、及びデータの持ち方とその共有の方法を定義したのが ATProtocol です。Bluesky はそのデータの形式を決め、データでサービスを形作ったものになります。なので、仕様書を見ると、ATProtocol と Bluesky でレイヤーに分かれて実装されているのが見て取れます。

 Bluesky/ATProtocol の仕様は 公式のドキュメントページ で見ることができます。仕様書は Lexicon というスキーマ定義言語で記述されていて、その仕様についてもドキュメントからみることが出来ます。とはいえ、この仕様を読んでいくのも結構骨が折れるので、まずは、どんなリクエストが飛んでいるのか、を Web 公式アプリ からデベロッパーツール (使い方)を使って見ることをオススメします。

bsky5

クライアントライブラリ

@uakihir0
uakihir0 / Bluesky の歩き方.md
Last active July 7, 2024 05:34
Bluesky の歩き方.md

Bluesky の歩き方

 Bluesky は Twitter の類似サービスとして期待されている分散 SNS の一つです。 Twitter の創設者である Jack Dorsey による出資を受けており、 Bluesky, PBLLC によって開発・運営されています。 Bluesky は現在公式のアプリ・ウェブでは、日本語の UI がなくとっつきにくい部分があるため、ここでは楽しみ方について簡単に説明します。

日本語話者の探し方

 まずは何にせよ、フォローする人を見つける必要があります。 Bluesky 公式 Web または、公式アプリからログインしている人は、以下の日本語話者カスタムフィード (ユーザーが作成した、独自のタイムライン) Japanese Cluster を見れば、日本語話者が見つかると思います。

 とはいえ、このカスタムフィードでは、人が多すぎて何がなんだかと思う人も多いと思うので、今トレンドのポスト (投稿) を取得する方法を説明します。まず、設定からコンテンツ言語を日本語にします。コンテンツ言語は、カスタムフィードにおいて、どの言語のポストを取得するか? という設定になります。左メニューから、 Settings > Content Languages の順にアクセスすると変更できます。

@monyone
monyone / aho.ts
Created June 12, 2023 13:14
Aho Corasick Implementation in TypeScript
class Trie {
private goto: Map<string, Trie> = new Map<string, Trie>();
public keywords: string[] = []
public failure: Trie | null = null;
public has(s: string) {
return this.goto.has(s);
}
public get(s: string) {
return this.goto.get(s);