Text Generation
Transformers
Safetensors
bacformer
biology
bacteria
prokaryotes
genomics
protein
plm
cplm
custom_code
Instructions to use macwiatrak/bacformer-causal-MAG with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use macwiatrak/bacformer-causal-MAG with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="macwiatrak/bacformer-causal-MAG", trust_remote_code=True)# Load model directly from transformers import AutoModelForCausalLM model = AutoModelForCausalLM.from_pretrained("macwiatrak/bacformer-causal-MAG", trust_remote_code=True, dtype="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use macwiatrak/bacformer-causal-MAG with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "macwiatrak/bacformer-causal-MAG" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "macwiatrak/bacformer-causal-MAG", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/macwiatrak/bacformer-causal-MAG
- SGLang
How to use macwiatrak/bacformer-causal-MAG 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 "macwiatrak/bacformer-causal-MAG" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "macwiatrak/bacformer-causal-MAG", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'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 "macwiatrak/bacformer-causal-MAG" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "macwiatrak/bacformer-causal-MAG", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use macwiatrak/bacformer-causal-MAG with Docker Model Runner:
docker model run hf.co/macwiatrak/bacformer-causal-MAG
| { | |
| "alpha_contrastive_loss": 0.5, | |
| "architectures": [ | |
| "BacformerForCausalGM" | |
| ], | |
| "attention_probs_dropout_prob": 0.1, | |
| "auto_map": { | |
| "AutoConfig": "configuration_bacformer.BacformerConfig", | |
| "AutoModelForCausalLM": "modeling_bacformer.BacformerForCausalGM" | |
| }, | |
| "batch_size": 1, | |
| "ckpt_path": null, | |
| "dataloader_num_workers": 10, | |
| "early_stopping_patience": 8, | |
| "end_token_id": 5, | |
| "eval_steps": 4000, | |
| "gradient_accumulation_steps": 8, | |
| "hidden_dropout_prob": 0.1, | |
| "hidden_size": 480, | |
| "id2label": { | |
| "0": "LABEL_0" | |
| }, | |
| "initializer_range": 0.02, | |
| "input_dir": "/rds/user/mw896/rds-flotolab-9X9gY1OFt4M/projects/bacformer/input-data/eval-genomes/", | |
| "intermediate_size": 1280, | |
| "is_causal_gm": true, | |
| "label2id": { | |
| "LABEL_0": 0 | |
| }, | |
| "layer_norm_eps": 1e-12, | |
| "logging_steps": 500, | |
| "lr": 0.00015, | |
| "mask_token_id": 1, | |
| "max_epochs": 10, | |
| "max_grad_norm": 2.0, | |
| "max_n_contigs": 1000, | |
| "max_n_proteins": 6000, | |
| "max_position_embeddings": 6000, | |
| "max_token_type_embeddings": 1000, | |
| "mgm_probability": 0.0, | |
| "model_type": "bacformer", | |
| "monitor_metric": "loss", | |
| "n_nodes": 1, | |
| "n_total_samples": 1203731, | |
| "num_attention_heads": 8, | |
| "num_hidden_layers": 12, | |
| "num_special_tokens": 6, | |
| "output_dir": "/rds/user/mw896/rds-flotolab-9X9gY1OFt4M/projects/bacformer/output-data/all-genomes/runs-causal/12L-full-data-rotary-lr15e-5/", | |
| "pad_token_id": 0, | |
| "pretrained_model_dir": null, | |
| "problem_type": "single_label_classification", | |
| "prot_emb_token_id": 4, | |
| "protein_clusters_vocab_size": 50000, | |
| "random_state": 30, | |
| "return_attn_weights": false, | |
| "return_dict": false, | |
| "save_steps": 4000, | |
| "special_tokens_dict": { | |
| "CLS": 2, | |
| "END": 5, | |
| "MASK": 1, | |
| "PAD": 0, | |
| "PROT_EMB": 4, | |
| "SEP": 3 | |
| }, | |
| "test": false, | |
| "test_after_train": false, | |
| "torch_dtype": "float32", | |
| "train_subset_prop": 1.0, | |
| "transformers_version": "4.50.3", | |
| "warmup_proportion": 0.1, | |
| "weight_decay": 0.01 | |
| } | |