PaddlePaddle / PaddleMIX

Paddle Multimodal Integration and eXploration, supporting mainstream multi-modal tasks, including end-to-end large-scale multi-modal pretrain models and diffusion model toolbox. Equipped with high performance and flexibility.
Apache License 2.0
362 stars 145 forks source link

blip2-caption-opt2.7b\processor\eval/image_preprocessor_config.json 404错误 #674

Closed flymorn closed 3 months ago

flymorn commented 3 months ago

运行示例程序 python automatic_label.py 时,出现错误:

Downloading image_preprocessor_config.json from https://bj.bcebos.com/paddlenlp/models/community/paddlemix/blip2-caption-opt2.7b\processor\eval/image_preprocessor_config.json Traceback (most recent call last): File "D:\Python\projects\PaddleMIX\PaddleMIX-2.0.0\paddlemix\processors\processing_utils.py", line 288, in get_processor_dict resolved_processor_file = get_path_from_url_with_filelock(processor_file, cache_dir) File "D:\Python\projects\PaddleMIX\PaddleMIX-2.0.0\paddlemix\utils\downloader.py", line 147, in get_path_from_url_with_filelock result = get_path_from_url(url=url, root_dir=root_dir, md5sum=md5sum, check_exist=check_exist) File "D:\Python\projects\PaddleMIX\PaddleMIX-2.0.0\paddlemix\utils\downloader.py", line 107, in get_path_from_url fullpath = _download(url, root_dir, md5sum) File "D:\Python\projects\PaddleMIX\PaddleMIX-2.0.0\paddlemix\utils\downloader.py", line 173, in _download raise RuntimeError("Downloading from {} failed with code " "{}!".format(url, req.status_code)) RuntimeError: Downloading from https://bj.bcebos.com/paddlenlp/models/community/paddlemix/blip2-caption-opt2.7b\processor\eval/image_preprocessor_config.json failed with code 404! 【貌似win下提示这个文件不存在】

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "automatic_label.py", line 39, in task = Appflow( File "D:\Python\projects\PaddleMIX\PaddleMIX-2.0.0\paddlemix\appflow\appflow.py", line 67, in init task_class( File "D:\Python\projects\PaddleMIX\PaddleMIX-2.0.0\paddlemix\appflow\image2text_generation.py", line 43, in init self._construct_processor(model) File "D:\Python\projects\PaddleMIX\PaddleMIX-2.0.0\paddlemix\appflow\image2text_generation.py", line 52, in _construct_processor image_processor = BlipImageProcessor.from_pretrained(os.path.join(model, "processor", "eval")) File "D:\Python\projects\PaddleMIX\PaddleMIX-2.0.0\paddlemix\processors\processing_utils.py", line 141, in from_pretrained processor_dict, kwargs = cls.get_processor_dict(pretrained_model_name_or_path, **kwargs) File "D:\Python\projects\PaddleMIX\PaddleMIX-2.0.0\paddlemix\processors\processing_utils.py", line 295, in get_processor_dict raise EnvironmentError( OSError: Can't load processor for 'paddlemix/blip2-caption-opt2.7b\processor\eval'. If you were trying to load it from 'BOS', make sure you don't have a local directory with the same name. Otherwise, make sure 'paddlemix/blip2-caption-opt2.7b\processor\eval' is the correct path to a directory containing a image_preprocessor_config.json file

环境 win10 : paddle2onnx 1.0.6 paddleaudio 1.1.0 paddlefsl 1.1.0 paddlehub 2.4.0 paddlemix 0.1.0 D:\Python\projects\PaddleMIX\PaddleMIX-2.0.0 paddlenlp 2.7.2 D:\Python\projects\PaddleNLP\PaddleNLP-2.7.2 paddlepaddle-gpu 3.0.0b1 paddlesde 0.2.5 paddleslim 2.6.0 paddlespeech 1.4.1 paddlespeech-feat 0.1.0 ppdiffusers 0.24.1 d:\python\projects\paddlemix\paddlemix-2.0.0\ppdiffusers

请排查下 ppdiffusers 0.24.1 版本是否有问题呢?

flymorn commented 3 months ago

应该是路径分隔符(\)导致的,解决方法: 手动下载上述json文件,复制到 C:\Users\用户\ .paddlemix\models\paddlemix\blip2-caption-opt2.7b\processor\eval\image_preprocessor_config.json 还有一个文件:text_preprocessor_config.json,类似处理。

JunnYu commented 3 months ago

@flymorn 当前下载逻辑应该不太适配 windows下, 当前代码这里应该有问题,os.path.join(model, "processor", "eval"),应该改成直接 "/".join([model, "processor", "eval"]) File "D:\Python\projects\PaddleMIX\PaddleMIX-2.0.0\paddlemix\appflow\image2text_generation.py", line 52, in _construct_processor image_processor = BlipImageProcessor.from_pretrained(os.path.join(model, "processor", "eval"))