Upload folder using huggingface_hub
Browse filesFiles changed (8)
- README.md+404-3
- config.jsonAdded+7
- onnx/safety_checker.onnxAdded+3
- onnx/text_encoder.onnxAdded+3
- onnx/unet.onnxAdded+3
- onnx/vae_decoder.onnxAdded+3
- onnx/vae_encoder.onnxAdded+3
- zhare-logo.pngAdded
123123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404---
license: creativeml-openrail-m
------license: creativeml-openrail-mbase_model: runwayml/stable-diffusion-v1-5library_name: transformers.jstags:- stable-diffusion- text-to-image- diffusion- webgpu- browser-ai- onnx- transformers.js- zhare-ai- client-side- privacy-preservingpipeline_tag: text-to-imageinference: falsewidget:- text: "A beautiful sunset over mountains, digital art style" example_title: "Mountain Sunset"- text: "A futuristic cityscape with flying cars at night, cyberpunk" example_title: "Cyberpunk City"- text: "A serene lake surrounded by autumn trees, oil painting" example_title: "Autumn Lake"- text: "Portrait of a wise elderly person, studio lighting, photorealistic" example_title: "Portrait"model-index:- name: sd-1-5-webgpu results: - task: type: text-to-image name: Text-to-Image Generation dataset: name: Browser Performance Benchmark type: webgpu-inference metrics: - type: generation-time value: 3-45 name: Generation Time (seconds) config: 512x512, 20 steps, various hardware - type: memory-usage value: 4-6 name: VRAM Usage (GB) config: WebGPU acceleration - type: model-size value: 3.5 name: Total Model Size (GB) config: All ONNX components---
<div align="center"> <img src="zhare-logo.png" alt="Zhare-AI Logo" width="200" height="auto" style="margin-bottom: 20px;"></div>
# Stable Diffusion 1.5 WebGPU by Zhare-AI
<div align="center"> 
**Privacy-preserving text-to-image generation in your browser with WebGPU acceleration**
</div>
This is a browser-optimized implementation of Stable Diffusion v1.5, specifically converted and optimized for client-side deployment using WebGPU acceleration. Developed by **Zhare-AI**, this model enables high-quality image generation directly in web browsers without requiring server infrastructure, ensuring complete user privacy and data sovereignty.
<div align="center"> <img src="zhare-logo.png" alt="Zhare-AI - Democratizing AI" width="150" height="auto"> <p><em>Democratizing AI through distributed computing and privacy-preserving technology</em></p></div>
## π Key Features
- π **Fully Client-Side**: Complete image generation in the browser, no data leaves your device- β‘ **WebGPU Accelerated**: Hardware-accelerated inference with automatic WebAssembly fallback - π **Privacy-First**: All processing happens locally, protecting user prompts and generated content- π± **Cross-Platform**: Compatible with desktop and mobile browsers- π οΈ **Production-Ready**: Optimized for real-world web applications- π **Transformers.js Compatible**: Direct integration with Hugging Face Transformers.js
## π Quick Start
### Installation & Setup
```bash# Clone or download the modelgit lfs installgit clone https://huggingface.co/Zhare-AI/sd-1-5-webgpu```
### Usage with Transformers.js
```javascriptimport { pipeline } from '@huggingface/transformers';
// Initialize the pipelineconst generator = await pipeline( 'text-to-image', 'Zhare-AI/sd-1-5-webgpu', { device: 'webgpu', dtype: 'fp16' });
// Generate an imageconst result = await generator( 'A majestic mountain landscape at sunrise, digital art', { num_inference_steps: 20, guidance_scale: 7.5, height: 512, width: 512 });
// Display the resultdocument.getElementById('output').src = result.images[0];```
### Advanced Configuration
```javascript// Custom generation parametersconst advancedOptions = { prompt: "A futuristic city with flying cars, neon lights, cyberpunk style", negative_prompt: "blurry, low quality, distorted, ugly, deformed", num_inference_steps: 25, guidance_scale: 8.0, height: 512, width: 512, seed: 12345, // For reproducible results // Memory optimization for lower-end devices enable_attention_slicing: true, enable_cpu_offload: false};
const image = await generator(advancedOptions.prompt, advancedOptions);```
## π Performance Specifications
### Model Architecture
| Component | Description | Approximate Size ||-----------|-------------|------------------|| **Text Encoder** | CLIP ViT-L/14 for text understanding | ~500MB || **UNet** | Core diffusion model for image generation | ~3.4GB || **VAE Decoder** | Converts latents to final images | ~160MB || **VAE Encoder** | Encodes images to latent space | ~160MB || **Safety Checker** | Content filtering (optional) | ~600MB |
**Total Model Size**: ~4.8GB (without safety checker: ~4.2GB)
### Browser Performance Benchmarks
*Generation time for 512Γ512 images with 20 inference steps:*
| Hardware Category | Example Device | Typical Performance ||------------------|----------------|-------------------|| **High-End Desktop** | RTX 4090, RTX 4080 | 3-8 seconds || **Gaming Desktop** | RTX 3080, RTX 3070 | 8-15 seconds || **Intel Arc GPUs** | Arc A750, Arc A770 | 8-15 seconds || **AMD High-End** | RX 7900 XT/XTX | 6-12 seconds || **Apple Silicon** | M2 Max, M1 Ultra | 10-20 seconds || **Integrated GPUs** | Intel Iris Xe | 25-50 seconds || **WebAssembly Fallback** | CPU-only devices | 2-10 minutes |
### System Requirements
- **Minimum VRAM**: 4GB (recommended: 6GB+)- **System RAM**: 8GB minimum, 16GB recommended- **Storage**: 5GB free space for model files- **Browser**: Chrome 113+, Edge 113+ (WebGPU), or any modern browser (WebAssembly fallback)
## π Browser Compatibility
| Browser | WebGPU Support | Performance Level | Notes ||---------|---------------|------------------|-------|| **Chrome 113+** | β
Full Support | Excellent | Primary recommendation || **Microsoft Edge 113+** | β
Full Support | Excellent | Primary recommendation || **Firefox 141+** | β
Stable Support | Very Good | Recent WebGPU implementation || **Safari 17.4+** | πΆ Experimental | Good | Behind feature flag || **Mobile Chrome 121+** | πΆ Limited | Fair | Android only, limited memory |
*All browsers support WebAssembly fallback for universal compatibility*
## βοΈ Configuration Options
### Generation Parameters
```javascriptconst generationConfig = { // Core settings num_inference_steps: 20, // 10-50 (quality vs speed trade-off) guidance_scale: 7.5, // 1.0-20.0 (prompt adherence) height: 512, // Must be multiple of 64 width: 512, // Must be multiple of 64 // Quality settings negative_prompt: "blurry, low quality, distorted", seed: undefined, // Random seed, or integer for reproducibility // Performance optimizations enable_attention_slicing: true, // Reduces VRAM usage enable_sequential_cpu_offload: false, // CPU fallback for components use_fp16: true // Half precision for speed/memory};```
### Memory Optimization
For devices with limited VRAM or older hardware:
```javascriptconst memoryOptimizedConfig = { num_inference_steps: 15, // Fewer steps = less memory guidance_scale: 7.0, // Slightly lower guidance enable_attention_slicing: true, // Essential for <6GB VRAM enable_sequential_cpu_offload: true, // Move components to CPU when needed use_safety_checker: false // Disable to save ~600MB};```
## π Model Details
### Training Information
This model is based on Stable Diffusion v1.5 with the following training characteristics:
- **Base Dataset**: LAION-5B filtered subset (~590M image-text pairs)- **Training Resolution**: 512Γ512 pixels- **Architecture**: Latent Diffusion Model with CLIP ViT-L/14 text encoder- **Precision**: Originally trained in FP32, optimized to FP16 for browser deployment
### Optimization for Web Deployment
- **ONNX Conversion**: Optimized computational graph for web inference- **WebGPU Kernels**: Custom compute shaders for GPU acceleration- **Memory Efficiency**: Attention slicing and dynamic memory management- **Cross-Platform**: WebAssembly fallback ensures universal browser support
## π‘οΈ Ethical Use and Safety
### Built-in Safety Features
- **Content Filter**: Optional NSFW detection and filtering- **Prompt Sanitization**: Basic filtering of potentially harmful prompts- **Local Processing**: No data transmission ensures privacy protection
### Responsible Use Guidelines
β
**Encouraged Uses:**- Creative art and design projects- Educational demonstrations of AI capabilities- Rapid prototyping for applications- Personal creative exploration- Research and development
β **Prohibited Uses:**- Creating harmful, offensive, or illegal content- Generating misleading information or deepfakes- Violating copyright or intellectual property rights- Any use that violates the CreativeML OpenRAIL-M license terms
### Privacy and Data Protection
- **Zero Data Collection**: All processing occurs locally in your browser- **No Server Communication**: Model runs entirely offline after initial download- **User Control**: Complete control over generated content and prompts- **GDPR Compliant**: No personal data processing or storage
## β οΈ Limitations and Considerations
### Technical Limitations
- **Resolution**: Optimized for 512Γ512 (other resolutions may reduce quality)- **Batch Size**: Single image generation only in browser environment- **Memory Constraints**: Limited by browser and device VRAM/RAM- **Generation Speed**: Slower than dedicated server hardware
### Content Limitations
- **Language Bias**: Best performance with English prompts- **Cultural Representation**: Training data may reflect Western/English-speaking biases- **Artistic Style**: Tendency toward photorealistic and digital art styles- **Consistency**: Multiple generations from same prompt may vary significantly
### Browser-Specific Considerations
- **WebGPU Availability**: Limited to supporting browsers and devices- **Memory Management**: Browser security limits may affect large model loading- **Performance Variance**: Significant variation across different devices and browsers
## π License: CreativeML OpenRAIL-M
This model is released under the **CreativeML OpenRAIL-M** license, which allows for:
β
**Permitted:**- Commercial and non-commercial use- Distribution and modification- Creation of derivative works- Integration into applications and services
π« **Restrictions:**- Must not be used to generate harmful content- Cannot be used for illegal activities- Must include license terms in any distribution- Derivative works must maintain the same license restrictions
**Full License Text**: Available at [CreativeML OpenRAIL-M License](https://huggingface.co/spaces/CompVis/stable-diffusion-license)
### License Compliance
When using this model:1. **Include License**: Provide license terms to end users2. **Respect Restrictions**: Ensure use cases comply with content restrictions3. **Derivative Works**: Apply same license to modified versions4. **Attribution**: Credit original Stable Diffusion creators and Zhare-AI adaptation
## π’ About Zhare-AI
<div align="center"> <img src="zhare-logo.png" alt="Zhare-AI" width="120" height="auto" style="margin: 20px 0;"></div>
**Zhare-AI** is focused on democratizing AI technology by making powerful models accessible directly in web browsers. Our mission is to enable privacy-preserving AI applications that put users in control of their data and creative processes.
- **Website**: [zhare.ai](https://zhare.ai)- **Focus**: Distributed AI computing and browser-based AI applications- **Philosophy**: Privacy-first, user-controlled AI experiences- **Vision**: Making AI accessible, private, and distributed
### Our Mission
We believe AI should be:- **Accessible** to everyone, regardless of infrastructure- **Private** with complete user data control- **Distributed** across devices rather than centralized servers- **Transparent** with open-source implementations
## π Citation and References
### Cite This Work
```bibtex@misc{zhare-ai-sd15-webgpu-2025, title={Stable Diffusion 1.5 WebGPU: Browser-Optimized Text-to-Image Generation}, author={Zhare-AI}, year={2025}, howpublished={\url{https://huggingface.co/Zhare-AI/sd-1-5-webgpu}}, note={WebGPU-optimized implementation for privacy-preserving browser-based image generation}}```
### Original Stable Diffusion Citation
```bibtex@InProceedings{Rombach_2022_CVPR, author = {Rombach, Robin and Blattmann, Andreas and Lorenz, Dominik and Esser, Patrick and Ommer, BjΓΆrn}, title = {High-Resolution Image Synthesis With Latent Diffusion Models}, booktitle = {Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR)}, month = {June}, year = {2022}, pages = {10684-10695}}```
## π€ Community and Support
### Getting Help
- **Issues**: Report technical problems via the repository issues- **Discussions**: Join the community discussion for tips and examples- **Documentation**: Comprehensive guides available in the repository
### Contributing
We welcome contributions to improve browser compatibility, performance, and user experience:
- Performance optimizations for different hardware- Browser compatibility improvements - Documentation enhancements- Example applications and tutorials
---
<div align="center"> <img src="zhare-logo.png" alt="Zhare-AI" width="100" height="auto"> **π Ready to create amazing images directly in your browser?**
*This model brings the power of Stable Diffusion to web applications while keeping your data completely private and secure.*
**Developed with β€οΈ by Zhare-AI for the open-source community**
[π Visit Zhare.ai](https://zhare.ai) | [π§ Contact Us](mailto:contact@zhare.ai) | [π¬ Join Discussion](https://github.com/Zhare-AI)
</div>1234567{ "model_type": "stable_diffusion", "pipeline_tag": "text-to-image", "intel_webgpu_optimized": true, "transformers_js_compatible": true, "framework": "Intel Web AI Showcase"}123version https://git-lfs.github.com/spec/v1oid sha256:caa59d6eafadea9c850dbafa5f1a71410000e15a714d469a6846d243daae4596size 1216647261123version https://git-lfs.github.com/spec/v1oid sha256:7c83ed133fd7a397ec1fd25eed7451936c066a9b5c2d06362a13e63ed4bddbf4size 492543235123version https://git-lfs.github.com/spec/v1oid sha256:dcc6e47bcd2f9137a0d2fd4bea29dd481f438baccd724b5320c0602d30379a8dsize 1088564123version https://git-lfs.github.com/spec/v1oid sha256:c4b6ca4aebff4a8850e7c92b8982c7afbcfc5c5cdd32ba66389988b92dabb300size 198078223123version https://git-lfs.github.com/spec/v1oid sha256:313d56e981fdb5d731a3ba117e15b4cf15d86fd7ba4cc654f0fb2f24af5afdadsize 136760348README.md+404-3
config.jsonAdded+7
onnx/safety_checker.onnxAdded+3
onnx/text_encoder.onnxAdded+3
onnx/unet.onnxAdded+3
onnx/vae_decoder.onnxAdded+3
onnx/vae_encoder.onnxAdded+3
zhare-logo.pngAdded
