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

Problem with skip_special_token in attribute method #293

Open
1 task done
rafikg opened this issue Nov 8, 2024 · 0 comments
Open
1 task done

Problem with skip_special_token in attribute method #293

rafikg opened this issue Nov 8, 2024 · 0 comments
Labels
question Further information is requested

Comments

@rafikg
Copy link

rafikg commented Nov 8, 2024

Question

MRE:

import inseq
from transformers import M2M100ForConditionalGeneration, M2M100Tokenizer
from inseq.data.aggregator import SequenceAttributionAggregator, SubwordAggregator
import torch
import numpy as np
model = M2M100ForConditionalGeneration.from_pretrained("facebook/m2m100_418M")
tokenizer = M2M100Tokenizer.from_pretrained("facebook/m2m100_418M")
tokenizer.src_lang = 'en'
tokenizer.tgt_lang = 'fr'
model = inseq.load_model(model=model,
                         tokenizer=tokenizer,
                         attribution_method="attention")
out = model.attribute(
    input_texts="Life is like a box of chocolates.",
    generated_texts="La vie est comme une boite de chocolats.",
    generation_args={"forced_bos_token_id": tokenizer.get_lang_id("fr")},
    attribute_target=False,
    show_progress=True,
    skip_special_tokens=True # 
)
**with skip_sepcial_toekns = True and generated_text is not None**
Working well without special tokens in the table. Generate warning as skip_special_tokens is not used!! 

**with skip_sepcial_toekns = True and generated_text is  None**
I have empty table.

**with skip_sepcial_toekns = False and generated_text is  None**
Working well but with special character in the table.



agg = SubwordAggregator()
agg_out = agg.aggregate(attr=out.sequence_attributions[0])
agg_out.show(do_aggregation=True)
  • I've searched the project's issues.
@rafikg rafikg added the question Further information is requested label Nov 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

1 participant