def METHOD_NAME(layer):
    if isinstance(layer, (nn.Conv1d, nn.Conv2d, nn.Linear)):
        layer.weight.data = layer.weight.data.half()
        if layer.bias is not None:
            layer.bias.data = layer.bias.data.half()
    if isinstance(layer, nn.MultiheadAttention):
        for attr in [
                *[f'{s}_proj_weight' for s in ['in', 'q', 'k', 'v']],
                'in_proj_bias', 'bias_k', 'bias_v'
        ]:
            tensor = getattr(layer, attr)
            if tensor is not None:
                tensor.data = tensor.data.half()
    for name in ['text_projection', 'proj']:
        if hasattr(layer, name):
            attr = getattr(layer, name)
            if attr is not None:
                attr.data = attr.data.half()
    for name in ['prompt_embeddings']:
        if hasattr(layer, name):
            attr = getattr(layer, name)
            if attr is not None:
                attr.data = attr.data.half()