Instructions to use cccczshao/CALM-M with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use cccczshao/CALM-M with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="cccczshao/CALM-M")# Load model directly from transformers import EnergyTransformer model = EnergyTransformer.from_pretrained("cccczshao/CALM-M", dtype="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use cccczshao/CALM-M with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "cccczshao/CALM-M" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "cccczshao/CALM-M", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/cccczshao/CALM-M
- SGLang
How to use cccczshao/CALM-M 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 "cccczshao/CALM-M" \ --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": "cccczshao/CALM-M", "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 "cccczshao/CALM-M" \ --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": "cccczshao/CALM-M", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use cccczshao/CALM-M with Docker Model Runner:
docker model run hf.co/cccczshao/CALM-M
Update model card: Add `text-generation` pipeline tag, `transformers` library, and sample usage
#1
by nielsr HF Staff - opened
This PR enhances the model card for the CALM model by:
- Adding the
pipeline_tag: text-generationto the metadata, which aligns with the model's core functionality as described in the paper abstract (language modeling and text generation). This will improve its discoverability on the Hugging Face Hub. - Updating the
library_namefromCALMtotransformers. This is supported by thetransformers_versioninconfig.jsonand explicit instructions in the GitHub README on how to use the model with thetransformerslibrary by settingtrust_remote_code=True. This change enables the automated code snippet and inference widget on the Hub. - Updating the "Blog" badge to "Project Page" for clarity and consistency, using the same URL.
- Adding a "Sample Usage" section with a Python code snippet for text generation, directly sourced from the project's GitHub README. This provides users with a quick and verified way to get started with the model.
These changes will make the model card more informative, discoverable, and user-friendly.
cccczshao changed pull request status to merged