Minor changes to readme
Browse files
README.md
CHANGED
|
@@ -10,7 +10,9 @@ tags:
|
|
| 10 |
- computational-social-science
|
| 11 |
---
|
| 12 |
|
| 13 |
-
|
|
|
|
|
|
|
| 14 |
|
| 15 |
## Load the model and tokenizer
|
| 16 |
|
|
@@ -24,6 +26,17 @@ model = LLM(model="ahalt/event-attribute-extractor",
|
|
| 24 |
gpu_memory_utilization=0.80)
|
| 25 |
|
| 26 |
tokenizer = AutoTokenizer.from_pretrained("Qwen/Qwen3-0.6B")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 27 |
```
|
| 28 |
|
| 29 |
|
|
@@ -73,8 +86,8 @@ In a joint statement published Saturday on social media, the National Anti-Corru
|
|
| 73 |
|
| 74 |
event_type = "Investigate, charge, or prosecute"
|
| 75 |
|
| 76 |
-
prompt = make_prompt(text, event_type,
|
| 77 |
-
output =
|
| 78 |
response = output[0].outputs[0].text.strip()
|
| 79 |
|
| 80 |
[{"event_type": "Investigate, charge, or prosecute",
|
|
|
|
| 10 |
- computational-social-science
|
| 11 |
---
|
| 12 |
|
| 13 |
+
|
| 14 |
+
|
| 15 |
+
# Example usage with vLLM
|
| 16 |
|
| 17 |
## Load the model and tokenizer
|
| 18 |
|
|
|
|
| 26 |
gpu_memory_utilization=0.80)
|
| 27 |
|
| 28 |
tokenizer = AutoTokenizer.from_pretrained("Qwen/Qwen3-0.6B")
|
| 29 |
+
|
| 30 |
+
|
| 31 |
+
sampling_params = SamplingParams(
|
| 32 |
+
temperature=0.5, # Greedy decoding breaks Qwen
|
| 33 |
+
top_p=0.8, # Qwen3 non-thinking recommendation
|
| 34 |
+
top_k=20, # Qwen3 recommendation
|
| 35 |
+
presence_penalty=1.5, # Recommended for quantized models
|
| 36 |
+
min_p=0.0,
|
| 37 |
+
#guided_decoding=guided_decoding_params, # Optionally, set a JSON schema for contrained decoding
|
| 38 |
+
max_tokens=1024,
|
| 39 |
+
)
|
| 40 |
```
|
| 41 |
|
| 42 |
|
|
|
|
| 86 |
|
| 87 |
event_type = "Investigate, charge, or prosecute"
|
| 88 |
|
| 89 |
+
prompt = make_prompt(text, event_type, tokenizer)
|
| 90 |
+
output = model.generate(prompt, sampling_params=sampling_params)
|
| 91 |
response = output[0].outputs[0].text.strip()
|
| 92 |
|
| 93 |
[{"event_type": "Investigate, charge, or prosecute",
|