def activate_neftune(model, neftune_noise_alpha=0.1):
    r"""
    Activates the neftune as presented in this code: https://github.com/neelsjain/NEFTune and paper:
    https://arxiv.org/abs/2310.05914
    """
    embeddings = unwrap(model).get_input_embeddings()

    embeddings.neftune_noise_alpha = neftune_noise_alpha
    hook_handle = embeddings.register_forward_hook(neftune_post_forward_hook)
    neftune_hook_handle = hook_handle

    return model, neftune_hook_handle

    Activates the neftune as presented in this code: https://github.com/neelsjain/NEFTune and paper:
    https://arxiv.org/abs/2310.05914
    
train/colossalai_llm4decompile/colossal_llama/utils/neftune_patch.py