Instructions to use krogoldAI/QueryRefiner-0.5B-v0.1-GRPO with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use krogoldAI/QueryRefiner-0.5B-v0.1-GRPO with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="krogoldAI/QueryRefiner-0.5B-v0.1-GRPO") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("krogoldAI/QueryRefiner-0.5B-v0.1-GRPO") model = AutoModelForCausalLM.from_pretrained("krogoldAI/QueryRefiner-0.5B-v0.1-GRPO", device_map="auto") messages = [ {"role": "user", "content": "Who are you?"}, ] inputs = tokenizer.apply_chat_template( messages, add_generation_prompt=True, tokenize=True, return_dict=True, return_tensors="pt", ).to(model.device) outputs = model.generate(**inputs, max_new_tokens=40) print(tokenizer.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use krogoldAI/QueryRefiner-0.5B-v0.1-GRPO with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "krogoldAI/QueryRefiner-0.5B-v0.1-GRPO" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "krogoldAI/QueryRefiner-0.5B-v0.1-GRPO", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/krogoldAI/QueryRefiner-0.5B-v0.1-GRPO
- SGLang
How to use krogoldAI/QueryRefiner-0.5B-v0.1-GRPO 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 "krogoldAI/QueryRefiner-0.5B-v0.1-GRPO" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "krogoldAI/QueryRefiner-0.5B-v0.1-GRPO", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'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 "krogoldAI/QueryRefiner-0.5B-v0.1-GRPO" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "krogoldAI/QueryRefiner-0.5B-v0.1-GRPO", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use krogoldAI/QueryRefiner-0.5B-v0.1-GRPO with Docker Model Runner:
docker model run hf.co/krogoldAI/QueryRefiner-0.5B-v0.1-GRPO
Update README.md
Browse files
README.md
CHANGED
|
@@ -30,37 +30,6 @@ This model is part of a two-model series addressing a critical challenge in RAG
|
|
| 30 |
|
| 31 |
User query:
|
| 32 |
|
| 33 |
-
>Was his mother tall?
|
| 34 |
-
|
| 35 |
-
Model output:
|
| 36 |
-
|
| 37 |
-
```xml
|
| 38 |
-
<query_analysis>
|
| 39 |
-
<domain ambiguous="true">
|
| 40 |
-
<candidate confidence="0.5">Biography</candidate>
|
| 41 |
-
<candidate confidence="0.5">History</candidate>
|
| 42 |
-
</domain>
|
| 43 |
-
<intent ambiguous="true">
|
| 44 |
-
<candidate confidence="0.6">Factual question</candidate>
|
| 45 |
-
<candidate confidence="0.4">Definition lookup</candidate>
|
| 46 |
-
</intent>
|
| 47 |
-
<concepts>
|
| 48 |
-
<explicit>mother</explicit>
|
| 49 |
-
<implicit>[PERSON]</implicit>
|
| 50 |
-
</concepts>
|
| 51 |
-
<insufficient_context>true</insufficient_context>
|
| 52 |
-
<rephrased>true</rephrased>
|
| 53 |
-
<rephrased_query>Was [PERSON]'s mother tall?</rephrased_query>
|
| 54 |
-
</query_analysis>
|
| 55 |
-
```
|
| 56 |
-
|
| 57 |
-
</details>
|
| 58 |
-
|
| 59 |
-
<details>
|
| 60 |
-
<summary><i>Unroll to see Example #2</i></summary>
|
| 61 |
-
|
| 62 |
-
User query:
|
| 63 |
-
|
| 64 |
>Which legal aspects of data gathering must be considered before training a language model?
|
| 65 |
|
| 66 |
Model output:
|
|
@@ -90,7 +59,7 @@ Model output:
|
|
| 90 |
</details>
|
| 91 |
|
| 92 |
<details>
|
| 93 |
-
<summary><i>Unroll to see Example #
|
| 94 |
|
| 95 |
User query:
|
| 96 |
|
|
@@ -125,6 +94,37 @@ Model output:
|
|
| 125 |
|
| 126 |
</details>
|
| 127 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 128 |
|
| 129 |
## Intended Use
|
| 130 |
|
|
|
|
| 30 |
|
| 31 |
User query:
|
| 32 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 33 |
>Which legal aspects of data gathering must be considered before training a language model?
|
| 34 |
|
| 35 |
Model output:
|
|
|
|
| 59 |
</details>
|
| 60 |
|
| 61 |
<details>
|
| 62 |
+
<summary><i>Unroll to see Example #2</i></summary>
|
| 63 |
|
| 64 |
User query:
|
| 65 |
|
|
|
|
| 94 |
|
| 95 |
</details>
|
| 96 |
|
| 97 |
+
<details>
|
| 98 |
+
<summary><i>Unroll to see Example #3</i></summary>
|
| 99 |
+
|
| 100 |
+
User query:
|
| 101 |
+
|
| 102 |
+
>Was his mother tall?
|
| 103 |
+
|
| 104 |
+
Model output:
|
| 105 |
+
|
| 106 |
+
```xml
|
| 107 |
+
<query_analysis>
|
| 108 |
+
<domain ambiguous="true">
|
| 109 |
+
<candidate confidence="0.5">Biography</candidate>
|
| 110 |
+
<candidate confidence="0.5">History</candidate>
|
| 111 |
+
</domain>
|
| 112 |
+
<intent ambiguous="true">
|
| 113 |
+
<candidate confidence="0.6">Factual question</candidate>
|
| 114 |
+
<candidate confidence="0.4">Definition lookup</candidate>
|
| 115 |
+
</intent>
|
| 116 |
+
<concepts>
|
| 117 |
+
<explicit>mother</explicit>
|
| 118 |
+
<implicit>[PERSON]</implicit>
|
| 119 |
+
</concepts>
|
| 120 |
+
<insufficient_context>true</insufficient_context>
|
| 121 |
+
<rephrased>true</rephrased>
|
| 122 |
+
<rephrased_query>Was [PERSON]'s mother tall?</rephrased_query>
|
| 123 |
+
</query_analysis>
|
| 124 |
+
```
|
| 125 |
+
|
| 126 |
+
</details>
|
| 127 |
+
|
| 128 |
|
| 129 |
## Intended Use
|
| 130 |
|