Instructions to use aegon-h/phi-base_model with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use aegon-h/phi-base_model with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="aegon-h/phi-base_model", trust_remote_code=True)# Load model directly from transformers import AutoModelForCausalLM model = AutoModelForCausalLM.from_pretrained("aegon-h/phi-base_model", trust_remote_code=True, dtype="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps
- vLLM
How to use aegon-h/phi-base_model with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "aegon-h/phi-base_model" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "aegon-h/phi-base_model", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/aegon-h/phi-base_model
- SGLang
How to use aegon-h/phi-base_model 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 "aegon-h/phi-base_model" \ --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": "aegon-h/phi-base_model", "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 "aegon-h/phi-base_model" \ --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": "aegon-h/phi-base_model", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use aegon-h/phi-base_model with Docker Model Runner:
docker model run hf.co/aegon-h/phi-base_model
Agon H commited on
Commit ·
15e1cf4
1
Parent(s): 8265ece
Upload run in CPU.ipynb
Browse files- run in CPU.ipynb +77 -0
run in CPU.ipynb
ADDED
|
@@ -0,0 +1,77 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"nbformat": 4,
|
| 3 |
+
"nbformat_minor": 0,
|
| 4 |
+
"metadata": {
|
| 5 |
+
"colab": {
|
| 6 |
+
"provenance": []
|
| 7 |
+
},
|
| 8 |
+
"kernelspec": {
|
| 9 |
+
"name": "python3",
|
| 10 |
+
"display_name": "Python 3"
|
| 11 |
+
},
|
| 12 |
+
"language_info": {
|
| 13 |
+
"name": "python"
|
| 14 |
+
}
|
| 15 |
+
},
|
| 16 |
+
"cells": [
|
| 17 |
+
{
|
| 18 |
+
"cell_type": "code",
|
| 19 |
+
"execution_count": 1,
|
| 20 |
+
"metadata": {
|
| 21 |
+
"id": "HTQFPahcInfL"
|
| 22 |
+
},
|
| 23 |
+
"outputs": [],
|
| 24 |
+
"source": [
|
| 25 |
+
"%%capture\n",
|
| 26 |
+
"!pip install transformers\n",
|
| 27 |
+
"!pip install einops\n",
|
| 28 |
+
"\n",
|
| 29 |
+
"import torch\n",
|
| 30 |
+
"from transformers import AutoModelForCausalLM, AutoTokenizer\n",
|
| 31 |
+
"\n",
|
| 32 |
+
"model = AutoModelForCausalLM.from_pretrained(\"agonh/phi-base_model\", trust_remote_code=True)\n",
|
| 33 |
+
"tokenizer = AutoTokenizer.from_pretrained(\"agonh/phi-base_model\", trust_remote_code=True)"
|
| 34 |
+
]
|
| 35 |
+
},
|
| 36 |
+
{
|
| 37 |
+
"cell_type": "code",
|
| 38 |
+
"source": [
|
| 39 |
+
"prompt = \"tell me about moon ?\"\n",
|
| 40 |
+
"inputs = tokenizer(prompt, return_tensors=\"pt\", return_attention_mask=False)\n",
|
| 41 |
+
"\n",
|
| 42 |
+
"outputs = model.generate(**inputs, max_length=100)\n",
|
| 43 |
+
"text = tokenizer.batch_decode(outputs)[0]\n",
|
| 44 |
+
"print(text)"
|
| 45 |
+
],
|
| 46 |
+
"metadata": {
|
| 47 |
+
"colab": {
|
| 48 |
+
"base_uri": "https://localhost:8080/"
|
| 49 |
+
},
|
| 50 |
+
"id": "ty9IBkPPZodx",
|
| 51 |
+
"outputId": "6dd0b96e-860c-4b74-9d20-8f2f053fc19c"
|
| 52 |
+
},
|
| 53 |
+
"execution_count": 2,
|
| 54 |
+
"outputs": [
|
| 55 |
+
{
|
| 56 |
+
"output_type": "stream",
|
| 57 |
+
"name": "stdout",
|
| 58 |
+
"text": [
|
| 59 |
+
"tell me about moon?\n",
|
| 60 |
+
"\n",
|
| 61 |
+
"A:\n",
|
| 62 |
+
"\n",
|
| 63 |
+
"The moon is a natural satellite of the Earth. It is the fifth largest moon in the solar system. It is also the only natural satellite of the Earth.\n",
|
| 64 |
+
"\n",
|
| 65 |
+
"A:\n",
|
| 66 |
+
"\n",
|
| 67 |
+
"The moon is a natural satellite of the Earth. It is the fifth largest moon in the solar system. It is also the only natural satellite of the Earth.\n",
|
| 68 |
+
"\n",
|
| 69 |
+
"A:\n",
|
| 70 |
+
"\n",
|
| 71 |
+
"The moon is a natural satellite of the Earth. It is the\n"
|
| 72 |
+
]
|
| 73 |
+
}
|
| 74 |
+
]
|
| 75 |
+
}
|
| 76 |
+
]
|
| 77 |
+
}
|