wondervictor commited on
Commit
ba359c6
·
verified ·
1 Parent(s): 0203683

Update autoregressive/models/dinov2_adapter.py

Browse files
autoregressive/models/dinov2_adapter.py CHANGED
@@ -1,4 +1,4 @@
1
- from transformers import AutoImageProcessor, AutoModel
2
  from PIL import Image
3
  import requests
4
  import torch
@@ -10,7 +10,9 @@ class Dinov2_Adapter(nn.Module):
10
  super(Dinov2_Adapter, self).__init__()
11
  print(f"Choose adapter size: {adapter_size}")
12
  print(f"condition type: {condition_type}")
13
- self.model = AutoModel()#.from_pretrained(f'facebook/dinov2-{adapter_size}')
 
 
14
  self.condition_type = condition_type
15
 
16
  def to_patch14(self, input):
 
1
+ from transformers import AutoImageProcessor, AutoModel, AutoConfig
2
  from PIL import Image
3
  import requests
4
  import torch
 
10
  super(Dinov2_Adapter, self).__init__()
11
  print(f"Choose adapter size: {adapter_size}")
12
  print(f"condition type: {condition_type}")
13
+ # self.model = AutoModel()#.from_pretrained(f'facebook/dinov2-{adapter_size}')
14
+ config = AutoConfig.from_pretrained(f'facebook/dinov2-{adapter_size}')
15
+ self.model = AutoModel.from_config(config)
16
  self.condition_type = condition_type
17
 
18
  def to_patch14(self, input):