Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 7 additions & 5 deletions tests/test_custom_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -1230,7 +1230,6 @@
{"target_modules": ["lin0"], "init_weights": False},
{"target_modules": ["lin1"], "init_weights": False},
),
# BD-LoRA different encounters issues as the adapter weights have different shapes then
]


Expand Down Expand Up @@ -1365,10 +1364,6 @@ def __init__(self, emb_size=100):
super().__init__()
self.emb = nn.Embedding(emb_size, 5)
self.conv1d = Conv1D(1, 5)
# make sure that we have a good signal-to-noise ratio
# since apparently CUDA ReLU clips the gradient at a
# certain point.
self.conv1d.weight.data += 10
self.relu = nn.ReLU()
self.flat = nn.Flatten()
self.lin0 = nn.Linear(10, 2)
Expand Down Expand Up @@ -2271,6 +2266,13 @@ def test_disable_adapters_with_merging(self, test_name, model_id, config_cls, co
# same as test_disable_adapters, but with merging
X = self.prepare_inputs_for_testing()
model = self.transformers_class.from_pretrained(model_id).to(self.torch_device)

if isinstance(model, ModelEmbConv1D) and (self.torch_device != "cpu"):
# Make sure that we have a good signal-to-noise ratio
# since apparently CUDA ReLU clips the gradient at a
# certain point. On CPU, avoid this.
model.conv1d.weight.data += 10

config = config_cls(
base_model_name_or_path=model_id,
**config_kwargs,
Expand Down
Loading