PaddleNLP icon indicating copy to clipboard operation
PaddleNLP copied to clipboard

[Question]: stable-diffusion-v1-5

Open zcswdt opened this issue 3 years ago • 9 comments

请提出你的问题

请问这个模型是如何下载呢?我去了diffusion官网,是下载如下的模型吗?如果不是,该zen'm怎么下载呢? image

zcswdt avatar Oct 27 '22 14:10 zcswdt

你好,你是需要下载原版模型吗?还是要下载paddle版本的模型? 如果是当前paddle版本的话,目前还没有统一的下载方式。 你可以在机器上

from ppdiffusers import StableDiffusionPipeline

pipe = StableDiffusionPipeline.from_pretrained("runwayml/stable-diffusion-v1-5")
pipe.save_pretrained("你需要保存的文件夹地址")

JunnYu avatar Oct 28 '22 08:10 JunnYu

pipe = StableDiffusionPipeline.from_pretrained("runwayml/stable-diffusion-v1-5")

您好,运行你这个代码,还是下载不了这个模型,我环境配置都没问题,请问怎么解决呢?或者是方便发给我一份模型吗?谢谢你。 image

zcswdt avatar Oct 31 '22 09:10 zcswdt

windwos环境下"/"可能跟linux不太一样,所以有问题, image 你好,我大约知道是什么问题了,我给你个脚本吧,可以下载

JunnYu avatar Oct 31 '22 12:10 JunnYu

windwos环境下"/"可能跟linux不太一样,所以有问题, image 你好,我大约知道是什么问题了,我给你个脚本吧,可以下载

我邮箱[email protected]

谢谢谢谢!脚本可以发给我邮箱吗?[email protected]

zcswdt avatar Oct 31 '22 12:10 zcswdt

from paddlenlp.utils.downloader import get_path_from_url
def download(model_name, cache_dir):
    file = [
     'model_index.json',
     'tokenizer/vocab.json',
     'tokenizer/special_tokens_map.json',
     'tokenizer/merges.txt',
     'tokenizer/tokenizer_config.json',
     'tokenizer/added_tokens.json',
     'text_encoder/model_config.json',
     'text_encoder/model_state.pdparams',
     'unet/model_state.pdparams',
     'unet/config.json',
     'feature_extractor/preprocessor_config.json',
     'safety_checker/model_config.json',
     'safety_checker/model_state.pdparams',
     'scheduler/scheduler_config.json',
     'vae/model_state.pdparams',
     'vae/config.json']
    base_url = "https://bj.bcebos.com/paddlenlp/models/community/"
    for f in file:
        url = base_url + model_name + "/" + f
        suffix = f.split("/")[0]
        new_cache_dir = cache_dir + "/" + suffix if suffix!='model_index.json' else cache_dir
        get_path_from_url(url, new_cache_dir)
        
# 输入你的想要下载的模型名称
model_name = "runwayml/stable-diffusion-v1-5"
# 保存的路径
cache_dir = "./stable-diffusion-v1-5"
download(model_name, cache_dir)

JunnYu avatar Oct 31 '22 13:10 JunnYu

from paddlenlp.utils.downloader import get_path_from_url
def download(model_name, cache_dir):
    file = [
     'model_index.json',
     'tokenizer/vocab.json',
     'tokenizer/special_tokens_map.json',
     'tokenizer/merges.txt',
     'tokenizer/tokenizer_config.json',
     'tokenizer/added_tokens.json',
     'text_encoder/model_config.json',
     'text_encoder/model_state.pdparams',
     'unet/model_state.pdparams',
     'unet/config.json',
     'feature_extractor/preprocessor_config.json',
     'safety_checker/model_config.json',
     'safety_checker/model_state.pdparams',
     'scheduler/scheduler_config.json',
     'vae/model_state.pdparams',
     'vae/config.json']
    base_url = "https://bj.bcebos.com/paddlenlp/models/community/"
    for f in file:
        url = base_url + model_name + "/" + f
        suffix = f.split("/")[0]
        new_cache_dir = cache_dir + "/" + suffix if suffix!='model_index.json' else cache_dir
        get_path_from_url(url, new_cache_dir)
        
# 输入你的想要下载的模型名称
model_name = "runwayml/stable-diffusion-v1-5"
# 保存的路径
cache_dir = "./stable-diffusion-v1-5"
download(model_name, cache_dir)

您好,我下载玩模型了,加载模型的这个函数,pipe = StableDiffusionPipeline.from_pretrained("路径"),这“路径”是替换模型的路径吗?

zcswdt avatar Oct 31 '22 13:10 zcswdt

from paddlenlp.utils.downloader import get_path_from_url
# 输入你的想要下载的模型名称
model_name = "runwayml/stable-diffusion-v1-5"
# 保存的路径
cache_dir = "./stable-diffusion-v1-5"
download(model_name, cache_dir)

您好,我下载玩模型了,加载模型的这个函数,pipe = StableDiffusionPipeline.from_pretrained("路径"),这“路径”是替换模型的路径吗?

zcswdt avatar Oct 31 '22 13:10 zcswdt

是的,替换成cache_dir = "./stable-diffusion-v1-5",这个路径,当然你也可以改名字

JunnYu avatar Oct 31 '22 13:10 JunnYu

是的,替换成cache_dir = "./stable-diffusion-v1-5",这个路径,当然你也可以改名字

好的,那谢谢你了!可以加个V吗?如果可以,可以给V发到我邮箱,[email protected],我加你,谢谢了!

zcswdt avatar Oct 31 '22 13:10 zcswdt

This issue is stale because it has been open for 60 days with no activity. 当前issue 60天内无活动,被标记为stale。

github-actions[bot] avatar Dec 30 '22 16:12 github-actions[bot]

This issue was closed because it has been inactive for 14 days since being marked as stale. 当前issue 被标记为stale已有14天,即将关闭。

github-actions[bot] avatar Jan 15 '23 09:01 github-actions[bot]