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
|
@@ -28,31 +28,31 @@ This model is part of a two-model series addressing a critical challenge in RAG
|
|
| 28 |
<details>
|
| 29 |
<summary><i>Unroll to see Example #1</i></summary>
|
| 30 |
|
| 31 |
-
User query:
|
| 32 |
|
| 33 |
-
>
|
| 34 |
|
| 35 |
Model output:
|
| 36 |
|
| 37 |
```xml
|
| 38 |
<query_analysis>
|
| 39 |
<domain ambiguous="false">
|
| 40 |
-
<candidate confidence="1.0">
|
| 41 |
</domain>
|
| 42 |
<intent ambiguous="false">
|
| 43 |
-
<candidate confidence="1.0">
|
| 44 |
</intent>
|
| 45 |
<concepts>
|
| 46 |
-
<explicit>
|
| 47 |
-
<implicit>
|
| 48 |
</concepts>
|
| 49 |
<relations>
|
| 50 |
-
<relation subject="
|
| 51 |
-
<relation subject="
|
| 52 |
</relations>
|
| 53 |
<insufficient_context>false</insufficient_context>
|
| 54 |
<rephrased>true</rephrased>
|
| 55 |
-
<rephrased_query>
|
| 56 |
</query_analysis>
|
| 57 |
```
|
| 58 |
|
|
@@ -63,32 +63,33 @@ Model output:
|
|
| 63 |
|
| 64 |
User query:
|
| 65 |
|
| 66 |
-
>
|
| 67 |
|
| 68 |
Model output:
|
| 69 |
|
| 70 |
```xml
|
| 71 |
<query_analysis>
|
| 72 |
<domain ambiguous="true">
|
| 73 |
-
<candidate confidence="0.
|
| 74 |
-
<candidate confidence="0.
|
| 75 |
</domain>
|
| 76 |
<intent ambiguous="true">
|
| 77 |
-
<candidate confidence="0.
|
| 78 |
-
<candidate confidence="0.
|
| 79 |
</intent>
|
| 80 |
<concepts>
|
| 81 |
-
<explicit>
|
| 82 |
-
<implicit>[
|
| 83 |
</concepts>
|
| 84 |
<relations>
|
| 85 |
-
<relation subject="[
|
| 86 |
-
<relation subject="[
|
| 87 |
-
<relation subject="
|
|
|
|
| 88 |
</relations>
|
| 89 |
-
<insufficient_context>
|
| 90 |
<rephrased>true</rephrased>
|
| 91 |
-
<rephrased_query>How
|
| 92 |
</query_analysis>
|
| 93 |
```
|
| 94 |
|
|
@@ -97,29 +98,34 @@ Model output:
|
|
| 97 |
<details>
|
| 98 |
<summary><i>Unroll to see Example #3</i></summary>
|
| 99 |
|
| 100 |
-
User query:
|
| 101 |
|
| 102 |
-
>
|
| 103 |
|
| 104 |
Model output:
|
| 105 |
|
| 106 |
```xml
|
| 107 |
<query_analysis>
|
| 108 |
<domain ambiguous="true">
|
| 109 |
-
<candidate confidence="0.5">
|
| 110 |
-
<candidate confidence="0.5">
|
| 111 |
</domain>
|
| 112 |
<intent ambiguous="true">
|
| 113 |
-
<candidate confidence="0.6">
|
| 114 |
-
<candidate confidence="0.4">
|
| 115 |
</intent>
|
| 116 |
<concepts>
|
| 117 |
-
<explicit>
|
| 118 |
-
<implicit>[PERSON]</implicit>
|
| 119 |
</concepts>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 120 |
<insufficient_context>true</insufficient_context>
|
| 121 |
<rephrased>true</rephrased>
|
| 122 |
-
<rephrased_query>
|
| 123 |
</query_analysis>
|
| 124 |
```
|
| 125 |
|
|
|
|
| 28 |
<details>
|
| 29 |
<summary><i>Unroll to see Example #1</i></summary>
|
| 30 |
|
| 31 |
+
User query :
|
| 32 |
|
| 33 |
+
>How can artificial intelligence be utilized to improve emergency response systems in urban environments?
|
| 34 |
|
| 35 |
Model output:
|
| 36 |
|
| 37 |
```xml
|
| 38 |
<query_analysis>
|
| 39 |
<domain ambiguous="false">
|
| 40 |
+
<candidate confidence="1.0">Technology</candidate>
|
| 41 |
</domain>
|
| 42 |
<intent ambiguous="false">
|
| 43 |
+
<candidate confidence="1.0">Informational</candidate>
|
| 44 |
</intent>
|
| 45 |
<concepts>
|
| 46 |
+
<explicit>artificial intelligence, emergency response systems, urban environments</explicit>
|
| 47 |
+
<implicit>safety, efficiency, decision-making, urban planning</implicit>
|
| 48 |
</concepts>
|
| 49 |
<relations>
|
| 50 |
+
<relation subject="artificial intelligence" predicate="utilized to improve" object="emergency response systems"/>
|
| 51 |
+
<relation subject="emergency response systems" predicate="used in" object="urban environments"/>
|
| 52 |
</relations>
|
| 53 |
<insufficient_context>false</insufficient_context>
|
| 54 |
<rephrased>true</rephrased>
|
| 55 |
+
<rephrased_query>how can artificial intelligence technologies be leveraged to enhance emergency management and response in urban settings</rephrased_query>
|
| 56 |
</query_analysis>
|
| 57 |
```
|
| 58 |
|
|
|
|
| 63 |
|
| 64 |
User query:
|
| 65 |
|
| 66 |
+
>How have its fiscal policies regarding these things impacted its overall financial stability and future outlook, particularly concerning external market fluctuations?
|
| 67 |
|
| 68 |
Model output:
|
| 69 |
|
| 70 |
```xml
|
| 71 |
<query_analysis>
|
| 72 |
<domain ambiguous="true">
|
| 73 |
+
<candidate confidence="0.6">Finance</candidate>
|
| 74 |
+
<candidate confidence="0.4">Economics</candidate>
|
| 75 |
</domain>
|
| 76 |
<intent ambiguous="true">
|
| 77 |
+
<candidate confidence="0.7">Impact assessment</candidate>
|
| 78 |
+
<candidate confidence="0.3">Analysis of policy</candidate>
|
| 79 |
</intent>
|
| 80 |
<concepts>
|
| 81 |
+
<explicit>fiscal policies, external market fluctuations, financial stability, future outlook</explicit>
|
| 82 |
+
<implicit>[ENTITY]</implicit>
|
| 83 |
</concepts>
|
| 84 |
<relations>
|
| 85 |
+
<relation subject="[ENTITY]" predicate="has" object="fiscal policies"/>
|
| 86 |
+
<relation subject="[ENTITY]" predicate="impacts" object="financial stability"/>
|
| 87 |
+
<relation subject="[ENTITY]" predicate="impacts" object="future outlook"/>
|
| 88 |
+
<relation subject="[ENTITY]" predicate="relates to" object="external market fluctuations"/>
|
| 89 |
</relations>
|
| 90 |
+
<insufficient_context>false</insufficient_context>
|
| 91 |
<rephrased>true</rephrased>
|
| 92 |
+
<rephrased_query>How have [ENTITY]'s fiscal policies regarding external market fluctuations impacted its overall financial stability and future outlook?</rephrased_query>
|
| 93 |
</query_analysis>
|
| 94 |
```
|
| 95 |
|
|
|
|
| 98 |
<details>
|
| 99 |
<summary><i>Unroll to see Example #3</i></summary>
|
| 100 |
|
| 101 |
+
User query :
|
| 102 |
|
| 103 |
+
>How does she describe her emotional journey and the complexities of her interactions with him in that book?
|
| 104 |
|
| 105 |
Model output:
|
| 106 |
|
| 107 |
```xml
|
| 108 |
<query_analysis>
|
| 109 |
<domain ambiguous="true">
|
| 110 |
+
<candidate confidence="0.5">Literature</candidate>
|
| 111 |
+
<candidate confidence="0.5">Psychology</candidate>
|
| 112 |
</domain>
|
| 113 |
<intent ambiguous="true">
|
| 114 |
+
<candidate confidence="0.6">Analysis</candidate>
|
| 115 |
+
<candidate confidence="0.4">Description</candidate>
|
| 116 |
</intent>
|
| 117 |
<concepts>
|
| 118 |
+
<explicit>emotional journey, interactions, book</explicit>
|
| 119 |
+
<implicit>[PERSON], complex</implicit>
|
| 120 |
</concepts>
|
| 121 |
+
<relations>
|
| 122 |
+
<relation subject="[PERSON]" predicate="describe" object="emotional journey"/>
|
| 123 |
+
<relation subject="[PERSON]" predicate="interact with" object="him"/>
|
| 124 |
+
<relation subject="book" predicate="describe" object="[PERSON]'s journey and interactions"/>
|
| 125 |
+
</relations>
|
| 126 |
<insufficient_context>true</insufficient_context>
|
| 127 |
<rephrased>true</rephrased>
|
| 128 |
+
<rephrased_query>How does [PERSON] describe her emotional journey and the complexities of her interactions with [PERSON] in the book?</rephrased_query>
|
| 129 |
</query_analysis>
|
| 130 |
```
|
| 131 |
|