Spaces:
Running on Zero
Running on Zero
File size: 1,600 Bytes
c58c39d 8f92c65 c58c39d 8f92c65 38c5f38 8f92c65 c58c39d 8f92c65 58529f7 8f92c65 c58c39d 38c5f38 c58c39d | 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 | """RAP RL checkpoint-240 on ZeroGPU; BF16 weights, no quantization."""
import spaces
import os
os.environ.setdefault('HF_HUB_DISABLE_PROGRESS_BARS','1')
os.environ.setdefault('TOKENIZERS_PARALLELISM','false')
import json
import shutil
import time
from pathlib import Path
import torch
import gradio as gr
import psutil
from transformers import AutoModelForImageTextToText, AutoProcessor
from demo_ui import build
REPO = "VincentHancoder/RAP-Qwen3.8-27B-RL"
REVISION = "50f3adc4ebb9b19e53ef9c21c293993a77bf3fd7"
print("STARTUP", json.dumps({"ram_gib": psutil.virtual_memory().total / 2**30,
"disk_free_gib": shutil.disk_usage(".").free / 2**30,
"torch": torch.__version__}), flush=True)
processor = AutoProcessor.from_pretrained(REPO, revision=REVISION, token=os.environ.get("HF_TOKEN"))
model = AutoModelForImageTextToText.from_pretrained(
REPO, revision=REVISION, token=os.environ.get("HF_TOKEN"), dtype=torch.bfloat16,
device_map="cuda:0", attn_implementation="sdpa",
)
model.eval()
model.config.use_cache = True
model.config.text_config.use_cache = True
print("RAP_MODEL_READY", flush=True)
demo, artifacts = build(model, processor)
demo.queue(default_concurrency_limit=1, max_size=8).launch(
show_error=False, max_file_size='40mb', ssr_mode=False,
allowed_paths=[str(artifacts),str(Path(__file__).parent/'examples')],
blocked_paths=[str(__import__('pathlib').Path(__file__).parent/'.runtime'),
'/root/.cache/huggingface','/home/user/.cache/huggingface',
'/etc','/proc','/sys'],
)
|