File size: 11,771 Bytes
2ff5c54 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 | #!/usr/bin/env python3
"""
Upload ENTIRE MINDI 1.5 Vision-Coder project to HuggingFace.
REPO 1 (model): Mindigenous/MINDI-1.5-Vision-Coder
REPO 2 (dataset): Mindigenous/MINDI-1.5-training-data
Both private. On MI300X we will clone these repos directly.
"""
import os
import sys
import time
from pathlib import Path
from dotenv import load_dotenv
from huggingface_hub import HfApi, create_repo
# ββ Paths ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
PROJECT_ROOT = Path(__file__).resolve().parent.parent
ENV_FILE = PROJECT_ROOT / ".env"
# ββ Repo names βββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
MODEL_REPO = "Mindigenous/MINDI-1.5-Vision-Coder"
DATASET_REPO = "Mindigenous/MINDI-1.5-training-data"
# ββ Model card (written to repo as README.md) βββββββββββββββββββββββββ
MODEL_CARD = """\
---
license: apache-2.0
language:
- en
tags:
- code-generation
- nextjs
- react
- typescript
- vision
- multimodal
- mindi
- mindigenous
base_model: Qwen/Qwen2.5-Coder-7B-Instruct
---
# MINDI 1.5 Vision-Coder
Built by MINDIGENOUS.AI
## Model Description
MINDI 1.5 is an agentic AI coding model
that sees its own output and critiques it.
## Key Features
- Generates Next.js 14 + Tailwind + TypeScript
- Sees screenshots via CLIP ViT-L/14
- Critiques its own UI/UX output
- Searches internet for latest packages
- Tests code in sandbox environment
- Self-fixes errors automatically
## Training
- Base: Qwen/Qwen2.5-Coder-7B-Instruct
- Method: LoRA fine-tuning
- Hardware: AMD MI300X 192GB VRAM
- Dataset: 1,449,428 examples
- Tokens: 859,694,776
- Status: Training in progress
## Built By
Faaz - MINDIGENOUS.AI
Mumbai, India
April 2026
"""
# ββ Dataset card βββββββββββββββββββββββββββββββββββββββββββββββββββββββ
DATASET_CARD = """\
---
license: apache-2.0
language:
- en
tags:
- code-generation
- nextjs
- react
- typescript
- vision
- multimodal
- mindi
- mindigenous
size_categories:
- 1M<n<10M
---
# MINDI 1.5 Training Data
Training dataset for **MINDI 1.5 Vision-Coder** by MINDIGENOUS.AI
## Dataset Statistics
| Metric | Value |
|--------|-------|
| Total examples | 1,449,428 |
| Total tokens | 859,694,776 |
| Avg tokens/example | 593 |
| Avg quality score | 6.49 |
| Sources | 9 |
## Splits
| Split | Examples | Percentage |
|-------|----------|------------|
| Train | 1,304,486 | 90.0% |
| Validation | 72,471 | 5.0% |
| Test | 72,471 | 5.0% |
## Sources
| Source | Examples | Kept % |
|--------|----------|--------|
| starcoderdata | 569,350 | 94.9% |
| websight | 250,987 | 99.99% |
| evol_code | 155,998 | 99.7% |
| codefeedback | 149,865 | 99.9% |
| magicoder | 149,987 | 99.99% |
| synthetic_nextjs | 90,000 | 100% (protected) |
| codealpaca | 59,241 | 98.8% |
| search_examples | 15,000 | 100% (protected) |
| sandbox_examples | 9,000 | 100% (protected) |
## Type Distribution
| Type | Examples |
|------|----------|
| code_generation | 1,183,441 |
| vision_code | 250,987 |
| search | 15,000 |
## Language Distribution
| Language | Examples |
|----------|----------|
| unknown | 490,305 |
| typescript | 375,859 |
| javascript | 298,497 |
| python | 211,842 |
| html | 36,371 |
| java | 32,458 |
| rust | 3,709 |
| go | 387 |
## Format
Each example is a JSON object with:
- `conversations`: list of `{"role": ..., "content": ...}` turns
- `source`: dataset origin
- `type`: code_generation / vision_code / search
- `language`: programming language
- `quality_score`: heuristic quality (0-10+)
- `token_count`: number of tokens
## Quality Filtering
- Protected sources (sandbox, search, synthetic_nextjs) bypass aggressive filters
- MINDI special token bonuses boost agentic examples
- Dedup via SHA-256 content hashing
- Rejection reasons: too_many_tokens (30,637), boilerplate (1,373), duplicate (59)
## Built By
Faaz - MINDIGENOUS.AI
Mumbai, India β April 2026
"""
# ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
def load_token() -> str:
"""Load HF token from .env."""
load_dotenv(ENV_FILE)
token = os.getenv("HUGGINGFACE_TOKEN") or os.getenv("HF_TOKEN")
if not token:
print("ERROR: No HUGGINGFACE_TOKEN or HF_TOKEN found in .env")
sys.exit(1)
return token
def ensure_repo(api: HfApi, repo_id: str, repo_type: str, token: str):
"""Create repo if it doesn't exist."""
try:
create_repo(
repo_id=repo_id,
repo_type=repo_type,
private=True,
token=token,
exist_ok=True,
)
print(f" Repo ready: {repo_id} ({repo_type})")
except Exception as e:
print(f" Repo create/check: {e}")
def upload_folder(api: HfApi, local: Path, remote: str, repo_id: str,
repo_type: str, token: str):
"""Upload a local folder to HF repo."""
if not local.exists():
print(f" SKIP (not found): {local}")
return
label = str(local.relative_to(PROJECT_ROOT))
print(f" Uploading {label}/ to {repo_type} repo ... ", end="", flush=True)
t0 = time.time()
api.upload_folder(
repo_id=repo_id,
repo_type=repo_type,
folder_path=str(local),
path_in_repo=remote,
token=token,
ignore_patterns=["__pycache__", "*.pyc", ".git"],
)
print(f"done ({time.time() - t0:.1f}s)")
def upload_file(api: HfApi, local: Path, remote: str, repo_id: str,
repo_type: str, token: str):
"""Upload a single file to HF repo."""
if not local.exists():
print(f" SKIP (not found): {local.name}")
return
size_mb = local.stat().st_size / (1024 * 1024)
label = str(local.relative_to(PROJECT_ROOT))
print(f" Uploading {label} ({size_mb:.1f} MB) to {repo_type} repo ... ",
end="", flush=True)
t0 = time.time()
api.upload_file(
repo_id=repo_id,
repo_type=repo_type,
path_or_fileobj=str(local),
path_in_repo=remote,
token=token,
)
print(f"done ({time.time() - t0:.1f}s)")
def upload_readme(api: HfApi, content: str, repo_id: str,
repo_type: str, token: str):
"""Upload a README.md string to a repo."""
print(f" Uploading README.md to {repo_type} repo ... ", end="", flush=True)
api.upload_file(
repo_id=repo_id,
repo_type=repo_type,
path_or_fileobj=content.encode("utf-8"),
path_in_repo="README.md",
token=token,
)
print("done")
# ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
def main():
print("=" * 60)
print(" MINDI 1.5 β Upload Everything to HuggingFace")
print("=" * 60)
print()
token = load_token()
api = HfApi()
# ββ Create repos βββββββββββββββββββββββββββββββββββββββββββββββ
print("[1/4] Creating repositories ...")
ensure_repo(api, MODEL_REPO, "model", token)
ensure_repo(api, DATASET_REPO, "dataset", token)
print()
# ββ REPO 1: Model (code + configs) βββββββββββββββββββββββββββββ
print("[2/4] Uploading to MODEL repo:", MODEL_REPO)
print("-" * 50)
# Folders
model_folders = [
(PROJECT_ROOT / "src", "src"),
(PROJECT_ROOT / "scripts", "scripts"),
(PROJECT_ROOT / "configs", "configs"),
(PROJECT_ROOT / "data" / "tokenizer", "data/tokenizer"),
(PROJECT_ROOT / "tests", "tests"),
(PROJECT_ROOT / "api", "api"),
]
for local, remote in model_folders:
upload_folder(api, local, remote, MODEL_REPO, "model", token)
# Single files
model_files = [
(PROJECT_ROOT / "requirements.txt", "requirements.txt"),
(PROJECT_ROOT / "setup.py", "setup.py"),
(PROJECT_ROOT / "activate_mindi.bat", "activate_mindi.bat"),
(PROJECT_ROOT / ".env.example", ".env.example"),
]
for local, remote in model_files:
upload_file(api, local, remote, MODEL_REPO, "model", token)
# setup_mi300x.sh
mi300x_sh = PROJECT_ROOT / "setup_mi300x.sh"
if mi300x_sh.exists():
upload_file(api, mi300x_sh, "setup_mi300x.sh", MODEL_REPO, "model", token)
# Model card replaces README.md
upload_readme(api, MODEL_CARD, MODEL_REPO, "model", token)
print()
# ββ REPO 2: Dataset ββββββββββββββββββββββββββββββββββββββββββββ
print("[3/4] Uploading to DATASET repo:", DATASET_REPO)
print("-" * 50)
processed = PROJECT_ROOT / "data" / "processed"
dataset_files = [
(processed / "train.jsonl", "processed/train.jsonl"),
(processed / "val.jsonl", "processed/val.jsonl"),
(processed / "test.jsonl", "processed/test.jsonl"),
(processed / "mindi_filtered.jsonl", "processed/mindi_filtered.jsonl"),
(processed / "filter_report.json", "processed/filter_report.json"),
(processed / "split_meta.json", "processed/split_meta.json"),
]
for local, remote in dataset_files:
upload_file(api, local, remote, DATASET_REPO, "dataset", token)
# Raw data folder
upload_folder(
api, PROJECT_ROOT / "data" / "raw", "raw",
DATASET_REPO, "dataset", token,
)
# Tokenizer copy in dataset repo
upload_folder(
api, PROJECT_ROOT / "data" / "tokenizer", "tokenizer",
DATASET_REPO, "dataset", token,
)
# Dataset card
upload_readme(api, DATASET_CARD, DATASET_REPO, "dataset", token)
print()
# ββ Done βββββββββββββββββββββββββββββββββββββββββββββββββββββββ
print("[4/4] Upload complete!")
print()
print("ββββββββββββββββββββββββββββββββββββββββ")
print("β UPLOAD COMPLETE! β")
print("β β")
print("β Model repo: β")
print("β huggingface.co/Mindigenous/ β")
print("β MINDI-1.5-Vision-Coder β")
print("β β")
print("β Dataset repo: β")
print("β huggingface.co/datasets/ β")
print("β Mindigenous/MINDI-1.5-training-data β")
print("β β")
print("β On MI300X just run: β")
print("β git clone https://huggingface.co/ β")
print("β Mindigenous/MINDI-1.5-Vision-Coder β")
print("β β")
print("β Ready to train! π β")
print("ββββββββββββββββββββββββββββββββββββββββ")
if __name__ == "__main__":
main()
|