Skip to content

Instantly share code, notes, and snippets.

@kyo-takano
kyo-takano / serving-uncensored-llm-on-cloud.md
Created October 9, 2026 03:21
無検閲LLMをクラウドで

無検閲LLMをクラウドで

目的に制限のかからない無検閲LLMを使うために、数十万円かけてローカルLLM実行環境を用意する必要はあるでしょうか? Qwen 3.8 27B Uncensoredが話題になったここ数週間、そうした相談を受けることが増えました。 結論を言えば、ほとんどのケースでその必要はありません。

よくある推論APIでは、プロンプトを文字列のまま送り、またレスポンスの主な要素として文字列を受け取ります。 事業者によっては内容をモニターしており、ポリシーに反する内容を検出すれば、そこに悪意がなくとも利用に制限がかかります。これは、生物化学系の研究やサイバーセキュリティにおけるペンテスト(penetration test)などを行う上では非常に不便です。 ローカルLLMはその回避を主目的の一つとして発展してきましたが、そもそもAI企業の規制を掻い潜るのに手元に機材を揃える必要はありません—クラウド上に自身でデプロイし、必要なときだけ呼び出せばいいのですから。そしてそれは、パラメータに刷り込まれたガードレールすらも排除したuncensored LLMにおいても同じことです。

@kyo-takano
kyo-takano / rawllm-predictability-example-2.ipynb
Created August 19, 2026 06:57
rawllm:predictability.example-2.ipynb
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@kyo-takano
kyo-takano / rawllm-predictability-example-1.ipynb
Created August 19, 2026 06:57
rawllm-predictability-example-1.ipynb
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@kyo-takano
kyo-takano / xet-gc.md
Created July 29, 2026 05:28
Xet-GC: Garbage Collector for Hugging Face Storage with Xet Backend

Xet-GC semi-automates the cleanup of Hugging Face repositories bloated by Xet.

image

With the "LFS Files" modal open in your settings, this script maps each row of the table to its corresponding "Possible filename," which is hidden within a tooltip mask. By parsing the DOM to extract this information, the script retains only the most recent version of each unique filename (assuming the first occurrence from top to bottom is the latest) and automatically selects all older duplicates.


  1. Open the Settings of your Hugging Face repository and navigate to Storage Usage > List Large Files.
@kyo-takano
kyo-takano / the-poor-mans-guide-to-cloud-gpu-selection--ja.md
Created January 26, 2026 11:07
貧者のクラウドGPU選択ガイド

cost-efficiency

投資コストに対して得られる計算量は、GPUと演算強度(Arithmetic Intensity)によって大きく異なります。Runpodの価格設定に基づき、`batch_size=1024` (tokens) でLLMを事前学習した場合、0.5Bパラメータ未満のモデルではL4が、それ以上の規模ではH100が圧倒的なコストパフォーマンスを示します。

貧者のクラウドGPU選択ガイド

@kyo-takano
kyo-takano / the-poor-mans-guide-to-cloud-gpu-selection.md
Created January 26, 2026 10:53
The Poor Man’s Guide to Cloud GPU Selection

cost-efficiency

Compute obtained per dollar varies significantly by GPU and arithmetic intensity. According to Runpod's pricing, when pre-training LLMs with `batch_size=1024` (tokens), the L4 offers superior cost-performance for models under 0.5B parameters, while the H100 dominates for larger scales.

The Poor Man’s Guide to Cloud GPU Selection

@kyo-takano
kyo-takano / making-the-most-of-local-llms.ipynb
Last active August 20, 2026 00:12
ローカルLLMはこーやって使うの💢
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@kyo-takano
kyo-takano / openai_batch_generation.py
Created April 16, 2024 09:31
Submitting an Asyncronous Large-Batch Request with OpenAI Python SDK
#!/usr/bin/python
import json
import textwrap
import time
from openai import OpenAI
client = OpenAI()
@kyo-takano
kyo-takano / pandas-concise-query.py
Created March 16, 2024 03:16
Creating a concise query for Pandas DataFrame
init_std, lr = 0.02, 2e-5 # example
""" Redundant """
indices = df["init_std"] == init_std) & (df["lr"] == lr)
print(df[(indices])
""" Concise """
query = f"{init_std=} & {lr=}".replace("=", "==")
print(df.query(query)) # "init_std==0.02 & lr==2e-05"
@kyo-takano
kyo-takano / cheat-sheet--pytorch-on-tpu.md
Created March 10, 2024 04:40
Cheat Sheet: PyTorch on TPU

Cheatsheet: Migrating a PyTorch script to a single TPU

Mar 10, 2024.

See pytorch.org/xla for up-to-date info and implementation with multiple TPUs

Installing PyTorch/XLA for TPU

# Usually pre-installed on TPU instances
pip install torch_xla[tpu] -f https://storage.googleapis.com/libtpu-releases/index.html