cclaess commited on
Commit
60e3fe9
·
verified ·
1 Parent(s): 7cc1b7c

Initial commit

Browse files
README.md CHANGED
@@ -14,7 +14,7 @@ library_name: transformers
14
  pipeline_tag: feature-extraction
15
  ---
16
 
17
- 📢 [2026-05-20] The pretrained SPECTRE can now be loaded directly from the `transformers` library. Check below for the details.
18
 
19
  📢 [2026-04-10] SPECTRE is now an official baseline for the [**CVPR 2026 Workshop Competition: Foundation Models for General CT Image Diagnosis**](https://www.codabench.org/competitions/12650/)! See `experiments/cvpr26_fm_for_ct_diag_task_1` for scripts and additional details.
20
 
@@ -30,8 +30,8 @@ pipeline_tag: feature-extraction
30
  <a href="https://pypi.org/project/spectre-fm/"><img alt="Python Versions" src="https://img.shields.io/pypi/pyversions/spectre-fm?style=flat-square&cacheSeconds=0" /></a>
31
  <a href="https://pypi.org/project/spectre-fm/"><img alt="Downloads per Month" src="https://img.shields.io/pypi/dm/spectre-fm?style=flat-square&label=downloads&cacheSeconds=0" /></a>
32
  <a href="https://github.com/cclaess/SPECTRE/blob/main/LICENSE"><img alt="License" src="https://img.shields.io/github/license/cclaess/SPECTRE?style=flat-square&cacheSeconds=0" /></a>
33
- <a href="https://huggingface.co/cclaess/SPECTRE"><img alt="Model weights" src="https://img.shields.io/badge/models-Hugging%20Face-yellow?style=flat-square&cacheSeconds=0" /></a>
34
- <a href="https://arxiv.org/abs/2511.17209"><img alt="Paper" src="https://img.shields.io/badge/paper-arXiv-b31b1b?style=flat-square&cacheSeconds=0" /></a>
35
  </p>
36
 
37
  <p align="center">
@@ -45,7 +45,7 @@ SPECTRE has been trained on a large cohort of **open-source CT scans** of the **
45
  This repository provides pretrained SPECTRE models together with tools for fine-tuning and evaluation.
46
 
47
  ## 🧠 Pretrained Models
48
- The pretrained SPECTRE model can easily be imported using `AutoModel` from the `transformers` library
49
 
50
  ```python
51
  from transformers import AutoModel
 
14
  pipeline_tag: feature-extraction
15
  ---
16
 
17
+ 📢 [2026-05-20] The pretrained SPECTRE model can now be loaded directly through the `transformers` library, no separate SPECTRE package installation required. Check below for details and usage examples.
18
 
19
  📢 [2026-04-10] SPECTRE is now an official baseline for the [**CVPR 2026 Workshop Competition: Foundation Models for General CT Image Diagnosis**](https://www.codabench.org/competitions/12650/)! See `experiments/cvpr26_fm_for_ct_diag_task_1` for scripts and additional details.
20
 
 
30
  <a href="https://pypi.org/project/spectre-fm/"><img alt="Python Versions" src="https://img.shields.io/pypi/pyversions/spectre-fm?style=flat-square&cacheSeconds=0" /></a>
31
  <a href="https://pypi.org/project/spectre-fm/"><img alt="Downloads per Month" src="https://img.shields.io/pypi/dm/spectre-fm?style=flat-square&label=downloads&cacheSeconds=0" /></a>
32
  <a href="https://github.com/cclaess/SPECTRE/blob/main/LICENSE"><img alt="License" src="https://img.shields.io/github/license/cclaess/SPECTRE?style=flat-square&cacheSeconds=0" /></a>
33
+ <a href="https://huggingface.co/cclaess/SPECTRE-Large"><img alt="Model weights" src="https://img.shields.io/badge/model-Hugging%20Face-yellow?style=flat-square&cacheSeconds=0" /></a>
34
+ <a href="https://arxiv.org/abs/2511.17209"><img alt="Preprint" src="https://img.shields.io/badge/preprint-arXiv-b31b1b?style=flat-square&cacheSeconds=0" /></a>
35
  </p>
36
 
37
  <p align="center">
 
45
  This repository provides pretrained SPECTRE models together with tools for fine-tuning and evaluation.
46
 
47
  ## 🧠 Pretrained Models
48
+ The pretrained SPECTRE model can easily be imported using the `transformers` library
49
 
50
  ```python
51
  from transformers import AutoModel
modeling_spectre.py CHANGED
@@ -36,6 +36,6 @@ class SpectreModel(PreTrainedModel):
36
  outputs = self.model(pixel_values, grid_size=grid_size)
37
 
38
  if not return_dict:
39
- return (outputs,)
40
 
41
  return BaseModelOutput(last_hidden_state=outputs)
 
36
  outputs = self.model(pixel_values, grid_size=grid_size)
37
 
38
  if not return_dict:
39
+ return outputs
40
 
41
  return BaseModelOutput(last_hidden_state=outputs)
spectre/models/__init__.py CHANGED
@@ -14,18 +14,6 @@ from .vision_transformer_features import (
14
  feat_vit_base,
15
  feat_vit_large,
16
  )
17
- from .resnet import (
18
- ResNet,
19
- resnet18,
20
- resnet34,
21
- resnet50,
22
- resnet101,
23
- resnext50,
24
- resnext101,
25
- )
26
- from .eomt import EoMT
27
- from .seomt import SEoMT
28
- from .upsample_anything import UPA
29
 
30
  __all__ = [
31
  'VisionTransformer',
 
14
  feat_vit_base,
15
  feat_vit_large,
16
  )
 
 
 
 
 
 
 
 
 
 
 
 
17
 
18
  __all__ = [
19
  'VisionTransformer',
spectre/utils/__init__.py CHANGED
@@ -6,29 +6,6 @@ from ._utils import (
6
  to_3tuple,
7
  to_4tuple,
8
  )
9
- from .checkpointing import (
10
- save_state,
11
- load_state,
12
- extract_model_from_checkpoint_dinov2,
13
- extract_model_from_checkpoint_siglip,
14
- )
15
- from .collate import (
16
- extended_collate_dino,
17
- extended_collate_siglip,
18
- collate_add_filenames,
19
- )
20
- from .config import setup
21
- from .dataloader import get_dataloader
22
- from .distributed import (
23
- is_enabled,
24
- get_global_size,
25
- get_global_rank,
26
- get_local_size,
27
- get_local_rank,
28
- init_distributed,
29
- )
30
- from .lora import add_lora_adapters
31
- from .masking import random_block_mask
32
  from .modeling import (
33
  deactivate_requires_grad_and_to_eval,
34
  activate_requires_grad_and_to_train,
@@ -54,13 +31,6 @@ from .modeling import (
54
  nchwd_to,
55
  nhwdc_to,
56
  )
57
- from .param_groups import get_param_groups_with_decay
58
- from .scheduler import (
59
- linear_warmup_schedule,
60
- cosine_schedule,
61
- cosine_warmup_schedule,
62
- CosineWarmupScheduler,
63
- )
64
 
65
  __all__ = [
66
  "fix_random_seeds",
 
6
  to_3tuple,
7
  to_4tuple,
8
  )
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
9
  from .modeling import (
10
  deactivate_requires_grad_and_to_eval,
11
  activate_requires_grad_and_to_train,
 
31
  nchwd_to,
32
  nhwdc_to,
33
  )
 
 
 
 
 
 
 
34
 
35
  __all__ = [
36
  "fix_random_seeds",