Instructions to use ruhook/test-ruhook with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use ruhook/test-ruhook with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="ruhook/test-ruhook")# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("ruhook/test-ruhook") model = AutoModelForCausalLM.from_pretrained("ruhook/test-ruhook", device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use ruhook/test-ruhook with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "ruhook/test-ruhook" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "ruhook/test-ruhook", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/ruhook/test-ruhook
- SGLang
How to use ruhook/test-ruhook 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 "ruhook/test-ruhook" \ --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": "ruhook/test-ruhook", "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 "ruhook/test-ruhook" \ --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": "ruhook/test-ruhook", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use ruhook/test-ruhook with Docker Model Runner:
docker model run hf.co/ruhook/test-ruhook
Tiny random GPT-2 for testing
This model is randomly initialized and has not been trained. It is for testing upload, download, tokenization, and model loading only. Its output is not meaningful and it is not suitable for real language tasks or benchmarking. No pretrained model weights or training datasets were used.
Architecture: 1 GPT-2 layer, 1 attention head, 16 hidden dimensions, 32 vocabulary tokens, and a maximum context length of 64 tokens. Parameter count: 3792.
Usage
from transformers import AutoTokenizer, AutoModelForCausalLM
repo = "ruhook/test-ruhook"
tokenizer = AutoTokenizer.from_pretrained(repo)
model = AutoModelForCausalLM.from_pretrained(repo)
inputs = tokenizer("hello world", return_tensors="pt")
outputs = model.generate(**inputs, max_new_tokens=5, do_sample=False)
print(tokenizer.decode(outputs[0], skip_special_tokens=True))
Validated locally with Python 3, torch 2.2.2 and transformers 4.46.3. The toy word-level tokenizer maps words outside its small vocabulary to UNK.
- Downloads last month
- 1,183