Instructions to use mediocredev/open-llama-3b-v2-instruct with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use mediocredev/open-llama-3b-v2-instruct with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="mediocredev/open-llama-3b-v2-instruct")# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("mediocredev/open-llama-3b-v2-instruct") model = AutoModelForCausalLM.from_pretrained("mediocredev/open-llama-3b-v2-instruct") - Notebooks
- Google Colab
- Kaggle
- Local Apps
- vLLM
How to use mediocredev/open-llama-3b-v2-instruct with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "mediocredev/open-llama-3b-v2-instruct" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "mediocredev/open-llama-3b-v2-instruct", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/mediocredev/open-llama-3b-v2-instruct
- SGLang
How to use mediocredev/open-llama-3b-v2-instruct 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 "mediocredev/open-llama-3b-v2-instruct" \ --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": "mediocredev/open-llama-3b-v2-instruct", "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 "mediocredev/open-llama-3b-v2-instruct" \ --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": "mediocredev/open-llama-3b-v2-instruct", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use mediocredev/open-llama-3b-v2-instruct with Docker Model Runner:
docker model run hf.co/mediocredev/open-llama-3b-v2-instruct
Prerequisites
In addition to pytorch and transformers, install required packages:
pip install accelerate sentencepiece
Usage
To use, copy the following script:
from transformers import AutoTokenizer, AutoModelForCausalLM
import transformers
import torch
model_id = 'mediocredev/open-llama-3b-v2-instruct'
tokenizer_id = 'mediocredev/open-llama-3b-v2-instruct'
tokenizer = AutoTokenizer.from_pretrained(tokenizer_id)
pipeline = transformers.pipeline(
'text-generation',
model=model_id,
tokenizer=tokenizer,
torch_dtype=torch.bfloat16,
device_map='auto',
)
system_message = 'You are a helpful assistant, who always provide explanation.'
user_message = 'How many days are there in a leap year?'
prompt = f'### System:\n{system_message}<|endoftext|>\n### User:\n{user_message}<|endoftext|>\n### Assistant:\n'
response = pipeline(
prompt,
max_length=1000,
repetition_penalty=1.05,
)
response = response[0]['generated_text']
print(response)
# Assistant: A leap year has 366 days. It's an extra day added to the calendar every four years to account for the extra time it takes for Earth to complete one full orbit around the Sun.
Limitations
mediocredev/open-llama-3b-v2-instruct is based on LLaMA 3B v2. It can struggle with factual accuracy, particularly when presented with conflicting information or nuanced topics. Its outputs are not deterministic and require critical evaluation to avoid relying solely on its assertions. Additionally, its generative capabilities, while promising, can sometimes produce factually incorrect or offensive content, necessitating careful curation and human oversight. As an evolving model, LLaMA is still under development, and its limitations in areas like bias mitigation and interpretability are being actively addressed. By using this model responsibly and being aware of its shortcomings, we can unlock its potential while mitigating its risks.
Contact
Welcome any feedback, questions, and discussions. Feel free to reach out: mediocredev@outlook.com
Open LLM Leaderboard Evaluation Results
Detailed results can be found here
| Metric | Value |
|---|---|
| Avg. | 42.02 |
| AI2 Reasoning Challenge (25-Shot) | 38.48 |
| HellaSwag (10-Shot) | 70.24 |
| MMLU (5-Shot) | 39.69 |
| TruthfulQA (0-shot) | 37.96 |
| Winogrande (5-shot) | 65.75 |
| GSM8k (5-shot) | 0.00 |
- Downloads last month
- 207
Model tree for mediocredev/open-llama-3b-v2-instruct
Evaluation results
- normalized accuracy on AI2 Reasoning Challenge (25-Shot)test set Open LLM Leaderboard38.480
- normalized accuracy on HellaSwag (10-Shot)validation set Open LLM Leaderboard70.240
- accuracy on MMLU (5-Shot)test set Open LLM Leaderboard39.690
- mc2 on TruthfulQA (0-shot)validation set Open LLM Leaderboard37.960
- accuracy on Winogrande (5-shot)validation set Open LLM Leaderboard65.750
- accuracy on GSM8k (5-shot)test set Open LLM Leaderboard0.000