You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Seems like raw outputs of the model are being passed to NonOverlappingOutput implemented methods _is_goal_complete which subsequently calls word_difference_score with those tensors leading to split() being called on tensors giving TypeError: split() missing 1 required positional argument: 'split_size'. Let me know if there is something wrong while constructing the model_wrapper or if BART can be attacked using TextAttack?
import transformers
from transformers import BartForConditionalGeneration, BartTokenizer
import textattack
from textattack.attack_recipes.seq2sick_cheng_2018_blackbox import Seq2SickCheng2018BlackBox
# Define the input text and target summary
input_text = "ministers from the european union and its mediterranean neighbors gathered here under heavy security on monday for an unprecedented conference"
original_summary = "eu mediterranean nations meet for first-ever conference on cooperation."
# Load the Hugging Face BART model
# Load model, tokenizer, and model_wrapper
model = transformers.BartForConditionalGeneration.from_pretrained("facebook/bart-large-cnn")
tokenizer = transformers.BartTokenizer.from_pretrained("facebook/bart-large-cnn")
model_wrapper = textattack.models.wrappers.HuggingFaceModelWrapper(model, tokenizer)
# Specify the attack recipe and constraints
attack_recipe = Seq2SickCheng2018BlackBox.build(model_wrapper)
# Run the attack
result = attack_recipe.attack(input_text, original_summary)
# Print the result
print(result.__str__(color_method="ansi"))
The text was updated successfully, but these errors were encountered:
Seems like raw outputs of the model are being passed to
NonOverlappingOutput
implemented methods_is_goal_complete
which subsequently callsword_difference_score
with those tensors leading tosplit()
being called on tensors givingTypeError: split() missing 1 required positional argument: 'split_size'
. Let me know if there is something wrong while constructing themodel_wrapper
or if BART can be attacked using TextAttack?The text was updated successfully, but these errors were encountered: