Download configuration_tapct.py from fomofo/tap-ct-s-3d: direct link, hf CLI and curl.
- Browser
- Download file 2.39 kB
-
https://huggingface.co/fomofo/tap-ct-s-3d/resolve/main/configuration_tapct.py
- Command line
-
hf download hf://fomofo/tap-ct-s-3d/configuration_tapct.py
-
curl -L -o configuration_tapct.py https://huggingface.co/fomofo/tap-ct-s-3d/resolve/main/configuration_tapct.py
2.39 kB
| # Copyright 2025 AI for Oncology Research Group. All Rights Reserved. | |
| # | |
| # Licensed under the Apache License, Version 2.0 (the "License"); | |
| # you may not use this file except in compliance with the License. | |
| # You may obtain a copy of the License at | |
| # | |
| # http://www.apache.org/licenses/LICENSE-2.0 | |
| # | |
| # Unless required by applicable law or agreed to in writing, software | |
| # distributed under the License is distributed on an "AS IS" BASIS, | |
| # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
| # See the License for the specific language governing permissions and | |
| # limitations under the License. | |
| from typing import Literal | |
| from transformers import PretrainedConfig | |
| class TAPCTConfig(PretrainedConfig): | |
| """ | |
| Configuration class for TAP-CT models. | |
| Parameters | |
| ---------- | |
| model_size : Literal['small', 'base'], default='base' | |
| Size of the model ('small' or 'base') | |
| model_variant : Literal['2d', '2.5d', '3d'], default='3d' | |
| Variant of the model ('2d', '2.5d', or '3d') | |
| img_size : int | tuple | list, default=224 | |
| Input image size. For 2D: int or tuple[int, int], for 3D: tuple[int, int, int] | |
| patch_size : int | tuple | list, default=16 | |
| Patch size. For 2D: int or tuple[int, int], for 3D: tuple[int, int, int] | |
| in_chans : int, default=1 | |
| Number of input channels (default: 1 for CT scans) | |
| num_register_tokens : int, default=4 | |
| Number of register tokens | |
| init_values : float | None, default=None | |
| Layer scale init values | |
| block_chunks : int, default=0 | |
| Number of block chunks for FSDP | |
| """ | |
| model_type = "tapct" | |
| def __init__( | |
| self, | |
| model_size: Literal['small', 'base'] = 'base', | |
| model_variant: Literal['2d', '2.5d', '3d'] = '3d', | |
| img_size: int | tuple | list = 224, | |
| patch_size: int | tuple | list = 16, | |
| in_chans: int = 1, | |
| num_register_tokens: int = 4, | |
| init_values: float | None = None, | |
| block_chunks: int = 0, | |
| **kwargs | |
| ): | |
| super().__init__(**kwargs) | |
| self.model_size = model_size | |
| self.model_variant = model_variant | |
| self.img_size = img_size | |
| self.patch_size = patch_size | |
| self.in_chans = in_chans | |
| self.num_register_tokens = num_register_tokens | |
| self.init_values = init_values | |
| self.block_chunks = block_chunks |