Text Generation
Transformers
Safetensors
qwen3_5
image-text-to-text
qwen3.5
korean
essay-evaluation
rationale-generation
conversational
Instructions to use davemaxuellkr/260814-writer-model with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use davemaxuellkr/260814-writer-model with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="davemaxuellkr/260814-writer-model") messages = [ { "role": "user", "content": [ {"type": "image", "url": "https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/p-blog/candy.JPG"}, {"type": "text", "text": "What animal is on the candy?"} ] }, ] pipe(text=messages)# Load model directly from transformers import AutoProcessor, AutoModelForMultimodalLM processor = AutoProcessor.from_pretrained("davemaxuellkr/260814-writer-model") model = AutoModelForMultimodalLM.from_pretrained("davemaxuellkr/260814-writer-model", device_map="auto") messages = [ { "role": "user", "content": [ {"type": "image", "url": "https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/p-blog/candy.JPG"}, {"type": "text", "text": "What animal is on the candy?"} ] }, ] inputs = processor.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(processor.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use davemaxuellkr/260814-writer-model with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "davemaxuellkr/260814-writer-model" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "davemaxuellkr/260814-writer-model", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/davemaxuellkr/260814-writer-model
- SGLang
How to use davemaxuellkr/260814-writer-model 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 "davemaxuellkr/260814-writer-model" \ --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": "davemaxuellkr/260814-writer-model", "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 "davemaxuellkr/260814-writer-model" \ --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": "davemaxuellkr/260814-writer-model", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use davemaxuellkr/260814-writer-model with Docker Model Runner:
docker model run hf.co/davemaxuellkr/260814-writer-model
File size: 3,642 Bytes
fd1803c | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 | """Parse the writer's first balanced JSON object without repairing its text.
This mirrors the parser used for the checkpoint's reported 4.3926 evaluation:
Markdown or prose around a complete JSON object is tolerated, but malformed or
truncated JSON is not repaired and is not retried.
"""
from __future__ import annotations
import argparse
import json
import math
import sys
from pathlib import Path
from typing import Any
CATEGORIES = ("content", "organization", "expression")
def extract_first_json_object(text: str) -> str | None:
"""Return the first balanced JSON-object substring in *text*."""
start = text.find("{")
if start == -1:
return None
depth = 0
in_string = False
escaped = False
for index in range(start, len(text)):
char = text[index]
if in_string:
if escaped:
escaped = False
elif char == "\\":
escaped = True
elif char == '"':
in_string = False
continue
if char == '"':
in_string = True
elif char == "{":
depth += 1
elif char == "}":
depth -= 1
if depth == 0:
return text[start : index + 1]
return None
def coerce_score(value: object) -> int:
"""Return a 1..5 integer, applying historical half-up float rounding."""
if isinstance(value, bool):
raise ValueError(f"invalid boolean score: {value!r}")
if isinstance(value, int):
score = value
elif isinstance(value, float) and math.isfinite(value):
score = math.floor(value + 0.5)
else:
raise ValueError(f"score is not numeric: {value!r}")
if not 1 <= score <= 5:
raise ValueError(f"score is outside 1..5: {value!r}")
return score
def parse_writer_output(text: str) -> dict[str, dict[str, Any]]:
"""Extract and validate the writer's nested content/organization/expression JSON."""
candidate = extract_first_json_object(text)
if candidate is None:
raise ValueError("no balanced JSON object found")
try:
parsed = json.loads(candidate)
except json.JSONDecodeError as error:
raise ValueError(f"invalid JSON: {error}") from error
if not isinstance(parsed, dict):
raise ValueError("top-level JSON is not an object")
validated: dict[str, dict[str, Any]] = {}
for category in CATEGORIES:
block = parsed.get(category)
if not isinstance(block, dict):
raise ValueError(f"{category}: expected an object")
if "score" not in block or "rationale" not in block:
raise ValueError(f"{category}: missing score/rationale")
rationale = block["rationale"]
if not isinstance(rationale, str) or not rationale.strip():
raise ValueError(f"{category}: rationale must be a non-empty string")
validated[category] = {
"score": coerce_score(block["score"]),
"rationale": rationale,
}
return validated
def main() -> None:
parser = argparse.ArgumentParser(description=__doc__)
parser.add_argument(
"path",
nargs="?",
type=Path,
help="raw model-output file; omit to read UTF-8 text from stdin",
)
args = parser.parse_args()
raw = args.path.read_text(encoding="utf-8") if args.path else sys.stdin.read()
try:
parsed = parse_writer_output(raw)
except ValueError as error:
raise SystemExit(f"parse failure: {error}") from error
print(json.dumps(parsed, ensure_ascii=False, indent=2))
if __name__ == "__main__":
main()
|