Instructions to use PanocularAI/PanoLM-380M with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use PanocularAI/PanoLM-380M with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="PanocularAI/PanoLM-380M", trust_remote_code=True) messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoModelForCausalLM model = AutoModelForCausalLM.from_pretrained("PanocularAI/PanoLM-380M", trust_remote_code=True, dtype="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use PanocularAI/PanoLM-380M with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "PanocularAI/PanoLM-380M" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "PanocularAI/PanoLM-380M", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/PanocularAI/PanoLM-380M
- SGLang
How to use PanocularAI/PanoLM-380M 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/PanoLM-380M" \ --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": "PanocularAI/PanoLM-380M", "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 "PanocularAI/PanoLM-380M" \ --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": "PanocularAI/PanoLM-380M", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use PanocularAI/PanoLM-380M with Docker Model Runner:
docker model run hf.co/PanocularAI/PanoLM-380M
| library_name: transformers | |
| license: apache-2.0 | |
| language: | |
| - en | |
| pipeline_tag: text-generation | |
| tags: | |
| - panolm | |
| - linear-attention | |
| # PanoLM-380M | |
| This repo contains the base 380M PanoLM model, which is a linear-attention causal language. | |
| ## 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 | |
| model = AutoModelForCausalLM.from_pretrained( | |
| "PanocularAI/PanoLM-380M", | |
| 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 = "I am PanoLM, an edge device friendly language model." | |
| inputs = tokenizer(prompt, return_tensors="pt").to(model.device) | |
| # use_cache=False: HF's generate() would pass a DynamicCache that fla's KDA | |
| # layer indexes as a list, which the new transformers API no longer supports. | |
| outputs = model.generate( | |
| **inputs, | |
| max_length=512, | |
| top_k=10, | |
| use_cache=False, | |
| 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`); for | |
| Based-suite recall tasks we report `contains` (soft answer match), which is the | |
| metric the suite was designed around. | |
| ### Commonsense reasoning & general QA | |
| | Task | Metric | Value | Stderr | | |
| |----------------|----------|-------:|----------| | |
| | arc_challenge | acc_norm | 0.2910 | ± 0.0133 | | |
| | arc_easy | acc_norm | 0.5349 | ± 0.0102 | | |
| | commonsense_qa | acc | 0.1892 | ± 0.0112 | | |
| | hellaswag | acc_norm | 0.4137 | ± 0.0049 | | |
| | piqa | acc_norm | 0.6741 | ± 0.0109 | | |
| | winogrande | acc | 0.5304 | ± 0.0140 | | |
| ### Associative recall (Based suite) | |
| | Task | Metric | Value | | |
| |----------------|----------|-------:| | |
| | drop | contains | 0.2286 | | |
| | fda | contains | 0.0499 | | |
| | nq_2048 | contains | 0.0687 | | |
| | squadv2 | contains | 0.3542 | | |
| | swde | contains | 0.2439 | | |
| | triviaqa | contains | 0.4680 | | |