SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2410.09400 · ICLR · 2025

CtrLoRA: An Extensible and Efficient Framework for Controllable Image Generation

Xilin Chen, Shiguang Shan, Yifeng Xu, Zhenliang He

arXiv · PDF · Open in the Atlas

Code that ran

13 of 22 samples (functions and classes) lifted from this paper's linked repositories executed on a synthesized input in Syntology's jail (6 of them constructed an object rather than computing a result; 2 honoured the contract we drafted, 1 violated it and 7 have no contract verdict; 3 failures of our instrument; 9 no recorded run), measured 2026-11-22; repository links from the Papers with Code archive attributed under CC BY-SA, no affiliation; bodies inline only under a permissive licence as GitHub detects it. Not a reproduction of the paper's results.

"Ran" means the function executed on a synthesized input and returned a value. It is not a reproduction of the paper's results. This record, dated, as JSON: /api/ran/2410.09400.json · badge: /api/ran/2410.09400.svg

Each repository's role is a label: a classifier's output recorded on the link, or, where no role is recorded, what the Papers with Code archive marked. The line under it names its basis. Neither says who wrote the code.

RepositoryRoleRan
xyfJASON/ctrlora canonical (classifier label)
classifier basis: classifier_2025
2 ran · 0 no recorded run
xyfjason/ctrlora community
Papers with Code archive
7 ran · 7 no recorded run
copy not recorded community
not in the paper's declared repositories
2 ran · 1 no recorded run
cloneofsimo/lora reimplementation (classifier label)
classifier basis: classifier_2025
2 ran · 1 no recorded run
FunctionStatusWhere it lives
LoRACompatibleLinear Ran
ran on a synthesized input · constructed an object; no result was computed
xyfjason/ctrlora/cldm/cldm_ctrlora_inference.py
code served (permissive licence) · get_code("9da413a606c2fa21")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned an instance of its own class, LoRACompatibleLinear: the run constructed the object and did not call it, so no result was computed. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch
import torch.nn as nn

torch.manual_seed(0)

# Create a small LoRA layer for testing
lora_layer = nn.Module()
lora_layer.up = nn.Linear(4, 3, bias=False)
lora_layer.down = nn.Linear(5, 4, bias=False)
lora_layer.network_alpha = 0.5
lora_layer.rank = 4

# Build ARGS dict with all parameters for LoRACompatibleLinear
ARGS = {
    'in_features': 5,
    'out_features': 3,
    'bias': True,
    'device': None,
    'dtype': None,
    'lora_layer': lora_layer,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type LoRACompatibleLinear — the run constructed an instance of its own class and did not call it; no shape is stated — the instrument coerces any output to an array; for a LoRACompatibleLinear output the recorded ndim 0 and dtype family float describe that coercion, not the output, and are not stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
LoRALinearLayer Ran
ran on a synthesized input · constructed an object; no result was computed
xyfjason/ctrlora/cldm/cldm_ctrlora_inference.py
code served (permissive licence) · get_code("902d1f89b0cf6904")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned an instance of its own class, LoRALinearLayer: the run constructed the object and did not call it, so no result was computed. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch
import torch.nn as nn

torch.manual_seed(0)

ARGS = {
    "in_features": 8,
    "out_features": 16,
    "rank": 4,
    "network_alpha": 1.0,
    "device": None,
    "dtype": None,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type LoRALinearLayer — the run constructed an instance of its own class and did not call it; no shape is stated — the instrument coerces any output to an array; for a LoRALinearLayer output the recorded ndim 0 and dtype family float describe that coercion, not the output, and are not stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
MemoryEfficientCrossAttention Ran
ran on a synthesized input · constructed an object; no result was computed
xyfjason/ctrlora/cldm/cldm_ctrlora_inference.py
code served (permissive licence) · get_code("f60e775a28631190")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned an instance of its own class, MemoryEfficientCrossAttention: the run constructed the object and did not call it, so no result was computed. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch
import torch.nn as nn

torch.manual_seed(0)

# Mock xformers module since it's not available
class MockXformersOps:
    @staticmethod
    def memory_efficient_attention(q, k, v, attn_bias=None, op=None):
        # Simple mock: return a tensor of shape (b*heads, seq_len, dim_head)
        return torch.randn(q.shape[0], q.shape[1], q.shape[2])

class MockXformers:
    ops = MockXformersOps()

import sys
sys.modules['xformers'] = MockXformers()
sys.modules['xformers.ops'] = MockXformers.ops

import xformers

# Now define the arguments
ARGS = {
    'query_dim': 64,
    'context_dim': 64,
    'heads': 8,
    'dim_head': 8,
    'dropout': 0.1,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
torch, xformers — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type MemoryEfficientCrossAttention — the run constructed an instance of its own class and did not call it; no shape is stated — the instrument coerces any output to an array; for a MemoryEfficientCrossAttention output the recorded ndim 0 and dtype family float describe that coercion, not the output, and are not stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
QKVAttentionLegacy Ran
ran on a synthesized input
xyfjason/ctrlora/cldm/cldm_ctrlora_inference.py
code served (permissive licence) · get_code("0e10d815fe77258a")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, class construct-then-call prompt, model not recorded) and returned Tensor, ndim 3, dtype family float; no output shape is stated. The image it ran in was not recorded. If your copy returns the same type and ndim on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch
import torch.nn as nn
import math
import numpy as np

def count_flops_attn(model, _x, y):
    """
    A counter for the `thop` package to count the operations in an
    attention operation.
    Meant to be used like:
        macs, params = thop.profile(
            model,
            inputs=(inputs, timestamps),
            custom_ops={QKVAttention: QKVAttention.count_flops},
        )
    """
    b, c, *spatial = y[0].shape
    num_spatial = int(np.prod(spatial))
    matmul_ops = 2 * b * num_spatial ** 2 * c
    model.total_ops += torch.DoubleTensor([matmul_ops])

class QKVAttentionLegacy(nn.Module):
    """
    A module which performs QKV attention. Matches legacy QKVAttention + input/ouput heads shaping
    """

    def __init__(self, n_heads):
        super().__init__()
        self.n_heads = n_heads

    def forward(self, qkv):
        """
        Apply QKV attention.
        :param qkv: an [N x (H * 3 * C) x T] tensor of Qs, Ks, and Vs.
        :return: an [N x (H * C) x T] tensor after attention.
        """
        bs, width, length = qkv.shape
        assert width % (3 * self.n_heads) == 0
        ch = width // (3 * self.n_heads)
        q, k, v = qkv.reshape(bs * self.n_heads, ch * 3, length).split(ch, dim=1)
        scale = 1 / math.sqrt(math.sqrt(ch))
        weight = torch.einsum('bct,bcs->bts', q * scale, k * scale)
        weight = torch.softmax(weight.float(), dim=-1).type(weight.dtype)
        a = torch.einsum('bts,bcs->bct', weight, v)
        return a.reshape(bs, -1, length)

    @staticmethod
    def count_flops(model, _x, y):
        return count_flops_attn(model, _x, y)


INIT_ARGS = {
    'n_heads': 2,
}

ARGS = {
    'qkv': torch.randn(2, 24, 5),
}

if __name__ == '__main__':
    model = QKVAttentionLegacy(**INIT_ARGS)
    output = model(**ARGS)
    print(f"Output shape: {output.shape}")
    print(f"Output: {output}")
Setup block drafted by
a language model, class construct-then-call prompt, model not recorded
Imports
numpy, torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type Tensor, ndim 3, dtype family float — no output shape is stated: observe_signature.py observed this class with its constructor sizes canonicalised where it could, which the node does not record, so its shape is not stated as this setup block's
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: torch and numpy seeded to 0 by the harness immediately before the class was constructed from INIT_ARGS (fixture_check.py)
SwitchableConv2d Ran
ran on a synthesized input · constructed an object; no result was computed
xyfjason/ctrlora/cldm/cldm_ctrlora_inference.py
code served (permissive licence) · get_code("1fc018a678b94a86")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned an instance of its own class, SwitchableConv2d: the run constructed the object and did not call it, so no result was computed. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch
import torch.nn as nn

torch.manual_seed(0)

# Create a small input tensor for testing
# Shape: (batch=2, channels=3, height=4, width=4)
input_tensor = torch.randn(2, 3, 4, 4)

# Create the conv_layer that will be used
# in_channels=3, out_channels=5, kernel_size=3
conv_layer = nn.Conv2d(in_channels=3, out_channels=5, kernel_size=3, padding=1)

ARGS = {
    'in_channels': 3,
    'out_channels': 5,
    'kernel_size': 3,
    'conv_layer': conv_layer,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type SwitchableConv2d — the run constructed an instance of its own class and did not call it; no shape is stated — the instrument coerces any output to an array; for a SwitchableConv2d output the recorded ndim 0 and dtype family float describe that coercion, not the output, and are not stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
SwitchableGroupNorm Ran
ran on a synthesized input · constructed an object; no result was computed
xyfjason/ctrlora/cldm/cldm_ctrlora_inference.py
code served (permissive licence) · get_code("6be4fea6271b2108")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned an instance of its own class, SwitchableGroupNorm: the run constructed the object and did not call it, so no result was computed. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch
import torch.nn as nn

torch.manual_seed(0)

# Create a small input tensor for testing
# Shape: (batch_size=2, channels=4, height=8, width=8)
x = torch.randn(2, 4, 8, 8)

# Create the norm_layer that will be used
# GroupNorm requires num_groups and num_channels
# For num_channels=4, we can use num_groups=2 or 4
norm_layer = nn.GroupNorm(num_groups=2, num_channels=4)

ARGS = {
    'num_groups': 2,
    'num_channels': 4,
    'norm_layer': norm_layer,
    'eps': 1e-5,
    'affine': True
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type SwitchableGroupNorm — the run constructed an instance of its own class and did not call it; no shape is stated — the instrument coerces any output to an array; for a SwitchableGroupNorm output the recorded ndim 0 and dtype family float describe that coercion, not the output, and are not stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
SwitchableLayerNorm Ran
ran on a synthesized input · constructed an object; no result was computed
xyfjason/ctrlora/cldm/cldm_ctrlora_inference.py
code served (permissive licence) · get_code("2181071c92a4cce8")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned an instance of its own class, SwitchableLayerNorm: the run constructed the object and did not call it, so no result was computed. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch
import torch.nn as nn

torch.manual_seed(0)

# The function uses norm_layer.weight.data, norm_layer.bias.data, and calls norm_layer(x)
# So norm_layer must be an nn.LayerNorm or compatible module
norm_layer = nn.LayerNorm(4)

ARGS = {
    'normalized_shape': 4,
    'norm_layer': norm_layer
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type SwitchableLayerNorm — the run constructed an instance of its own class and did not call it; no shape is stated — the instrument coerces any output to an array; for a SwitchableLayerNorm output the recorded ndim 0 and dtype family float describe that coercion, not the output, and are not stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
check_key Ran
ran, violated the contract we drafted
xyfJASON/ctrlora/app/gradio_ctrlora.py
code served (permissive licence) · get_code("10ec89be27e3e44a")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1) and returned bool, ndim 0, dtype family float, shape () as a later run recorded it. The image it ran in was not recorded. If your copy returns the same type, ndim and shape on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch

torch.manual_seed(0)

def check_key(k):
    return 'lora_layer' in k or 'zero_convs' in k or 'middle_block_out' in k or ('norm' in k)

# The function takes a single parameter 'k' which is a string
# It checks if certain substrings are present in the string
# We need to provide a string value for k

ARGS = {
    'k': 'lora_layer_1'
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type bool, ndim 0, dtype family float, shape () — shape () as a later run recorded it
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
get_config Ran
ran; our contract draft was wrong, not the code
xyfJASON/ctrlora/app/gradio_ctrlora.py
code served (permissive licence) · get_code("8450074c26c4e371")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1) and returned str. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import os
import tempfile

# Create a temporary config directory structure
temp_dir = tempfile.mkdtemp()
config_dir = os.path.join(temp_dir, 'configs', 'inference')
os.makedirs(config_dir, exist_ok=True)

# Create dummy config files
config_files = [
    'ctrlora_sd15_rank32_1lora.yaml',
    'ctrlora_sd15_rank64_1lora.yaml',
    'ctrlora_sd15_rank128_1lora.yaml',
    'ctrlora_sd15_rank256_1lora.yaml',
    'ctrlora_sd15_rank512_1lora.yaml',
    'ctrlora_sd15_rank128_2loras.yaml',
]

for config_file in config_files:
    config_path = os.path.join(config_dir, config_file)
    with open(config_path, 'w') as f:
        f.write('# dummy config\n')

# Patch CONFIG_DIR to use our temp directory
import sys
import types

# Create a module that will be imported
config_module = types.ModuleType('config_module')
config_module.CONFIG_DIR = os.path.join(temp_dir, 'configs')

# Now define test arguments
ARGS = {
    'lora_ckpt': 'model_rank128_checkpoint.pt',
    'lora_num': 1,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1
Imports
none outside the standard library — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type str — a str output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a str output the recorded ndim 0 and dtype family float describe that coercion, not the output, and are not stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
inject_trainable_lora Ran
ran; our contract draft was wrong, not the code
this paper's copy was not recorded; identical code first harvested from cloneofsimo/lora
pointer only · get_code("a1f6aab648f338b8")
How it ran

The body of this sample is withheld: this paper's copy of the code was not recorded (its link names no repository or source path), so no licence was read for it. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. A run is recorded.

inject_trainable_lora Ran
ran; our contract draft was wrong, not the code
cloneofsimo/lora/lora_diffusion/lora.py
code served (permissive licence) · get_code("4b4a8984a2737ae5")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1) and returned tuple. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch
import torch.nn as nn

torch.manual_seed(0)

# Build a minimal model that contains modules matching the search criteria
class SimpleAttention(nn.Module):
    def __init__(self):
        super().__init__()
        self.linear1 = nn.Linear(4, 8)
        self.linear2 = nn.Linear(8, 4)
    
    def forward(self, x):
        return self.linear2(self.linear1(x))

class CrossAttention(nn.Module):
    def __init__(self):
        super().__init__()
        self.linear = nn.Linear(4, 8)
    
    def forward(self, x):
        return self.linear(x)

class Attention(nn.Module):
    def __init__(self):
        super().__init__()
        self.linear = nn.Linear(4, 8)
    
    def forward(self, x):
        return self.linear(x)

class GEGLU(nn.Module):
    def __init__(self):
        super().__init__()
        self.linear = nn.Linear(4, 8)
    
    def forward(self, x):
        return self.linear(x)

class TestModel(nn.Module):
    def __init__(self):
        super().__init__()
        self.cross_attn = CrossAttention()
        self.attn = Attention()
        self.geglu = GEGLU()
        self.other_linear = nn.Linear(4, 8)
    
    def forward(self, x):
        x = self.cross_attn(x)
        x = self.attn(x)
        x = self.geglu(x)
        x = self.other_linear(x)
        return x

# Create model instance
model = TestModel()

# Define ARGS dictionary with all parameters for inject_trainable_lora
ARGS = {
    'model': model,
    'target_replace_module': {'CrossAttention', 'Attention', 'GEGLU'},
    'r': 2,
    'loras': None,
    'verbose': False,
    'dropout_p': 0.1,
    'scale': 1.0
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type tuple — a tuple output has no array shape of its own; none is stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
inject_trainable_lora_extended Ran
ran, honoured the contract we drafted
this paper's copy was not recorded; identical code first harvested from cloneofsimo/lora
pointer only · get_code("5ed08f9762be44ee")
How it ran

The body of this sample is withheld: this paper's copy of the code was not recorded (its link names no repository or source path), so no licence was read for it. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. A run is recorded.

inject_trainable_lora_extended Ran
ran, honoured the contract we drafted
cloneofsimo/lora/lora_diffusion/lora.py
code served (permissive licence) · get_code("3aec51ff694c19af")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1) and returned tuple, ndim 2, dtype family float; no output shape is stated. The image it ran in was not recorded. If your copy returns the same type and ndim on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch
import torch.nn as nn
from typing import Set, Optional

torch.manual_seed(0)

# Create a minimal model that mimics a UNet structure with target modules
class SimpleResnetBlock2D(nn.Module):
    def __init__(self):
        super().__init__()
        self.linear1 = nn.Linear(4, 8)
        self.linear2 = nn.Linear(8, 4)
    
    def forward(self, x):
        x = self.linear1(x)
        x = self.linear2(x)
        return x

class SimpleCrossAttention(nn.Module):
    def __init__(self):
        super().__init__()
        self.to_q = nn.Linear(4, 4)
        self.to_k = nn.Linear(4, 4)
        self.to_v = nn.Linear(4, 4)
    
    def forward(self, x):
        return self.to_q(x)

class SimpleAttention(nn.Module):
    def __init__(self):
        super().__init__()
        self.linear = nn.Linear(4, 4)
    
    def forward(self, x):
        return self.linear(x)

class SimpleGEGLU(nn.Module):
    def __init__(self):
        super().__init__()
        self.linear = nn.Linear(4, 8)
    
    def forward(self, x):
        return self.linear(x)

class SimpleUNet(nn.Module):
    def __init__(self):
        super().__init__()
        self.resnet_block = SimpleResnetBlock2D()
        self.cross_attention = SimpleCrossAttention()
        self.attention = SimpleAttention()
        self.geglu = SimpleGEGLU()
    
    def forward(self, x):
        x = self.resnet_block(x)
        x = self.cross_attention(x)
        x = self.attention(x)
        x = self.geglu(x)
        return x

# Create model instance
model = SimpleUNet()

# Define ARGS dictionary with all parameters for inject_trainable_lora_extended
ARGS = {
    'model': model,
    'target_replace_module': {'ResnetBlock2D', 'CrossAttention', 'Attention', 'GEGLU'},
    'r': 2,
    'loras': None
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type tuple, ndim 2, dtype family float — a tuple output has no array shape of its own; none is stated
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
AttentionBlock Not yet run
unverified (harvested, no recorded run)
xyfjason/ctrlora/cldm/cldm_ctrlora_inference.py
code served (permissive licence) · get_code("de2f868c40cb8ebe")
How it ran

no invocation recorded.

BasicTransformerBlock Not yet run
unverified (harvested, no recorded run)
xyfjason/ctrlora/cldm/cldm_ctrlora_inference.py
code served (permissive licence) · get_code("c02f4e63f9a3b275")
How it ran

no invocation recorded.

ControlNet Not yet run
unverified (harvested, no recorded run)
xyfjason/ctrlora/cldm/cldm_ctrlora_inference.py
code served (permissive licence) · get_code("9c1933018e1fe3c4")
How it ran

no invocation recorded.

ControlNetInference Not yet run
unverified (harvested, no recorded run)
xyfjason/ctrlora/cldm/cldm_ctrlora_inference.py
code served (permissive licence) · get_code("23aca6b588778459")
How it ran

no invocation recorded.

ResBlock Not yet run
unverified (harvested, no recorded run)
xyfjason/ctrlora/cldm/cldm_ctrlora_inference.py
code served (permissive licence) · get_code("dd3dd6c4cfa9bb05")
How it ran

no invocation recorded.

SpatialTransformer Not yet run
unverified (harvested, no recorded run)
xyfjason/ctrlora/cldm/cldm_ctrlora_inference.py
code served (permissive licence) · get_code("df38578e601e8130")
How it ran

no invocation recorded.

TimestepEmbedSequential Not yet run
unverified (harvested, no recorded run)
xyfjason/ctrlora/cldm/cldm_ctrlora_inference.py
code served (permissive licence) · get_code("b714f25e81b2ceff")
How it ran

no invocation recorded.

extract_lora_ups_down Not yet run
unverified (harvested, no recorded run)
this paper's copy was not recorded; identical code first harvested from cloneofsimo/lora
pointer only · get_code("33b1ae9f923ab3ec")
How it ran

The body of this sample is withheld: this paper's copy of the code was not recorded (its link names no repository or source path), so no licence was read for it. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. No invocation recorded.

extract_lora_ups_down Not yet run
unverified (harvested, no recorded run)
cloneofsimo/lora/lora_diffusion/lora.py
code served (permissive licence) · get_code("2f9880b526ff277e")
How it ran

no invocation recorded.

Also present in other papers' code

Of 22 samples lifted from this paper's linked repositories, 22 carry a function identity and 0 do not. Of the 19 distinct functions with an identity, 11 are also present in other papers whose code we hold (11 with at least one paper dated earlier, 3 the same month, 4 later) and 8 are only here among the 52,977 papers whose code Syntology holds (as of 2026-09-26).

Only here means: among the 52,977 papers whose code Syntology holds (51,887 with lifted samples, 1,090 through their assemblies only), as of 2026-09-26, no other paper's lifted samples or current assembly bricks contain an identical function body after normalisation.

FunctionAlso present inEarliest-datedOthers named
QKVAttentionLegacy
brick of this paper's assembly: helper
15 other papers
12 dated earlier, 3 later · 6 only as an assembly brick
2006.11239 (2020-06)
Denoising Diffusion Probabilistic Models
2209.15264 (2022-09)
Diffusion-based Image Translation using Disentangled Style and Content Representation
2301.05225 (2023-01)
Domain Expansion of Image Generators
and 12 more not named here
AttentionBlock
brick of this paper's assembly: helper
12 other papers
9 dated earlier, 3 later · 2 only as an assembly brick
2209.15264 (2022-09)
Diffusion-based Image Translation using Disentangled Style and Content Representation
2301.05225 (2023-01)
Domain Expansion of Image Generators
2302.04304 (2023-02)
Q-Diffusion: Quantizing Diffusion Models
and 9 more not named here
ResBlock
brick of this paper's assembly: helper
11 other papers
10 dated earlier, 1 later · 4 only as an assembly brick
2209.15264 (2022-09)
Diffusion-based Image Translation using Disentangled Style and Content Representation
2301.05225 (2023-01)
Domain Expansion of Image Generators
2302.07685 (2023-02)
Video Probabilistic Diffusion Models in Projected Latent Space
and 8 more not named here
inject_trainable_lora 10 other papers
8 dated earlier, 1 the same month, 1 same year, order not determinable
2208.01618 (2022-08)
An Image is Worth One Word: Personalizing Text-to-Image Generation using Textual Inversion
2208.12242 (2022-08)
DreamBooth: Fine Tuning Text-to-Image Diffusion Models for Subject-Driven Generation
2308.06571 (2023-08)
ModelScope Text-to-Video Technical Report
and 7 more not named here
TimestepEmbedSequential
brick of this paper's assembly: helper
8 other papers
6 dated earlier, 2 later
2301.05225 (2023-01)
Domain Expansion of Image Generators
2302.07685 (2023-02)
Video Probabilistic Diffusion Models in Projected Latent Space
2304.02012 (2023-04)
EGC: Image Generation and Classification via a Diffusion Energy-Based Model
and 5 more not named here
extract_lora_ups_down 8 other papers
6 dated earlier, 1 the same month, 1 same year, order not determinable
2208.12242 (2022-08)
DreamBooth: Fine Tuning Text-to-Image Diffusion Models for Subject-Driven Generation
2312.07315 (2023-12)
NVS-Adapter: Plug-and-Play Novel View Synthesis from a Single Image
2312.17250 (2023-12)
iFusion: Inverting Diffusion for Pose-Free Reconstruction from Sparse Views
and 5 more not named here
inject_trainable_lora_extended 6 other papers
5 dated earlier, 1 the same month
2208.12242 (2022-08)
DreamBooth: Fine Tuning Text-to-Image Diffusion Models for Subject-Driven Generation
2312.07315 (2023-12)
NVS-Adapter: Plug-and-Play Novel View Synthesis from a Single Image
2402.02347 (2024-02)
Riemannian Preconditioned LoRA for Fine-Tuning Foundation Models
and 3 more not named here
BasicTransformerBlock
brick of this paper's assembly: helper
3 other papers
3 dated earlier
2301.05225 (2023-01)
Domain Expansion of Image Generators
2305.18259 (2023-05)
GlyphControl: Glyph Conditional Control for Visual Text Generation
2404.11474 (2024-04)
Towards Highly Realistic Artistic Style Transfer via Stable Diffusion with Step-aware and Layer-aware Prompt
SpatialTransformer
brick of this paper's assembly: helper
3 other papers
3 dated earlier
2301.05225 (2023-01)
Domain Expansion of Image Generators
2305.18259 (2023-05)
GlyphControl: Glyph Conditional Control for Visual Text Generation
2404.11474 (2024-04)
Towards Highly Realistic Artistic Style Transfer via Stable Diffusion with Step-aware and Layer-aware Prompt
ControlNet
brick of this paper's assembly: helper
2 other papers
2 dated earlier
2301.05225 (2023-01)
Domain Expansion of Image Generators
2305.18259 (2023-05)
GlyphControl: Glyph Conditional Control for Visual Text Generation
MemoryEfficientCrossAttention
brick of this paper's assembly: helper
2 other papers
2 dated earlier
2301.05225 (2023-01)
Domain Expansion of Image Generators
2404.11474 (2024-04)
Towards Highly Realistic Artistic Style Transfer via Stable Diffusion with Step-aware and Layer-aware Prompt

Presence, not direction: an identical function body in two papers' repositories does not say who wrote it, which came from which, or that either paper's method rests on it. Matching is exact after normalisation, so a renamed or edited function is not matched. Dates are when papers appeared, not when code was written. Only .py files the harvester lifted are covered; notebooks are not read. A new-style arXiv id YYMM.NNNN dates a paper to the month 20YY-MM; otherwise Paper.year dates it to the year; otherwise it is undated. Dates are when the paper appeared, not when the code was written. Read 2026-11-22.

Repositories linked to this paper

Some links come from the archived Papers with Code dataset (CC BY-SA 4.0): attribution and licence.

Abstract

Recently, large-scale diffusion models have made impressive progress in text-toimage (T2I) generation. To further equip these T2I models with fine-grained spatial control, approaches like ControlNet introduce an extra network that learns to follow a condition image. However, for every single condition type, Con-trolNet requires independent training on millions of data pairs with hundreds of GPU hours, which is quite expensive and makes it challenging for ordinary users to explore and develop new types of conditions. To address this problem, we propose the CtrLoRA framework, which trains a Base ControlNet to learn the common knowledge of image-to-image generation from multiple base conditions, along with condition-specific LoRAs to capture distinct characteristics of each condition. Utilizing our pretrained Base ControlNet, users can easily adapt it to new conditions, requiring as few as 1,000 data pairs and less than one hour of single-GPU training to obtain satisfactory results in most scenarios. Moreover, our CtrLoRA reduces the learnable parameters by 90% compared to ControlNet, significantly lowering the threshold to distribute and deploy the model weights. Extensive experiments on various types of conditions demonstrate the efficiency and effectiveness of our method. Codes and model weights will be released at https://github.com/xyfJASON/ctrlora.

For agents

The same record, over MCP at https://syntology.ai/mcp:

get_harvested_code_for_paper("2410.09400")
get_code_for_paper("2410.09400")
have("2410.09400")

The run record, dated, one paper per request, free:

curl https://syntology.ai/api/ran/2410.09400.json

A badge for a README (the split and the date, never a ratio):

[![Syntology run record](https://syntology.ai/api/ran/2410.09400.svg)](https://syntology.ai/paper/2410.09400)

Connect an agent — have() is free.