Google Colabs I got this error: NameError: name 'bnb' is not defined
#8
by
damesek
- opened
Hello,
I got this error in Google Colabs (see under my text). I installed !pip install bitsandbytes
too, so that couldn't be a problem.. so Im not sure, how to fix. If you have any idea, Im happy to hear :)
Requirement already satisfied: bitsandbytes in /usr/local/lib/python3.9/dist-packages (0.38.1)
โญโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ Traceback (most recent call last) โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฎ
โ in <cell line: 2>:2 โ
โ โ
โ /usr/local/lib/python3.9/dist-packages/peft/peft_model.py:143 in from_pretrained โ
โ โ
โ 140 โ โ if config.task_type not in MODEL_TYPE_TO_PEFT_MODEL_MAPPING.keys(): โ
โ 141 โ โ โ model = cls(model, config) โ
โ 142 โ โ else: โ
โ โฑ 143 โ โ โ model = MODEL_TYPE_TO_PEFT_MODEL_MAPPING[config.task_type](model, config) โ
โ 144 โ โ โ
โ 145 โ โ # load weights if any โ
โ 146 โ โ if os.path.exists(os.path.join(model_id, WEIGHTS_NAME)): โ
โ โ
โ /usr/local/lib/python3.9/dist-packages/peft/peft_model.py:514 in __init__ โ
โ โ
โ 511 โ """ โ
โ 512 โ โ
โ 513 โ def __init__(self, model, peft_config: PeftConfig): โ
โ โฑ 514 โ โ super().__init__(model, peft_config) โ
โ 515 โ โ self.base_model_prepare_inputs_for_generation = self.base_model.prepare_inputs_f โ
โ 516 โ โ self.base_model.prepare_inputs_for_generation = self.prepare_inputs_for_generati โ
โ 517 โ
โ โ
โ /usr/local/lib/python3.9/dist-packages/peft/peft_model.py:79 in __init__ โ
โ โ
โ 76 โ โ if isinstance(self.peft_config, PromptLearningConfig): โ
โ 77 โ โ โ self._setup_prompt_encoder() โ
โ 78 โ โ else: โ
โ โฑ 79 โ โ โ self.base_model = LoraModel(peft_config, model) โ
โ 80 โ โ if getattr(self.peft_config, "modules_to_save", None) is not None: โ
โ 81 โ โ โ self.modules_to_save = self.peft_config.modules_to_save โ
โ 82 โ โ โ _set_trainable(self) โ
โ โ
โ /usr/local/lib/python3.9/dist-packages/peft/tuners/lora.py:118 in __init__ โ
โ โ
โ 115 โ โ super().__init__() โ
โ 116 โ โ self.peft_config = config โ
โ 117 โ โ self.model = model โ
โ โฑ 118 โ โ self._find_and_replace() โ
โ 119 โ โ mark_only_lora_as_trainable(self.model, self.peft_config.bias) โ
โ 120 โ โ self.forward = self.model.forward โ
โ 121 โ
โ โ
โ /usr/local/lib/python3.9/dist-packages/peft/tuners/lora.py:148 in _find_and_replace โ
โ โ
โ 145 โ โ โ โ โ is_target_modules_in_base_model = True โ
โ 146 โ โ โ โ parent, target, target_name = self._get_submodules(key) โ
โ 147 โ โ โ โ bias = target.bias is not None โ
โ โฑ 148 โ โ โ โ if loaded_in_8bit and isinstance(target, bnb.nn.Linear8bitLt): โ
โ 149 โ โ โ โ โ kwargs.update( โ
โ 150 โ โ โ โ โ โ { โ
โ 151 โ โ โ โ โ โ โ "has_fp16_weights": target.state.has_fp16_weights, โ
โฐโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฏ
NameError: name 'bnb' is not defined```
I fixed it by pip install bitsandbytes==0.35.0
damesek
changed discussion status to
closed