|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
from transformers.models.gemma2.configuration_gemma2 import Gemma2Config |
|
|
|
class CostWiseGemmaConfig(Gemma2Config): |
|
r""" |
|
This is the configuration class to store the configuration of a [`GemmaModel`]. It is used to instantiate an Gemma |
|
model according to the specified arguments, defining the model architecture. Instantiating a configuration with the |
|
defaults will yield a similar configuration to that of the Gemma-7B. |
|
e.g. [google/gemma-7b](https://huggingface.co/google/gemma-7b) |
|
Configuration objects inherit from [`PretrainedConfig`] and can be used to control the model outputs. Read the |
|
documentation from [`PretrainedConfig`] for more information. |
|
Args: |
|
start_layer (`int`, *optional*, defaults to 28): |
|
The start layer to output score. |
|
layer_sep (`int`, *optional*, defaults to 28): |
|
The sep layer from the start layer to output score. |
|
layer_wise (`bool`, *optional*, defaults to `False`): |
|
Whether or not the model should be layerwise. |
|
```python |
|
>>> from transformers import Gemma2Model, Gemma2Config |
|
>>> # Initializing a Gemma2 gemma2-9b style configuration |
|
>>> configuration = Gemma2Config() |
|
>>> # Initializing a model from the gemma2-9b style configuration |
|
>>> model = Gemma2Model(configuration) |
|
>>> # Accessing the model configuration |
|
>>> configuration = model.config |
|
```""" |
|
|
|
model_type = "cost_wise_gemma" |
|
keys_to_ignore_at_inference = ["past_key_values"] |
|
|
|
def __init__( |
|
self, |
|
start_layer: int = 28, |
|
layer_sep: int = 28, |
|
layer_wise: bool = False, |
|
**kwargs, |
|
): |
|
self.start_layer = start_layer |
|
self.layer_sep = layer_sep |
|
self.layer_wise = layer_wise |
|
|
|
super().__init__( |
|
**kwargs, |
|
) |