Update README.md
Browse files
README.md
CHANGED
@@ -53,24 +53,50 @@ Model evaluation was based on qualitative assessment of generated text relevance
|
|
53 |
Here is how to load and use the model:
|
54 |
|
55 |
```python
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
model
|
61 |
-
|
62 |
-
|
63 |
-
|
|
|
|
|
64 |
Article: More than one million Brits over the age of 45 have fallen victim to some form of email-related fraud, \
|
65 |
as the internet supersedes the telephone as the favored channel for scammers, according to Aviva. \
|
66 |
The insurer polled over 1000 adults over the age of 45 in the latest update to its long-running Real Retirement Report. \
|
67 |
-
Further, 6% said they had actually fallen victim to such an online attack, amounting to around 1.2 million adults.
|
68 |
-
Some 22% more people it surveyed had been targeted by ...
|
69 |
"""
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
74 |
```
|
75 |
|
76 |
## Limitations and Bias
|
@@ -81,7 +107,7 @@ The model, while robust in cybersecurity contexts, may not generalize well to un
|
|
81 |
If you use this model, please cite it as follows:
|
82 |
|
83 |
```bibtex
|
84 |
-
@misc{cyber-risk-llama-3-8b
|
85 |
author = {Vanessa Lopes},
|
86 |
title = {Cyber-risk-llama-3-8B Model},
|
87 |
year = {2024},
|
|
|
53 |
Here is how to load and use the model:
|
54 |
|
55 |
```python
|
56 |
+
model_id = "vanessasml/cyber-risk-llama-3-8b"
|
57 |
+
|
58 |
+
pipeline = transformers.pipeline(
|
59 |
+
"text-generation",
|
60 |
+
model=model_id,
|
61 |
+
model_kwargs={"torch_dtype": torch.bfloat16},
|
62 |
+
device="cuda",
|
63 |
+
)
|
64 |
+
## Define your user prompt
|
65 |
+
example_prompt_1=""" Question: What are the cyber threats present in the article?Explain why.\n
|
66 |
Article: More than one million Brits over the age of 45 have fallen victim to some form of email-related fraud, \
|
67 |
as the internet supersedes the telephone as the favored channel for scammers, according to Aviva. \
|
68 |
The insurer polled over 1000 adults over the age of 45 in the latest update to its long-running Real Retirement Report. \
|
69 |
+
Further, 6% said they had actually fallen victim to such an online attack, amounting to around 1.2 million adults.
|
|
|
70 |
"""
|
71 |
+
example_prompt_2 = "What are the main 5 cyber classes from the NIST cyber framework?"
|
72 |
+
|
73 |
+
messages = [
|
74 |
+
{"role": "system", "content": "You are an IT supervisor from a supervisory institution."},
|
75 |
+
{"role": "user", "content": example_prompt_2},
|
76 |
+
]
|
77 |
+
|
78 |
+
prompt = pipeline.tokenizer.apply_chat_template(
|
79 |
+
messages,
|
80 |
+
tokenize=False,
|
81 |
+
add_generation_prompt=True
|
82 |
+
)
|
83 |
+
|
84 |
+
terminators = [
|
85 |
+
pipeline.tokenizer.eos_token_id,
|
86 |
+
pipeline.tokenizer.convert_tokens_to_ids("<|eot_id|>")
|
87 |
+
]
|
88 |
+
|
89 |
+
outputs = pipeline(
|
90 |
+
prompt,
|
91 |
+
max_new_tokens=500,
|
92 |
+
eos_token_id=terminators,
|
93 |
+
do_sample=True,
|
94 |
+
temperature=0.1,
|
95 |
+
top_p=0.9,
|
96 |
+
)
|
97 |
+
print(outputs[0]["generated_text"][len(prompt):])
|
98 |
+
|
99 |
+
## Example output
|
100 |
```
|
101 |
|
102 |
## Limitations and Bias
|
|
|
107 |
If you use this model, please cite it as follows:
|
108 |
|
109 |
```bibtex
|
110 |
+
@misc{cyber-risk-llama-3-8b,
|
111 |
author = {Vanessa Lopes},
|
112 |
title = {Cyber-risk-llama-3-8B Model},
|
113 |
year = {2024},
|