Instructions to use agemagician/scgpt with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use agemagician/scgpt with Transformers:
# Load model directly from transformers import scgpt model = scgpt.from_pretrained("agemagician/scgpt", trust_remote_code=True, device_map="auto") - Notebooks
- Google Colab
- Kaggle
Create modeling_scgpt.py
Browse files- modeling_scgpt.py +30 -0
modeling_scgpt.py
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from transformers import PreTrainedModel
|
| 2 |
+
#from timm.models.resnet import BasicBlock, Bottleneck, ResNet
|
| 3 |
+
from .configuration_scgpt import ScgptConfig
|
| 4 |
+
|
| 5 |
+
|
| 6 |
+
#BLOCK_MAPPING = {"basic": BasicBlock, "bottleneck": Bottleneck}
|
| 7 |
+
|
| 8 |
+
|
| 9 |
+
class ScgptModel(PreTrainedModel):
|
| 10 |
+
config_class = ScgptConfig
|
| 11 |
+
|
| 12 |
+
def __init__(self, config):
|
| 13 |
+
super().__init__(config)
|
| 14 |
+
#block_layer = BLOCK_MAPPING[config.block_type]
|
| 15 |
+
#self.model = ScgptModel(
|
| 16 |
+
# block_layer,
|
| 17 |
+
# config.layers,
|
| 18 |
+
# num_classes=config.num_classes,
|
| 19 |
+
# in_chans=config.input_channels,
|
| 20 |
+
# cardinality=config.cardinality,
|
| 21 |
+
# base_width=config.base_width,
|
| 22 |
+
# stem_width=config.stem_width,
|
| 23 |
+
# stem_type=config.stem_type,
|
| 24 |
+
# avg_down=config.avg_down,
|
| 25 |
+
#)
|
| 26 |
+
self.model = None
|
| 27 |
+
|
| 28 |
+
def forward(self, tensor):
|
| 29 |
+
#return self.model.forward_features(tensor)
|
| 30 |
+
return None
|