Instructions to use birgermoell/eir with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use birgermoell/eir with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="birgermoell/eir")# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("birgermoell/eir") model = AutoModelForCausalLM.from_pretrained("birgermoell/eir") - Notebooks
- Google Colab
- Kaggle
- Local Apps
- vLLM
How to use birgermoell/eir with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "birgermoell/eir" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "birgermoell/eir", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/birgermoell/eir
- SGLang
How to use birgermoell/eir 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 "birgermoell/eir" \ --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": "birgermoell/eir", "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 "birgermoell/eir" \ --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": "birgermoell/eir", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use birgermoell/eir with Docker Model Runner:
docker model run hf.co/birgermoell/eir
Eir
Eir är läkekonstens gudinna i nordisk mytologi.
How to use
from transformers import AutoTokenizer
import transformers
import torch
model = "birgermoell/eir"
messages = [
{"role": "system", "content": "Du är en läkare som är expert i allmänmedicin: Svara på följande fråga:"},
{"role": "user", "content": "Vad ska jag göra om jag är förkyld?"}]
tokenizer = AutoTokenizer.from_pretrained(model)
prompt = tokenizer.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)
pipeline = transformers.pipeline(
"text-generation",
model=model,
torch_dtype=torch.float16,
device_map="auto",
)
outputs = pipeline(prompt, max_new_tokens=512, do_sample=False, temperature=0.7, top_k=50, top_p=0.95, repetition_penalty=1.2)
print(outputs[0]["generated_text"])
>>> "Om du är förkyld är det viktigt att vila och dricka mycket vatten.
Om du har feber, kan du ta paracetamol eller ibuprofen.
Om du har svårare symptom som svår feber, svårare smärtor i halsen,
svårare svullnad i halsen, svårare svårigheter att andas, kan du behöva söka hjälp hos en läkare."
model = "birgermoell/eir"
messages = [
{"role": "system", "content": "Du är en läkare som är expert i allmänmedicin: Svara på följande fråga:"},
{"role": "user", "content": "Jag har ont i magen, hur vet jag om jag ska besöka en läkare?"}]
tokenizer = AutoTokenizer.from_pretrained(model)
prompt = tokenizer.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)
pipeline = transformers.pipeline(
"text-generation",
model=model,
torch_dtype=torch.float16,
device_map="auto",
)
outputs = pipeline(prompt, max_new_tokens=512, do_sample=False, temperature=0.7, top_k=50, top_p=0.95, repetition_penalty=1.2)
print(outputs[0]["generated_text"])
>>> "Om du har ont i magen som är svår att förklara, varar längre än tre veckor, eller är kombinerat med andra symtom som viktigast, feber, diarré, blod i avföringen,
minskad aptit, viktförlust, gastroesophageal reflux, nausea, kräkningar, eller svårigheter att svälja, bör du söka hjälp av en läkare."
This model is a merge of https://huggingface.co/timpal0l/Mistral-7B-v0.1-flashback-v2-instruct and https://huggingface.co/BioMistral/BioMistral-7B.
Configuration
The following YAML configuration was used to produce this model:
models:
- model: timpal0l/Mistral-7B-v0.1-flashback-v2-instruct
# No parameters necessary for base model
- model: BioMistral/BioMistral-7B
parameters:
density: 0.53
weight: 0.6
merge_method: dare_ties
base_model: timpal0l/Mistral-7B-v0.1-flashback-v2-instruct
parameters:
int8_mask: true
dtype: bfloat16
CAUTION!
Both direct and downstream users need to be informed about the risks, biases, and constraints inherent in the model. While the model can produce natural language text, our exploration of its capabilities and limitations is just beginning. In fields such as medicine, comprehending these limitations is crucial. Hence, we strongly advise against deploying this model for natural language generation in production or for professional tasks in the realm of health and medicine.
- Downloads last month
- 8