Skip to content

Commit d6fcbdb

Browse files
authored
Fix Transformers bug in NeMo Curator (#591)
Signed-off-by: Vibhu Jawa <vjawa@nvidia.com>
1 parent 85d3de5 commit d6fcbdb

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

nemo_curator/classifiers/aegis.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@
2424
from crossfit import op
2525
from crossfit.backend.torch.hf.model import HFModel
2626
from huggingface_hub import PyTorchModelHubMixin
27-
from peft import PeftModel
2827
from torch.nn import Dropout, Linear
2928
from transformers import AutoConfig, AutoModelForCausalLM, AutoTokenizer
3029

@@ -116,6 +115,11 @@ def __init__(
116115
base_model = AutoModelForCausalLM.from_pretrained(
117116
pretrained_model_name_or_path, torch_dtype=dtype, token=token
118117
)
118+
# Importing PeftModel here to prevent cuda context issues
119+
# that seem to happen on Transformers 4.48.3
120+
# See related: https://github.com/rapidsai/crossfit/pull/113
121+
from peft import PeftModel
122+
119123
self.model = PeftModel.from_pretrained(base_model, peft_model_name_or_path)
120124
self.autocast = autocast
121125
self.add_instruction_data_guard = add_instruction_data_guard

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ dependencies = [
4343
"beautifulsoup4",
4444
"charset_normalizer>=3.1.0",
4545
"comment_parser",
46-
"crossfit>=0.0.8",
46+
"crossfit>=0.0.8.post1",
4747
"dask-mpi>=2021.11.0",
4848
"dask[complete]>=2021.7.1",
4949
"datasets",

0 commit comments

Comments
 (0)