Instructions to use zstanjj/SlimPLM-Query-Rewriting with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use zstanjj/SlimPLM-Query-Rewriting with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="zstanjj/SlimPLM-Query-Rewriting")# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("zstanjj/SlimPLM-Query-Rewriting") model = AutoModelForCausalLM.from_pretrained("zstanjj/SlimPLM-Query-Rewriting") - Notebooks
- Google Colab
- Kaggle
- Local Apps
- vLLM
How to use zstanjj/SlimPLM-Query-Rewriting with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "zstanjj/SlimPLM-Query-Rewriting" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "zstanjj/SlimPLM-Query-Rewriting", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/zstanjj/SlimPLM-Query-Rewriting
- SGLang
How to use zstanjj/SlimPLM-Query-Rewriting 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 "zstanjj/SlimPLM-Query-Rewriting" \ --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": "zstanjj/SlimPLM-Query-Rewriting", "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 "zstanjj/SlimPLM-Query-Rewriting" \ --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": "zstanjj/SlimPLM-Query-Rewriting", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use zstanjj/SlimPLM-Query-Rewriting with Docker Model Runner:
docker model run hf.co/zstanjj/SlimPLM-Query-Rewriting
Update README.md
Browse files
README.md
CHANGED
|
@@ -37,6 +37,12 @@ heuristic_answer = "The voice of Darth Vader in Star Wars is provided by British
|
|
| 37 |
prompt = (f"<s>[INST] <<SYS>>\nYou are a helpful assistant. Your task is to parse user input into"
|
| 38 |
f" structured formats according to the coarse answer. Current datatime is 2023-12-20 9:47:28"
|
| 39 |
f" <</SYS>>\n Course answer: (({heuristic_answer}))\nQuestion: (({question})) [/INST]")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 40 |
params_query_rewrite = {"repetition_penalty": 1.05, "temperature": 0.01, "top_k": 1, "top_p": 0.85,
|
| 41 |
"max_new_tokens": 512, "do_sample": False, "seed": 2023}
|
| 42 |
|
|
|
|
| 37 |
prompt = (f"<s>[INST] <<SYS>>\nYou are a helpful assistant. Your task is to parse user input into"
|
| 38 |
f" structured formats according to the coarse answer. Current datatime is 2023-12-20 9:47:28"
|
| 39 |
f" <</SYS>>\n Course answer: (({heuristic_answer}))\nQuestion: (({question})) [/INST]")
|
| 40 |
+
|
| 41 |
+
# alternatively you can input question only
|
| 42 |
+
# prompt = (f"<s>[INST] <<SYS>>\nYou are a helpful assistant. Your task is to parse user input into"
|
| 43 |
+
# f" structured formats. Current datatime is 2023-12-20 9:47:28"
|
| 44 |
+
# f" <</SYS>>\n{question} [/INST]")
|
| 45 |
+
|
| 46 |
params_query_rewrite = {"repetition_penalty": 1.05, "temperature": 0.01, "top_k": 1, "top_p": 0.85,
|
| 47 |
"max_new_tokens": 512, "do_sample": False, "seed": 2023}
|
| 48 |
|