Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: Krishna/swift-coreml-diffusers
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: main
Choose a base ref
...
head repository: huggingface/swift-coreml-diffusers
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: main
Choose a head ref
Checking mergeability… Don’t worry, you can still create the pull request.
  • 15 commits
  • 29 files changed
  • 6 contributors

Commits on Jun 14, 2023

  1. Palettization Support (huggingface#49)

    * Add palettized model definitions.
    
    * Adapt to new API
    
    TODO: update SPM package dependency.
    
    * Allow download of private repos with HF token
    
    This is not exposed in the UI.
    
    * Use split_einsum_v2 when available
    
    * Minor README changes.
    
    * iOS: reduceMemory if models not quantized or < 6GB RAM
    
    * Only show quantized models in iOS 17, macOS 14.
    
    * Update ml-stable-diffusion package reference.
    
    * Update URLs of quantized models.
    pcuenca authored Jun 14, 2023
    Configuration menu
    Copy the full SHA
    e03c0e0 View commit details
    Browse the repository at this point in the history

Commits on Jun 15, 2023

  1. Add a quick "Copy to Clipboard" context menu. (huggingface#44)

    Add a "Copy to Clipboard" context menu.
    1ucas authored Jun 15, 2023
    Configuration menu
    Copy the full SHA
    1d89a52 View commit details
    Browse the repository at this point in the history

Commits on Jun 23, 2023

  1. Created Common group (huggingface#55)

    XCode file order update. Created a new "Common" group at the top level and moved all files that are assigned to both the Diffusion and the Diffusion-macOS targets into the common folder. Extracted from pull 51 - huggingface#51
    dolmere authored Jun 23, 2023
    Configuration menu
    Copy the full SHA
    8a684e9 View commit details
    Browse the repository at this point in the history

Commits on Jun 24, 2023

  1. Remove Path swift package (huggingface#56)

    * Remove Path swift package
    
    Path is useful shorthand for working with URLs. In this project Path is used in 3 files while basic URLs are used in the rest. SwiftUI.Path is a new addition causing occasional compiler issues trying to determine which API is being referenced. This submission removes the Path swift package from the project and updates all instances where Path was used to URL alternative code.
    
    * Added suggested modifications
    
    Added suggested modifications with a (commented out) check on prepare() to ensure that the constructed URLs match the expected format. huggingface#56
    
    * Update Diffusion-macOS/ControlsView.swift
    
    remove comment
    
    Co-authored-by: Pedro Cuenca <pedro@huggingface.co>
    
    * Update Diffusion/Common/Pipeline/PipelineLoader.swift
    
    remove debugging comments
    
    Co-authored-by: Pedro Cuenca <pedro@huggingface.co>
    
    * Update Diffusion/Common/Pipeline/PipelineLoader.swift
    
    cleanup on models folder location creation.
    
    Co-authored-by: Pedro Cuenca <pedro@huggingface.co>
    
    * Update Diffusion/Common/Pipeline/PipelineLoader.swift
    
    remove comment
    
    Co-authored-by: Pedro Cuenca <pedro@huggingface.co>
    
    ---------
    
    Co-authored-by: Pedro Cuenca <pedro@huggingface.co>
    dolmere and pcuenca authored Jun 24, 2023
    Configuration menu
    Copy the full SHA
    b9816f9 View commit details
    Browse the repository at this point in the history

Commits on Jul 12, 2023

  1. PromptTextField (huggingface#58)

    * PromptTextField
    
    huggingface#53
    Rather than limiting the prompt entry on textfield size limits or character limits this PR adds a token tracker.
    
    As the user enters prompts an indicator displays the current number of used tokens versus the maximum of 75.
    
    Tokens are calculated using the currently selected model.
    
    For the moment this is a short term goal to  expose the token count to the end user with a change of text color to warn of approaching or exceeding mac token count.
    
    Note that in a1111 they handle this by merging excessive tokens. "AUTOMATIC1111 has no token limits. If a prompt contains more than 75 tokens, the limit of the CLIP tokenizer, it will start a new chunk of another 75 tokens, so the new “limit” becomes 150. The process can continue forever or until your computer runs out of memory…
    
    Each chunk of 75 tokens is processed independently, and the resulting representations are concatenated before feeding into Stable Diffusion’s U-Net."
    
    * Update Diffusion-macOS/ControlsView.swift
    
    spacing
    
    Co-authored-by: Pedro Cuenca <pedro@huggingface.co>
    
    * Update Diffusion/Common/Views/PromptTextField.swift
    
    increase the mac token count to account for start and end tokens.
    
    Co-authored-by: Pedro Cuenca <pedro@huggingface.co>
    
    * Moved token count below textfield
    
    On macOS token count now displays below the textfield right aligned. On iOS the token count displays below the text field left aligned. The text color in the text field was changed from .white to .primary to avoid dark mode/light mode issues.
    
    On iOS a bug was fixed where the selected model was not matching due to changes in the way palettized models were being selected.
    
    * Correctly select palettized version when needed
    
    v21Palettized
    
    * Update Diffusion/Common/Views/PromptTextField.swift
    
    Comment spacing style guide compliance.
    
    Co-authored-by: Pedro Cuenca <pedro@huggingface.co>
    
    * Update Diffusion/Common/Views/PromptTextField.swift
    
    Comment spacing style guide compliance.
    
    Co-authored-by: Pedro Cuenca <pedro@huggingface.co>
    
    * Update Diffusion/Common/Views/PromptTextField.swift
    
    update token count on appear to ensure that the model (if present) at load is used for field token calculations.
    
    Co-authored-by: Pedro Cuenca <pedro@huggingface.co>
    
    * Remove duplicated lines in project
    
    ---------
    
    Co-authored-by: Pedro Cuenca <pedro@huggingface.co>
    dolmere and pcuenca authored Jul 12, 2023
    Configuration menu
    Copy the full SHA
    6cb0bdc View commit details
    Browse the repository at this point in the history
  2. Application support path fix (huggingface#60)

    * Application support path fix
    
    I discovered that post Path.swift fix the location of the default models folder was inconsistent. This PR creates a new internal API to access the user domain applicationSupportDirectory to improve consistency. If there is an issue with the user domain then this code will fall back to URL.applicationSupportDirectory but under normal operating conditions it should use the app bundle.
    
    In the previous code I was using URL.applicationSupportDirectory directly which results in
    /Users/<uname>/Library/Application Support/hs-diffusion-models
    
    Whereas the previous and correct usage is
    /Users/<uname>/Library/Application Support/<bundle identifier>hf-diffusion-models
    
    I've put the new applicationSupportURL function inside Settings. To access it use Settings.shared.applicationSupportURL()
    
    Is Settings.shared a reasonable location for such an API? It's not quite a Util function.
    
    * Update Diffusion/Common/State.swift
    
    remove bundle identifier in path to ensure backward compatibility with current live release version.
    dolmere authored Jul 12, 2023
    Configuration menu
    Copy the full SHA
    333e40c View commit details
    Browse the repository at this point in the history

Commits on Jul 16, 2023

  1. Preview progress images (huggingface#65)

    * Render preview image per step, upgrade steps UI
    
    * Update UI for preview options
    
    * Reset preview image if disabled or at startup
    
    * Update preview for ios
    
    * Update preview help content text
    
    * Add new option for denoised intermediates
    
    * Cleanup edits from CR
    
    - Also includes new Package.resolved
    ZachNagengast authored Jul 16, 2023
    Configuration menu
    Copy the full SHA
    efba3c2 View commit details
    Browse the repository at this point in the history

Commits on Jul 26, 2023

  1. Uint32 Seed (huggingface#62)

    * Uint32 Seed
    
    Justification: The seed internally is changed between different number types with wildly different max values. This PR normalizes all of them to UInt32.
    
    Earlier @pcuenca commented that the reason for the lower precision use of Double was to support the CompactSlider component and make it easier for a user to select a number.
    
    In this submission the CompactSlider component has been swapped for a TextField.
    
    [Feature extracted from larger PR huggingface#59 huggingface#59]
    
    * Update ControlsView.swift
    
    Align the leading edge of the new TextField for seed value with the other controls.
    
    * marking functions as fileprivate
    
    Added a docc compatible comment for PipelineState enum.
     Internal functions that do no need external access marked as fileprivate.
    
    * Update Diffusion/Common/Pipeline/Pipeline.swift
    
    remove leftover debug comment line
    
    Co-authored-by: Pedro Cuenca <pedro@huggingface.co>
    
    * Update Diffusion/Common/State.swift
    
    personal preference in how to casr/declare type. (style guide needed)
    
    Co-authored-by: Pedro Cuenca <pedro@huggingface.co>
    
    * Update Diffusion/Common/State.swift
    
    remove cast
    
    Co-authored-by: Pedro Cuenca <pedro@huggingface.co>
    
    * Update Diffusion/Common/State.swift
    
    remove seed greater than zero check
    
    Co-authored-by: Pedro Cuenca <pedro@huggingface.co>
    
    * Update Diffusion-macOS/StatusView.swift
    
    remove unnecessary cast
    
    Co-authored-by: Pedro Cuenca <pedro@huggingface.co>
    
    * Update Diffusion-macOS/StatusView.swift
    
    remove unnecessary cast
    
    Co-authored-by: Pedro Cuenca <pedro@huggingface.co>
    
    * Suggested updates
    
    - seedBinding in ControlsView doesn't return an empty string but rather just the generation.seed value which won't be a nil value.
    - In StatusView when displaying the seed value it will be truncated to 3 places (1.134B, etc)
    - Comment describing the contents of GenerationState.complete(,,,) removed.
    - Addition of Double.reduceScale and general func formatLargeNumber(UInt32) -> String added to Utils
    
    * 1 is NOT Random
    
    @pcuenca caught an error in logic where the random seed trigger was being tested as "seed > 1" which would result in a seed of 0 or 1 generating a random seed. Changing to "seed > 0" (or seed >= 1) is the correct logic for 0 as random seed.
    
    ---------
    
    Co-authored-by: Pedro Cuenca <pedro@huggingface.co>
    dolmere and pcuenca authored Jul 26, 2023
    Configuration menu
    Copy the full SHA
    839c9ba View commit details
    Browse the repository at this point in the history

Commits on Jul 27, 2023

  1. SD XL support (huggingface#67)

    * Support SDXL base model.
    
    * Add support for 4.5 bit SDXL model.
    
    * Update package version
    pcuenca authored Jul 27, 2023
    Configuration menu
    Copy the full SHA
    b434cee View commit details
    Browse the repository at this point in the history

Commits on Jul 30, 2023

  1. Update Capabilities.swift so Xcode 13 can build the app (huggingface#66)

    Update Capabilities.swift
    
    Changed constant deviceSupportsQuantization to include word "return" so the project could be built using Xcode 13
    mattusi authored Jul 30, 2023
    Configuration menu
    Copy the full SHA
    e5f9a65 View commit details
    Browse the repository at this point in the history

Commits on Aug 1, 2023

  1. DiffusionImage (huggingface#64)

    * DiffusionImage
    
    Addition of DiffusionImage Model extracted from 59 huggingface#59
    
    * Update
    
    Latest DiffusionImage updates to support drag and drop and copy.
    
    * Update Diffusion/Common/DiffusionImage.swift
    
    Docc compatible comment style.
    
    Co-authored-by: Pedro Cuenca <pedro@huggingface.co>
    
    * Update Diffusion/Common/DiffusionImage.swift
    
    typo fixes in descriptive note
    
    Co-authored-by: Pedro Cuenca <pedro@huggingface.co>
    
    * Better comments
    
    Fleshing out docc compatible comments in new class. Also refactored two identical functions with different names.
    
    * Manual merge fix
    
    Fix from recent manual merge
    
    * Custom local enum created
    
    Diffusion_StableDiffusionScheduler created to get around a problem in a future PR for copy/paste and drag/drop with preserved "recipe" data about how the image was created.
    
    * Review suggestions
    
    This is a consolidated commit with the suggestions submitted in review.
    - Move as much platform specific code as possible out into target specific files.
    - Move save() and pngRepresentation() into separate platform specific files
    - Move platform specific protocol code out into separate file.
    
    * Less platform checks
    
    New Utils_iOS and Utils_macOS allow platform specific utility functions to live inside the target file structure.
    - added CGImage.fromData(Data) funcs for macOS/iOS
    - added new func inside StableDiffusionScheduler enum.
    - renamed Diffusion_StableDiffusionScheduler to StableDiffusionScheduler
    
    * Update Diffusion/Common/DiffusionImage.swift
    
    remove comment with answered question
    
    Co-authored-by: Pedro Cuenca <pedro@huggingface.co>
    
    * Update Diffusion-macOS/DiffusionImage+macOS.swift
    
    remove comment from self descriptive code
    
    Co-authored-by: Pedro Cuenca <pedro@huggingface.co>
    
    * Update Diffusion-macOS/DiffusionImage+macOS.swift
    
    remove comment from self descriptive code
    
    Co-authored-by: Pedro Cuenca <pedro@huggingface.co>
    
    * Update Diffusion/Common/DiffusionImage.swift
    
    more concise comment
    
    Co-authored-by: Pedro Cuenca <pedro@huggingface.co>
    
    ---------
    
    Co-authored-by: Pedro Cuenca <pedro@huggingface.co>
    dolmere and pcuenca authored Aug 1, 2023
    Configuration menu
    Copy the full SHA
    4eab476 View commit details
    Browse the repository at this point in the history

Commits on Aug 8, 2023

  1. Fix VAE scale factor for Stable Diffusion XL (huggingface#79)

    Fix vae scale factor for Stable Diffusion XL
    
    Colors are much better now.
    
    See apple/ml-stable-diffusion@ce8ee78
    pcuenca authored Aug 8, 2023
    Configuration menu
    Copy the full SHA
    4202e12 View commit details
    Browse the repository at this point in the history

Commits on Sep 28, 2023

  1. SDXL for iOS, and refiner for Mac (huggingface#83)

    * Bring model definitions over from benchmark branch
    
    * PrompTextField uses location from PipelineLoader
    
    This could be merged in main.
    
    * Fix potential model mismatch.
    
    * Disable previews only on iOS
    
    * Fix macOS build
    
    * Update package
    
    * Enable SDXL on big iPhones
    
    * Update model description
    
    * Refiner model
    
    * Use Karras by default for XL models
    
    * Update URL
    pcuenca authored Sep 28, 2023
    Configuration menu
    Copy the full SHA
    d041577 View commit details
    Browse the repository at this point in the history

Commits on Feb 9, 2024

  1. Update package versions

    pcuenca committed Feb 9, 2024
    Configuration menu
    Copy the full SHA
    17ee716 View commit details
    Browse the repository at this point in the history

Commits on Jun 25, 2024

  1. Add sd3 pipeline and models (huggingface#96)

    * Add sd3 pipeline and models
    
    * Add sd3 pipeline and models
    
    * Update minimum deployment target for macOS
    
    * Add checks for ANE support when selecting compute unit
    
    * Fix progress for non-background downloads
    ZachNagengast authored Jun 25, 2024
    Configuration menu
    Copy the full SHA
    a561fae View commit details
    Browse the repository at this point in the history
Loading