Image-to-Image
Diffusers
Safetensors
StableDiffusionControlNetPipeline
controlnet
stable-diffusion
satellite-imagery
osm
Run this model with HF Jobs
Run MVRL/VectorSynth-COSA on Hugging Face's managed compute, monitor its progress, and retrieve the results when it's done.
Paste one of these prompts into your coding agent:
Fine-tune on my dataset
Use HF Jobs to fine-tune https://huggingface.co/MVRL/VectorSynth-COSA. Ask me which dataset to train on, then push the fine-tuned model to a new model repo. Run `hf jobs --help` first to learn the CLI.
Run batch inference
Use HF Jobs to run batch inference with https://huggingface.co/MVRL/VectorSynth-COSA on the inputs in a mounted HF Bucket. Ask me which Bucket to use, then write the outputs back to it and keep each input ID. Run `hf jobs --help` first to learn the CLI.
Instructions to use MVRL/VectorSynth-COSA with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Diffusers
How to use MVRL/VectorSynth-COSA with Diffusers:
pip install -U diffusers transformers accelerate
from diffusers import ControlNetModel, StableDiffusionControlNetPipeline controlnet = ControlNetModel.from_pretrained("MVRL/VectorSynth-COSA") pipe = StableDiffusionControlNetPipeline.from_pretrained( "stabilityai/stable-diffusion-2-1-base", controlnet=controlnet ) - Notebooks
- Google Colab
- Kaggle
Upload render.py with huggingface_hub
Browse files12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091import torchimport torch.nn as nnimport torch.nn.functional as F
class ResidualRenderBlock(nn.Module): def __init__(self, dim): super().__init__() self.block = nn.Sequential( nn.Conv2d(dim, dim, kernel_size=3, padding=1), nn.GroupNorm(8, dim), nn.SiLU(), nn.Conv2d(dim, dim, kernel_size=3, padding=1), nn.GroupNorm(8, dim) )
def forward(self, x): return x + self.block(x)
class RenderEncoder(nn.Module): def __init__(self, encoder_type="1d", in_channels=768, out_channels=3): super().__init__() self.encoder_type = encoder_type
if encoder_type == "1d": self.model = nn.Sequential( nn.Conv2d(in_channels, out_channels, kernel_size=1), nn.Sigmoid() )
elif encoder_type == "residual": self.model = ResidualBlockRender(in_channels, out_channels)
elif encoder_type == "expressive": mid_channels = 256 self.model = nn.Sequential( nn.Conv2d(in_channels, mid_channels, kernel_size=3, padding=1), nn.GroupNorm(8, mid_channels), nn.SiLU(), ResidualRenderBlock(mid_channels), ResidualRenderBlock(mid_channels), ResidualRenderBlock(mid_channels), nn.Conv2d(mid_channels, out_channels, kernel_size=1), nn.Sigmoid() )
else: raise ValueError(f"Unknown encoder_type '{encoder_type}'. Use '1d', 'residual', or 'expressive'.")
def forward(self, x): return self.model(x)
class ResidualBlockRender(nn.Module): def __init__(self, in_channels=768, out_channels=3): super().__init__() self.conv1 = nn.Conv2d(in_channels, 256, kernel_size=3, padding=1) self.relu1 = nn.ReLU() self.conv2 = nn.Conv2d(256, 256, kernel_size=3, padding=1) self.relu2 = nn.ReLU() self.conv3 = nn.Conv2d(256, out_channels, kernel_size=1) self.out = nn.Sigmoid()
if in_channels != out_channels: self.residual_proj = nn.Conv2d(in_channels, out_channels, kernel_size=1) else: self.residual_proj = nn.Identity()
def forward(self, x): residual = self.residual_proj(x) h = self.relu1(self.conv1(x)) h = self.relu2(self.conv2(h)) h = self.conv3(h) h = h + residual return self.out(h)
def load_render_encoder(checkpoint_path, device='cpu'): """Load standalone RenderEncoder from checkpoint""" checkpoint = torch.load(checkpoint_path, map_location=device) config = checkpoint['model_config'] model = RenderEncoder( encoder_type=config['encoder_type'], in_channels=config['in_channels'], out_channels=config['out_channels'] ) model.load_state_dict(checkpoint['model_state_dict']) model.to(device) model.eval() print(f"Loaded RenderEncoder: {config}") return modelrender.pyAdded+91