ワンクリックで
doc-to-lora
A method to instantly internalize document contexts into language models using LoRA without fine-tuning.
Codex または Claude でインストール この Prompt をコピーして Codex、Claude、または他のアシスタントに貼り付けると、Skill ページを確認してインストールできます。
メニュー
A method to instantly internalize document contexts into language models using LoRA without fine-tuning.
Codex または Claude でインストール この Prompt をコピーして Codex、Claude、または他のアシスタントに貼り付けると、Skill ページを確認してインストールできます。
SOC 職業分類に基づく
| name | doc_to_lora |
| description | A method to instantly internalize document contexts into language models using LoRA without fine-tuning. |
| source_type | github |
| auth_required | true |
| repository_url | https://github.com/SakanaAI/doc-to-lora |
| reference_url | https://arxiv.org/abs/2602.15902 |
A method to instantly internalize document contexts into language models using LoRA without fine-tuning.
https://github.com/SakanaAI/doc-to-lora
Use this as the implementation source: clone the repo and follow its README for install, dependencies, and how to run code or experiments. The generated client prints JSON with a suggested git clone command.
https://arxiv.org/abs/2602.15902
This is the paper reference. The client can optionally fetch live Atom metadata (title, abstract) for agents; it does not run training or upstream research code by itself.
The *_client.py script prints JSON that combines a GitHub repository (clone URL + suggested git clone) with optional paper context from arXiv (live Atom metadata when reference_url is arXiv). Run the real code by cloning the repo and following its README — the skill is your agent-facing entrypoint, not a substitute for the repo’s install steps.
To call a REST API instead, set BASE_URL in scripts/doc_to_lora_client.py or wrap the upstream CLI with subprocess after clone.
Extracted for operators and agents. Confirm against the upstream repository or paper before relying on it in production.
curl -LsSf https://astral.sh/uv/install.sh | sh
./install.sh
Login to Hugging Face to download pre-trained models:
uv run huggingface-cli login
uv run huggingface-cli download SakanaAI/doc-to-lora --local-dir trained_d2l --include "/"
uv run demo/app.py
import torch
from ctx_to_lora.model_loading import get_tokenizer
from ctx_to_lora.modeling.hypernet import ModulatedPretrainedModel
# Load model
checkpoint_path = "trained_d2l/gemma_demo/checkpoint-80000/pytorch_model.bin"
state_dict = torch.load(checkpoint_path, weights_only=False)
model = ModulatedPretrainedModel.from_state_dict(
state_dict, train=False, use_sequence_packing=False
)
model.reset()
tokenizer = get_tokenizer(model.base_model.name_or_path)
# Prepare input
doc = open("data/sakana_wiki.txt", "r").read()
chat = [{"role": "user", "content": "Tell me about Sakana AI."}]
chat_ids = tokenizer.apply_chat_template(
chat,
add_special_tokens=False,
return_attention_mask=False,
add_generation_prompt=True,
return_tensors="pt",
).to(model.device)
# Internalize document and generate
model.internalize(doc)
outputs = model.generate(input_ids=chat_ids, max_new_tokens=512)
print(tokenizer.decode(outputs[0]))
# Reset to remove internalized context
model.reset()
Run experiments from repository root using uv run:
Main Experiment:
uv run scripts/main_exp/0-download_data.sh
uv run scripts/main_exp/1-train.sh
uv run scripts/main_exp/eval/*.sh
NIAH (Needle in a Haystack):
uv run scripts/niah/0-gen_data.sh
uv run scripts/niah/1-train.sh
uv run scripts/niah/2-eval.sh
View self-generated data samples:
uv run webui/self_gen_viewer.py
See webui/SELF_GEN_VIEWER.md for details.
checkpoint_path parametersrc/ctx_to_lora/modeling/hypernet.pyThe same text lives in scripts/USAGE.md for tools that prefer reading files under scripts/.
--api-key (str) [required] API key for authentication --checkpoint-path (str) [required] Path to the trained D2L model checkpoint (pytorch_model.bin) --doc (str) [required] Document text or file path to internalize --query (str) [required] User query or chat message to generate response for --max-new-tokens (int) [optional, default=512] Maximum number of tokens to generate
python3 scripts/doc_to_lora_client.py uv run demo/app.py
{"response": "Generated text influenced by internalized document"}
Onboard and manage Paperclip AI for research-paper knowledge and agent orchestration
Generate a structured scientific post and publish it to Infinite. Runs a focused single-agent investigation (PubMed search → LLM analysis → hypothesis/method/findings/conclusion) and posts the result. Faster than scienceclaw-investigate — best for targeted, single-topic posts.
Infinite platform integration for AI agent collaboration
Read a CSV or XLSX file and return columns, shape, dtypes, and first N rows as JSON.
Execute arbitrary Python code and return stdout. NumPy, pandas, scipy, matplotlib, and other scientific libraries are available.
Generate a structured scientific PDF report from a JSON description. Accepts a JSON file specifying title, authors, abstract, sections (headings, text, tables, figures), and inline data panels (heatmap, bar, scatter, line). Produces a publication-style A4 PDF using reportlab with no LaTeX dependency. All figures are either loaded from PNG paths or generated on-the-fly from inline data.