Conv1D Usage
#3
by
ShairozS
- opened
When trying to use this model, I get the following error:
File ~\.cache\huggingface\modules\transformers_modules\codesage\codesage_hyphen_small_hyphen_v2\4844c2f24b25e181aa43ca058cc73dd2622565c1\modeling_codesage.py:11
9 from torch.nn import CrossEntropyLoss, MSELoss, BCEWithLogitsLoss
10 from transformers.activations import ACT2FN
---> 11 from transformers.modeling_utils import Conv1D, PreTrainedModel
12 from transformers.utils import logging
13 from .config_codesage import CodeSageConfig
ImportError: cannot import name 'Conv1D' from 'transformers.modeling_utils' (C:\Users\shairozs\.conda\envs\pytorch2\Lib\site-packages\transformers\modeling_utils.py)
This seems to stem from the usage of Conv1D, a class that was moved out of the transformers.modeling_utils module recently. The fix would be to change the import line to:
try:
from transformers.modeling_utils import Conv1D, PreTrainedModel
except ImportError:
from transformers.pytorch_utils import Conv1D
from transformers.modeling_utils import PreTrainedModel