cclaess commited on
Commit
b39aef7
·
verified ·
1 Parent(s): 89dc002

Initial commit

Browse files
Files changed (3) hide show
  1. README.md +30 -4
  2. metadata.yaml +13 -0
  3. modeling_spectre.py +1 -1
README.md CHANGED
@@ -1,4 +1,19 @@
1
- 📢 [2026-04-10] The pretrained SPECTRE can now be loaded directly from the transformers library. Check below for the details.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2
 
3
  📢 [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.
4
 
@@ -29,14 +44,25 @@ SPECTRE has been trained on a large cohort of **open-source CT scans** of the **
29
  This repository provides pretrained SPECTRE models together with tools for fine-tuning and evaluation.
30
 
31
  ## 🧠 Pretrained Models
32
- The pretrained SPECTRE model can easily be imported as follows:
33
 
34
  ```python
35
- from spectre import SpectreImageFeatureExtractor, MODEL_CONFIGS
36
- import torch
 
37
 
 
 
 
 
38
  config = MODEL_CONFIGS['spectre-large-pretrained']
39
  model = SpectreImageFeatureExtractor.from_config(config)
 
 
 
 
 
 
40
  model.eval()
41
 
42
  # Dummy input: (batch, crops, channels, height, width, depth)
 
1
+ ---
2
+ license: cc-by-nc-sa-4.0
3
+ language:
4
+ - en
5
+ tags:
6
+ - medical-imaging
7
+ - ct-scan
8
+ - 3d
9
+ - vision-transformer
10
+ - self-supervised-learning
11
+ - foundation-model
12
+ - radiology
13
+ library_name: transformers
14
+ pipeline_tag: feature-extraction---
15
+
16
+ 📢 [2026-05-20] The pretrained SPECTRE can now be loaded directly from the `transformers` library. Check below for the details.
17
 
18
  📢 [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.
19
 
 
44
  This repository provides pretrained SPECTRE models together with tools for fine-tuning and evaluation.
45
 
46
  ## 🧠 Pretrained Models
47
+ The pretrained SPECTRE model can easily be imported using `AutoModel` from the `transformers` library
48
 
49
  ```python
50
+ from transformers import AutoModel
51
+ model = AutoModel.from_pretrained('cclaess/SPECTRE-Large', trust_remote_code=True)
52
+ ```
53
 
54
+ or by using the `spectre-fm` package as follows:
55
+
56
+ ```python
57
+ from spectre import SpectreImageFeatureExtractor, MODEL_CONFIGS
58
  config = MODEL_CONFIGS['spectre-large-pretrained']
59
  model = SpectreImageFeatureExtractor.from_config(config)
60
+ ```
61
+
62
+ A simple forward pass would look like:
63
+ ```python
64
+ import torch
65
+
66
  model.eval()
67
 
68
  # Dummy input: (batch, crops, channels, height, width, depth)
metadata.yaml ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ license: cc-by-nc-sa-4.0
2
+ language:
3
+ - en
4
+ tags:
5
+ - medical-imaging
6
+ - ct-scan
7
+ - 3d
8
+ - vision-transformer
9
+ - self-supervised-learning
10
+ - foundation-model
11
+ - radiology
12
+ library_name: transformers
13
+ pipeline_tag: feature-extraction
modeling_spectre.py CHANGED
@@ -30,7 +30,7 @@ class SpectreModel(PreTrainedModel):
30
  self,
31
  pixel_values: torch.Tensor,
32
  grid_size=None,
33
- return_dict=True,
34
  **kwargs,
35
  ):
36
  outputs = self.model(pixel_values, grid_size=grid_size)
 
30
  self,
31
  pixel_values: torch.Tensor,
32
  grid_size=None,
33
+ return_dict=False,
34
  **kwargs,
35
  ):
36
  outputs = self.model(pixel_values, grid_size=grid_size)