mirror of
https://github.com/huggingface/transformers.git
synced 2025-07-03 04:40:06 +06:00
[Dinov2] Enable device_map="auto" support (#38487)
* Fix: resolve import order and duplicate import (ruff I001, F811) * Format: clean up Dinov2 test file with ruff formatter * Add _no_split_modules = ['Dinov2Layer'] to enable device_map='auto' * Revert dinov2_with_registers _no_split_modules to original state * Remove redundant device_map test as suggested * Remove unused import after deleting test * removed import torch and the redundant test function * Update tests/models/dinov2/test_modeling_dinov2.py --------- Co-authored-by: Marc Sun <57196510+SunMarc@users.noreply.github.com>
This commit is contained in:
parent
ae3733f06e
commit
b9c17c5dc0
@ -491,7 +491,7 @@ class Dinov2PreTrainedModel(PreTrainedModel):
|
||||
base_model_prefix = "dinov2"
|
||||
main_input_name = "pixel_values"
|
||||
supports_gradient_checkpointing = True
|
||||
_no_split_modules = ["Dinov2SwiGLUFFN"]
|
||||
_no_split_modules = ["Dinov2Layer"]
|
||||
_supports_sdpa = True
|
||||
_supports_flash_attn_2 = True
|
||||
_supports_flex_attn = True
|
||||
|
@ -509,7 +509,7 @@ class Dinov2WithRegistersPreTrainedModel(PreTrainedModel):
|
||||
base_model_prefix = "dinov2_with_registers"
|
||||
main_input_name = "pixel_values"
|
||||
supports_gradient_checkpointing = True
|
||||
_no_split_modules = ["Dinov2WithRegistersSwiGLUFFN"]
|
||||
_no_split_modules = ["Dinov2WithRegistersLayer"]
|
||||
_supports_sdpa = True
|
||||
_supports_flash_attn_2 = True
|
||||
_supports_flex_attn = True
|
||||
|
Loading…
Reference in New Issue
Block a user