Instructions to use silicobio/peleke-phi-4-merged with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- PEFT
How to use silicobio/peleke-phi-4-merged with PEFT:
Task type is invalid.
- Transformers
How to use silicobio/peleke-phi-4-merged with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="silicobio/peleke-phi-4-merged") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("silicobio/peleke-phi-4-merged") model = AutoModelForCausalLM.from_pretrained("silicobio/peleke-phi-4-merged") messages = [ {"role": "user", "content": "Who are you?"}, ] inputs = tokenizer.apply_chat_template( messages, add_generation_prompt=True, tokenize=True, return_dict=True, return_tensors="pt", ).to(model.device) outputs = model.generate(**inputs, max_new_tokens=40) print(tokenizer.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use silicobio/peleke-phi-4-merged with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "silicobio/peleke-phi-4-merged" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "silicobio/peleke-phi-4-merged", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/silicobio/peleke-phi-4-merged
- SGLang
How to use silicobio/peleke-phi-4-merged with SGLang:
Install from pip and serve model
# Install SGLang from pip: pip install sglang # Start the SGLang server: python3 -m sglang.launch_server \ --model-path "silicobio/peleke-phi-4-merged" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "silicobio/peleke-phi-4-merged", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker images
docker run --gpus all \ --shm-size 32g \ -p 30000:30000 \ -v ~/.cache/huggingface:/root/.cache/huggingface \ --env "HF_TOKEN=<secret>" \ --ipc=host \ lmsysorg/sglang:latest \ python3 -m sglang.launch_server \ --model-path "silicobio/peleke-phi-4-merged" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "silicobio/peleke-phi-4-merged", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use silicobio/peleke-phi-4-merged with Docker Model Runner:
docker model run hf.co/silicobio/peleke-phi-4-merged
Model Card for peleke-phi-4-merged
This model is a fine-tuned version of microsoft/phi-4 for antibody sequence generation. It takes in an antigen sequence, and returns novel Fv portions of heavy and light chain antibody sequences. (This is a merged version of silicobio/peleke-1-phi-4, which includes the fine-tuned LoRA weights.)
Quick start
- Load in the Model
from transformers import AutoModelForCausalLM, AutoTokenizer
import torch, re
model_name = 'silicobio/peleke-phi-4'
model = AutoModelForCausalLM.from_pretrained(
model_name,
torch_dtype=torch.bfloat16,
device_map="auto",
trust_remote_code=True,
)
tokenizer = AutoTokenizer.from_pretrained(model_name, trust_remote_code=True)
- Format your Input
This model uses <epi> and </epi> to annotate epitope residues of interest.
It may be easier to use other characters for annotation, such as [ ]'s. For example: ...CSFS[S][F][V]L[N]WY....
Then, use the following function to properly format the input.
def format_prompt(antigen_sequence):
epitope_seq = re.sub(r'\[([A-Z])\]', r'<epi>\1</epi>', antigen_sequence)
formatted_str = f"Antigen: {epitope_seq}<|im_end|>\nAntibody:"
return formatted_str
- Generate an Antibody Sequence
## Example HIV-1 gp120 antigen sequence with epitopes marked
antigen_sequence = "VPVWKDADTTLFCASDAKAHETEVHNVWATHACVPTDPNPQEIHLENVTENFNMWKNNMVEQMQEDVISLWDQSLQPCVKLTGGSVIKQACPKISFDPIPIHYCTPAGYVILKCNDKNFNGTGPCKNVSSVQCTHGIKPVVSTQLLLNGSLAEEEIIIRSENLT[N][N]A[K]TIIVHLNKSVEINCTRPSNGGSGSGGDIRKAYCEINGTKWNKVLKQVTEKLKEHFNNKTIIFQPPSGG[D]LEITMHSFNCRGEFFYCNTTQLFNNTCIGNETMKGCNGTITLPCKIKQIINMWQGTGQAMYAPPIDGKINCVSNITGILLT[R]D[G][G]ANNTSNETFRPGGGNIKDNWRSELYKYKVVQIE"
prompt = format_prompt(antigen_sequence)
inputs = tokenizer(prompt, return_tensors="pt")
inputs = {k: v.cuda() for k, v in inputs.items()}
with torch.no_grad():
outputs = model.generate(
**inputs,
max_new_tokens=1000,
do_sample=True,
temperature=0.7,
pad_token_id=tokenizer.eos_token_id,
use_cache=False,
)
full_text = tokenizer.decode(outputs[0], skip_special_tokens=False)
antibody_sequence = full_text.split('<|im_end|>')[1].replace('Antibody: ', '')
print(f"Antigen: {antigen_sequence}\nAntibody: {antibody_sequence}\n")
This will generate a |-delimited output, which is an Fv portion of a heavy and light chain.
Antigen: NPPTFSPALL...
Antibody: QVQLVQSGGG...|DIQMTQSPSS...
Training procedure
This model was trained with SFT.
Framework versions
- PEFT 0.17.0
- TRL: 0.19.1
- Transformers: 4.54.0
- Pytorch: 2.7.1
- Datasets: 4.0.0
- Tokenizers: 0.21.2
- Downloads last month
- -
Model tree for silicobio/peleke-phi-4-merged
Base model
microsoft/phi-4