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

Adding span_srl task with tests, usage and documentation #226

Closed
wants to merge 36 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
07a4f2b
Adding span_srl task with tests, usage and documentation
ahmeshaf Jul 21, 2023
22cba55
Fixing minor issues
ahmeshaf Jul 25, 2023
917868b
adding example usage of SRL
ahmeshaf Jul 25, 2023
0ff46ad
Merging main
ahmeshaf Jul 25, 2023
b6f4f52
Fixing format warnings
ahmeshaf Jul 25, 2023
d803b23
Fixing format warnings
ahmeshaf Jul 25, 2023
53a494c
Fixing format warnings
ahmeshaf Jul 25, 2023
dd7d9fb
Fixing format warnings
ahmeshaf Jul 25, 2023
0ad6063
Fix Literal ImportError
ahmeshaf Jul 25, 2023
15412b5
Fix Label assignment
ahmeshaf Jul 25, 2023
fd19441
Fix the template's preamble
ahmeshaf Jul 25, 2023
b56c1d0
Black formatting
ahmeshaf Jul 25, 2023
d6564f7
imports in alphabetical order
ahmeshaf Jul 27, 2023
de68696
alignment_mode should be a Literal.
ahmeshaf Jul 27, 2023
ed07c83
Update spacy_llm/tasks/srl_task.py
ahmeshaf Jul 27, 2023
472d5c7
Update spacy_llm/tasks/templates/span-srl.v1.jinja
ahmeshaf Jul 27, 2023
55a8018
Update spacy_llm/tests/tasks/test_span_srl.py
ahmeshaf Jul 27, 2023
355241a
reformatting
ahmeshaf Jul 27, 2023
a63d610
Merge branch 'main' of github.com:ahmeshaf/spacy-llm
ahmeshaf Jul 27, 2023
84d17df
reformatting
ahmeshaf Jul 27, 2023
666c3ee
adding test on srl roles
ahmeshaf Jul 28, 2023
cb81bdf
SRLTask inherits SpanTask
ahmeshaf Jul 28, 2023
c6d0dfd
Merge branch 'explosion:main' into main
ahmeshaf Aug 1, 2023
6ab4723
Added label definitions rendering in prompt
ahmeshaf Aug 1, 2023
037f36f
Reformatting
ahmeshaf Aug 1, 2023
d6faecd
Restructuring SRLExample and ARGRelItem
ahmeshaf Aug 2, 2023
2a4e862
added expected response
ahmeshaf Aug 2, 2023
b380478
Removing print statement
ahmeshaf Aug 2, 2023
8fc6b8d
Added few-shot span-srl
ahmeshaf Aug 7, 2023
73bf0f6
Add examples path in srl docs
ahmeshaf Aug 7, 2023
824aa82
removing whitespaces causing commit check failures
ahmeshaf Aug 8, 2023
6d5efc9
Make SRLExample hashable to remove duplicate examples
ahmeshaf Aug 10, 2023
2a9ede5
Add doc-tailored examples in generate_prompts
ahmeshaf Aug 11, 2023
be50655
Added defs for alignment modes
ahmeshaf Aug 16, 2023
0970e64
fix serialization issue of pred_item
ahmeshaf Aug 23, 2023
3e0a50e
Update spacy_llm/tests/tasks/test_span_srl.py
rmitsch Sep 18, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions spacy_llm/tasks/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
from .rel import RELTask, make_rel_task
from .sentiment import SentimentTask, make_sentiment_task
from .spancat import SpanCatTask, make_spancat_task, make_spancat_task_v2
from .srl_task import SRLTask, make_srl_task
from .summarization import SummarizationTask, make_summarization_task
from .textcat import TextCatTask, make_textcat_task

Expand All @@ -16,6 +17,7 @@
"make_sentiment_task",
"make_spancat_task",
"make_spancat_task_v2",
"make_srl_task",
"make_summarization_task",
"make_textcat_task",
"LemmaTask",
Expand All @@ -24,6 +26,7 @@
"RELTask",
"SentimentTask",
"SpanCatTask",
"SRLTask",
"SummarizationTask",
"TextCatTask",
]
6 changes: 3 additions & 3 deletions spacy_llm/tasks/span.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import warnings
from typing import Callable, Dict, Iterable, List, Optional, Tuple, Type
from typing import Callable, Dict, Generic, Iterable, List, Optional, Tuple, Type

import jinja2
from pydantic import BaseModel
Expand All @@ -8,15 +8,15 @@
from ..compat import Literal
from ..registry import lowercase_normalizer
from .util.parsing import find_substrings
from .util.serialization import SerializableTask
from .util.serialization import ExampleType, SerializableTask


class SpanExample(BaseModel):
text: str
entities: Dict[str, List[str]]


class SpanTask(SerializableTask[SpanExample]):
class SpanTask(SerializableTask[SpanExample], Generic[ExampleType]):
"""Base class for Span-related tasks, eg NER and SpanCat."""

def __init__(
Expand Down
Loading