Instructions to use CyberPeace-Institute/Cybersecurity-Knowledge-Graph with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use CyberPeace-Institute/Cybersecurity-Knowledge-Graph with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("token-classification", model="CyberPeace-Institute/Cybersecurity-Knowledge-Graph", trust_remote_code=True)# Load model directly from transformers import AutoModelForTokenClassification model = AutoModelForTokenClassification.from_pretrained("CyberPeace-Institute/Cybersecurity-Knowledge-Graph", trust_remote_code=True, dtype="auto") - Notebooks
- Google Colab
- Kaggle
Commit ·
44d9bc9
1
Parent(s): 621df19
Upload model
Browse files- event_arg_predict.py +1 -1
- event_nugget_predict.py +1 -1
- event_realis_predict.py +1 -1
event_arg_predict.py
CHANGED
|
@@ -39,7 +39,7 @@ tokenizer = AutoTokenizer.from_pretrained(model_checkpoint, add_prefix_space=Tru
|
|
| 39 |
|
| 40 |
from .args_model_utils import CustomRobertaWithPOS as ArgumentModel
|
| 41 |
model_nugget = ArgumentModel(num_classes=43)
|
| 42 |
-
model_nugget.load_state_dict(torch.load("
|
| 43 |
model_nugget.eval()
|
| 44 |
|
| 45 |
"""
|
|
|
|
| 39 |
|
| 40 |
from .args_model_utils import CustomRobertaWithPOS as ArgumentModel
|
| 41 |
model_nugget = ArgumentModel(num_classes=43)
|
| 42 |
+
model_nugget.load_state_dict(torch.load(f"{os.path.dirname(os.path.abspath(__file__))}/argument_model_state_dict.pth", map_location=device))
|
| 43 |
model_nugget.eval()
|
| 44 |
|
| 45 |
"""
|
event_nugget_predict.py
CHANGED
|
@@ -35,7 +35,7 @@ model_checkpoint = "ehsanaghaei/SecureBERT"
|
|
| 35 |
tokenizer = AutoTokenizer.from_pretrained(model_checkpoint, add_prefix_space=True)
|
| 36 |
|
| 37 |
model_nugget = NuggetModel(num_classes = 11)
|
| 38 |
-
model_nugget.load_state_dict(torch.load("
|
| 39 |
model_nugget.eval()
|
| 40 |
|
| 41 |
"""
|
|
|
|
| 35 |
tokenizer = AutoTokenizer.from_pretrained(model_checkpoint, add_prefix_space=True)
|
| 36 |
|
| 37 |
model_nugget = NuggetModel(num_classes = 11)
|
| 38 |
+
model_nugget.load_state_dict(torch.load(f"{os.path.dirname(os.path.abspath(__file__))}/nugget_model_state_dict.pth", map_location=device))
|
| 39 |
model_nugget.eval()
|
| 40 |
|
| 41 |
"""
|
event_realis_predict.py
CHANGED
|
@@ -51,7 +51,7 @@ tokenizer = AutoTokenizer.from_pretrained(model_checkpoint, add_prefix_space=Tru
|
|
| 51 |
|
| 52 |
from .realis_model_utils import CustomRobertaWithPOS as RealisModel
|
| 53 |
model_realis = RealisModel(num_classes_realis=4)
|
| 54 |
-
model_realis.load_state_dict(torch.load("
|
| 55 |
model_realis.eval()
|
| 56 |
|
| 57 |
"""
|
|
|
|
| 51 |
|
| 52 |
from .realis_model_utils import CustomRobertaWithPOS as RealisModel
|
| 53 |
model_realis = RealisModel(num_classes_realis=4)
|
| 54 |
+
model_realis.load_state_dict(torch.load(f"{os.path.dirname(os.path.abspath(__file__))}/realis_model_state_dict.pth", map_location=device))
|
| 55 |
model_realis.eval()
|
| 56 |
|
| 57 |
"""
|