bart-base-detox-ttd / configuration_bart.py
not-found's picture
Add TT-compressed model with rank 128
bf24ef5
raw
history blame contribute delete
626 Bytes
from typing import Tuple
from transformers import BartConfig
class TTCompressedBartConfig(BartConfig):
"""Class TTCompressedBartConfig defines a configuration for TT-compressed
BART. Here, we split shape to input and output shape in order to serialize
them to different fields in JSON.
"""
def __init__(self, *args, shape_in: Tuple[int] = (),
shape_out: Tuple[int] = (), rank: int = 128, **kwargs):
super().__init__(*args, **kwargs)
self.shape_in = shape_in
self.shape_out = shape_out
self.rank = rank
TTCompressedBartConfig.register_for_auto_class()