Instructions to use liufanfanlff/C3-Context-Cascade-Compression with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use liufanfanlff/C3-Context-Cascade-Compression with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="liufanfanlff/C3-Context-Cascade-Compression", trust_remote_code=True)# Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("liufanfanlff/C3-Context-Cascade-Compression", trust_remote_code=True, dtype="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use liufanfanlff/C3-Context-Cascade-Compression with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "liufanfanlff/C3-Context-Cascade-Compression" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "liufanfanlff/C3-Context-Cascade-Compression", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/liufanfanlff/C3-Context-Cascade-Compression
- SGLang
How to use liufanfanlff/C3-Context-Cascade-Compression 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 "liufanfanlff/C3-Context-Cascade-Compression" \ --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": "liufanfanlff/C3-Context-Cascade-Compression", "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 "liufanfanlff/C3-Context-Cascade-Compression" \ --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": "liufanfanlff/C3-Context-Cascade-Compression", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use liufanfanlff/C3-Context-Cascade-Compression with Docker Model Runner:
docker model run hf.co/liufanfanlff/C3-Context-Cascade-Compression
lets scale this further
I want to scale this concept to larger context with more tasks. I have started with a basic training run at 160 latent tokens on 5k research papers for the task of summarization. I believe it needs for data and more compute (or possibly just bigger models and more latent tokens), as it hallucinates a lot. This takes around 4 hours to train on a single h100 for 1 epoch. Here's the code and the model:
https://github.com/bdytx5/context_cascade
https://huggingface.co/youngbrett48/C3-Context-Cascade-Summarization
Let me know if you would like to collaborate further to push this concept to its potential.
Brett Young