Instructions to use heegyu/llama-small-randomweights with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use heegyu/llama-small-randomweights with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="heegyu/llama-small-randomweights")# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("heegyu/llama-small-randomweights") model = AutoModelForCausalLM.from_pretrained("heegyu/llama-small-randomweights") - Notebooks
- Google Colab
- Kaggle
- Local Apps
- vLLM
How to use heegyu/llama-small-randomweights with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "heegyu/llama-small-randomweights" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "heegyu/llama-small-randomweights", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/heegyu/llama-small-randomweights
- SGLang
How to use heegyu/llama-small-randomweights 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 "heegyu/llama-small-randomweights" \ --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": "heegyu/llama-small-randomweights", "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 "heegyu/llama-small-randomweights" \ --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": "heegyu/llama-small-randomweights", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use heegyu/llama-small-randomweights with Docker Model Runner:
docker model run hf.co/heegyu/llama-small-randomweights
This is 82M parameters llama model of random weights. This model can be use for proof of concept.
Tokenizer is copy of meta-llama/Llama-2-7b
# Use a pipeline as a high-level helper
from transformers import LlamaConfig, LlamaForCausalLM, LlamaTokenizer
import numpy as np
config = LlamaConfig(vocab_size=32000, hidden_size=768, intermediate_size=768*4, num_hidden_layers=4, num_attention_heads=8)
tokenizer = LlamaTokenizer.from_pretrained("meta-llama/Llama-2-7b")
model = LlamaForCausalLM(config).half()
model_parameters = filter(lambda p: p.requires_grad, model.parameters())
params = sum([np.prod(p.size()) for p in model_parameters])
print(params / 1024 / 1024) # 82.881591796875
hub_id = "heegyu/llama-small-randomweights"
tokenizer.push_to_hub(hub_id)
model.push_to_hub(hub_id)
- Downloads last month
- 4
docker model run hf.co/heegyu/llama-small-randomweights