LayerSpec
- class ctranslate2.specs.LayerSpec
A layer specification declares the weights that should be set by the converters.
Inherits from:
ctranslate2.specs.model_spec.FrozenAttr
Extended by:
Methods:
- optimize(quantization: Optional[str] = None) None
Recursively applies some optimizations to this layer:
Alias variables with the same shape and value.
Quantize weights.
- Parameters
quantization – Weight quantization scheme (possible values are: int8, int8_float32, int8_float16, int8_bfloat16, int16, float16, bfloat16, float32).
- validate() None
Verify that the required weights are set.
- Raises
ValueError – If a required weight is not set in the specification.
- variables(prefix: str = '', ordered: bool = False) Dict[str, ndarray]
Recursively returns the weights from this layer and its children.
- Parameters
prefix – Prefix to prepend to all variable names.
ordered – If set, an ordered list is returned instead.
- Returns
Dictionary mapping variables name to value.