HUSTAI / uie_pytorch

PaddleNLP UIE模型的PyTorch版实现
Apache License 2.0
586 stars 99 forks source link

报错module 'paddle.fluid.dygraph' has no attribute 'load_dygraph',请问怎么解决 #39

Open BearsEatLardCake opened 9 months ago

BearsEatLardCake commented 9 months ago

╭─────────────────────────────── Traceback (most recent call last) ────────────────────────────────╮ │ c:\Users\n\Desktop\uie_pytorch-main (1)\uie_predictor.py:680 in │ │ │ │ 677 │ args.schema = ['航母'] │ │ 678 │ args.schema_lang = "en" │ │ 679 │ uie = UIEPredictor(model=args.model, task_path=args.task_path, schema_lang=args.sche │ │ ❱ 680 │ │ │ │ │ position_prob=args.position_prob, max_seq_len=args.max_seq_len, b │ │ 681 │ print(uie("印媒所称的“印度第一艘国产航母”—“维克兰特”号")) │ │ 682 │ │ │ │ c:\Users\n\Desktop\uie_pytorch-main (1)\uie_predictor.py:147 in init │ │ │ │ 144 │ │ self._is_en = True if model in ['uie-base-en' │ │ 145 │ │ │ │ │ │ │ │ │ │ ] or schema_lang == 'en' else False │ │ 146 │ │ self.set_schema(schema) │ │ ❱ 147 │ │ self._prepare_predictor() │ │ 148 │ │ │ 149 │ def _prepare_predictor(self): │ │ 150 │ │ assert self._engine in ['pytorch', │ │ │ │ c:\Users\n\Desktop\uie_pytorch-main (1)\uie_predictor.py:158 in _prepare_predictor │ │ │ │ 155 │ │ │ if not os.path.exists(self._task_path): │ │ 156 │ │ │ │ from convert import check_model, extract_and_convert │ │ 157 │ │ │ │ check_model(self._model) │ │ ❱ 158 │ │ │ │ extract_and_convert(self._model, self._task_path) │ │ 159 │ │ │ │ 160 │ │ if self._multilingual: │ │ 161 │ │ │ from tokenizer import ErnieMTokenizerFast │ │ │ │ c:\Users\n\Desktop\uie_pytorch-main (1)\convert.py:292 in extract_and_convert │ │ │ │ 289 │ │ import paddle.fluid.dygraph as D │ │ 290 │ │ from paddle import fluid │ │ 291 │ │ with fluid.dygraph.guard(): │ │ ❱ 292 │ │ │ paddle_paddleparams, = D.load_dygraph( │ │ 293 │ │ │ │ os.path.join(input_dir, 'model_state')) │ │ 294 │ else: │ │ 295 │ │ paddle_paddle_params = pickle.load( │ ╰──────────────────────────────────────────────────────────────────────────────────────────────────╯ AttributeError: module 'paddle.fluid.dygraph' has no attribute 'load_dygraph'

zhuchenxi commented 5 months ago

同问

Chris-Mraz commented 3 months ago

同问,请问有办法解决吗