-
Notifications
You must be signed in to change notification settings - Fork 4
Open
Description
Hello,
when running python trainer_finetune.py
, I first hit the following error:
Traceback (most recent call last):
File "/content/PAED/trainer_finetune.py", line 28, in <module>
from dataset import ExtDataTr, VAEData, get_dataloader
File "/content/PAED/dataset.py", line 18, in <module>
from encoding import ExtractEncoder
File "/content/PAED/encoding.py", line 11, in <module>
from transformer_base import run_summarization
File "/content/PAED/transformer_base/run_summarization.py", line 37, in <module>
from cst_trainer import CustomTrainer
File "/content/PAED/cst_trainer.py", line 32, in <module>
from transformers.trainer_pt_utils import IterableDatasetShard, get_model_param_count, nested_detach
ImportError: cannot import name 'get_model_param_count' from 'transformers.trainer_pt_utils' (/usr/local/lib/python3.10/dist-packages/transformers/trainer_pt_utils.py)
I temporarily resolved this by removing the get_model_param_count
. After fixing a further error rooted in wrapper.py
where the if statement at the end was empty, I finally, get the following error:
Traceback (most recent call last):
File "/usr/local/lib/python3.10/dist-packages/transformers/utils/import_utils.py", line 1031, in _get_module
return importlib.import_module("." + module_name, self.__name__)
File "/usr/lib/python3.10/importlib/__init__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1050, in _gcd_import
File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
File "<frozen importlib._bootstrap>", line 1006, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 688, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 883, in exec_module
File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
File "/usr/local/lib/python3.10/dist-packages/transformers/models/gpt2/modeling_tf_gpt2.py", line 30, in <module>
from ...modeling_tf_utils import (
File "/usr/local/lib/python3.10/dist-packages/transformers/modeling_tf_utils.py", line 39, in <module>
from keras.saving.hdf5_format import save_attributes_to_hdf5_group
ModuleNotFoundError: No module named 'keras.saving.hdf5_format'
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/content/PAED/trainer_finetune.py", line 735, in <module>
main(
File "/content/PAED/trainer_finetune.py", line 599, in main
gen_synthetic(save_dir, path_train, path_dev, path_test)
File "/content/PAED/trainer_finetune.py", line 584, in gen_synthetic
generator.generate(labels_dev + labels_test, path_out=path_synthetic)
File "/content/PAED/wrapper.py", line 207, in generate
pipe = model.make_pipe()
File "/content/PAED/modeling.py", line 52, in make_pipe
pipe = pipeline(
File "/usr/local/lib/python3.10/dist-packages/transformers/pipelines/__init__.py", line 702, in pipeline
framework, model = infer_framework_load_model(
File "/usr/local/lib/python3.10/dist-packages/transformers/pipelines/base.py", line 233, in infer_framework_load_model
_class = getattr(transformers_module, f"TF{architecture}", None)
File "/usr/local/lib/python3.10/dist-packages/transformers/utils/import_utils.py", line 1022, in __getattr__
value = getattr(module, name)
File "/usr/local/lib/python3.10/dist-packages/transformers/utils/import_utils.py", line 1021, in __getattr__
module = self._get_module(self._class_to_module[name])
File "/usr/local/lib/python3.10/dist-packages/transformers/utils/import_utils.py", line 1033, in _get_module
raise RuntimeError(
RuntimeError: Failed to import transformers.models.gpt2.modeling_tf_gpt2 because of the following error (look up to see its traceback):
No module named 'keras.saving.hdf5_format'
The versions of Python and requirements I am using align with the ones you have specified:
Python 3.10.12
Transformers version: 4.22.2
Tensorflow version: 2.17.1
Torch version: 2.5.1+cu121
fastavro==1.4.0
fire==0.4.0
nltk==3.6.6
lxml==4.6.5
editdistance==0.5.3
seqeval==1.2.2
and the latest versions of the following libraries that pip
installs:
datasets
pydantic
pyyaml
tqdm
spacy
jsonlines
scikit-learn
Could you please provide guidance on resolving the compatibility issues and ensure the script runs as expected? Let me know if additional details are needed to reproduce the errors.
Thanks!
Metadata
Metadata
Assignees
Labels
No labels