Text Generation
Transformers
Safetensors
English
panolm
kda
linear-attention
mla
hybrid-attention
custom_code
Instructions to use PanocularAI/PanoLM1.5-400M-Base with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use PanocularAI/PanoLM1.5-400M-Base with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="PanocularAI/PanoLM1.5-400M-Base", trust_remote_code=True)# pip install -U transformers accelerate # Load model directly from transformers import AutoModelForCausalLM model = AutoModelForCausalLM.from_pretrained("PanocularAI/PanoLM1.5-400M-Base", trust_remote_code=True, device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use PanocularAI/PanoLM1.5-400M-Base with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "PanocularAI/PanoLM1.5-400M-Base" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "PanocularAI/PanoLM1.5-400M-Base", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/PanocularAI/PanoLM1.5-400M-Base
- SGLang
How to use PanocularAI/PanoLM1.5-400M-Base 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 "PanocularAI/PanoLM1.5-400M-Base" \ --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": "PanocularAI/PanoLM1.5-400M-Base", "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 "PanocularAI/PanoLM1.5-400M-Base" \ --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": "PanocularAI/PanoLM1.5-400M-Base", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use PanocularAI/PanoLM1.5-400M-Base with Docker Model Runner:
docker model run hf.co/PanocularAI/PanoLM1.5-400M-Base
|
Download README.md from PanocularAI/PanoLM1.5-400M-Base: direct link, hf CLI and curl.
- Browser
- Download file 3.24 kB
-
https://huggingface.co/PanocularAI/PanoLM1.5-400M-Base/resolve/main/README.md
- Command line
-
hf download hf://PanocularAI/PanoLM1.5-400M-Base/README.md
-
curl -L -o README.md https://huggingface.co/PanocularAI/PanoLM1.5-400M-Base/resolve/main/README.md
3.24 kB
| library_name: transformers | |
| license: apache-2.0 | |
| language: | |
| - en | |
| pipeline_tag: text-generation | |
| tags: | |
| - panolm | |
| - kda | |
| - linear-attention | |
| - mla | |
| - hybrid-attention | |
| # PanoLM1.5-400M-Base | |
| This repo contains the base PanoLM1.5 model (~400M parameters), a hybrid | |
| causal language model. 20 of its 24 layers use KDA linear attention; the other | |
| 4 (zero-based layers 5, 11, 17 and 23) use multi-head latent attention (MLA). | |
| ## Training Data | |
| Pretrained on a weighted mixture of three web-scale English corpora: | |
| | Weight | Dataset | | |
| |-------:|------------------------| | |
| | 0.45 | FineWeb-Edu (100B-token subset) | | |
| | 0.30 | DCLM (100B-token subset) | | |
| | 0.25 | FinePDFs-Edu (100B-token subset) | | |
| ## Requirements | |
| ```text | |
| torch==2.12.0 | |
| transformers==5.8.1 | |
| flash-linear-attention==0.5.0 | |
| ``` | |
| ## Usage | |
| ```python | |
| from transformers import AutoModelForCausalLM, AutoTokenizer | |
| repo_id = "PanocularAI/PanoLM1.5-400M-Base" | |
| model = AutoModelForCausalLM.from_pretrained( | |
| repo_id, | |
| trust_remote_code=True, | |
| ).cuda() # fla's RMSNorm uses Triton kernels that only run on CUDA tensors. | |
| print(model) | |
| tokenizer = AutoTokenizer.from_pretrained(repo_id, trust_remote_code=True) | |
| prompt = "PanoLM is an edge device friendly language model." | |
| inputs = tokenizer(prompt, return_tensors="pt").to(model.device) | |
| outputs = model.generate( | |
| **inputs, | |
| max_length=512, | |
| top_k=10, | |
| do_sample=True, | |
| trust_remote_code=True, | |
| ) | |
| print(tokenizer.decode(outputs[0], skip_special_tokens=True)) | |
| ``` | |
| ## Evaluation | |
| All scores are 0-shot, evaluated with [lm-evaluation-harness](https://github.com/EleutherAI/lm-evaluation-harness). | |
| For multi-choice tasks we report length-normalized accuracy (`acc_norm`), except | |
| for commonsense_qa and winogrande, which report plain accuracy (`acc`). | |
| ### Commonsense reasoning & general QA | |
| | Task | Metric | Value | Stderr | | |
| |----------------|----------|-------:|----------| | |
| | arc_challenge | acc_norm | 0.2799 | ± 0.0131 | | |
| | arc_easy | acc_norm | 0.5471 | ± 0.0102 | | |
| | commonsense_qa | acc | 0.2015 | ± 0.0115 | | |
| | hellaswag | acc_norm | 0.4286 | ± 0.0049 | | |
| | piqa | acc_norm | 0.6665 | ± 0.0110 | | |
| | winogrande | acc | 0.5201 | ± 0.0140 | | |
| ### Associative recall (Based suite) | |
| Extraction from a document in the prompt: the model must copy the answer out of | |
| the text it was just given. `contains` counts a generation as correct when the | |
| reference answer appears in it. fda, swde and squad_completion are | |
| lm-evaluation-harness' own tasks; based_triviaqa, based_drop and based_nq_2048 | |
| are the single-document versions of the remaining Based-suite tasks. Greedy | |
| decoding, no repetition penalty, prompts left-truncated to the model's | |
| 2,048-token training context. Stderr is the binomial standard error. | |
| | Task | Metric | Value | Stderr | | |
| |------------------|----------|-------:|----------| | |
| | fda | contains | 0.6670 | ± 0.0142 | | |
| | swde | contains | 0.6814 | ± 0.0140 | | |
| | squad_completion | contains | 0.4042 | ± 0.0090 | | |
| | based_triviaqa | contains | 0.5379 | ± 0.0121 | | |
| | based_drop | contains | 0.2415 | ± 0.0094 | | |
| | based_nq_2048 | contains | 0.1387 | ± 0.0062 | | |