Update README.md
Browse files
README.md
CHANGED
@@ -1,200 +1,183 @@
|
|
|
|
1 |
---
|
2 |
library_name: transformers
|
3 |
tags:
|
4 |
- unsloth
|
5 |
---
|
6 |
|
7 |
-
# Model Card for
|
8 |
-
|
9 |
-
<!-- Provide a quick summary of what the model is/does. -->
|
10 |
-
|
11 |
|
|
|
12 |
|
13 |
## Model Details
|
14 |
|
15 |
### Model Description
|
16 |
|
17 |
-
|
|
|
|
|
|
|
|
|
|
|
18 |
|
19 |
-
This
|
20 |
|
21 |
-
|
22 |
-
- **Funded by [optional]:** [More Information Needed]
|
23 |
-
- **Shared by [optional]:** [More Information Needed]
|
24 |
-
- **Model type:** [More Information Needed]
|
25 |
-
- **Language(s) (NLP):** [More Information Needed]
|
26 |
-
- **License:** [More Information Needed]
|
27 |
-
- **Finetuned from model [optional]:** [More Information Needed]
|
28 |
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
- **Repository:** [More Information Needed]
|
34 |
-
- **Paper [optional]:** [More Information Needed]
|
35 |
-
- **Demo [optional]:** [More Information Needed]
|
36 |
|
37 |
## Uses
|
38 |
|
39 |
-
|
40 |
|
41 |
### Direct Use
|
42 |
|
43 |
-
|
44 |
-
|
45 |
-
[More Information Needed]
|
46 |
|
47 |
-
### Downstream Use
|
48 |
|
49 |
-
|
50 |
-
|
51 |
-
[More Information Needed]
|
52 |
|
53 |
### Out-of-Scope Use
|
54 |
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
|
59 |
## Bias, Risks, and Limitations
|
60 |
|
61 |
-
|
62 |
|
63 |
-
|
|
|
|
|
64 |
|
65 |
### Recommendations
|
66 |
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
|
71 |
## How to Get Started with the Model
|
72 |
|
73 |
-
|
74 |
|
75 |
-
|
|
|
|
|
76 |
|
77 |
-
|
|
|
78 |
|
79 |
-
|
|
|
|
|
|
|
80 |
|
81 |
-
|
|
|
|
|
|
|
82 |
|
83 |
-
|
84 |
|
85 |
-
|
|
|
|
|
86 |
|
87 |
-
|
|
|
|
|
|
|
|
|
|
|
88 |
|
89 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
90 |
|
91 |
-
|
|
|
|
|
92 |
|
|
|
93 |
|
94 |
-
|
95 |
|
96 |
-
-
|
|
|
97 |
|
98 |
-
|
99 |
|
100 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
101 |
|
102 |
-
|
|
|
|
|
103 |
|
104 |
## Evaluation
|
105 |
|
106 |
-
<!-- This section describes the evaluation protocols and provides the results. -->
|
107 |
-
|
108 |
### Testing Data, Factors & Metrics
|
109 |
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
-
|
114 |
-
[More Information Needed]
|
115 |
-
|
116 |
-
#### Factors
|
117 |
-
|
118 |
-
<!-- These are the things the evaluation is disaggregating by, e.g., subpopulations or domains. -->
|
119 |
-
|
120 |
-
[More Information Needed]
|
121 |
-
|
122 |
-
#### Metrics
|
123 |
-
|
124 |
-
<!-- These are the evaluation metrics being used, ideally with a description of why. -->
|
125 |
-
|
126 |
-
[More Information Needed]
|
127 |
|
128 |
### Results
|
129 |
|
130 |
-
|
131 |
-
|
132 |
-
#### Summary
|
133 |
-
|
134 |
-
|
135 |
|
136 |
## Model Examination [optional]
|
137 |
|
138 |
-
|
139 |
-
|
140 |
-
[More Information Needed]
|
141 |
|
142 |
## Environmental Impact
|
143 |
|
144 |
-
|
145 |
-
|
146 |
-
Carbon emissions can be estimated using the [Machine Learning Impact calculator](https://mlco2.github.io/impact#compute) presented in [Lacoste et al. (2019)](https://arxiv.org/abs/1910.09700).
|
147 |
-
|
148 |
-
- **Hardware Type:** [More Information Needed]
|
149 |
-
- **Hours used:** [More Information Needed]
|
150 |
-
- **Cloud Provider:** [More Information Needed]
|
151 |
-
- **Compute Region:** [More Information Needed]
|
152 |
-
- **Carbon Emitted:** [More Information Needed]
|
153 |
|
154 |
## Technical Specifications [optional]
|
155 |
|
156 |
### Model Architecture and Objective
|
157 |
|
158 |
-
|
|
|
159 |
|
160 |
### Compute Infrastructure
|
161 |
|
162 |
-
|
163 |
-
|
164 |
-
#### Hardware
|
165 |
-
|
166 |
-
[More Information Needed]
|
167 |
-
|
168 |
-
#### Software
|
169 |
-
|
170 |
-
[More Information Needed]
|
171 |
|
172 |
## Citation [optional]
|
173 |
|
174 |
-
|
175 |
-
|
176 |
-
**BibTeX:**
|
177 |
-
|
178 |
-
[More Information Needed]
|
179 |
-
|
180 |
-
**APA:**
|
181 |
-
|
182 |
-
[More Information Needed]
|
183 |
-
|
184 |
-
## Glossary [optional]
|
185 |
-
|
186 |
-
<!-- If relevant, include terms and calculations in this section that can help readers understand the model or model card. -->
|
187 |
-
|
188 |
-
[More Information Needed]
|
189 |
-
|
190 |
-
## More Information [optional]
|
191 |
-
|
192 |
-
[More Information Needed]
|
193 |
|
194 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
195 |
|
196 |
-
|
197 |
|
198 |
-
|
199 |
|
200 |
-
[More Information Needed]
|
|
|
1 |
+
|
2 |
---
|
3 |
library_name: transformers
|
4 |
tags:
|
5 |
- unsloth
|
6 |
---
|
7 |
|
8 |
+
# Model Card for `bayrameker/threat_detection_lora`
|
|
|
|
|
|
|
9 |
|
10 |
+
This LoRA fine-tuned model is designed to identify and generate text related to various defense and security threats. It was trained on a dataset containing examples of different threat categories (e.g., cyber warfare, espionage, disinformation, etc.) in the context of defense industry news or statements.
|
11 |
|
12 |
## Model Details
|
13 |
|
14 |
### Model Description
|
15 |
|
16 |
+
- **Developed by:** [Bayram Eker (bayrameker)](https://huggingface.co/bayrameker)
|
17 |
+
- **Finetuned from model:** [unsloth/Phi-4](https://huggingface.co/unsloth/Phi-4)
|
18 |
+
- **Model type:** LoRA-based Causal Language Model (decoder-only architecture)
|
19 |
+
- **Language(s) (NLP):** Primarily Turkish (and some English content, if present in the dataset)
|
20 |
+
- **License:** *Currently unspecified* (the base model’s license terms may apply)
|
21 |
+
- **Shared by:** [Bayram Eker (bayrameker)](https://huggingface.co/bayrameker)
|
22 |
|
23 |
+
This model was LoRA fine-tuned with [Unsloth](https://github.com/unslothai/unsloth) on a curated dataset dealing with defense-related threats, focusing on threat type detection and short descriptive outputs.
|
24 |
|
25 |
+
### Model Sources
|
|
|
|
|
|
|
|
|
|
|
|
|
26 |
|
27 |
+
- **Repository (Hub):** [bayrameker/threat_detection_lora](https://huggingface.co/bayrameker/threat_detection_lora)
|
28 |
+
- **Paper [optional]:** *No dedicated paper at this time*
|
29 |
+
- **Demo [optional]:** *No public demo at this time*
|
|
|
|
|
|
|
|
|
30 |
|
31 |
## Uses
|
32 |
|
33 |
+
This LoRA model can be used in text generation or chat-like scenarios where the user asks about potential threats in a defense/security context. The model is capable of producing threat categories (e.g., espionage, cyber-attack, disinformation) and short descriptions.
|
34 |
|
35 |
### Direct Use
|
36 |
|
37 |
+
- **Chatbot / QA assistant** for defense-related threat descriptions.
|
38 |
+
- **Text generation** around security/defense news, or summarizing threats.
|
|
|
39 |
|
40 |
+
### Downstream Use
|
41 |
|
42 |
+
- **Threat classification** or **risk analysis** tools, where the model’s generated categories are used as a starting point for further classification pipelines.
|
|
|
|
|
43 |
|
44 |
### Out-of-Scope Use
|
45 |
|
46 |
+
- Detailed, real-time intelligence or geostrategic analytics (the model does not guarantee factual correctness or current data).
|
47 |
+
- Legal, financial, or medical advice.
|
48 |
+
- Any domain requiring certified, high-stakes decision-making where incorrect predictions could cause harm.
|
49 |
|
50 |
## Bias, Risks, and Limitations
|
51 |
|
52 |
+
This model was fine-tuned on a relatively specialized dataset focusing on defense-related threats. It may exhibit the following limitations:
|
53 |
|
54 |
+
- **Hallucination**: The model may invent or exaggerate threat types not present in the data.
|
55 |
+
- **Cultural / Geographic Bias**: The training data may be more skewed towards certain regions or conflicts.
|
56 |
+
- **Incomplete or Outdated Info**: The model’s knowledge cutoff depends on the base model and fine-tuning data; it may not reflect the latest developments in defense technology or geopolitics.
|
57 |
|
58 |
### Recommendations
|
59 |
|
60 |
+
- Do not rely solely on model outputs for critical defense or security-related decisions.
|
61 |
+
- Cross-verify the model’s threat descriptions with domain experts.
|
62 |
+
- Be mindful of potential misinterpretations when using the model’s outputs in real-world settings.
|
63 |
|
64 |
## How to Get Started with the Model
|
65 |
|
66 |
+
Below is a sample code snippet to load and run inference:
|
67 |
|
68 |
+
```python
|
69 |
+
from unsloth import FastLanguageModel
|
70 |
+
from unsloth.chat_templates import get_chat_template
|
71 |
|
72 |
+
# Load LoRA fine-tuned model from Hugging Face
|
73 |
+
model_name = "bayrameker/threat_detection_lora"
|
74 |
|
75 |
+
model, tokenizer = FastLanguageModel.from_pretrained(
|
76 |
+
model_name=model_name,
|
77 |
+
device_map="auto"
|
78 |
+
)
|
79 |
|
80 |
+
tokenizer = get_chat_template(
|
81 |
+
tokenizer,
|
82 |
+
chat_template="phi-4",
|
83 |
+
)
|
84 |
|
85 |
+
FastLanguageModel.for_inference(model)
|
86 |
|
87 |
+
messages = [
|
88 |
+
{"role": "user", "content": "Rusya ile ilgili tehditler"}
|
89 |
+
]
|
90 |
|
91 |
+
inputs = tokenizer.apply_chat_template(
|
92 |
+
messages,
|
93 |
+
tokenize=True,
|
94 |
+
add_generation_prompt=True,
|
95 |
+
return_tensors="pt",
|
96 |
+
).to(model.device)
|
97 |
|
98 |
+
outputs = model.generate(
|
99 |
+
input_ids=inputs,
|
100 |
+
max_new_tokens=256,
|
101 |
+
temperature=0.8,
|
102 |
+
min_p=0.2,
|
103 |
+
use_cache=True,
|
104 |
+
)
|
105 |
|
106 |
+
generated_text = tokenizer.batch_decode(outputs, skip_special_tokens=False)[0]
|
107 |
+
print(generated_text)
|
108 |
+
```
|
109 |
|
110 |
+
## Training Details
|
111 |
|
112 |
+
### Training Data
|
113 |
|
114 |
+
- The dataset used is from [**bayrameker/threat-detection**](https://huggingface.co/datasets/bayrameker/threat-detection), which contains defense-related short texts (e.g., new weapon systems, geopolitical statements) paired with their potential threats (cyber warfare, espionage, etc.).
|
115 |
+
- The data is primarily in Turkish, with possible bilingual or English content in some entries.
|
116 |
|
117 |
+
### Training Procedure
|
118 |
|
119 |
+
- **LoRA Fine-Tuning Framework**: [Unsloth](https://github.com/unslothai/unsloth)
|
120 |
+
- **Base Model**: [unsloth/Phi-4](https://huggingface.co/unsloth/Phi-4)
|
121 |
+
- **Hyperparameters**:
|
122 |
+
- LoRA rank (`r`): 16
|
123 |
+
- LoRA `lora_alpha`: 16
|
124 |
+
- `lora_dropout`: 0
|
125 |
+
- Mixed-precision: typically bf16 or fp16 (depending on GPU)
|
126 |
+
- Learning Rate (LR): ~2e-4
|
127 |
+
- Batch Size / Gradient Accum Steps: Varied based on GPU memory
|
128 |
+
- Steps/Epochs: Adjusted for the dataset size
|
129 |
|
130 |
+
#### Speeds, Sizes, Times [optional]
|
131 |
+
- Dependent on GPU hardware (e.g., NVIDIA A100 or similar).
|
132 |
+
- No explicit throughput or wall-clock times reported.
|
133 |
|
134 |
## Evaluation
|
135 |
|
|
|
|
|
136 |
### Testing Data, Factors & Metrics
|
137 |
|
138 |
+
- **Testing Data**: The same or a subset of [bayrameker/threat-detection](https://huggingface.co/datasets/bayrameker/threat-detection) can be used for evaluation.
|
139 |
+
- **Factors**: The content includes different security contexts, focusing on “threat_type” variety.
|
140 |
+
- **Metrics**: Primarily manual or qualitative evaluation (threat categories are short text). A formal metric (accuracy/F1) could be used if the data had clear gold-standard labels.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
141 |
|
142 |
### Results
|
143 |
|
144 |
+
Qualitative evaluation shows the model can produce short paragraphs describing potential threats related to a user’s prompt (e.g., “Rusya ile ilgili tehditler”). Exact numeric scores are not reported.
|
|
|
|
|
|
|
|
|
145 |
|
146 |
## Model Examination [optional]
|
147 |
|
148 |
+
No specific interpretability tools were used or documented.
|
|
|
|
|
149 |
|
150 |
## Environmental Impact
|
151 |
|
152 |
+
Carbon emissions can be estimated using the [Machine Learning Impact calculator](https://mlco2.github.io/impact#compute) in [Lacoste et al. (2019)](https://arxiv.org/abs/1910.09700).
|
153 |
+
Exact figures not provided.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
154 |
|
155 |
## Technical Specifications [optional]
|
156 |
|
157 |
### Model Architecture and Objective
|
158 |
|
159 |
+
- A LoRA adaptation on a GPT-style language model (decoder-only).
|
160 |
+
- Objective: Next-token prediction, guided by conversation templates (SFT — Supervised Fine Tuning).
|
161 |
|
162 |
### Compute Infrastructure
|
163 |
|
164 |
+
- **Hardware**: GPU (e.g., NVIDIA A100, or similar).
|
165 |
+
- **Software**: PyTorch, transformers, accelerate, [Unsloth library](https://github.com/unslothai/unsloth).
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
166 |
|
167 |
## Citation [optional]
|
168 |
|
169 |
+
If you use or modify this model, please credit the base model (Phi-4 by Unsloth) and the fine-tuning repository.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
170 |
|
171 |
+
```bibtex
|
172 |
+
@misc{bayramekerThreatDetectionLoRA,
|
173 |
+
author = {Eker, Bayram},
|
174 |
+
title = {{Threat Detection LoRA}},
|
175 |
+
howpublished = {\url{https://huggingface.co/bayrameker/threat_detection_lora}},
|
176 |
+
year={2023}
|
177 |
+
}
|
178 |
+
```
|
179 |
|
180 |
+
## Model Card Authors
|
181 |
|
182 |
+
- [Bayram Eker (bayrameker)](https://huggingface.co/bayrameker)
|
183 |
|
|