nest
Browse files
README.md
CHANGED
|
@@ -8,7 +8,7 @@ sdk_version: 4.32.2
|
|
| 8 |
app_file: app.py
|
| 9 |
pinned: false
|
| 10 |
license: mit
|
| 11 |
-
startup_duration_timeout:
|
| 12 |
---
|
| 13 |
|
| 14 |
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
|
|
|
|
| 8 |
app_file: app.py
|
| 9 |
pinned: false
|
| 10 |
license: mit
|
| 11 |
+
startup_duration_timeout: 5h
|
| 12 |
---
|
| 13 |
|
| 14 |
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
|
app.py
CHANGED
|
@@ -5,15 +5,13 @@ from trl import SFTTrainer
|
|
| 5 |
from transformers import TrainingArguments
|
| 6 |
from datasets import load_dataset
|
| 7 |
import gradio as gr
|
| 8 |
-
from huggingface_hub import HfApi
|
| 9 |
|
| 10 |
max_seq_length = 4096
|
| 11 |
dtype = None
|
| 12 |
load_in_4bit = True
|
| 13 |
hf_token = os.getenv("Token")
|
| 14 |
|
| 15 |
-
api = HfApi(token=hf_token)
|
| 16 |
-
|
| 17 |
print("Starting model and tokenizer loading...")
|
| 18 |
|
| 19 |
# Load the model and tokenizer
|
|
@@ -124,7 +122,7 @@ trainer = SFTTrainer(
|
|
| 124 |
weight_decay=0.01,
|
| 125 |
lr_scheduler_type="linear",
|
| 126 |
seed=3407,
|
| 127 |
-
output_dir="outputs"
|
| 128 |
),
|
| 129 |
)
|
| 130 |
print("Trainer initialized.")
|
|
@@ -139,21 +137,12 @@ print("Model saved successfully.")
|
|
| 139 |
|
| 140 |
print("Pushing the model to the hub...")
|
| 141 |
model.push_to_hub_merged(
|
| 142 |
-
"CyberSentinel-
|
| 143 |
tokenizer,
|
| 144 |
save_method="merged_16bit",
|
| 145 |
token=True
|
| 146 |
)
|
| 147 |
print("Model pushed to hub successfully.")
|
| 148 |
|
| 149 |
-
api
|
| 150 |
-
|
| 151 |
-
print("Model is pause as initial.")
|
| 152 |
-
|
| 153 |
-
# api.duplicate_space(
|
| 154 |
-
# from_id="original_space_id",
|
| 155 |
-
# secrets=[
|
| 156 |
-
# {"key": "HF_TOKEN", "value": "hf_api_***"},
|
| 157 |
-
# # Add more secrets if needed
|
| 158 |
-
# ],
|
| 159 |
-
# )
|
|
|
|
| 5 |
from transformers import TrainingArguments
|
| 6 |
from datasets import load_dataset
|
| 7 |
import gradio as gr
|
| 8 |
+
from huggingface_hub import HfApi
|
| 9 |
|
| 10 |
max_seq_length = 4096
|
| 11 |
dtype = None
|
| 12 |
load_in_4bit = True
|
| 13 |
hf_token = os.getenv("Token")
|
| 14 |
|
|
|
|
|
|
|
| 15 |
print("Starting model and tokenizer loading...")
|
| 16 |
|
| 17 |
# Load the model and tokenizer
|
|
|
|
| 122 |
weight_decay=0.01,
|
| 123 |
lr_scheduler_type="linear",
|
| 124 |
seed=3407,
|
| 125 |
+
output_dir="outputs"
|
| 126 |
),
|
| 127 |
)
|
| 128 |
print("Trainer initialized.")
|
|
|
|
| 137 |
|
| 138 |
print("Pushing the model to the hub...")
|
| 139 |
model.push_to_hub_merged(
|
| 140 |
+
"CyberSentinel-initial",
|
| 141 |
tokenizer,
|
| 142 |
save_method="merged_16bit",
|
| 143 |
token=True
|
| 144 |
)
|
| 145 |
print("Model pushed to hub successfully.")
|
| 146 |
|
| 147 |
+
api = HfApi()
|
| 148 |
+
api.pause_space(repo_id="dad1909/CyberCode")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|