File tree Expand file tree Collapse file tree 1 file changed +10
-0
lines changed Expand file tree Collapse file tree 1 file changed +10
-0
lines changed Original file line number Diff line number Diff line change 2727
2828if is_torch_available ():
2929 import torch
30+ from torch import nn
3031
3132 from transformers import DINOv3ViTBackbone , DINOv3ViTForImageClassification , DINOv3ViTModel
3233
@@ -250,6 +251,15 @@ def test_training_gradient_checkpointing_use_reentrant(self):
250251 def test_training_gradient_checkpointing_use_reentrant_false (self ):
251252 pass
252253
254+ def test_model_get_set_embeddings (self ):
255+ config , _ = self .model_tester .prepare_config_and_inputs_for_common ()
256+
257+ for model_class in self .all_model_classes :
258+ model = model_class (config )
259+ self .assertIsInstance (model .get_input_embeddings (), (nn .Module ))
260+ x = model .get_output_embeddings ()
261+ self .assertTrue (x is None or isinstance (x , nn .Linear ))
262+
253263 def test_for_image_classification (self ):
254264 config_and_inputs = self .model_tester .prepare_config_and_inputs ()
255265 self .model_tester .create_and_check_for_image_classification (* config_and_inputs )
You can’t perform that action at this time.
0 commit comments