Instructions to use danielrosehill/Contextual-Sentence-Creator with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use danielrosehill/Contextual-Sentence-Creator with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="danielrosehill/Contextual-Sentence-Creator") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# pip install -U transformers accelerate # Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("danielrosehill/Contextual-Sentence-Creator") model = AutoModelForCausalLM.from_pretrained("danielrosehill/Contextual-Sentence-Creator", 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=256) print(tokenizer.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use danielrosehill/Contextual-Sentence-Creator with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "danielrosehill/Contextual-Sentence-Creator" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "danielrosehill/Contextual-Sentence-Creator", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/danielrosehill/Contextual-Sentence-Creator
- SGLang
How to use danielrosehill/Contextual-Sentence-Creator 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 "danielrosehill/Contextual-Sentence-Creator" \ --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": "danielrosehill/Contextual-Sentence-Creator", "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 "danielrosehill/Contextual-Sentence-Creator" \ --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": "danielrosehill/Contextual-Sentence-Creator", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use danielrosehill/Contextual-Sentence-Creator with Docker Model Runner:
docker model run hf.co/danielrosehill/Contextual-Sentence-Creator
Term-Context Sentence Generator (Granite 4.2 3B, v1)
A small model for one job. Given a term, a one-line context and a count n, it returns a JSON array of exactly n natural English sentences (6 to 18 words). Each sentence uses the term once, spelled as given, in the meaning the context describes. It was built to write sentences that get read aloud to record ASR fine-tuning data for specialist vocabulary (romanized Hebrew, Israeli names and places, tech terms). It works for any term.
LoRA fine-tune of ibm-granite/granite-4.2-3b, merged.
GGUF: danielrosehill/Contextual-Sentence-Creator-GGUF.
Data: danielrosehill/term-context-sentences.
Prompt
System (use exactly this; it is what the model was trained on):
Write exactly n different natural English sentences, 6 to 18 words each, that each use the term once, exactly as given, in the meaning the context describes. Reply with a JSON array of strings.
User: a JSON object. kind is optional (hebrew, yiddish, name, place, street, brand, drug, medical, tech, ai_model,
linux, smart_home, jewish_text, english_word, other).
{"term": "gemach", "context": "a free community lending fund or service (money, baby gear, wedding dresses)", "n": 3, "kind": "hebrew"}
Output:
["The gemach has everything from baby monitors to hiking boots.", "Honestly, the gemach saved us a lot of money during the first year.", "My cousin borrowed a couch from the gemach last spring and never returned it."]
from transformers import AutoModelForCausalLM, AutoTokenizer
import json
repo = "danielrosehill/Contextual-Sentence-Creator"
tok = AutoTokenizer.from_pretrained(repo); model = AutoModelForCausalLM.from_pretrained(repo, dtype="auto")
SYSTEM = "Write exactly n different natural English sentences, 6 to 18 words each, that each use the term once, exactly as given, in the meaning the context describes. Reply with a JSON array of strings."
user = json.dumps({"term": "gemach", "context": "a free community lending fund", "n": 5})
ids = tok.apply_chat_template([{"role": "system", "content": SYSTEM}, {"role": "user", "content": user}],
add_generation_prompt=True, return_tensors="pt")
out = model.generate(ids, max_new_tokens=60 * 5 + 40, do_sample=True, temperature=0.8, top_p=0.95)
print(json.loads(tok.decode(out[0][ids.shape[1]:], skip_special_tokens=True)))
Evaluation (2026-11-03)
309 held-out calls (terms never seen in training, plus 6 fixed benchmark pairs), n = 10, temperature 0.8. "Gate" is the ASR acceptance check: 6 to 18 words, the term exactly once, allowed charset, number rules.
| this model | Gemini 3.1 Flash-Lite (API baseline, same prompt set) | |
|---|---|---|
| reply is valid JSON | 100% | 100% |
| exactly n sentences | 100% | 100% |
| sentences passing the gate | 95.7% | 99.7% |
| calls where all n pass first try | 72.8% | 96.8% |
Failures are mostly sentences slightly too long (19 to 22 words) and a missing term (1.8% of sentences). A missing
term is usually a rare word swapped for a familiar one, as with arev written as "avrech". The term appears twice
in 0.3% of sentences. Recommended use: ask for n + 2 and keep the first n that pass your own checks.
Training
LoRA r = 32, alpha 32, dropout 0.05, all linear layers. lr 2e-4 cosine, 2 epochs, batch 16, 1,676 steps, bf16, one L40S (27 min). Loss on the assistant turn only. 13,408 examples over 8,342 terms.
Limitations
English only. The vocabulary leans heavily Israeli. Much of the training data is LLM-written (Claude, Gemini, DeepSeek). It is not checked for factual accuracy: it writes plausible sentences, not true ones. The gate in the table checks form, not meaning.
- Downloads last month
- 337