doc_to_lora
A method to instantly internalize document contexts into language models using LoRA without fine-tuning.
Skill by lamm-mit
Install
Works with Claude Code, Claude apps, Codex, Cursor, Gemini CLI, GitHub Copilot, VS Code, OpenCode, Goose, Windsurf. Read the repository before you give any tool access to your data.
npx agentmarket install skill/lamm-mit-doc-to-lora
Asks which of your tools to add it to (Claude Code, Codex, Cursor, VS Code, Windsurf, Gemini CLI, Claude Desktop) and shows the change first. See https://agentmart.dev/cli.
Get the weekly diff
The weekly diff: one email a week with new agent tools, notable updates and grade changes, plus security alerts for tools you follow. Double opt-in, one-click unsubscribe.
About
Use cases: documents
Reviews
Write a reviewNo reviews yet. Installed it? Reviews come from verified installers only. How reviews work
Permissions
What this skill can do and what it asks for, from its SKILL.md. Checked Oct 25, 2026.
- Tools
- No tools found
- Secrets
- None asked for
- Install scripts
- None found
- Runs as
- Python package
Network hosts it talks to 1
codeload.github.com· found in install command
Files it touches
~/.claude/skills/doc-to-lora
What's inside
- Skill name
doc_to_lora- Description
- A method to instantly internalize document contexts into language models using LoRA without fine-tuning.
- License
- Apache-2.0
- Instructions
- 144 lines in SKILL.md · view on GitHub
Before installing
- Ships executable scripts
- Instructions call the network
Agent Skills spec issues
- name: only lowercase letters, digits and single hyphens allowed
Files (3)
- SKILL.md
- USAGE.md · scripts/
- doc_to_lora_client.py · scripts/
SKILL.md (first lines)
## doc_to_lora
A method to instantly internalize document contexts into language models using LoRA without fine-tuning.
### Code repository
<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.
### Paper (arXiv — explanation)
<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.
### What “running” this client does
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.
### How to run the method (from the source)
Extracted for **operators and agents**. Confirm against the upstream repository or paper before relying on it in production.
## Prerequisites
- Python 3.8+
- CUDA-capable GPU (recommended)
- Hugging Face account for model access
## Installation
```bash
curl -LsSf https://astral.sh/uv/install.sh | sh
./install.sh
```
## Configuration
### Hugging Face Authentication
Login to Hugging Face to download pre-trained models:
```bash
uv run huggingface-cli login
```
### Download Pre-Trained Models
```bash
uv run huggingface-cli download SakanaAI/doc-to-lora --local-dir trained_d2l --include "/"
```
## How to run
### Interactive Demo
```bash
uv run demo/app.py
```
### Python API Usage (Non-batched)
```python
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()
```
### Experimental Scripts
Run experiments from repository root using `uv run`:
**Main Experiment:**
```bash
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):**
```bash
uv run scripts/niah/0-gen_data.sh
uv run scripts/niah/1-train.sh
uv run scripts/niah/2-eval.sh
```
### Data Viewer
View self-generated data samples:
```bash
uv run webui/self_gen_viewer.py
```
See [webui/SELF_GEN_VIEWER.md](webui/SELF_GEN_VIEWER.md) for details.
## Configuration
- **Model checkpoint paths**: Specify via `checkpoint_path` parameter
- **Base model**: Configured in checkpoint; supports Gemma and other Hugging Face models
- **Batched inference**: For batched operations, see `src/ctx_to_lora/modeling/hypernet.py`From lamm-mit/scienceclaw, Apache-2.0.
More from lamm-mit/scienceclaw
- 0.516score
drugbank-database
lamm-mit
Access and analyze comprehensive drug information from the DrugBank database including drug properties, interactions, targets, pathways, chemical structures…
SkillCFreshness: C★ 250Claude Code +9 - 0.516score
geometry-generator
lamm-mit
Generate parametric bioinspired ribbed membrane STL geometry via LLM-guided design.
SkillCFreshness: C★ 250Claude Code +9 - 0.516score
disease-research
lamm-mit
Generate comprehensive disease research reports using 100+ ToolUniverse tools.
SkillCFreshness: C★ 250Claude Code +9 - 0.516score
drug-research
lamm-mit
Generates comprehensive drug research reports with compound disambiguation, evidence grading, and mandatory completeness sections.
SkillCFreshness: C★ 250Claude Code +9 - 0.516score
fem-analysis
lamm-mit
Modal analysis of a membrane STL using Kirchhoff plate FEM (scipy eigensolver).
SkillCFreshness: C★ 250Claude Code +9 - 0.516score
generate-image
lamm-mit
Generate or edit images using AI models (FLUX, Gemini).
SkillCFreshness: C★ 250Claude Code +9 - 0.516score
ase
lamm-mit
Atomic Simulation Environment (ASE) for computational materials science.
SkillCFreshness: C★ 250Claude Code +9 - 0.516score
askcos
lamm-mit
Retrosynthetic template relevance prediction using a locally deployed ASKCOS TorchServe service.
SkillCFreshness: C★ 250Claude Code +9 - 0.516score
pylabrobot
lamm-mit
Vendor-agnostic lab automation framework.
SkillCFreshness: C★ 250Claude Code +9 - 0.516score
biorxiv-database
lamm-mit
Efficient database search tool for bioRxiv preprint server.
SkillCFreshness: C★ 250Claude Code +9 - 0.516score
esm
lamm-mit
Comprehensive toolkit for protein language models including ESM3 (generative multimodal protein design across sequence, structure, and function) and ESM C…
SkillCFreshness: C★ 250Claude Code +9 - 0.516score
jax-modal-analysis
lamm-mit
3D tetrahedral FEM modal analysis of a membrane STL.
SkillCFreshness: C★ 250Claude Code +9
Signals
- Stars
- 250
- Forks
- 47
- Open issues
- 1
- Last commit (this folder)
- Mar 25, 2026 (7 months ago)
- Last release
- Jun 23, 2026 (4 months ago)
From GitHub (fetched Oct 24, 2026).
Details
- License
- Apache-2.0
- Repository
- github.com/lamm-mit/scienceclaw
- First seen
- Oct 24, 2026
- Last checked
- Oct 24, 2026
- Source
- GitHubgithub-graphql
More from lamm-mit
- 0.516score
biorxiv-database
lamm-mit
Efficient database search tool for bioRxiv preprint server.
SkillCFreshness: C★ 250Claude Code +9 - 0.516score
disease-research
lamm-mit
Generate comprehensive disease research reports using 100+ ToolUniverse tools.
SkillCFreshness: C★ 250Claude Code +9 - 0.516score
askcos
lamm-mit
Retrosynthetic template relevance prediction using a locally deployed ASKCOS TorchServe service.
SkillCFreshness: C★ 250Claude Code +9 - 0.516score
ase
lamm-mit
Atomic Simulation Environment (ASE) for computational materials science.
SkillCFreshness: C★ 250Claude Code +9 - 0.516score
pylabrobot
lamm-mit
Vendor-agnostic lab automation framework.
SkillCFreshness: C★ 250Claude Code +9 - 0.516score
drug-research
lamm-mit
Generates comprehensive drug research reports with compound disambiguation, evidence grading, and mandatory completeness sections.
SkillCFreshness: C★ 250Claude Code +9
Cite this page
doc_to_lora skill. Agent Mart. https://agentmart.dev/skills/lamm-mit-doc-to-lora (last updated 2026-10-24)