Instructions to use Zaynoid/JSL-Granite-CP with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use Zaynoid/JSL-Granite-CP with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="Zaynoid/JSL-Granite-CP") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("Zaynoid/JSL-Granite-CP") model = AutoModelForCausalLM.from_pretrained("Zaynoid/JSL-Granite-CP") 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 Zaynoid/JSL-Granite-CP with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "Zaynoid/JSL-Granite-CP" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "Zaynoid/JSL-Granite-CP", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/Zaynoid/JSL-Granite-CP
- SGLang
How to use Zaynoid/JSL-Granite-CP 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 "Zaynoid/JSL-Granite-CP" \ --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": "Zaynoid/JSL-Granite-CP", "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 "Zaynoid/JSL-Granite-CP" \ --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": "Zaynoid/JSL-Granite-CP", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use Zaynoid/JSL-Granite-CP with Docker Model Runner:
docker model run hf.co/Zaynoid/JSL-Granite-CP
JSL-Granite-CP
A fine-tune of ibm-granite/granite-4.0-h-tiny (Mamba-2 hybrid MoE, ~7B total / ~1B active) that
authors Spark NLP ContextualParser (CP) rules for PHI de-identification.
Given a clinical text and a target entity type, it emits a CP rule as JSON — a regex plus context
gates (prefix/suffix words, contextLength, contextException), or a dictionary, or null
(abstain) when no rule applies.
Results — clean held-out test (700 rows, zero training leakage)
| model | F1 | hallucinations |
|---|---|---|
base granite-4.0-h-tiny |
88.33 | 288 |
| JSL-Granite-CP (this model) | 93.97 | 39 |
Scored with the project's shipped reward logic (grpo_reward / offline simulate_cp — the rule is
executed against the text and matched spans are compared to gold). Test rows share 0 examples
with the training data.
Training
QLoRA (bitsandbytes 4-bit nf4, LoRA r=16 / α=32, target_modules="all-linear") on 5,029
reward-verified CP-rule examples (balanced across entities, weak entities oversampled), 2 epochs,
then merged back to bf16.
Usage
Use the project system prompt (from to_chat.py). Serve with vLLM:
vllm serve Zaynoid/JSL-Granite-CP --max-model-len 8192 --trust-remote-code
User message format:
Text: <clinical text>
Target entity: <ENTITY>
Return the ContextualParser rule as JSON.
Output: {"cp_rule": { ... }} or {"cp_rule": null}.
- Downloads last month
- 38
Model tree for Zaynoid/JSL-Granite-CP
Base model
ibm-granite/granite-4.0-h-tiny