MCPcopy Create free account
hub / github.com/FreedomIntelligence/CMB / ChatGLMPreTrainedModel

Class ChatGLMPreTrainedModel

workers/modeling_chatglm_med.py:695–715  ·  view source on GitHub ↗

An abstract class to handle weights initialization and a simple interface for downloading and loading pretrained models.

Source from the content-addressed store, hash-verified

693
694
695class ChatGLMPreTrainedModel(PreTrainedModel):
696 """
697 An abstract class to handle weights initialization and
698 a simple interface for downloading and loading pretrained models.
699 """
700
701 is_parallelizable = True
702 supports_gradient_checkpointing = True
703 config_class = ChatGLMConfig
704 base_model_prefix = "transformer"
705 _no_split_modules = ["GLM6BBlock"]
706
707 def __init__(self, *inputs, **kwargs):
708 super().__init__(*inputs, **kwargs)
709
710 def _init_weights(self, module):
711 return
712
713 def _set_gradient_checkpointing(self, module, value=False):
714 if isinstance(module, (GLMBlock)):
715 module.gradient_checkpointing = value
716
717
718CHATGLM_6B_START_DOCSTRING = r"""

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected