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
|
@@ -37,22 +37,20 @@ Model output:
|
|
| 37 |
```xml
|
| 38 |
<query_analysis>
|
| 39 |
<domain ambiguous="true">
|
| 40 |
-
<candidate confidence="0.
|
| 41 |
-
<candidate confidence="0.
|
| 42 |
</domain>
|
| 43 |
<intent ambiguous="true">
|
| 44 |
-
<candidate confidence="0.
|
| 45 |
-
<candidate confidence="0.
|
| 46 |
</intent>
|
| 47 |
<concepts>
|
| 48 |
<explicit>mother</explicit>
|
|
|
|
| 49 |
</concepts>
|
| 50 |
-
<
|
| 51 |
-
<relation subject="mother" predicate="height" object="[PERSON]"/>
|
| 52 |
-
</relations>
|
| 53 |
-
<insufficient_context>false</insufficient_context>
|
| 54 |
<rephrased>true</rephrased>
|
| 55 |
-
<rephrased_query>
|
| 56 |
</query_analysis>
|
| 57 |
```
|
| 58 |
|
|
@@ -76,16 +74,16 @@ Model output:
|
|
| 76 |
<candidate confidence="1.0">Data privacy and ethics</candidate>
|
| 77 |
</intent>
|
| 78 |
<concepts>
|
| 79 |
-
<explicit>data gathering, language models</explicit>
|
| 80 |
-
<implicit>
|
| 81 |
</concepts>
|
| 82 |
<relations>
|
| 83 |
<relation subject="data gathering" predicate="must consider" object="legal aspects"/>
|
| 84 |
-
<relation subject="language models" predicate="
|
| 85 |
</relations>
|
| 86 |
<insufficient_context>false</insufficient_context>
|
| 87 |
<rephrased>true</rephrased>
|
| 88 |
-
<rephrased_query>legal requirements for
|
| 89 |
</query_analysis>
|
| 90 |
```
|
| 91 |
|
|
@@ -96,27 +94,32 @@ Model output:
|
|
| 96 |
|
| 97 |
User query:
|
| 98 |
|
| 99 |
-
> How
|
| 100 |
|
| 101 |
Model output:
|
| 102 |
|
| 103 |
```xml
|
| 104 |
<query_analysis>
|
| 105 |
<domain ambiguous="true">
|
| 106 |
-
<candidate confidence="0.5">
|
| 107 |
-
<candidate confidence="0.5">
|
| 108 |
</domain>
|
| 109 |
<intent ambiguous="true">
|
| 110 |
-
<candidate confidence="0.6">
|
| 111 |
-
<candidate confidence="0.4">
|
| 112 |
</intent>
|
| 113 |
<concepts>
|
| 114 |
-
<explicit>
|
| 115 |
-
<implicit>[
|
| 116 |
</concepts>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 117 |
<insufficient_context>true</insufficient_context>
|
| 118 |
<rephrased>true</rephrased>
|
| 119 |
-
<rephrased_query>
|
| 120 |
</query_analysis>
|
| 121 |
```
|
| 122 |
|
|
|
|
| 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 |
|
|
|
|
| 74 |
<candidate confidence="1.0">Data privacy and ethics</candidate>
|
| 75 |
</intent>
|
| 76 |
<concepts>
|
| 77 |
+
<explicit>data gathering, language models, legal aspects</explicit>
|
| 78 |
+
<implicit>data protection, data governance, ethical considerations</implicit>
|
| 79 |
</concepts>
|
| 80 |
<relations>
|
| 81 |
<relation subject="data gathering" predicate="must consider" object="legal aspects"/>
|
| 82 |
+
<relation subject="language models" predicate="trained on" object="data gathered"/>
|
| 83 |
</relations>
|
| 84 |
<insufficient_context>false</insufficient_context>
|
| 85 |
<rephrased>true</rephrased>
|
| 86 |
+
<rephrased_query>legal requirements for collecting and protecting sensitive data when training natural language processing (NLP) models</rephrased_query>
|
| 87 |
</query_analysis>
|
| 88 |
```
|
| 89 |
|
|
|
|
| 94 |
|
| 95 |
User query:
|
| 96 |
|
| 97 |
+
> How does she describe her emotional journey and the complexities of her interactions with him in that book?
|
| 98 |
|
| 99 |
Model output:
|
| 100 |
|
| 101 |
```xml
|
| 102 |
<query_analysis>
|
| 103 |
<domain ambiguous="true">
|
| 104 |
+
<candidate confidence="0.5">Literature</candidate>
|
| 105 |
+
<candidate confidence="0.5">Psychology</candidate>
|
| 106 |
</domain>
|
| 107 |
<intent ambiguous="true">
|
| 108 |
+
<candidate confidence="0.6">Analysis</candidate>
|
| 109 |
+
<candidate confidence="0.4">Description</candidate>
|
| 110 |
</intent>
|
| 111 |
<concepts>
|
| 112 |
+
<explicit>emotional journey, interactions, book</explicit>
|
| 113 |
+
<implicit>[PERSON], complex</implicit>
|
| 114 |
</concepts>
|
| 115 |
+
<relations>
|
| 116 |
+
<relation subject="[PERSON]" predicate="describe" object="emotional journey"/>
|
| 117 |
+
<relation subject="[PERSON]" predicate="interact with" object="him"/>
|
| 118 |
+
<relation subject="book" predicate="describe" object="[PERSON]'s journey and interactions"/>
|
| 119 |
+
</relations>
|
| 120 |
<insufficient_context>true</insufficient_context>
|
| 121 |
<rephrased>true</rephrased>
|
| 122 |
+
<rephrased_query>How does [PERSON] describe her emotional journey and the complexities of her interactions with [PERSON] in the book?</rephrased_query>
|
| 123 |
</query_analysis>
|
| 124 |
```
|
| 125 |
|