Skip to content

Commit

Permalink
Fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
gsarti committed Aug 13, 2024
1 parent e0b25d2 commit b1d8dac
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,7 @@ All commands support the full range of parameters available for `attribute`, att

**Result:**

<img src="https://raw.githubusercontent.com/inseq-team/inseq/main/docs/source/images/attribute_context_hospital_output.png" style="width:300px">
<img src="https://raw.githubusercontent.com/inseq-team/inseq/main/docs/source/images/attribute_context_hospital_output.png" style="width:500px">
</details>

## Planned Development
Expand Down
7 changes: 7 additions & 0 deletions tests/commands/test_attribute_context.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ def test_in_out_ctx_encdec_whitespace_sep(encdec_model: MarianMTModel):
CCIOutput(
cti_idx=0,
cti_token="▁Où",
contrast_token="▁Où",
cti_score=1.36,
contextual_output="Où",
contextless_output="Où",
Expand Down Expand Up @@ -95,6 +96,7 @@ def test_in_ctx_deconly(deconly_model: GPT2LMHeadModel):
CCIOutput(
cti_idx=2,
cti_token="Ġhospital",
contrast_token="Ġoffice",
cti_score=0.55,
contextual_output="George was sick yesterday. His colleagues asked him to come to the hospital",
contextless_output="His colleagues asked him to come to the office",
Expand Down Expand Up @@ -164,6 +166,7 @@ def test_out_ctx_deconly(deconly_model: GPT2LMHeadModel):
CCIOutput(
cti_idx=1,
cti_token="Ġpairs",
contrast_token="Ġhorses",
cti_score=1.39,
contextual_output="Question: How many pairs of legs do 10 horses have?\nLet's think step by step:\n1. A horse has 4 legs.\n2. 10 horses have 40 legs.\n3. 40 legs make 20 pairs of legs.\n\nAnswer:\n20 pairs",
contextless_output="Question: How many pairs of legs do 10 horses have?\nAnswer:\n20 horses",
Expand Down Expand Up @@ -230,6 +233,7 @@ def test_in_out_ctx_deconly(deconly_model: GPT2LMHeadModel):
CCIOutput(
cti_idx=2,
cti_token="Ġfine",
contrast_token="Ġa",
cti_score=1.5,
contextual_output="George was sick yesterday. His colleagues asked him if something was wrong. He said he was fine",
contextless_output="His colleagues asked him if he was a",
Expand Down Expand Up @@ -269,6 +273,7 @@ def test_in_ctx_encdec_special_sep():
CCIOutput(
cti_idx=3,
cti_token="elles",
contrast_token="elles",
cti_score=0.32,
contextual_output="Où sont-elles",
contextless_output="Où sont-elles",
Expand Down Expand Up @@ -310,6 +315,7 @@ def test_in_out_ctx_encdec_special_sep():
CCIOutput(
cti_idx=3,
cti_token="elles",
contrast_token="ils",
cti_score=3.99,
contextual_output="Les filles étaient parties.<brk> Où sont-elles",
contextless_output="Où sont-ils",
Expand Down Expand Up @@ -352,6 +358,7 @@ def test_in_out_ctx_encdec_langtag_whitespace_sep():
CCIOutput(
cti_idx=4,
cti_token="elles",
contrast_token="ils",
cti_score=4.49,
contextual_output="Les filles étaient loin. Où sont-elles",
contextless_output="Où sont-ils",
Expand Down

0 comments on commit b1d8dac

Please sign in to comment.