Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Attention mask not specified #368

Open
svenhakvoort opened this issue Dec 3, 2023 · 1 comment
Open

Attention mask not specified #368

svenhakvoort opened this issue Dec 3, 2023 · 1 comment

Comments

@svenhakvoort
Copy link

svenhakvoort commented Dec 3, 2023

We strongly recommend passing in an attention_mask since your input_ids may be padded, how to pass this in?

PyABSA Version (Required)

Python Version: 3.10
PyABSA Version: 2.3.4
Torch Version: 2.1.1
Transformers Version: 4.35.2

See the console output for PyABSA, Torch, Transformers Version

Code To Reproduce (Required)

base_model = 'yangheng/deberta-v3-large-absa-v1.1'
lcf = 'cdw'
model = APC.APCModelList.FAST_LSA_T
config = APC.APCConfigManager.get_apc_config_english()
config.lcf = lcf
config.model = model
config.pretrained_bert = base_model
config.evaluate_begin = 0
config.max_seq_len = 128
config.num_epoch = 30
config.similarity_threshold = 1
config.log_step = -1
config.patience = 5
config.dropout = 0.5
config.batch_size = 16
config.cache_dataset = False
config.l2reg = 1e-8
config.shuffle = True
config.dynamic_truncate = True
config.srd_alignment = True
config.use_torch_compile = False
config.seed = [random.randint(0, 10000) for _ in range(3)]

trainer = APC.APCTrainer(
              config=config,
              dataset=dataset,
              # from_checkpoint='english',
              checkpoint_save_mode=ModelSaveOption.SAVE_MODEL_STATE_DICT,
              # checkpoint_save_mode=ModelSaveOption.DO_NOT_SAVE_MODEL,
              path_to_save=f"checkpoints/{base_model}",
              auto_device=DeviceTypeOption.AUTO
          )

Full Console Output (Required)

Epoch:0 | Loss:0:   0%|          | 0/854 [00:00<?, ?it/s]We strongly recommend passing in an `attention_mask` since your input_ids may be padded. See

Describe the bug

Getting a message about missing attention_mask, how can i pass this in?
@yangheng95
Copy link
Owner

If you want to modify the attention mask, you need to revise the data_utils.py. Please debug to find the data_utils.py, which are different files for different tasks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants