creyone-model 1.0.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 QNiLix
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,77 @@
1
+ Metadata-Version: 2.4
2
+ Name: creyone_model
3
+ Version: 1.0.0
4
+ Summary: PyTorch layer building tools for CREYONE
5
+ Author-email: Linqa Kiriyama <kiriyamalq@gmail.com>
6
+ License: MIT License
7
+
8
+ Copyright (c) 2026 QNiLix
9
+
10
+ Permission is hereby granted, free of charge, to any person obtaining a copy
11
+ of this software and associated documentation files (the "Software"), to deal
12
+ in the Software without restriction, including without limitation the rights
13
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
14
+ copies of the Software, and to permit persons to whom the Software is
15
+ furnished to do so, subject to the following conditions:
16
+
17
+ The above copyright notice and this permission notice shall be included in all
18
+ copies or substantial portions of the Software.
19
+
20
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
21
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
22
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
23
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
24
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
25
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
26
+ SOFTWARE.
27
+
28
+ Project-URL: Homepage, https://github.com/qnilix/creyone_model
29
+ Project-URL: Documentation, https://creyone-model.readthedocs.io/
30
+ Project-URL: Repository, https://github.com/qnilix/creyone_model.git
31
+ Project-URL: Bug Tracker, https://github.com/qnilix/creyone_model/issues
32
+ Project-URL: Changelog, https://github.com/qnilix/creyone_model/blob/main/CHANGELOG.md
33
+ Classifier: Development Status :: 4 - Beta
34
+ Classifier: Programming Language :: Python :: 3 :: Only
35
+ Requires-Python: >=3.10
36
+ Description-Content-Type: text/markdown
37
+ License-File: LICENSE
38
+ Requires-Dist: torch>=2.0
39
+ Requires-Dist: einops
40
+ Requires-Dist: creyone_layer
41
+ Dynamic: license-file
42
+
43
+ # creyone_model
44
+
45
+ PyTorch layer-building utilities for the CREYONE framework.
46
+
47
+ ## Overview
48
+
49
+ `creyone_model` provides a config-first API for assembling CNN building blocks.
50
+ All layer hyper-parameters live in a single `CNNBlockCfg` dataclass, making it
51
+ easy to swap layer types (convolution, normalisation, activation, pooling)
52
+ without changing model code.
53
+
54
+ ## Installation
55
+
56
+ ```bash
57
+ pip install creyone_model
58
+ ```
59
+
60
+ Requires Python ≥ 3.10 and PyTorch ≥ 2.0.
61
+
62
+ ## Quick start
63
+
64
+ ```python
65
+ from creyone_model import CNNBlockCfg
66
+
67
+ cfg = CNNBlockCfg(tensor_dims=2, act_name='silu')
68
+ block = cfg.block_module(in_dim=3, out_dim=64, kernel_size=3)
69
+
70
+ import torch
71
+ y = block(torch.randn(1, 3, 224, 224)) # (1, 64, 224, 224)
72
+ ```
73
+
74
+ ## Documentation
75
+
76
+ Full documentation (API reference + getting started guide) is hosted at
77
+ <https://creyone-model.readthedocs.io/>.
@@ -0,0 +1,35 @@
1
+ # creyone_model
2
+
3
+ PyTorch layer-building utilities for the CREYONE framework.
4
+
5
+ ## Overview
6
+
7
+ `creyone_model` provides a config-first API for assembling CNN building blocks.
8
+ All layer hyper-parameters live in a single `CNNBlockCfg` dataclass, making it
9
+ easy to swap layer types (convolution, normalisation, activation, pooling)
10
+ without changing model code.
11
+
12
+ ## Installation
13
+
14
+ ```bash
15
+ pip install creyone_model
16
+ ```
17
+
18
+ Requires Python ≥ 3.10 and PyTorch ≥ 2.0.
19
+
20
+ ## Quick start
21
+
22
+ ```python
23
+ from creyone_model import CNNBlockCfg
24
+
25
+ cfg = CNNBlockCfg(tensor_dims=2, act_name='silu')
26
+ block = cfg.block_module(in_dim=3, out_dim=64, kernel_size=3)
27
+
28
+ import torch
29
+ y = block(torch.randn(1, 3, 224, 224)) # (1, 64, 224, 224)
30
+ ```
31
+
32
+ ## Documentation
33
+
34
+ Full documentation (API reference + getting started guide) is hosted at
35
+ <https://creyone-model.readthedocs.io/>.
@@ -0,0 +1,2 @@
1
+ from .utils import BaseCfg
2
+ from .cnn.block import CNNBlockCfg, ConvNormAct
@@ -0,0 +1 @@
1
+ from .block import CNNBlockCfg, ConvNormAct
@@ -0,0 +1,201 @@
1
+ from dataclasses import dataclass
2
+
3
+ import torch
4
+ from torch import nn, Tensor
5
+
6
+ from ..utils import BaseCfg
7
+ from creyone_layer import create_layer
8
+
9
+
10
+ @dataclass
11
+ class CNNBlockCfg(BaseCfg):
12
+ """Configuration dataclass for CNN building blocks.
13
+
14
+ Centralises all hyper-parameters needed to construct a
15
+ :class:`ConvNormAct` block: convolution, normalisation, activation, and
16
+ pooling layers are each described by a *name* (matched by
17
+ ``creyone_layer.create_layer``) and a set of scalar options.
18
+
19
+ Attributes:
20
+ tensor_dims: Spatial dimensionality of the input tensor (e.g. ``2``
21
+ for images, ``1`` for sequences, ``3`` for volumetric data).
22
+ conv_option: Option string forwarded to the convolution factory
23
+ (see creyone-layer).
24
+ conv_name: Registered name of the convolution layer (default
25
+ ``'base'`` -> standard convolution).
26
+ conv_bias: Whether the convolution includes a learnable bias term.
27
+ Typically ``False`` when batch normalisation follows.
28
+ act_name: Registered name of the activation function
29
+ (default ``'relu'``).
30
+ act_inplace: Whether the activation operates in-place.
31
+ norm_name: Registered name of the normalisation layer
32
+ (default ``'batch'`` -> BatchNorm).
33
+ norm_eps: Epsilon added to the denominator for numerical stability.
34
+ norm_mom: Momentum used to update the running statistics.
35
+ pool_name: Registered name of the pooling layer (default ``'max'``).
36
+ pool_option: Option string forwarded to the pooling factory.
37
+
38
+ Example::
39
+
40
+ cfg = CNNBlockCfg(tensor_dims=2, act_name='silu')
41
+ block = cfg.block_module(in_dim=32, out_dim=64, kernel_size=3)
42
+ """
43
+
44
+ tensor_dims: int = 2
45
+ conv_option: str = 'ap'
46
+
47
+ conv_name: str = 'base'
48
+ conv_bias: bool = False
49
+
50
+ act_name: str = 'relu'
51
+ act_inplace: bool = False
52
+
53
+ norm_name: str = 'batch'
54
+ norm_eps: float = 1e-5
55
+ norm_mom: float = 0.1
56
+
57
+ pool_name: str = 'max'
58
+ pool_option: str = 'ap'
59
+
60
+ def block_module(self, in_dim: int, out_dim: int, *args, **kwargs) -> 'ConvNormAct':
61
+ """Instantiate a :class:`ConvNormAct` block from this config.
62
+
63
+ Args:
64
+ in_dim: Number of input channels / features.
65
+ out_dim: Number of output channels / features.
66
+ *args: Positional arguments forwarded to :class:`ConvNormAct`.
67
+ **kwargs: Keyword arguments forwarded to :class:`ConvNormAct`.
68
+
69
+ Returns:
70
+ A configured :class:`ConvNormAct` module.
71
+ """
72
+ return ConvNormAct(self, in_dim, out_dim, *args, **kwargs)
73
+
74
+ def act_layer(self, name: str = None, inplace: bool = None, **kwargs) -> nn.Module:
75
+ """Build and return an activation layer.
76
+
77
+ Args:
78
+ name: Override ``act_name``; uses the config value when ``None``.
79
+ inplace: Override ``act_inplace``; uses the config value when
80
+ ``None``.
81
+ **kwargs: Extra keyword arguments passed to the layer constructor.
82
+
83
+ Returns:
84
+ An instantiated activation ``nn.Module``.
85
+ """
86
+ actl = create_layer(name or self.act_name, 'act')
87
+ return actl(inplace=inplace if inplace is not None else self.act_inplace)(**kwargs)
88
+
89
+ def conv_layer(self, *args, name: str = None, bias: bool = None,
90
+ c_opt: str = None, **kwargs) -> nn.Module:
91
+ """Build and return a convolution layer.
92
+
93
+ Args:
94
+ *args: Positional arguments forwarded to the layer constructor
95
+ (typically ``in_channels`` and ``out_channels``).
96
+ name: Override ``conv_name``; uses the config value when ``None``.
97
+ bias: Override ``conv_bias``; uses the config value when ``None``.
98
+ c_opt: Override ``conv_option``; uses the config value when
99
+ ``None``.
100
+ **kwargs: Extra keyword arguments (e.g. ``kernel_size``,
101
+ ``stride``) forwarded to the layer constructor.
102
+
103
+ Returns:
104
+ An instantiated convolution ``nn.Module``.
105
+ """
106
+ conv = create_layer(name or self.conv_name, 'conv')
107
+ conv = conv(dim = self.tensor_dims, optional = c_opt or self.conv_option)
108
+ return conv(*args, bias = bias if bias is not None else self.conv_bias, **kwargs)
109
+
110
+ def norm_layer(self, dim: int, name: str = None, eps: float = None) -> nn.Module:
111
+ """Build and return a normalisation layer.
112
+
113
+ Args:
114
+ dim: Number of features / channels to normalise.
115
+ name: Override ``norm_name``; uses the config value when ``None``.
116
+ eps: Override ``norm_eps``; uses the config value when ``None``.
117
+
118
+ Returns:
119
+ An instantiated normalisation ``nn.Module``.
120
+ """
121
+ norm = create_layer(name or self.norm_name, 'norm')
122
+ return norm(dim = self.tensor_dims, eps=eps if eps is not None else self.norm_eps, mom=self.norm_mom)(dim)
123
+
124
+ def pool_layer(self, *args, name: str = None, p_opt: str = None, **kwargs) -> nn.Module:
125
+ """Build and return a pooling layer.
126
+
127
+ Args:
128
+ *args: Positional arguments forwarded to the layer constructor
129
+ (e.g. ``kernel_size``).
130
+ name: Override ``pool_name``; uses the config value when ``None``.
131
+ p_opt: Override ``pool_option``; uses the config value when
132
+ ``None``.
133
+ **kwargs: Extra keyword arguments forwarded to the layer
134
+ constructor.
135
+
136
+ Returns:
137
+ An instantiated pooling ``nn.Module``.
138
+ """
139
+ pool = create_layer(name or self.pool_name, 'pool')
140
+ pool = pool(dim = self.tensor_dims, optional = p_opt or self.pool_option)
141
+ return pool(*args, **kwargs)
142
+
143
+
144
+ class ConvNormAct(nn.Module):
145
+ """Sequential Convolution → Normalisation → Activation block.
146
+
147
+ A standard building block used throughout modern CNN architectures.
148
+ All layer details are driven by a :class:`CNNBlockCfg` instance, which
149
+ allows swapping convolution type, normalisation, and activation without
150
+ changing the block's code.
151
+
152
+ Attributes:
153
+ stride: Stride used by the internal convolution (mirrors ``s``).
154
+ out_dim: Number of output channels / features.
155
+ conv: The convolution layer.
156
+ norm: The normalisation layer.
157
+ act: The activation layer.
158
+
159
+ Example::
160
+
161
+ cfg = CNNBlockCfg()
162
+ block = ConvNormAct(cfg, in_dim=3, out_dim=64, kernel_size=3)
163
+ y = block(x) # x: (B, 3, H, W) -> y: (B, 64, H, W)
164
+ """
165
+
166
+ def __init__(self, cfg: CNNBlockCfg, in_dim: int, out_dim: int, *args, s=1,
167
+ norm_name: str = None, act_name: str = None,
168
+ inplace: bool = None, eps: float = None, **kwargs):
169
+ """Initialise the ConvNormAct block.
170
+
171
+ Args:
172
+ cfg: Configuration object that supplies all layer factories.
173
+ in_dim: Number of input channels / features.
174
+ out_dim: Number of output channels / features.
175
+ *args: Extra positional arguments forwarded to the convolution
176
+ layer (e.g. ``kernel_size``).
177
+ s: Stride for the convolution. Defaults to ``1``.
178
+ norm_name: Override the normalisation layer name from ``cfg``.
179
+ act_name: Override the activation layer name from ``cfg``.
180
+ inplace: Override the in-place flag from ``cfg``.
181
+ eps: Override the normalisation epsilon from ``cfg``.
182
+ **kwargs: Additional keyword arguments forwarded to the
183
+ convolution layer.
184
+ """
185
+ super().__init__()
186
+ self.stride = s; self.out_dim = out_dim
187
+ self.conv = cfg.conv_layer(in_dim, out_dim, *args, s=s, **kwargs)
188
+ self.norm = cfg.norm_layer(out_dim, name=norm_name, eps=eps)
189
+ self.act = cfg.act_layer(name=act_name, inplace=inplace)
190
+
191
+ def forward(self, x: Tensor) -> Tensor:
192
+ """Apply conv -> norm -> act to the input tensor.
193
+
194
+ Args:
195
+ x: Input tensor of shape ``(B, in_dim, *spatial)``.
196
+
197
+ Returns:
198
+ Output tensor of shape ``(B, out_dim, *spatial')``, where
199
+ ``spatial'`` depends on the convolution stride and padding.
200
+ """
201
+ return self.act(self.norm(self.conv(x)))
@@ -0,0 +1,94 @@
1
+ import copy
2
+ from typing import Self
3
+
4
+ import torch
5
+ import torch.nn as nn
6
+ import torch.nn.functional as F
7
+
8
+ from einops import rearrange
9
+
10
+
11
+ def _matmul(a, b): return a @ b
12
+
13
+
14
+ class CreYonT:
15
+
16
+ def __init__(self, *args, torchT: torch.Tensor = None, init_val: float = None, **kwargs):
17
+ self._t = torchT if torchT is not None else torch.Tensor(*args, **kwargs)
18
+ if init_val is not None: self._t = self._t * 0 + init_val
19
+
20
+ def __call__(self, func: callable, *args, **kwargs) -> Self:
21
+ return self.plug(func(self._t, *args, **kwargs))
22
+
23
+ def __add__(self, other) -> Self: return self.calc(other, lambda a, b: a + b)
24
+
25
+ def __mul__(self, other) -> Self: return self.calc(other, lambda a, b: a * b)
26
+
27
+ def __truediv__(self, other) -> Self: return self.calc(other, lambda a, b: a / b)
28
+
29
+ def __matmul__(self, other) -> Self: return self.calc(other, _matmul)
30
+
31
+ @property
32
+ def shape(self): return self._t.shape
33
+
34
+ @property
35
+ def B(self): return self._t.shape[0]
36
+
37
+ def tensor(self) -> torch.Tensor: return self._t
38
+
39
+ def calc(self, other, func, **kwargs):
40
+ if isinstance(other, CreYonT): other = other.tensor()
41
+ return self.plug(func(self._t, other, **kwargs))
42
+
43
+ def plug(self, x: torch.Tensor) -> Self:
44
+ result = copy.copy(self); result._t = x; return result
45
+
46
+ def chunk(self, chunks: int, dim: int = 0) -> tuple[Self, ...]:
47
+ return tuple(CreYonT(torchT=t) for t in self._t.chunk(chunks, dim=dim))
48
+
49
+ def contiguous(self) -> Self: return self.plug(self._t.contiguous())
50
+
51
+ def exp(self) -> Self: return self.plug(self._t.exp())
52
+
53
+ def flatten(self, *args, **kwargs) -> Self:
54
+ return self.plug(self._t.flatten(*args, **kwargs))
55
+
56
+ def flip(self, *args, **kwargs) -> Self:
57
+ return self.plug(self._t.flip(*args, **kwargs))
58
+
59
+ def log(self) -> Self: return self.plug(torch.log(self._t))
60
+
61
+ def mean(self, dim = None, keepdim: bool = False, *, dtype: torch.dtype = None) -> Self:
62
+ return self.plug(self._t.mean(dim, keepdim=keepdim, dtype=dtype))
63
+
64
+ def reshape(self, *args, **kwargs) -> Self:
65
+ return self.plug(self._t.reshape(*args, **kwargs))
66
+
67
+ def softmax(self, dim: int, dtype: torch.dtype = None) -> Self:
68
+ return self.plug(self._t.softmax(dim, dtype=dtype))
69
+
70
+ def init(self, name: str, **kwargs) -> Self:
71
+ if name == 'trunc_normal': nn.init.trunc_normal_(self._t, **kwargs)
72
+ return self
73
+
74
+ def transpose(self, dim0: int, dim1: int) -> Self:
75
+ return self.plug(self._t.transpose(dim0, dim1))
76
+
77
+ def bmm(self, other) -> Self: return self.calc(other, torch.bmm)
78
+
79
+ def cat(self, other, dim: int = 0) -> Self:
80
+ if isinstance(other, CreYonT): other = other.tensor()
81
+ return self.plug(torch.cat((self._t, other), dim=dim))
82
+
83
+ def linear(self, other, bias: torch.Tensor = None) -> Self:
84
+ return self.calc(other, F.linear, bias=bias)
85
+
86
+ def split(self, split_size_or_sections: int | list[int], dim: int = 0) -> tuple[Self, ...]:
87
+ a, *b = torch.split(self._t, split_size_or_sections, dim=dim)
88
+ return tuple([self.plug(a)] + [CreYonT(torchT=t) for t in b])
89
+
90
+ def normalize(self, p: float = 2, dim: int = 1, eps: float = 1e-12) -> Self:
91
+ return self.plug(F.normalize(self._t, p=p, dim=dim, eps=eps))
92
+
93
+ def rearrange(self, pattern: str, **axes_lengths: any) -> Self:
94
+ return self.plug(rearrange(self._t, pattern, **axes_lengths))
@@ -0,0 +1 @@
1
+ from .config import BaseCfg
@@ -0,0 +1,63 @@
1
+ from dataclasses import dataclass, fields
2
+ from typing import Any
3
+
4
+
5
+ def type_subclass(cls: type, classinfo) -> bool:
6
+ """Call issubclass safely, returning False if cls is not a type (e.g. MISSING)."""
7
+ try:
8
+ return issubclass(cls, classinfo)
9
+ except TypeError:
10
+ return False
11
+
12
+
13
+ @dataclass
14
+ class BaseCfg:
15
+ """Base class for hierarchical configuration dataclasses.
16
+
17
+ Subclasses should be decorated with ``@dataclass`` and may declare fields
18
+ of primitive types or other ``BaseCfg`` subclasses. Fields whose
19
+ ``default_factory`` is a ``BaseCfg`` subclass are built recursively by
20
+ ``instance()``.
21
+ """
22
+
23
+ @classmethod
24
+ def instance(cls, **kwargs) -> tuple[Any, dict[str, Any]]:
25
+ """Build an instance from kwargs and return any unconsumed kwargs.
26
+
27
+ Iterates over all dataclass fields, popping matching keys from kwargs.
28
+ For fields whose ``default_factory`` is a ``BaseCfg`` subclass, the
29
+ method recurses, passing both the field-specific kwargs and all
30
+ remaining kwargs so that shared parameters propagate down. Each nested
31
+ call returns its own unconsumed kwargs, which continue up the chain.
32
+
33
+ Args:
34
+ **kwargs: Keyword arguments keyed by field name. Values for nested
35
+ ``BaseCfg`` fields should be provided as a ``dict`` of
36
+ sub-kwargs for that config.
37
+
38
+ Returns:
39
+ A ``(instance, remaining_kwargs)`` tuple where ``remaining_kwargs``
40
+ holds any kwargs not consumed by this class or its nested configs.
41
+ """
42
+ kw: dict[str, Any] = {}
43
+ for f in fields(cls):
44
+ if f.name in kwargs: kw[f.name] = kwargs.pop(f.name)
45
+ if not type_subclass(f.default_factory, BaseCfg): continue
46
+ # Field-specific kwargs take priority over shared remaining kwargs.
47
+ # Build a new dict so the caller's original dict is never mutated.
48
+ temp = {**kwargs, **kw.get(f.name, {})}
49
+ kw[f.name], kwargs = f.default_factory.instance(**temp)
50
+ return cls(**kw), kwargs
51
+
52
+
53
+
54
+
55
+
56
+
57
+
58
+
59
+
60
+
61
+
62
+
63
+
@@ -0,0 +1,77 @@
1
+ Metadata-Version: 2.4
2
+ Name: creyone_model
3
+ Version: 1.0.0
4
+ Summary: PyTorch layer building tools for CREYONE
5
+ Author-email: Linqa Kiriyama <kiriyamalq@gmail.com>
6
+ License: MIT License
7
+
8
+ Copyright (c) 2026 QNiLix
9
+
10
+ Permission is hereby granted, free of charge, to any person obtaining a copy
11
+ of this software and associated documentation files (the "Software"), to deal
12
+ in the Software without restriction, including without limitation the rights
13
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
14
+ copies of the Software, and to permit persons to whom the Software is
15
+ furnished to do so, subject to the following conditions:
16
+
17
+ The above copyright notice and this permission notice shall be included in all
18
+ copies or substantial portions of the Software.
19
+
20
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
21
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
22
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
23
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
24
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
25
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
26
+ SOFTWARE.
27
+
28
+ Project-URL: Homepage, https://github.com/qnilix/creyone_model
29
+ Project-URL: Documentation, https://creyone-model.readthedocs.io/
30
+ Project-URL: Repository, https://github.com/qnilix/creyone_model.git
31
+ Project-URL: Bug Tracker, https://github.com/qnilix/creyone_model/issues
32
+ Project-URL: Changelog, https://github.com/qnilix/creyone_model/blob/main/CHANGELOG.md
33
+ Classifier: Development Status :: 4 - Beta
34
+ Classifier: Programming Language :: Python :: 3 :: Only
35
+ Requires-Python: >=3.10
36
+ Description-Content-Type: text/markdown
37
+ License-File: LICENSE
38
+ Requires-Dist: torch>=2.0
39
+ Requires-Dist: einops
40
+ Requires-Dist: creyone_layer
41
+ Dynamic: license-file
42
+
43
+ # creyone_model
44
+
45
+ PyTorch layer-building utilities for the CREYONE framework.
46
+
47
+ ## Overview
48
+
49
+ `creyone_model` provides a config-first API for assembling CNN building blocks.
50
+ All layer hyper-parameters live in a single `CNNBlockCfg` dataclass, making it
51
+ easy to swap layer types (convolution, normalisation, activation, pooling)
52
+ without changing model code.
53
+
54
+ ## Installation
55
+
56
+ ```bash
57
+ pip install creyone_model
58
+ ```
59
+
60
+ Requires Python ≥ 3.10 and PyTorch ≥ 2.0.
61
+
62
+ ## Quick start
63
+
64
+ ```python
65
+ from creyone_model import CNNBlockCfg
66
+
67
+ cfg = CNNBlockCfg(tensor_dims=2, act_name='silu')
68
+ block = cfg.block_module(in_dim=3, out_dim=64, kernel_size=3)
69
+
70
+ import torch
71
+ y = block(torch.randn(1, 3, 224, 224)) # (1, 64, 224, 224)
72
+ ```
73
+
74
+ ## Documentation
75
+
76
+ Full documentation (API reference + getting started guide) is hosted at
77
+ <https://creyone-model.readthedocs.io/>.
@@ -0,0 +1,14 @@
1
+ LICENSE
2
+ README.md
3
+ pyproject.toml
4
+ creyone_model/__init__.py
5
+ creyone_model.egg-info/PKG-INFO
6
+ creyone_model.egg-info/SOURCES.txt
7
+ creyone_model.egg-info/dependency_links.txt
8
+ creyone_model.egg-info/requires.txt
9
+ creyone_model.egg-info/top_level.txt
10
+ creyone_model/cnn/__init__.py
11
+ creyone_model/cnn/block.py
12
+ creyone_model/cynn/tensor.py
13
+ creyone_model/utils/__init__.py
14
+ creyone_model/utils/config.py
@@ -0,0 +1,3 @@
1
+ torch>=2.0
2
+ einops
3
+ creyone_layer
@@ -0,0 +1 @@
1
+ creyone_model
@@ -0,0 +1,35 @@
1
+ [build-system]
2
+ requires = ["setuptools"]
3
+ build-backend = "setuptools.build_meta"
4
+
5
+ [project]
6
+ name = "creyone_model"
7
+ version = "1.0.0"
8
+ dependencies = [
9
+ "torch>=2.0",
10
+ "einops",
11
+ "creyone_layer"
12
+ ]
13
+ requires-python = ">=3.10"
14
+ authors = [
15
+ {name = "Linqa Kiriyama", email = "kiriyamalq@gmail.com"},
16
+ ]
17
+ description = "PyTorch layer building tools for CREYONE"
18
+ readme = "README.md"
19
+ license = {file = "LICENSE"}
20
+ keywords = []
21
+ classifiers = [
22
+ "Development Status :: 4 - Beta",
23
+ "Programming Language :: Python :: 3 :: Only"
24
+ ]
25
+
26
+ [project.urls]
27
+ Homepage = "https://github.com/qnilix/creyone_model"
28
+ Documentation = "https://creyone-model.readthedocs.io/"
29
+ Repository = "https://github.com/qnilix/creyone_model.git"
30
+ "Bug Tracker" = "https://github.com/qnilix/creyone_model/issues"
31
+ Changelog = "https://github.com/qnilix/creyone_model/blob/main/CHANGELOG.md"
32
+
33
+ [tool.setuptools.packages.find]
34
+ where = ["."]
35
+ include = ["creyone_model*"]
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+