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 146 forks source link

import paddlemix 报错 #86

Closed skywalk163 closed 10 months ago

skywalk163 commented 1 year ago

import paddlemix 报错

git下载2023.8.18日PaddleMIX库文件,cd PaddleMIX && pip install -e . 安装。

使用的是启智平台: Python 3.10.10 NVIDIA-SMI 450.80.02 Driver Version: 450.80.02 CUDA Version: 11.0

pip库情况:

paddle-bfloat                  0.1.7
paddle-pipelines               0.5.3
paddle2onnx                    1.0.8
paddlefsl                      1.1.0
paddlemix                      0.1.0          /code/PaddleMIX
paddlenlp                      2.6.0rc0.post0
paddleocr                      2.6.1.3
paddlepaddle-gpu               2.5.1.post117
numpy                          1.24.3

报错信息

---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
Cell In[1], line 1
----> 1 from paddlemix import Appflow

File /code/PaddleMIX/paddlemix/__init__.py:16
      1 # copyright (c) 2023 paddlepaddle authors. all rights reserved.
      2 # copyright 2023 the salesforce team authors and the huggingface team. all rights reserved.
      3 #
   (...)
     13 # see the license for the specific language governing permissions and
     14 # limitations under the license.
---> 16 from .appflow import *
     17 from .datasets import *
     18 from .models import *

File /code/PaddleMIX/paddlemix/appflow/__init__.py:15
      1 # Copyright (c) 2023 PaddlePaddle Authors. All Rights Reserved.
      2 #
      3 # Licensed under the Apache License, Version 2.0 (the "License");
   (...)
     12 # See the License for the specific language governing permissions and
     13 # limitations under the License.
---> 15 from .appflow import Appflow

File /code/PaddleMIX/paddlemix/appflow/appflow.py:20
     16 import paddle
     18 from paddlemix.utils.tools import get_env_device
---> 20 from .configuration import APPLICATIONS
     23 class Appflow(object):
     24     """
     25     Args:
     26         app (str): The app name for the Appflow, and get the task class from the name.
   (...)
     32 
     33     """

File /code/PaddleMIX/paddlemix/appflow/configuration.py:20
     15 from .image2image_text_guided_generation import (
     16     StableDiffusionImg2ImgTask,
     17     StableDiffusionUpscaleTask,
     18 )
     19 from .image2text_generation import Blip2CaptionTask
---> 20 from .openset_det_sam import OpenSetDetTask, OpenSetSegTask
     21 from .text2image_generation import StableDiffusionTask, VersatileDiffusionDualGuidedTask
     22 from .text2image_inpaiting import StableDiffusionInpaintTask

File /code/PaddleMIX/paddlemix/appflow/openset_det_sam.py:18
     15 import paddle
     16 import paddle.nn.functional as F
---> 18 from paddlemix.models.groundingdino.modeling import GroundingDinoModel
     19 from paddlemix.models.sam.modeling import SamModel
     20 from paddlemix.processors.groundingdino_processing import GroudingDinoProcessor

File /code/PaddleMIX/paddlemix/models/groundingdino/modeling.py:26
     23 from paddlenlp.utils.initializer import constant_, xavier_uniform_
     25 from .backbone import build_backbone
---> 26 from .bertwarper import BertModelWarper
     27 from .configuration import GroundingDinoConfig
     28 from .transformer import build_transformer

File /code/PaddleMIX/paddlemix/models/groundingdino/bertwarper.py:21
     16 import paddle.nn as nn
     17 from paddlenlp.transformers.model_outputs import (
     18     BaseModelOutputWithPoolingAndCrossAttentions,
     19 )
---> 21 from .bert_model import BertModel
     24 class BertModelWarper(nn.Layer):
     25     def __init__(self, bert_model):

File /code/PaddleMIX/paddlemix/models/groundingdino/bert_model.py:455
    451         pooled_output = self.activation(pooled_output)
    452         return pooled_output
--> 455 class BertModel(nn.Layer):
    456     """
    457 
    458     The model can behave as an encoder (with only self-attention) as well as a decoder, in which case a layer of
   (...)
    465     `add_cross_attention` set to `True`; an `encoder_hidden_states` is then expected as an input to the forward pass.
    466     """
    468     def __init__(self, config, add_pooling_layer=True):

File /code/PaddleMIX/paddlemix/models/groundingdino/bert_model.py:495, in BertModel()
    487     for layer, heads in heads_to_prune.items():
    488         self.encoder.layer[layer].attention.prune_heads(heads)
    490 def get_extended_attention_mask(
    491     self,
    492     attention_mask: paddle.Tensor,
    493     input_shape: Tuple[int],
    494     device: str = None,
--> 495     dtype: np.float = None,
    496 ) -> paddle.Tensor:
    497     if dtype is None:
    498         dtype = np.float32

File /opt/conda/lib/python3.10/site-packages/numpy/__init__.py:305, in __getattr__(attr)
    300     warnings.warn(
    301         f"In the future `np.{attr}` will be defined as the "
    302         "corresponding NumPy scalar.", FutureWarning, stacklevel=2)
    304 if attr in __former_attrs__:
--> 305     raise AttributeError(__former_attrs__[attr])
    307 # Importing Tester requires importing all of UnitTest which is not a
    308 # cheap import Since it is mainly used in test suits, we lazy import it
    309 # here to save on the order of 10 ms of import time for most users
    310 #
    311 # The previous way Tester was imported also had a side effect of adding
    312 # the full `numpy.testing` namespace
    313 if attr == 'testing':

AttributeError: module 'numpy' has no attribute 'float'.
`np.float` was a deprecated alias for the builtin `float`. To avoid this error in existing code, use `float` by itself. Doing this will not modify any behavior and is safe. If you specifically wanted the numpy scalar type, use `np.float64` here.
The aliases was originally deprecated in NumPy 1.20; for more details and guidance see the original release note at:
    https://numpy.org/devdocs/release/1.20.0-notes.html#deprecations
jerrywgz commented 1 year ago

https://github.com/PaddlePaddle/PaddleMIX/pull/87 已修复,感谢反馈