Text Generation
Transformers
Safetensors
English
cloverlm
causal-lm
quartet-ii
nvfp4
low-precision-training
pretrained
custom_code
Instructions to use daslab-testing/CloverLM with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use daslab-testing/CloverLM with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="daslab-testing/CloverLM", trust_remote_code=True)# pip install -U transformers accelerate # Load model directly from transformers import AutoModelForCausalLM model = AutoModelForCausalLM.from_pretrained("daslab-testing/CloverLM", trust_remote_code=True, device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use daslab-testing/CloverLM with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "daslab-testing/CloverLM" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "daslab-testing/CloverLM", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/daslab-testing/CloverLM
- SGLang
How to use daslab-testing/CloverLM 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 "daslab-testing/CloverLM" \ --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": "daslab-testing/CloverLM", "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 "daslab-testing/CloverLM" \ --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": "daslab-testing/CloverLM", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use daslab-testing/CloverLM with Docker Model Runner:
docker model run hf.co/daslab-testing/CloverLM
|
Download lm_eval/README.md from daslab-testing/CloverLM: direct link, hf CLI and curl.
- Browser
- Download file 2.17 kB
-
https://huggingface.co/daslab-testing/CloverLM/resolve/main/lm_eval/README.md
- Command line
-
hf download hf://daslab-testing/CloverLM/lm_eval/README.md
-
curl -L -o README.md https://huggingface.co/daslab-testing/CloverLM/resolve/main/lm_eval/README.md
2.17 kB
Environment Setup
Download this directory to a local machine and set up uv.
Install
uv(if you haven't already):curl -LsSf [https://astral.sh/uv/install.sh](https://astral.sh/uv/install.sh) | shSync the environment:
uv sync(This automatically creates a virtual environment at
.venvand strictly installs the dependencies locked inuv.lock.)Activate the environment:
source .venv/bin/activate
Evaluation Script
Run:
accelerate launch eval.py \
--model cloverlm \
--model_args "pretrained=daslab-testing/CloverLM,dtype=bfloat16,quartet_2_impl=quartet2,attn_backend=pytorch" \
--tasks "arc_easy_mi,arc_challenge_mi,hellaswag,piqa" \
--num_fewshot 0 \
--include_path ./ \
--trust_remote_code \
--confirm_run_unsafe_code \
--batch_size auto
Expected Evaluation Results
| Tasks |Version|Filter|n-shot| Metric | |Value | |Stderr|
|----------------|------:|------|-----:|---------------|---|-----:|---|-----:|
|arc_challenge_mi| 1|none | 0|acc |↑ |0.4625|± |0.0146|
| | |none | 0|acc_mutual_info|↑ |0.5094|± |0.0146|
| | |none | 0|acc_norm |↑ |0.4923|± |0.0146|
|arc_easy_mi | 1|none | 0|acc |↑ |0.7997|± |0.0082|
| | |none | 0|acc_mutual_info|↑ |0.7239|± |0.0092|
| | |none | 0|acc_norm |↑ |0.7731|± |0.0086|
|hellaswag | 1|none | 0|acc |↑ |0.5392|± |0.0050|
| | |none | 0|acc_norm |↑ |0.7167|± |0.0045|
|piqa | 1|none | 0|acc |↑ |0.7922|± |0.0095|
| | |none | 0|acc_norm |↑ |0.8058|± |0.0092|
Alternative Backends
Replace quartet_2_impl=quartet2 with quartet_2_impl=pseudoquant on non-Blackwell GPUs.
You can try attn_backend=pytorch/flash2/flash3/flash4 if you have the corresponding libs installed.