Image-Text-to-Text
Safetensors
GGUF
Portuguese
English
gemma4
code
vision
multimodal
software-engineering
react-native
android
typescript
python
unsloth
conversational
Instructions to use SpaceGhost/SpaceCode-E2B with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- llama.cpp
How to use SpaceGhost/SpaceCode-E2B with llama.cpp:
Install (macOS, Linux)
curl -LsSf https://llama.app/install.sh | sh # Start a local OpenAI-compatible server with a web UI: llama serve -hf SpaceGhost/SpaceCode-E2B:Q4_K_M # Run inference directly in the terminal: llama cli -hf SpaceGhost/SpaceCode-E2B:Q4_K_M
Install from WinGet (Windows)
winget install llama.cpp # Start a local OpenAI-compatible server with a web UI: llama serve -hf SpaceGhost/SpaceCode-E2B:Q4_K_M # Run inference directly in the terminal: llama cli -hf SpaceGhost/SpaceCode-E2B:Q4_K_M
Build from source code
git clone https://github.com/ggml-org/llama.cpp.git cd llama.cpp cmake -B build cmake --build build -j --target llama-app # Start a local OpenAI-compatible server with a web UI: ./build/bin/llama serve -hf SpaceGhost/SpaceCode-E2B:Q4_K_M # Run inference directly in the terminal: ./build/bin/llama cli -hf SpaceGhost/SpaceCode-E2B:Q4_K_M
Use Docker
docker model run hf.co/SpaceGhost/SpaceCode-E2B:Q4_K_M
- Llama new
- LM Studio
- Jan
- vLLM
How to use SpaceGhost/SpaceCode-E2B with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "SpaceGhost/SpaceCode-E2B" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "SpaceGhost/SpaceCode-E2B", "messages": [ { "role": "user", "content": [ { "type": "text", "text": "Describe this image in one sentence." }, { "type": "image_url", "image_url": { "url": "https://cdn.britannica.com/61/93061-050-99147DCE/Statue-of-Liberty-Island-New-York-Bay.jpg" } } ] } ] }'Use Docker
docker model run hf.co/SpaceGhost/SpaceCode-E2B:Q4_K_M
- Ollama
How to use SpaceGhost/SpaceCode-E2B with Ollama:
ollama run hf.co/SpaceGhost/SpaceCode-E2B:Q4_K_M
- Unsloth Desktop
- Pi
How to use SpaceGhost/SpaceCode-E2B with Pi:
Start the llama.cpp server
# Install llama.cpp: brew install llama.cpp # Start a local OpenAI-compatible server: llama serve -hf SpaceGhost/SpaceCode-E2B:Q4_K_M
Configure the model in Pi
# Install Pi: npm install -g @earendil-works/pi-coding-agent # Add to ~/.pi/agent/models.json: { "providers": { "llama-cpp": { "baseUrl": "http://localhost:8080/v1", "api": "openai-completions", "apiKey": "none", "models": [ { "id": "SpaceGhost/SpaceCode-E2B:Q4_K_M" } ] } } }Run Pi
# Start Pi in your project directory: pi
- Docker Model Runner
How to use SpaceGhost/SpaceCode-E2B with Docker Model Runner:
docker model run hf.co/SpaceGhost/SpaceCode-E2B:Q4_K_M
- Lemonade
How to use SpaceGhost/SpaceCode-E2B with Lemonade:
Pull the model
# Download Lemonade from https://lemonade-server.ai/ lemonade pull SpaceGhost/SpaceCode-E2B:Q4_K_M
Run and chat with the model
lemonade run user.SpaceCode-E2B-Q4_K_M
List all available models
lemonade list
- Hermes Agent
How to use SpaceGhost/SpaceCode-E2B with Hermes Agent:
Start the llama.cpp server
# Install llama.cpp: brew install llama.cpp # Start a local OpenAI-compatible server: llama serve -hf SpaceGhost/SpaceCode-E2B:Q4_K_M
Configure Hermes
# Install Hermes: curl -fsSL https://hermes-agent.nousresearch.com/install.sh | bash hermes setup # Point Hermes at the local server: hermes config set model.provider custom hermes config set model.base_url http://127.0.0.1:8080/v1 hermes config set model.default SpaceGhost/SpaceCode-E2B:Q4_K_M
Run Hermes
hermes
- Atomic Chat
- OpenClaw
How to use SpaceGhost/SpaceCode-E2B with OpenClaw:
Start the llama.cpp server
# Install llama.cpp: brew install llama.cpp # Start a local OpenAI-compatible server: llama serve -hf SpaceGhost/SpaceCode-E2B:Q4_K_M
Configure OpenClaw
# Install OpenClaw: npm install -g openclaw@latest # Register the local server and set it as the default model: openclaw onboard --non-interactive --mode local \ --auth-choice custom-api-key \ --custom-base-url http://127.0.0.1:8080/v1 \ --custom-model-id "SpaceGhost/SpaceCode-E2B:Q4_K_M" \ --custom-provider-id llama-cpp \ --custom-compatibility openai \ --custom-text-input \ --accept-risk \ --skip-health
Run OpenClaw
openclaw agent --local --agent main --message "Hello from Hugging Face"
docs: sync official SpaceCode 131-example Model Card and lineage
Browse files
README.md
CHANGED
|
@@ -1,21 +1,119 @@
|
|
| 1 |
---
|
| 2 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 3 |
tags:
|
| 4 |
-
-
|
| 5 |
-
-
|
| 6 |
-
-
|
| 7 |
-
-
|
| 8 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 9 |
language:
|
| 10 |
-
-
|
|
|
|
|
|
|
| 11 |
---
|
| 12 |
|
| 13 |
-
#
|
| 14 |
|
| 15 |
-
- **
|
| 16 |
-
- **License:** apache-2.0
|
| 17 |
-
- **Finetuned from model :** unsloth/gemma-4-E2B-it-unsloth-bnb-4bit
|
| 18 |
|
| 19 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 20 |
|
| 21 |
-
|
|
|
|
|
|
| 1 |
---
|
| 2 |
+
license: gemma
|
| 3 |
+
base_model:
|
| 4 |
+
- google/gemma-4-E2B-it
|
| 5 |
+
- unsloth/gemma-4-E2B-it
|
| 6 |
+
datasets:
|
| 7 |
+
- SpaceGhost/space-dataset
|
| 8 |
tags:
|
| 9 |
+
- code
|
| 10 |
+
- vision
|
| 11 |
+
- multimodal
|
| 12 |
+
- gguf
|
| 13 |
+
- llama.cpp
|
| 14 |
+
- ollama
|
| 15 |
+
- unsloth
|
| 16 |
+
- causal-software-engineering
|
| 17 |
+
- react
|
| 18 |
+
- flutter
|
| 19 |
+
- typescript
|
| 20 |
+
- python
|
| 21 |
+
- rust
|
| 22 |
+
- go
|
| 23 |
language:
|
| 24 |
+
- pt
|
| 25 |
+
- en
|
| 26 |
+
pipeline_tag: image-text-to-text
|
| 27 |
---
|
| 28 |
|
| 29 |
+
# SpaceCode-E2B-it (`SpaceGhost/SpaceCode-E2B-it`)
|
| 30 |
|
| 31 |
+
**SpaceCode-E2B-it** é um modelo de Engenharia de Software e Reparo Visual Causal derivado do **Google Gemma 4 E2B (`google/gemma-4-E2B-it`)**, treinado via QLoRA SFT com [Unsloth](https://github.com/unslothai/unsloth) e quantizado em formato **GGUF (`Q4_K_M`)** pela **SpaceGhost** através do projeto `dataset-treina`.
|
|
|
|
|
|
|
| 32 |
|
| 33 |
+
---
|
| 34 |
+
|
| 35 |
+
## 📌 Visão Geral do Modelo
|
| 36 |
+
|
| 37 |
+
- **Nome Oficial**: `SpaceCode-E2B-it`
|
| 38 |
+
- **Repositório Hugging Face**: [`SpaceGhost/SpaceCode-E2B-it`](https://huggingface.co/SpaceGhost/SpaceCode-E2B-it)
|
| 39 |
+
- **Dataset Oficial**: [`SpaceGhost/space-dataset`](https://huggingface.co/datasets/SpaceGhost/space-dataset) (`data/gemma4/train_131.jsonl`)
|
| 40 |
+
- **Modelo Base**: `google/gemma-4-E2B-it` (`unsloth/gemma-4-E2B-it`)
|
| 41 |
+
- **Formato / Quantização**: `GGUF` (`gemma-4-E2B-it.Q4_K_M.gguf`) + `Modelfile` oficial para Ollama
|
| 42 |
+
- **Janela de Contexto**: 128K tokens (treinado com `max_seq_length=4096`)
|
| 43 |
+
|
| 44 |
+
---
|
| 45 |
+
|
| 46 |
+
## 📊 Corpus de Treinamento Consolidado (131 Exemplos Auditados)
|
| 47 |
+
|
| 48 |
+
O modelo foi ajustado sobre o corpus **`train_131.jsonl`** (SHA-256: `f4382467afa2a41e832c01d79489fdb17e9c561e6b5ec26545bdc937a74c1009`), combinando reparo visual causal e engenharia de software políglota com **zero vazamento (0% data leakage)** contra os conjuntos de validação, holdout de teste e benchmark de ambiguidade:
|
| 49 |
+
|
| 50 |
+
1. **C08 — Diagnóstico Causal e Reparo Visual Dual-Image (31 exemplos)**:
|
| 51 |
+
- Pares multimodais (`expected_ui` vs. `actual_ui` + código quebrado) cobrindo regressões de CSS/Tailwind e Flutter (`flex_direction`, `grid_columns`, `overflow_clipping`, `padding_collapse`, `gap_collapse`, `z_index_occlusion`, `color_contrast`, `alignment_shift`).
|
| 52 |
+
- Saída estruturada em 3 blocos auditáveis:
|
| 53 |
+
1. `### 1. Diagnóstico Causal da Regressão Visual`
|
| 54 |
+
2. `### 2. Patch Mínimo (Unified Diff)`
|
| 55 |
+
3. `### 3. Código Corrigido Completo`
|
| 56 |
+
2. **Engenharia de Software Políglota C01–C06 (100 exemplos em 9 linguagens)**:
|
| 57 |
+
- **Linguagens**: TypeScript (28), Python (22), Dart/Flutter (11), SQL (10), Java (9), Go (8), C# (5), Rust (5) e Bash (2).
|
| 58 |
+
- **Categorias**:
|
| 59 |
+
- `C01`: Correção de Bug com Causa Raiz + Teste Unitário (23)
|
| 60 |
+
- `C02`: Refatoração Estrutural / Clean Architecture (16)
|
| 61 |
+
- `C03`: Geração de Testes Unitários e Edge Cases (15)
|
| 62 |
+
- `C04`: Code Review Técnico e Segurança / OWASP (15)
|
| 63 |
+
- `C05`: Raciocínio Arquitetural e Trade-offs / ADR (16)
|
| 64 |
+
- `C06`: Implementação Idiomática End-to-End (15)
|
| 65 |
+
|
| 66 |
+
---
|
| 67 |
+
|
| 68 |
+
## ⚙️ Hiperparâmetros e Telemetria de Treinamento
|
| 69 |
+
|
| 70 |
+
| Parâmetro / Métrica | Valor |
|
| 71 |
+
| :--- | :--- |
|
| 72 |
+
| **Hardware** | 1x NVIDIA L4 (23 GB VRAM, CUDA 13.0, `bfloat16`) |
|
| 73 |
+
| **Método de Fine-Tuning** | QLoRA 4-bit (`r=16`, `lora_alpha=16`, `lora_dropout=0`) |
|
| 74 |
+
| **Parâmetros Treináveis** | `36,925,440` de `5,160,103,456` (`0.72%`) |
|
| 75 |
+
| **Épocas / Steps Totais** | `3.0` épocas (`99` steps de otimização) |
|
| 76 |
+
| **Batch Efetivo** | `4` (`per_device_train_batch_size=1`, `gradient_accumulation_steps=4`) |
|
| 77 |
+
| **Learning Rate / Scheduler** | `2e-4` (`cosine`, `warmup_ratio=0.05`, `adamw_8bit`) |
|
| 78 |
+
| **Training Loss Inicial $\rightarrow$ Final** | `2.3800` (step 1) $\rightarrow$ `0.4500–0.9045` (época 3) |
|
| 79 |
+
| **Training Loss Médio Global** | **`0.97316`** |
|
| 80 |
+
| **Tempo Total de Treino** | `822.52s` (~13m42s) |
|
| 81 |
+
|
| 82 |
+
---
|
| 83 |
+
|
| 84 |
+
## 🚀 Como Executar Localmente
|
| 85 |
+
|
| 86 |
+
### 1. Via Ollama
|
| 87 |
+
```bash
|
| 88 |
+
ollama run hf.co/SpaceGhost/SpaceCode-E2B-it
|
| 89 |
+
```
|
| 90 |
+
|
| 91 |
+
### 2. Via `llama.cpp` (`llama-cli`)
|
| 92 |
+
```bash
|
| 93 |
+
llama-cli -hf SpaceGhost/SpaceCode-E2B-it --jinja
|
| 94 |
+
```
|
| 95 |
+
|
| 96 |
+
### 3. Arquivos Disponíveis no Repositório
|
| 97 |
+
- `gemma-4-E2B-it.Q4_K_M.gguf` — Pesos quantizados em 4-bit (`Q4_K_M`)
|
| 98 |
+
- `Modelfile` — Configuração pronta para importação no Ollama
|
| 99 |
+
- `config.json` — Metadados de arquitetura Gemma 4 E2B
|
| 100 |
+
|
| 101 |
+
> **Nota sobre Multimodalidade em GGUF**: O arquivo `.gguf` exportado contém o backbone de texto quantizado (`Q4_K_M`) para inferência rápida de código, diagnóstico textual, refatoração e arquitetura em CPU/GPU local. Para inferência com entrada direta de imagens (visão nativa Dual-Image C08), utilize o adaptador QLoRA com `Unsloth` / `Transformers` (`FastVisionModel`).
|
| 102 |
+
|
| 103 |
+
---
|
| 104 |
+
|
| 105 |
+
## 🧭 Linhagem Oficial SpaceGhost
|
| 106 |
+
|
| 107 |
+
| Repositório Hugging Face | Papel na Arquitetura | Commit SHA |
|
| 108 |
+
| :--- | :--- | :--- |
|
| 109 |
+
| [`SpaceGhost/SpaceCode`](https://huggingface.co/SpaceGhost/SpaceCode) | **Adaptador QLoRA Multimodal** (`adapter_model.safetensors` + `processor_config.json`) | `45673d32` |
|
| 110 |
+
| [`SpaceGhost/SpaceCode-Merged`](https://huggingface.co/SpaceGhost/SpaceCode-Merged) | **Modelo 16-bit Merged** (QLoRA fundido ao base `model.safetensors` + visão multimodal) | `dbc5242d` |
|
| 111 |
+
| [`SpaceGhost/SpaceCode-E2B-it`](https://huggingface.co/SpaceGhost/SpaceCode-E2B-it) | **Modelo Quantizado GGUF (`Q4_K_M`)** + `Modelfile` para Ollama / `llama.cpp` | `560caef9` |
|
| 112 |
+
| [`SpaceGhost/space-dataset`](https://huggingface.co/datasets/SpaceGhost/space-dataset) | **Dataset Oficial Auditado** (`train_131.jsonl`, `manifest_131.json`, splits C07/C08) | `c6306f4a` |
|
| 113 |
+
|
| 114 |
+
---
|
| 115 |
+
|
| 116 |
+
## ⚠️ Nota de Atribuição
|
| 117 |
|
| 118 |
+
- *SpaceCode-E2B-it is a fine-tuned derivative of Google Gemma 4 E2B (`google/gemma-4-E2B-it`).*
|
| 119 |
+
- Desenvolvido pela organização **SpaceGhost** no contexto do projeto `dataset-treina` (sem relação com o benchmark acadêmico independente `KurtDu/SpaceCode-Bench`).
|