Instructions to use h2oai/llama2-0b-unit-test with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use h2oai/llama2-0b-unit-test with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="h2oai/llama2-0b-unit-test")# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("h2oai/llama2-0b-unit-test") model = AutoModelForCausalLM.from_pretrained("h2oai/llama2-0b-unit-test") - Notebooks
- Google Colab
- Kaggle
- Local Apps
- vLLM
How to use h2oai/llama2-0b-unit-test with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "h2oai/llama2-0b-unit-test" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "h2oai/llama2-0b-unit-test", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/h2oai/llama2-0b-unit-test
- SGLang
How to use h2oai/llama2-0b-unit-test 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 "h2oai/llama2-0b-unit-test" \ --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": "h2oai/llama2-0b-unit-test", "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 "h2oai/llama2-0b-unit-test" \ --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": "h2oai/llama2-0b-unit-test", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use h2oai/llama2-0b-unit-test with Docker Model Runner:
docker model run hf.co/h2oai/llama2-0b-unit-test
Small dummy LLama2-type Model useable for Unit/Integration tests. Suitable for CPU only machines, see H2O LLM Studio for an example integration test.
Model was created as follows:
from transformers import AutoConfig, AutoTokenizer, AutoModelForCausalLM
repo_name = "h2oai/llama2-0b-unit-test"
model_name = "h2oai/h2ogpt-4096-llama2-7b-chat"
config = AutoConfig.from_pretrained(model_name)
config.hidden_size = 12
config.max_position_embeddings = 1024
config.intermediate_size = 24
config.num_attention_heads = 2
config.num_hidden_layers = 2
config.num_key_value_heads = 2
tokenizer = AutoTokenizer.from_pretrained(model_name)
model = AutoModelForCausalLM.from_config(config)
print(model.num_parameters()) # 770_940
model.push_to_hub(repo_name, private=False)
tokenizer.push_to_hub(repo_name, private=False)
config.push_to_hub(repo_name, private=False)
Use the following configuration in H2O LLM Studio to run a complete experiment in 5 seconds using the default dataset and default settings otherwise:
Validation Size: 0.1
Data Sample: 0.1
Max Length Prompt: 32
Max Length Answer: 32
Max Length: 64
Backbone Dtype: float16
Gradient Checkpointing: False
Batch Size: 8
Max Length Inference: 16
- Downloads last month
- 2,972