zpn commited on
Commit
97192b7
1 Parent(s): e56285d

Upload model

Browse files
Files changed (1) hide show
  1. modeling_hf_nomic_bert.py +24 -1
modeling_hf_nomic_bert.py CHANGED
@@ -2002,7 +2002,30 @@ class NomicMultiHeadAttentionPooling(nn.Module):
2002
 
2003
  return hidden_states
2004
 
2005
- class NomicVisionModel(PreTrainedModel):
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2006
  def __init__(self, config):
2007
  super().__init__(config)
2008
 
 
2002
 
2003
  return hidden_states
2004
 
2005
+ class NomicVisionPreTrainedModel(PreTrainedModel):
2006
+ """An abstract class to handle weights initialization and
2007
+ a simple interface for dowloading and loading pretrained models.
2008
+ """
2009
+
2010
+ config_class = NomicBertConfig
2011
+ base_model_prefix = "model"
2012
+ supports_gradient_checkpointing = True
2013
+ _no_split_modules = ["Block"]
2014
+ _skip_keys_device_placement = "past_key_values"
2015
+
2016
+ def __init__(self, config, *inputs, **kwargs):
2017
+ super().__init__(config)
2018
+ if not isinstance(config, GPT2Config):
2019
+ raise ValueError(
2020
+ "Parameter config in `{}(config)` should be an instance of class `GPT2Config`. "
2021
+ "To create a model from a Google pretrained model use "
2022
+ "`model = {}.from_pretrained(PRETRAINED_MODEL_NAME)`".format(
2023
+ self.__class__.__name__, self.__class__.__name__
2024
+ )
2025
+ )
2026
+ self.config = config
2027
+
2028
+ class NomicVisionModel(NomicVisionPreTrainedModel):
2029
  def __init__(self, config):
2030
  super().__init__(config)
2031