Text Generation
Transformers
Safetensors
Spanish
English
llama
markdown
text-to-markdown
faithful-generation
from-scratch
spanish
english
ocr-postprocessing
rag
document-understanding
tiny-llm
Eval Results (legacy)
text-generation-inference
Instructions to use OpceanAI/PASITA with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use OpceanAI/PASITA with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="OpceanAI/PASITA")# pip install -U transformers accelerate # Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("OpceanAI/PASITA") model = AutoModelForCausalLM.from_pretrained("OpceanAI/PASITA", device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use OpceanAI/PASITA with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "OpceanAI/PASITA" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "OpceanAI/PASITA", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/OpceanAI/PASITA
- SGLang
How to use OpceanAI/PASITA 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 "OpceanAI/PASITA" \ --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": "OpceanAI/PASITA", "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 "OpceanAI/PASITA" \ --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": "OpceanAI/PASITA", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use OpceanAI/PASITA with Docker Model Runner:
docker model run hf.co/OpceanAI/PASITA
Upload README.md with huggingface_hub
Browse files
README.md
CHANGED
|
@@ -40,54 +40,54 @@ model-index:
|
|
| 40 |
value: 1.0
|
| 41 |
---
|
| 42 |
|
| 43 |
-
# PASITA v1 — plain text
|
| 44 |
|
| 45 |
-
|
| 46 |
|
| 47 |
-
>
|
| 48 |
|
| 49 |
-
##
|
| 50 |
|
| 51 |
-
|
|
| 52 |
|---|---|
|
| 53 |
-
|
|
| 54 |
-
|
|
| 55 |
-
|
|
| 56 |
-
|
|
| 57 |
-
|
|
| 58 |
-
| Embeddings |
|
| 59 |
-
|
|
| 60 |
-
| Tokenizer |
|
| 61 |
-
|
|
| 62 |
|
| 63 |
-
##
|
| 64 |
|
| 65 |
-
1. **SFT** 58M
|
| 66 |
-
2. **DPO**
|
| 67 |
-
3. **GRPO** 550+150 steps, G=4, rewards
|
| 68 |
-
4.
|
| 69 |
|
| 70 |
## Benchmark (held-out n=1000, greedy)
|
| 71 |
|
| 72 |
-
| Global | GFM 0.956
|
| 73 |
|---|---|
|
| 74 |
-
| code / ocr / docs / math / tables / html | 0.93
|
| 75 |
-
| control (
|
| 76 |
|
| 77 |
-
##
|
| 78 |
|
| 79 |
```python
|
| 80 |
from transformers import AutoModelForCausalLM, AutoTokenizer
|
| 81 |
tok = AutoTokenizer.from_pretrained("OpceanAI/PASITA")
|
| 82 |
model = AutoModelForCausalLM.from_pretrained("OpceanAI/PASITA", dtype="auto")
|
| 83 |
-
prompt = "CONVIERTE A MARKDOWN:\n" +
|
| 84 |
ids = tok(prompt, return_tensors="pt", truncation=True, max_length=1024)
|
| 85 |
out = model.generate(**ids, max_new_tokens=512, do_sample=False)
|
| 86 |
print(tok.decode(out[0][ids.input_ids.shape[1]:], skip_special_tokens=True))
|
| 87 |
```
|
| 88 |
|
| 89 |
-
|
| 90 |
|
| 91 |
-
##
|
| 92 |
|
| 93 |
-
|
|
|
|
| 40 |
value: 1.0
|
| 41 |
---
|
| 42 |
|
| 43 |
+
# PASITA v1 — plain text to Markdown (faithful)
|
| 44 |
|
| 45 |
+
A **decoder-only language model trained 100% from scratch** (no base model), specialized in a single task: converting **plain text into valid Markdown while preserving information**.
|
| 46 |
|
| 47 |
+
> Compiler behavior, not chatbot behavior: it adds structure, it does not invent content.
|
| 48 |
|
| 49 |
+
## Architecture (lab notes)
|
| 50 |
|
| 51 |
+
| Parameter | Value |
|
| 52 |
|---|---|
|
| 53 |
+
| Class | `LlamaForCausalLM` (decoder-only, dense, no MoE) |
|
| 54 |
+
| Parameters | **88,099,584** (~88M) in `bfloat16` |
|
| 55 |
+
| Layers / hidden / FFN | 12 / 768 / 2048 (SwiGLU) |
|
| 56 |
+
| Attention | GQA 12Q/4KV, head_dim 64, no bias |
|
| 57 |
+
| Positions | RoPE theta=100000, ctx 2048, RMSNorm eps=1e-5 |
|
| 58 |
+
| Embeddings | tied (saves ~12.6M params) |
|
| 59 |
+
| File | `model.safetensors` (176 MB, 110 tensors, sha `664665e7…`) |
|
| 60 |
+
| Tokenizer | Custom 16k byte-level BPE, verified ByteLevel decoder (~4.0 chars/token ES/EN) |
|
| 61 |
+
| Special tokens | `<pad> <s> </s> <unk> <think> </think>` |
|
| 62 |
|
| 63 |
+
## Training
|
| 64 |
|
| 65 |
+
1. **SFT** 58M tokens x2 epochs — final loss 0.09, token accuracy 98.4%
|
| 66 |
+
2. **DPO** beta=0.1 — preference margin 4.2
|
| 67 |
+
3. **GRPO** 550+150 steps, G=4, verifiable rewards (format + numeric fidelity + anti-overformatting)
|
| 68 |
+
4. Data: 80M human markdown-derived tokens (ES/EN Wikipedia, StackExchange, WikiHow) scaled to 625M in v4 corpus
|
| 69 |
|
| 70 |
## Benchmark (held-out n=1000, greedy)
|
| 71 |
|
| 72 |
+
| Global | GFM 0.956 - faith 0.927 - sem 0.888 - tables 1.0 |
|
| 73 |
|---|---|
|
| 74 |
+
| code / ocr / docs / math / tables / html | 0.93 - 1.00 |
|
| 75 |
+
| control (strict instructions) | 0.19 (known limitation) |
|
| 76 |
|
| 77 |
+
## Usage
|
| 78 |
|
| 79 |
```python
|
| 80 |
from transformers import AutoModelForCausalLM, AutoTokenizer
|
| 81 |
tok = AutoTokenizer.from_pretrained("OpceanAI/PASITA")
|
| 82 |
model = AutoModelForCausalLM.from_pretrained("OpceanAI/PASITA", dtype="auto")
|
| 83 |
+
prompt = "CONVIERTE A MARKDOWN:\n" + text + "\n\n### Markdown:\n"
|
| 84 |
ids = tok(prompt, return_tensors="pt", truncation=True, max_length=1024)
|
| 85 |
out = model.generate(**ids, max_new_tokens=512, do_sample=False)
|
| 86 |
print(tok.decode(out[0][ids.input_ids.shape[1]:], skip_special_tokens=True))
|
| 87 |
```
|
| 88 |
|
| 89 |
+
Valid regime: medium/long documents (OCR output, pasted HTML, meeting notes, tutorials). Fragile on 1-3 line inputs.
|
| 90 |
|
| 91 |
+
## Limitations
|
| 92 |
|
| 93 |
+
May truncate digits, drop secondary data, emit echo H1s, or continue past completion. Recommended: adaptive `max_new_tokens` + beam search + fidelity rerank.
|