Text Generation
Transformers
Safetensors
English
gemma4
image-text-to-text
function-calling
tool-use
bfcl
cloudsurf
qlora
gemma-4
conversational
Instructions to use cloudsurf-software/CloudSurf-4B-FC with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use cloudsurf-software/CloudSurf-4B-FC with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="cloudsurf-software/CloudSurf-4B-FC") messages = [ { "role": "user", "content": [ {"type": "image", "url": "https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/p-blog/candy.JPG"}, {"type": "text", "text": "What animal is on the candy?"} ] }, ] pipe(text=messages)# Load model directly from transformers import AutoProcessor, AutoModelForMultimodalLM processor = AutoProcessor.from_pretrained("cloudsurf-software/CloudSurf-4B-FC") model = AutoModelForMultimodalLM.from_pretrained("cloudsurf-software/CloudSurf-4B-FC", device_map="auto") messages = [ { "role": "user", "content": [ {"type": "image", "url": "https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/p-blog/candy.JPG"}, {"type": "text", "text": "What animal is on the candy?"} ] }, ] inputs = processor.apply_chat_template( messages, add_generation_prompt=True, tokenize=True, return_dict=True, return_tensors="pt", ).to(model.device) outputs = model.generate(**inputs, max_new_tokens=40) print(processor.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use cloudsurf-software/CloudSurf-4B-FC with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "cloudsurf-software/CloudSurf-4B-FC" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "cloudsurf-software/CloudSurf-4B-FC", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/cloudsurf-software/CloudSurf-4B-FC
- SGLang
How to use cloudsurf-software/CloudSurf-4B-FC 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 "cloudsurf-software/CloudSurf-4B-FC" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "cloudsurf-software/CloudSurf-4B-FC", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'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 "cloudsurf-software/CloudSurf-4B-FC" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "cloudsurf-software/CloudSurf-4B-FC", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use cloudsurf-software/CloudSurf-4B-FC with Docker Model Runner:
docker model run hf.co/cloudsurf-software/CloudSurf-4B-FC
Restore 54 KV-shared tensors (layers 24-41) in model.safetensors; stock-schema config.json (root + merged)
Browse files- README.md +26 -0
- config.json +3 -25
- merged/config.json +3 -25
- merged/model.safetensors +2 -2
- model.safetensors +2 -2
README.md
CHANGED
|
@@ -142,3 +142,29 @@ fixed function-calling instruction block to the caller's system message, and
|
|
| 142 |
when a generation terminates inside the thought channel with an empty answer it
|
| 143 |
attempts to recover a bracket-format tool-call list from the raw text before
|
| 144 |
returning an empty answer. Both behaviors are in the script, unabridged.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 142 |
when a generation terminates inside the thought channel with an empty answer it
|
| 143 |
attempts to recover a bracket-format tool-call list from the raw text before
|
| 144 |
returning an empty answer. Both behaviors are in the script, unabridged.
|
| 145 |
+
|
| 146 |
+
---
|
| 147 |
+
|
| 148 |
+
### 2026-08 weight-file fix
|
| 149 |
+
|
| 150 |
+
Earlier revisions of this repository shipped a `model.safetensors` missing 54
|
| 151 |
+
tensors relative to the base model: `k_proj`, `v_proj`, and `k_norm` weights
|
| 152 |
+
for language-model layers 24–41 (2076 keys instead of 2130). These layers use
|
| 153 |
+
shared KV projections (`num_kv_shared_layers: 18`), and the export path
|
| 154 |
+
(transformers 5.15.0 `save_pretrained`) silently omitted their parameters.
|
| 155 |
+
Some engines tolerated the omission; vLLM 0.25.1 correctly refused to load
|
| 156 |
+
the checkpoint.
|
| 157 |
+
|
| 158 |
+
The current revision restores all 2130 tensors. The 54 restored tensors are
|
| 159 |
+
byte-exact copies from `google/gemma-4-E4B-it` — this is provably lossless:
|
| 160 |
+
the fine-tuning adapter contains no LoRA entries for k/v projections at or
|
| 161 |
+
above layer 24, and every one of the 2076 retained tensors is either
|
| 162 |
+
bit-identical to the base or accounted for by an adapter-targeted module.
|
| 163 |
+
`config.json` now matches the base model's schema so the checkpoint loads
|
| 164 |
+
under both current and older transformers versions.
|
| 165 |
+
|
| 166 |
+
Verification: the fixed checkpoint serves under vLLM 0.25.1, and greedy
|
| 167 |
+
decoding logprobs match an independently reconstructed base+adapter merge at
|
| 168 |
+
the same numerical floor measured between two servings of the unmodified base
|
| 169 |
+
model (top-1 agreement 99.6% vs a 98.8% same-model cross-engine control; max
|
| 170 |
+
chosen-token logprob difference 0.166 vs 0.126 control).
|
config.json
CHANGED
|
@@ -66,6 +66,7 @@
|
|
| 66 |
"eos_token_id": 1,
|
| 67 |
"expert_intermediate_size": null,
|
| 68 |
"final_logit_softcapping": 30.0,
|
|
|
|
| 69 |
"head_dim": 256,
|
| 70 |
"hidden_activation": "gelu_pytorch_tanh",
|
| 71 |
"hidden_size": 2560,
|
|
@@ -118,36 +119,13 @@
|
|
| 118 |
],
|
| 119 |
"max_position_embeddings": 131072,
|
| 120 |
"model_type": "gemma4_text",
|
| 121 |
-
"moe_intermediate_size": null,
|
| 122 |
"num_attention_heads": 8,
|
| 123 |
"num_experts": null,
|
|
|
|
| 124 |
"num_hidden_layers": 42,
|
| 125 |
"num_key_value_heads": 2,
|
| 126 |
"num_kv_shared_layers": 18,
|
| 127 |
"pad_token_id": 0,
|
| 128 |
-
"per_layer_config": {
|
| 129 |
-
"05": {
|
| 130 |
-
"head_dim": 512
|
| 131 |
-
},
|
| 132 |
-
"11": {
|
| 133 |
-
"head_dim": 512
|
| 134 |
-
},
|
| 135 |
-
"17": {
|
| 136 |
-
"head_dim": 512
|
| 137 |
-
},
|
| 138 |
-
"23": {
|
| 139 |
-
"head_dim": 512
|
| 140 |
-
},
|
| 141 |
-
"29": {
|
| 142 |
-
"head_dim": 512
|
| 143 |
-
},
|
| 144 |
-
"35": {
|
| 145 |
-
"head_dim": 512
|
| 146 |
-
},
|
| 147 |
-
"41": {
|
| 148 |
-
"head_dim": 512
|
| 149 |
-
}
|
| 150 |
-
},
|
| 151 |
"rms_norm_eps": 1e-06,
|
| 152 |
"rope_parameters": {
|
| 153 |
"full_attention": {
|
|
@@ -170,7 +148,7 @@
|
|
| 170 |
"vocab_size_per_layer_input": 262144
|
| 171 |
},
|
| 172 |
"tie_word_embeddings": true,
|
| 173 |
-
"transformers_version": "5.
|
| 174 |
"video_token_id": 258884,
|
| 175 |
"vision_config": {
|
| 176 |
"_name_or_path": "",
|
|
|
|
| 66 |
"eos_token_id": 1,
|
| 67 |
"expert_intermediate_size": null,
|
| 68 |
"final_logit_softcapping": 30.0,
|
| 69 |
+
"global_head_dim": 512,
|
| 70 |
"head_dim": 256,
|
| 71 |
"hidden_activation": "gelu_pytorch_tanh",
|
| 72 |
"hidden_size": 2560,
|
|
|
|
| 119 |
],
|
| 120 |
"max_position_embeddings": 131072,
|
| 121 |
"model_type": "gemma4_text",
|
|
|
|
| 122 |
"num_attention_heads": 8,
|
| 123 |
"num_experts": null,
|
| 124 |
+
"num_global_key_value_heads": null,
|
| 125 |
"num_hidden_layers": 42,
|
| 126 |
"num_key_value_heads": 2,
|
| 127 |
"num_kv_shared_layers": 18,
|
| 128 |
"pad_token_id": 0,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 129 |
"rms_norm_eps": 1e-06,
|
| 130 |
"rope_parameters": {
|
| 131 |
"full_attention": {
|
|
|
|
| 148 |
"vocab_size_per_layer_input": 262144
|
| 149 |
},
|
| 150 |
"tie_word_embeddings": true,
|
| 151 |
+
"transformers_version": "5.5.0.dev0",
|
| 152 |
"video_token_id": 258884,
|
| 153 |
"vision_config": {
|
| 154 |
"_name_or_path": "",
|
merged/config.json
CHANGED
|
@@ -66,6 +66,7 @@
|
|
| 66 |
"eos_token_id": 1,
|
| 67 |
"expert_intermediate_size": null,
|
| 68 |
"final_logit_softcapping": 30.0,
|
|
|
|
| 69 |
"head_dim": 256,
|
| 70 |
"hidden_activation": "gelu_pytorch_tanh",
|
| 71 |
"hidden_size": 2560,
|
|
@@ -118,36 +119,13 @@
|
|
| 118 |
],
|
| 119 |
"max_position_embeddings": 131072,
|
| 120 |
"model_type": "gemma4_text",
|
| 121 |
-
"moe_intermediate_size": null,
|
| 122 |
"num_attention_heads": 8,
|
| 123 |
"num_experts": null,
|
|
|
|
| 124 |
"num_hidden_layers": 42,
|
| 125 |
"num_key_value_heads": 2,
|
| 126 |
"num_kv_shared_layers": 18,
|
| 127 |
"pad_token_id": 0,
|
| 128 |
-
"per_layer_config": {
|
| 129 |
-
"05": {
|
| 130 |
-
"head_dim": 512
|
| 131 |
-
},
|
| 132 |
-
"11": {
|
| 133 |
-
"head_dim": 512
|
| 134 |
-
},
|
| 135 |
-
"17": {
|
| 136 |
-
"head_dim": 512
|
| 137 |
-
},
|
| 138 |
-
"23": {
|
| 139 |
-
"head_dim": 512
|
| 140 |
-
},
|
| 141 |
-
"29": {
|
| 142 |
-
"head_dim": 512
|
| 143 |
-
},
|
| 144 |
-
"35": {
|
| 145 |
-
"head_dim": 512
|
| 146 |
-
},
|
| 147 |
-
"41": {
|
| 148 |
-
"head_dim": 512
|
| 149 |
-
}
|
| 150 |
-
},
|
| 151 |
"rms_norm_eps": 1e-06,
|
| 152 |
"rope_parameters": {
|
| 153 |
"full_attention": {
|
|
@@ -170,7 +148,7 @@
|
|
| 170 |
"vocab_size_per_layer_input": 262144
|
| 171 |
},
|
| 172 |
"tie_word_embeddings": true,
|
| 173 |
-
"transformers_version": "5.
|
| 174 |
"video_token_id": 258884,
|
| 175 |
"vision_config": {
|
| 176 |
"_name_or_path": "",
|
|
|
|
| 66 |
"eos_token_id": 1,
|
| 67 |
"expert_intermediate_size": null,
|
| 68 |
"final_logit_softcapping": 30.0,
|
| 69 |
+
"global_head_dim": 512,
|
| 70 |
"head_dim": 256,
|
| 71 |
"hidden_activation": "gelu_pytorch_tanh",
|
| 72 |
"hidden_size": 2560,
|
|
|
|
| 119 |
],
|
| 120 |
"max_position_embeddings": 131072,
|
| 121 |
"model_type": "gemma4_text",
|
|
|
|
| 122 |
"num_attention_heads": 8,
|
| 123 |
"num_experts": null,
|
| 124 |
+
"num_global_key_value_heads": null,
|
| 125 |
"num_hidden_layers": 42,
|
| 126 |
"num_key_value_heads": 2,
|
| 127 |
"num_kv_shared_layers": 18,
|
| 128 |
"pad_token_id": 0,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 129 |
"rms_norm_eps": 1e-06,
|
| 130 |
"rope_parameters": {
|
| 131 |
"full_attention": {
|
|
|
|
| 148 |
"vocab_size_per_layer_input": 262144
|
| 149 |
},
|
| 150 |
"tie_word_embeddings": true,
|
| 151 |
+
"transformers_version": "5.5.0.dev0",
|
| 152 |
"video_token_id": 258884,
|
| 153 |
"vision_config": {
|
| 154 |
"_name_or_path": "",
|
merged/model.safetensors
CHANGED
|
@@ -1,3 +1,3 @@
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
-
oid sha256:
|
| 3 |
-
size
|
|
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:85ba6e826cae2cb4978659417dda0840e738a6adc0bba8a7dfd9b43499947faf
|
| 3 |
+
size 15992595884
|
model.safetensors
CHANGED
|
@@ -1,3 +1,3 @@
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
-
oid sha256:
|
| 3 |
-
size
|
|
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:85ba6e826cae2cb4978659417dda0840e738a6adc0bba8a7dfd9b43499947faf
|
| 3 |
+
size 15992595884
|