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

Adds HuggingFace pretrained encoder unit tests #2962

Merged
merged 17 commits into from
Jan 24, 2023
Merged

Conversation

geoffreyangus
Copy link
Contributor

No description provided.

@geoffreyangus geoffreyangus requested review from arnavgarg1, justinxzhao and jeffkinnison and removed request for arnavgarg1 January 19, 2023 17:02
@geoffreyangus geoffreyangus changed the title Update camembert HF repository Update camembert name; add unit tests Jan 19, 2023
@geoffreyangus geoffreyangus marked this pull request as ready for review January 19, 2023 18:38
@github-actions
Copy link

github-actions bot commented Jan 19, 2023

Unit Test Results

         6 files  +    1           6 suites  +1   5h 13m 15s ⏱️ + 1h 4m 17s
  3 933 tests +  31    3 877 ✔️ +  49    56 💤  - 18  0 ±0 
11 796 runs  +283  11 628 ✔️ +314  168 💤  - 31  0 ±0 

Results for commit 8b8e44f. ± Comparison against base commit 26b36c3.

♻️ This comment has been updated with latest results.

@geoffreyangus geoffreyangus changed the title Update camembert name; add unit tests Adds HuggingFace pretrained encoder unit tests Jan 19, 2023
@arnavgarg1
Copy link
Contributor

Can you considering adding this one as well?

@pytest.mark.parametrize(
    "encoder_config_cls, encoder_cls",
    [
        (text_encoders_configs.ALBERTConfig, text_encoders.ALBERTEncoder),
        (text_encoders_configs.BERTConfig, text_encoders.BERTEncoder),
        (text_encoders_configs.XLMConfig, text_encoders.XLMEncoder),
        (text_encoders_configs.GPTConfig, text_encoders.GPTEncoder),
        (text_encoders_configs.RoBERTaConfig, text_encoders.RoBERTaEncoder),
        (text_encoders_configs.GPT2Config, text_encoders.GPT2Encoder),
        (text_encoders_configs.DistilBERTConfig, text_encoders.DistilBERTEncoder),
        (text_encoders_configs.TransformerXLConfig, text_encoders.TransformerXLEncoder),
        (text_encoders_configs.CTRLConfig, text_encoders.CTRLEncoder),
        (text_encoders_configs.CamemBERTConfig, text_encoders.CamemBERTEncoder),
        (text_encoders_configs.MT5Config, text_encoders.MT5Encoder),
        (text_encoders_configs.XLMRoBERTaConfig, text_encoders.XLMRoBERTaEncoder),
        (text_encoders_configs.LongformerConfig, text_encoders.LongformerEncoder),
        (text_encoders_configs.ELECTRAConfig, text_encoders.ELECTRAEncoder),
        (text_encoders_configs.FlauBERTConfig, text_encoders.FlauBERTEncoder),
        (text_encoders_configs.T5Config, text_encoders.T5Encoder),
        (text_encoders_configs.XLNetConfig, text_encoders.XLNetEncoder),
        (text_encoders_configs.DistilBERTConfig, text_encoders.DistilBERTEncoder),
    ],
)
def test_hf_default_reduce_output_strategy(
    encoder_config_cls: text_encoders_configs.BaseEncoderConfig, encoder_cls: text_encoders.HFTextEncoder
):
    """Test that default reduce_output strategy works for all text HFencoders."""
    reduce_output_strategy = encoder_config_cls.reduce_output
    encoder = encoder_cls(use_pretrained=False, reduce_output=reduce_output_strategy, max_sequence_length=20)
    inputs = torch.rand((2, 20)).type(encoder.input_dtype)
    encoder(inputs)

It may need some tweaking

@arnavgarg1
Copy link
Contributor

🚢

@geoffreyangus geoffreyangus merged commit dfa29d5 into master Jan 24, 2023
@geoffreyangus geoffreyangus deleted the camembert-update branch January 24, 2023 17:33
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

Successfully merging this pull request may close these issues.

5 participants