Skip to content

Instantly share code, notes, and snippets.

@kishida
kishida / chat_template.jinja
Created August 13, 2026 05:33
chat_template.jinja of Qwen3.8 for llama.cpp
{%- macro render_content(content) %}
{%- if content is string %}
{{- content }}
{%- elif content is iterable and content is not mapping %}
{%- for item in content %}
{%- if 'text' in item %}
{{- item.text }}
{%- else %}
{{- raise_exception('Unexpected item type in content.') }}
{%- endif %}
@kishida
kishida / metal-iq1-narrow.patch
Created August 13, 2026 04:58
patch for Metal of unsloth's q1 extension
diff --git a/ggml/src/ggml-metal/ggml-metal-device.cpp b/ggml/src/ggml-metal/ggml-metal-device.cpp
index c153bd821..64c3d3d70 100644
--- a/ggml/src/ggml-metal/ggml-metal-device.cpp
+++ b/ggml/src/ggml-metal/ggml-metal-device.cpp
@@ -941,6 +941,21 @@ ggml_metal_pipeline_with_params ggml_metal_library_get_pipeline_mul_mv(ggml_meta
nsg = N_SG_IQ1_M;
nr0 = N_R0_IQ1_M;
} break;
+ case GGML_TYPE_IQ1_XS:
+ {
@kishida
kishida / tokenizer_viz.py
Last active May 1, 2026 03:31
Llama.cpp Tokenize Visualizer
#!/usr/bin/env python3
"""
llama.cpp トークナイザー可視化ツール
単一Pythonファイル版 - llama-tokenizeコマンドの結果を色付きで表示
"""
import os
import glob
import subprocess
import json
@kishida
kishida / AdaptiveQuicksort.java
Last active January 26, 2026 15:50
patent US7680791B2 orasort implementation in Java
import java.util.*;
/**
* US7680791B2特許の最適化完全実装: Adaptive Quicksort (AQS) v2
*
* 特許の3つの核心技術を完全実装 + 追加最適化:
* 1. Common Prefix Skipping Quicksort (CPS-QS)
* 2. Key Substring Caching (2バイト + 拡張オプション)
* 3. Adaptive Quicksort (Quicksort ↔ Radix Sort 相互再帰)
*
@kishida
kishida / JavaLauncher.java
Last active March 18, 2026 18:23
Javaコードを実行する
import module java.desktop;
void main() {
var f = new JFrame("Javaランチャー");
f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
f.setSize(800, 600);
f.setLocationRelativeTo(null);
var split = new JSplitPane(JSplitPane.VERTICAL_SPLIT);
var taSource = new JTextArea();
@kishida
kishida / SuiGenerator.java
Last active December 14, 2025 11:45
Sui言語のサンプルコードを生成する
package kis;
import module java.desktop;
import module java.base;
import java.net.http.HttpClient;
import java.util.List;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonProperty;
@kishida
kishida / sui-lang-Qwen3-8b.ipynb
Last active December 14, 2025 10:03
LLMにやさしい言語SuiにやさしいLLMを作るJupyterNote
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@kishida
kishida / ToolSample.java
Last active December 3, 2025 13:21
Function Callingを試すサンプル
import dev.langchain4j.agent.tool.Tool;
import dev.langchain4j.http.client.jdk.JdkHttpClient;
import dev.langchain4j.memory.chat.MessageWindowChatMemory;
import dev.langchain4j.model.openai.OpenAiStreamingChatModel;
import dev.langchain4j.service.AiServices;
import dev.langchain4j.service.TokenStream;
import module java.desktop;
import java.net.http.HttpClient;
import java.time.LocalTime;
@kishida
kishida / java-error-ministral3_3B.ipynb
Last active December 3, 2025 12:11
Javaのエラーを明るく説明するMinistral 3 3B
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@kishida
kishida / java-error-gptoss-20b.ipynb
Created November 30, 2025 13:24
Javaのエラーを明るく解説するgpt-oss 20b Fine Tune
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.