Instructions to use BotaniBrain/openELM-biomimcry-270M with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use BotaniBrain/openELM-biomimcry-270M with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="BotaniBrain/openELM-biomimcry-270M", trust_remote_code=True)# Load model directly from transformers import AutoModelForCausalLM model = AutoModelForCausalLM.from_pretrained("BotaniBrain/openELM-biomimcry-270M", trust_remote_code=True, dtype="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps
- vLLM
How to use BotaniBrain/openELM-biomimcry-270M with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "BotaniBrain/openELM-biomimcry-270M" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "BotaniBrain/openELM-biomimcry-270M", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/BotaniBrain/openELM-biomimcry-270M
- SGLang
How to use BotaniBrain/openELM-biomimcry-270M 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 "BotaniBrain/openELM-biomimcry-270M" \ --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": "BotaniBrain/openELM-biomimcry-270M", "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 "BotaniBrain/openELM-biomimcry-270M" \ --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": "BotaniBrain/openELM-biomimcry-270M", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use BotaniBrain/openELM-biomimcry-270M with Docker Model Runner:
docker model run hf.co/BotaniBrain/openELM-biomimcry-270M
Inference:
inputs = """Below is an instruction that describes a task, paired with an input that provides further context. Write a response that appropriately completes the request.
### Instruction:
Given a human challenge, formulate a biological question that translates this specific human challenge into an exact biological equivalent, ensuring that the language used is devoid of any ambiguity and strictly adheres to the most current and relevant scientific terms in biomimicry and bioengineering.
The question should be grounded in a natural biological strategy or phenomenon that has been unequivocally established through empirical research, and should reflect a detailed one-to-one correspondence with the human challenge to facilitate precise bio-inspired solution development.
### Human Challenge:
How can we design a cost-effective, modular housing system that utilizes recycled materials without compromising on durability and aesthetics?
### Biomimetic Question:
"""
input_tokens = tokenizer(inputs, return_tensors="pt").to("cuda")
if tokenizer.pad_token_id is None:
tokenizer.pad_token_id = tokenizer.eos_token_id
stop_token = "###" # Example: use period as stop token, or use tokenizer.eos_token for the default EOS
stop_token_id = tokenizer.convert_tokens_to_ids(stop_token)
# Generate output
outputs = model.generate(input_tokens['input_ids'], attention_mask=input_tokens['attention_mask'], pad_token_id=tokenizer.pad_token_id, max_new_tokens=100, eos_token_id=stop_token_id, temperature =0.90, do_sample=True)
# Decode generated output
decoded_output = tokenizer.decode(outputs[0], skip_special_tokens=True)
decoded_output = decoded_output.replace(inputs, "")
print(decoded_output.split("?", 1)[0])
- Downloads last month
- 6