Spaces:
Sleeping
Sleeping
# Unsloth Zoo - Utilities for Unsloth | |
# Copyright 2023-present Daniel Han-Chen & the Unsloth team. All rights reserved. | |
# | |
# This program is free software: you can redistribute it and/or modify | |
# it under the terms of the GNU Lesser General Public License as published by | |
# the Free Software Foundation, either version 3 of the License, or | |
# (at your option) any later version. | |
# | |
# This program is distributed in the hope that it will be useful, | |
# but WITHOUT ANY WARRANTY; without even the implied warranty of | |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
# GNU General Public License for more details. | |
# | |
# You should have received a copy of the GNU Lesser General Public License | |
# along with this program. If not, see <https://www.gnu.org/licenses/>. | |
torch_compile_options = {'epilogue_fusion': True, 'max_autotune': False, 'shape_padding': True, 'trace.enabled': False, 'triton.cudagraphs': False} | |
from torch import Tensor | |
import torch | |
from torch.nn import functional as F | |
from transformers.models.mllama.modeling_mllama import (F) | |
def forward(self, input: Tensor) -> Tensor: | |
return F.group_norm( | |
input, self.num_groups, self.weight, self.bias, self.eps).to(input.dtype) | |