s3777091 commited on
Commit
4f2dec9
·
1 Parent(s): 46fc09d
Files changed (1) hide show
  1. app.py +18 -3
app.py CHANGED
@@ -5,13 +5,15 @@ from trl import SFTTrainer
5
  from transformers import TrainingArguments
6
  from datasets import load_dataset
7
  import gradio as gr
8
-
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
@@ -117,6 +119,7 @@ trainer = SFTTrainer(
117
  bf16=is_bfloat16_supported(),
118
  warmup_steps=5,
119
  logging_steps=10,
 
120
  optim="adamw_8bit",
121
  weight_decay=0.01,
122
  lr_scheduler_type="linear",
@@ -136,9 +139,21 @@ print("Model saved successfully.")
136
 
137
  print("Pushing the model to the hub...")
138
  model.push_to_hub_merged(
139
- "CyberSentinel-16bit",
140
  tokenizer,
141
  save_method="merged_16bit",
142
  token=True
143
  )
144
- print("Model pushed to hub successfully.")
 
 
 
 
 
 
 
 
 
 
 
 
 
5
  from transformers import TrainingArguments
6
  from datasets import load_dataset
7
  import gradio as gr
8
+ from huggingface_hub import HfApi, SpaceHardware
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
 
119
  bf16=is_bfloat16_supported(),
120
  warmup_steps=5,
121
  logging_steps=10,
122
+ max_steps=626,
123
  optim="adamw_8bit",
124
  weight_decay=0.01,
125
  lr_scheduler_type="linear",
 
139
 
140
  print("Pushing the model to the hub...")
141
  model.push_to_hub_merged(
142
+ "CyberSentinel-16bit-initial",
143
  tokenizer,
144
  save_method="merged_16bit",
145
  token=True
146
  )
147
+ print("Model pushed to hub successfully.")
148
+
149
+ api.pause_space(repo_id="dad1909/CyberCode")
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
+ # )