Image Segmentation
Transformers
Safetensors
PyTorch
English
tren
feature-extraction
vision
image-feature-extraction
region-tokens
dinov3
custom_code
Instructions to use aryaaan12/T-REN with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use aryaaan12/T-REN with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("image-segmentation", model="aryaaan12/T-REN", trust_remote_code=True)# Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("aryaaan12/T-REN", trust_remote_code=True, dtype="auto") - Notebooks
- Google Colab
- Kaggle
File size: 1,440 Bytes
e98924d | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 | from transformers import PretrainedConfig
class TRENConfig(PretrainedConfig):
"""
Configuration for T-REN (Text-aligned Region Encoder Network).
The trainable T-REN head (RegionEncoder) weights are stored in this HF repo.
The DINOv3 ViT-L/16 backbone weights must be downloaded separately from
Facebook Research (see load_backbone() in TRENModel).
"""
model_type = "tren"
auto_map = {
"AutoConfig": "configuration_tren.TRENConfig",
"AutoModel": "modeling_tren.TRENModel",
}
def __init__(
self,
patch_size: int = 16,
hidden_dim: int = 1024,
text_embed_dim: int = 1024,
num_decoder_layers: int = 2,
num_attention_heads: int = 8,
image_resolution: int = 512,
num_multiscale_regions: int = 3,
merging_iou_threshold: float = 0.8,
merging_similarity_threshold: float = 0.975,
**kwargs,
):
self.patch_size = patch_size
self.hidden_dim = hidden_dim
self.text_embed_dim = text_embed_dim
self.num_decoder_layers = num_decoder_layers
self.num_attention_heads = num_attention_heads
self.image_resolution = image_resolution
self.num_multiscale_regions = num_multiscale_regions
self.merging_iou_threshold = merging_iou_threshold
self.merging_similarity_threshold = merging_similarity_threshold
super().__init__(**kwargs)
|