Text Generation
Transformers
Safetensors
t5
text2text-generation
icd
historical-demography
digital-humanities
multi-label
text-generation-inference
Instructions to use codllm/codllm-base-deploy with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use codllm/codllm-base-deploy with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="codllm/codllm-base-deploy")# pip install -U transformers accelerate # Load model directly from transformers import AutoTokenizer, AutoModelForSeq2SeqLM tokenizer = AutoTokenizer.from_pretrained("codllm/codllm-base-deploy") model = AutoModelForSeq2SeqLM.from_pretrained("codllm/codllm-base-deploy", device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use codllm/codllm-base-deploy with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "codllm/codllm-base-deploy" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "codllm/codllm-base-deploy", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/codllm/codllm-base-deploy
- SGLang
How to use codllm/codllm-base-deploy 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 "codllm/codllm-base-deploy" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "codllm/codllm-base-deploy", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'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 "codllm/codllm-base-deploy" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "codllm/codllm-base-deploy", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use codllm/codllm-base-deploy with Docker Model Runner:
docker model run hf.co/codllm/codllm-base-deploy
Upload README.md with huggingface_hub
Browse files
README.md
ADDED
|
@@ -0,0 +1,63 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: apache-2.0
|
| 3 |
+
language:
|
| 4 |
+
- en
|
| 5 |
+
- nl
|
| 6 |
+
- da
|
| 7 |
+
- es
|
| 8 |
+
- fr
|
| 9 |
+
tags:
|
| 10 |
+
- text2text-generation
|
| 11 |
+
- icd
|
| 12 |
+
- historical-demography
|
| 13 |
+
- digital-humanities
|
| 14 |
+
pipeline_tag: text2text-generation
|
| 15 |
+
base_model: google/flan-t5-base
|
| 16 |
+
---
|
| 17 |
+
|
| 18 |
+
# codLLM base (deployment checkpoint)
|
| 19 |
+
|
| 20 |
+
Fine-tuned FLAN-T5-base that assigns **ICD-10h** codes to free-text causes of
|
| 21 |
+
death from historical death registers (roughly 1850-1939), across Dutch, Danish,
|
| 22 |
+
Spanish, French, English and Latin phrasings with archaic spellings.
|
| 23 |
+
|
| 24 |
+
## Input format matters, a lot
|
| 25 |
+
|
| 26 |
+
The model is highly sensitive to its input shape. Two formats were trained:
|
| 27 |
+
|
| 28 |
+
| format | example |
|
| 29 |
+
|---|---|
|
| 30 |
+
| `cod` | `tabes meseraica` |
|
| 31 |
+
| `cod_age_sex` | `cod: stuipen \| age: unknown \| sex: male` |
|
| 32 |
+
|
| 33 |
+
Rules that are easy to get wrong:
|
| 34 |
+
|
| 35 |
+
* **cod-only is a bare string** with no `cod: ` prefix.
|
| 36 |
+
* **cod_age_sex always emits all three fields**, using the literal string
|
| 37 |
+
`unknown` when a value is missing or unmappable. Omitting a field produces a
|
| 38 |
+
shape the model never saw in training.
|
| 39 |
+
|
| 40 |
+
Which format performs better is **source dependent**. On held-out sources scored
|
| 41 |
+
by leave-one-source-out checkpoints, exact match ranged from 0.043 to 0.593 on
|
| 42 |
+
the same records purely by changing the format. Measure on your own data rather
|
| 43 |
+
than assuming a default.
|
| 44 |
+
|
| 45 |
+
## Output
|
| 46 |
+
|
| 47 |
+
Comma-separated ICD-10h codes; the task is multi-label. Pair the model with the
|
| 48 |
+
included `ICD10h_Masterlist_2024.tsv` for code descriptions.
|
| 49 |
+
|
| 50 |
+
## Uncertainty
|
| 51 |
+
|
| 52 |
+
Mean token entropy over the generated sequence is a usable abstention signal.
|
| 53 |
+
The reference operating point is `0.127`, chosen for roughly 80% coverage on an
|
| 54 |
+
unseen-string slice. Entropy correlates with output length, so it is a better
|
| 55 |
+
ranking signal than an absolute per-record probability.
|
| 56 |
+
|
| 57 |
+
## Limitations
|
| 58 |
+
|
| 59 |
+
* Sub-code granularity may follow a different archive's coding convention than
|
| 60 |
+
yours; the broader category is often right where the sub-code differs.
|
| 61 |
+
* On cause strings never seen in training, accuracy drops substantially.
|
| 62 |
+
* Confident wrong codes occur, particularly for convention mismatches, so a
|
| 63 |
+
low-entropy prediction is not a guarantee of correctness.
|