Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make flax from_pretrained work with local subfolder #608

Merged
merged 1 commit into from
Sep 22, 2022

Conversation

mishig25
Copy link
Contributor

@mishig25 mishig25 commented Sep 21, 2022

from diffusers import FlaxUNet2DConditionModel

model, params = FlaxUNet2DConditionModel.from_pretrained("/home/mishig/sd-v1-4-flax", subfolder="unet")

on main, this would raise an error saying that /home/mishig/sd-v1-4-flax/{FLAX_MODEL} does not exist because it was not respecting argument subfolder when checking locally

Pytorch version already handled it correctly:

elif subfolder is not None and os.path.isfile(
os.path.join(pretrained_model_name_or_path, subfolder, WEIGHTS_NAME)
):
model_file = os.path.join(pretrained_model_name_or_path, subfolder, WEIGHTS_NAME)

@HuggingFaceDocBuilderDev
Copy link

HuggingFaceDocBuilderDev commented Sep 21, 2022

The documentation is not available anymore as the PR was closed or merged.

Copy link
Contributor

@patil-suraj patil-suraj left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very cool, thanks a lot for fixing this!

@patil-suraj patil-suraj merged commit 4b8880a into main Sep 22, 2022
@patil-suraj patil-suraj deleted the flax_from_subfolder branch September 22, 2022 09:44
yoonseokjin pushed a commit to yoonseokjin/diffusers that referenced this pull request Dec 25, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants