Views
No views yet
1import torch
2from transformers import AutoModel, AutoConfig
3
4# Load the configuration and model
5config = AutoConfig.from_pretrained("your-username/DaViT")
6model = AutoModel.from_pretrained("your-username/DaViT")
7
8# Generate a random sample input tensor with shape (batch_size, channels, height, width)
9batch_size = 2
10channels = 3
11height = 224
12width = 224
13sample_input = torch.randn(batch_size, channels, height, width)
14
15# Pass the sample input through the model
16output = model(sample_input)
17
18# Print the output shape
19print(f"Output shape: {output.shape}")configuration_davit.py: Contains the DaViTConfig class.modeling_davit.py: Contains the DaViTModel class.test_davit_model.py: Script to test the model.config.json: Configuration file for the model.model.safetensors: Pretrained weights of the DaViT model.