Instructions to use nikraf/directionality_probe with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use nikraf/directionality_probe with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("feature-extraction", model="nikraf/directionality_probe", trust_remote_code=True)# Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("nikraf/directionality_probe", trust_remote_code=True, dtype="auto") - Notebooks
- Google Colab
- Kaggle
| import torch.nn as nn | |
| from peft import LoraConfig, LoraModel | |
| def wrap_lora(module: nn.Module, r: int, lora_alpha: float, lora_dropout: float) -> nn.Module: | |
| # these modules handle ESM++ and ESM2 attention types, as well as any additional transformer blocks from Syndev | |
| target_modules=["layernorm_qkv.1", "out_proj", "query", "key", "value", "dense"] | |
| lora_config = LoraConfig( | |
| r=r, | |
| lora_alpha=lora_alpha, | |
| lora_dropout=lora_dropout, | |
| bias="none", | |
| target_modules=target_modules, | |
| ) | |
| module = LoraModel(module, lora_config, 'default') | |
| for name, param in module.named_parameters(): | |
| if 'classifier' in name.lower(): | |
| param.requires_grad = True | |
| return module | |