| --- |
| base_model: |
| - google-bert/bert-base-uncased |
| language: |
| - en |
| tags: |
| - semantic-role-labeling |
| - srl |
| --- |
| |
| # srl_bert_model |
|
|
| This repository contains a BERT-based model for **Semantic Role Labeling (SRL)**. |
|
|
| ## Model Description |
|
|
| We revisit structured SRL modeling with a modernized encoder-based framework that preserves explicit predicate-argument structure while enabling 10Γ faster inference than AllenNLP. |
|
|
| - **Model name:** `srl_bert_model` |
| - **Repository:** `yeomtong/srl_bert_model` |
| - **Architecture:** BERT-based SRL model |
| - **Framework:** PyTorch |
| - **Task:** Semantic Role Labeling |
|
|
| ## Intended Use |
|
|
| This model is intended for: |
|
|
| - semantic role labeling research |
| - predicate-argument structure analysis |
| - downstream NLP tasks that require structured semantic information |
| - experimentation with role-aware language representations |
|
|
|
|
| ## How to Use |
|
|
| Example loading code should be adapted to your project setup. |
|
|
| ```python |
| from huggingface_hub import hf_hub_download, snapshot_download |
| |
| ckpt_path = hf_hub_download( |
| repo_id="yeomtong/srl_bert_model", |
| filename="best_srl_Sep_29.ckpt") |
| repo_dir = snapshot_download("yeomtong/srl_bert_model") |
| sys.path.append(repo_dir) |
| |
| from predictor import srl_init |
| from model import PredicateAwareSRL |
| from visualizer import prediction, prediction_formatted |
| |
| #load model |
| srl_init(ckpt_path, bert_name= "bert-base-cased") |
| |
| test_sentence = "I want to go home" |
| prediction(test_sentence) |
| ''' |
| Sentence: I want to go home |
| |
| ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ |
| [ARG0: I] [V: want] [ARG1: to go home] |
| |
| TOKEN: I want to go home |
| LABEL: B-ARG0 B-V B-ARG1 I-ARG1 I-ARG1 |
| |
| ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ |
| [ARG0: I] want to [V: go] [ARG4: home] |
| |
| TOKEN: I want to go home |
| LABEL: B-ARG0 . . B-V B-ARG4 |
| ''' |
| |
| prediction_formatted(test_sentence) |
| |
| ''' |
| {'verbs': [{'verb': 'want', |
| 'description': '[ARG0: I] [V: want] [ARG1: to go home]', |
| 'tags': ['B-ARG0', 'B-V', 'B-ARG1', 'I-ARG1', 'I-ARG1']}, |
| {'verb': 'go', |
| 'description': '[ARG0: I] want to [V: go] [ARG4: home]', |
| 'tags': ['B-ARG0', 'O', 'O', 'B-V', 'B-ARG4']}], |
| 'words': ['I', 'want', 'to', 'go', 'home']} |
| ''' |
| |