AndrewMayesPrezzee
commited on
Commit
·
0fa67db
1
Parent(s):
8abd44b
Feat - Fixed Circular Imports
Browse files- configuration_autoencoder.py +5 -1
- modeling_autoencoder.py +7 -1
configuration_autoencoder.py
CHANGED
|
@@ -5,7 +5,11 @@ Autoencoder configuration for Hugging Face Transformers.
|
|
| 5 |
from dataclasses import dataclass
|
| 6 |
from typing import Union
|
| 7 |
|
| 8 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 9 |
from typing import List, Optional
|
| 10 |
|
| 11 |
# Support both package-relative and flat import in HF remote code context
|
|
|
|
| 5 |
from dataclasses import dataclass
|
| 6 |
from typing import Union
|
| 7 |
|
| 8 |
+
# Import PretrainedConfig in a way that avoids circular imports in some environments (e.g., Databricks)
|
| 9 |
+
try:
|
| 10 |
+
from transformers.configuration_utils import PretrainedConfig
|
| 11 |
+
except Exception: # fallback
|
| 12 |
+
from transformers import PretrainedConfig
|
| 13 |
from typing import List, Optional
|
| 14 |
|
| 15 |
# Support both package-relative and flat import in HF remote code context
|
modeling_autoencoder.py
CHANGED
|
@@ -10,7 +10,13 @@ from dataclasses import dataclass
|
|
| 10 |
import random
|
| 11 |
import re
|
| 12 |
|
| 13 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 14 |
from transformers.modeling_outputs import BaseModelOutput
|
| 15 |
from transformers.utils import ModelOutput
|
| 16 |
|
|
|
|
| 10 |
import random
|
| 11 |
import re
|
| 12 |
|
| 13 |
+
# Import PreTrainedModel in a way that avoids circular imports in some environments (e.g., Databricks)
|
| 14 |
+
try:
|
| 15 |
+
from transformers.modeling_utils import PreTrainedModel
|
| 16 |
+
except Exception:
|
| 17 |
+
# Fallback if direct path is unavailable
|
| 18 |
+
from transformers import PreTrainedModel
|
| 19 |
+
|
| 20 |
from transformers.modeling_outputs import BaseModelOutput
|
| 21 |
from transformers.utils import ModelOutput
|
| 22 |
|