MCPcopy Create free account
hub / github.com/deepspeedai/DeepSpeed / __exit__

Method __exit__

deepspeed/linear/context_manager.py:87–97  ·  view source on GitHub ↗
(self, *args, **kwargs)

Source from the content-addressed store, hash-verified

85 transformers.AutoModelForCausalLM.from_config = from_config
86
87 def __exit__(self, *args, **kwargs):
88 torch.nn.Linear = self._orig_nn_linear
89 if not self._post_init_complete:
90 print('WARNING: For some reason LoRA modules are not initialized, this is usually done automatically '
91 'if using transformers via (AutoModelForCausalLM from_pretrained/from_config). '
92 'You must call `init_lora` on each module in order to use DeepSpeed LoRA, otherwise '
93 'you will error out during runtime.')
94 else:
95 transformers = _import_transformers_library()
96 transformers.AutoModelForCausalLM.from_pretrained = self._orig_causallm_pretrained
97 transformers.AutoModelForCausalLM.from_config = self._orig_causallm_config

Callers

nothing calls this directly

Calls 1

Tested by

no test coverage detected