Instructions to use xquantize/climategpt-7b-4bit-mlx with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- MLX
How to use xquantize/climategpt-7b-4bit-mlx with MLX:
# Make sure mlx-lm is installed # pip install --upgrade mlx-lm # Generate text with mlx-lm from mlx_lm import load, generate model, tokenizer = load("xquantize/climategpt-7b-4bit-mlx") prompt = "Write a story about Einstein" messages = [{"role": "user", "content": prompt}] prompt = tokenizer.apply_chat_template( messages, add_generation_prompt=True ) text = generate(model, tokenizer, prompt=prompt, verbose=True) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- LM Studio
- MLX LM
How to use xquantize/climategpt-7b-4bit-mlx with MLX LM:
Generate or start a chat session
# Install MLX LM uv tool install mlx-lm # Interactive chat REPL mlx_lm.chat --model "xquantize/climategpt-7b-4bit-mlx"
Run an OpenAI-compatible server
# Install MLX LM uv tool install mlx-lm # Start the server mlx_lm.server --model "xquantize/climategpt-7b-4bit-mlx" # Calling the OpenAI-compatible server with curl curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "xquantize/climategpt-7b-4bit-mlx", "messages": [ {"role": "user", "content": "Hello"} ] }' - Atomic Chat
ClimateGPT-7B-4bit-mlx
This is a 4-bit MLX quantization of ClimateGPT-7B (eci-io/climategpt-7b), a climate-domain chat model, converted for fast local inference on Apple Silicon.
ClimateGPT is a family of models designed to synthesize interdisciplinary research on climate change. The 7B model is continued-pretrained from Llama-2-7B on a curated collection of climate documents and then instruction fine-tuned on instruction–completion pairs collected in cooperation with climate scientists. The authors report it outperforms Llama-2-70B-Chat on their climate-specific benchmarks. See the original work for full detail:
Thulke et al., ClimateGPT: Towards AI Synthesizing Interdisciplinary Research on Climate Change, 2024. Paper: https://arxiv.org/abs/2401.09646 · Project: https://eci.io
Conversion details
- Method:
mlx_lm.convertwith-q --q-bits 4 - Result: 4.500 bits per weight
- Precision of base load: bfloat16
- Converted on: Apple Silicon (MLX)
- mlx-lm version: 0.31.3
- Base model:
eci-io/climategpt-7b(continued-pretrained from Llama-2-7B)
Usage
pip install mlx-lm
from mlx_lm import load, generate
model, tokenizer = load("xquantize/climategpt-7b-4bit-mlx")
# ClimateGPT is an instruction-tuned CHAT model — use the chat template.
messages = [
{"role": "user", "content": "What is the difference between weather and climate?"}
]
prompt = tokenizer.apply_chat_template(
messages, tokenize=False, add_generation_prompt=True
)
print(generate(model, tokenizer, prompt=prompt, max_tokens=256, verbose=True))
Or from the command line:
mlx_lm.generate --model xquantize/climategpt-7b-4bit-mlx \
--prompt "What is the difference between weather and climate?" --max-tokens 128
Note on usage style
This is an instruction-tuned chat model, so prompt it with chat turns via the tokenizer's chat template (shown above) rather than raw text completion. It uses a ChatML-style format (<|im_start|> / <|im_end|>). The authors note the model is designed to be used with retrieval augmentation (RAG) to extend its knowledge and improve factuality and is not intended as a general-purpose chatbot, it is specialized for the climate domain. Context length is 4K tokens.
Stop-token fix
The upstream generation_config.json sets eos_token_id to 2 (Llama-2's </s>), but this model actually ends turns with the ChatML token <|im_end|> (id 32006). As shipped upstream that mismatch causes generation to run past the end of a turn and repeat. This repository sets eos_token_id to [2, 32006], so generation stops cleanly at the end of a turn with no extra flags required.
Performance
On an Apple Silicon Mac, this 4-bit build runs at ~34 tokens/sec with a peak memory footprint of ~4.0 GB, making a climate-specialized 7B usable on consumer hardware.
Limitations
ClimateGPT-7B is a 2024-era Llama-2-7B derivative; its general fluency and knowledge reflect that generation, not current frontier models. As with any chat-capable LLM, it may produce biased, offensive or inaccurate responses and should not be relied on for authoritative scientific or safety-critical decisions. It is intended to be paired with retrieval augmentation. Quantization to 4 bits may introduce additional minor quality degradation relative to the full-precision model.
License & attribution
This model is a 4-bit MLX quantization of ClimateGPT-7B and is distributed under the ClimateGPT Non-Commercial Community License (© EQTY R&D, Inc.; Erasmus.AI as third-party beneficiary). Non-commercial use only.
Per the license, this repository includes a copy of the license (LICENSE.txt) and the required attribution (Notice). By using these weights you agree to the ClimateGPT Terms of Service and Acceptable Use Policy contained in LICENSE.txt.
All credit for the underlying model belongs to the ClimateGPT authors (Thulke et al.; Erasmus AI, AppTek, EQTY R&D). This repository provides only an MLX-format 4-bit quantization for local inference on Apple Silicon and claims no ownership of the underlying model. The "ClimateGPT" name is used solely to describe the origin of these weights.
- Downloads last month
- -
4-bit