Instructions to use Open-Foundation-Models/PolyNorm_1B with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use Open-Foundation-Models/PolyNorm_1B with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="Open-Foundation-Models/PolyNorm_1B", trust_remote_code=True)# Load model directly from transformers import AutoModelForCausalLM model = AutoModelForCausalLM.from_pretrained("Open-Foundation-Models/PolyNorm_1B", trust_remote_code=True, dtype="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps
- vLLM
How to use Open-Foundation-Models/PolyNorm_1B with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "Open-Foundation-Models/PolyNorm_1B" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "Open-Foundation-Models/PolyNorm_1B", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/Open-Foundation-Models/PolyNorm_1B
- SGLang
How to use Open-Foundation-Models/PolyNorm_1B 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 "Open-Foundation-Models/PolyNorm_1B" \ --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": "Open-Foundation-Models/PolyNorm_1B", "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 "Open-Foundation-Models/PolyNorm_1B" \ --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": "Open-Foundation-Models/PolyNorm_1B", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use Open-Foundation-Models/PolyNorm_1B with Docker Model Runner:
docker model run hf.co/Open-Foundation-Models/PolyNorm_1B
# Load model directly
from transformers import AutoModelForCausalLM
model = AutoModelForCausalLM.from_pretrained("Open-Foundation-Models/PolyNorm_1B", trust_remote_code=True, dtype="auto")Introduction
This repository contains the checkpoints of the ICLR 2025 paper “Polynomial Composition Activations: Unleashing the Dynamics of Large Language Models”. This work introduces Polynomial Composition (PolyCom), a novel activation function that enhances the expressiveness of large language models (LLMs). PolyCom significantly improves the performance of dense and mixture of experts (MoE) models across various downstream tasks, without adding significant computational overhead.
Datasets and Training
We use the RedPajama-Data-1T dataset and pretrain the PolyCom model on 250B tokens. For more training details, please refer to the source code.
Inference
Here is an example of how to use the PolyCom model for inference:
from transformers import AutoModelForCausalLM, AutoTokenizer
model = AutoModelForCausalLM.from_pretrained(path_of_model, device_map="cuda",trust_remote_code=True)
tokenizer = AutoTokenizer.from_pretrained(path_of_model, padding_side="right",trust_remote_code=True)
prompt = "Hello, my name is"
input_ids = tokenizer.encode(prompt, return_tensors='pt').to('cuda')
greedy_output = model.generate(input_ids)
print(tokenizer.decode(greedy_output[0], skip_special_tokens=True))
Citing this work
If you find this work helpful or use it in your research, please consider citing our paper:
@inproceedings{zhuo2025polycom,
title={Polynomial Composition Activations: Unleashing the Dynamics of Large Language Models},
author={Zhijian Zhuo and Ya Wang and Yutao Zeng and Xiaoqing Li and Xun Zhou and Jinwen Ma},
booktitle={ICLR 2025},
year={2025}
}
- Downloads last month
- 18
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="Open-Foundation-Models/PolyNorm_1B", trust_remote_code=True)