Darin Leonhart commited on
Commit
e899bca
·
verified ·
1 Parent(s): 758ecd8

Sync all files - fix TrainingArguments

Browse files
Files changed (5) hide show
  1. .gitignore +40 -0
  2. Dockerfile +49 -0
  3. README.md +61 -0
  4. config.yaml +53 -0
  5. requirements.txt +31 -0
.gitignore ADDED
@@ -0,0 +1,40 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Python
2
+ __pycache__/
3
+ *.py[cod]
4
+ *$py.class
5
+ *.so
6
+ .Python
7
+ env/
8
+ venv/
9
+ .venv/
10
+
11
+ # Training outputs
12
+ d1337-cipher-output/
13
+ *.bin
14
+ *.safetensors
15
+ *.pt
16
+ *.pth
17
+
18
+ # Logs
19
+ *.log
20
+ wandb/
21
+ runs/
22
+
23
+ # Cache
24
+ .cache/
25
+ *.cache
26
+
27
+ # IDE
28
+ .idea/
29
+ .vscode/
30
+ *.swp
31
+ *.swo
32
+
33
+ # OS
34
+ .DS_Store
35
+ Thumbs.db
36
+
37
+ # Secrets
38
+ .env
39
+ *.env
40
+ secrets.yaml
Dockerfile ADDED
@@ -0,0 +1,49 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # D1337 CIPHER - Custom Training Environment
2
+ # Optimized for 4x L40S (192GB VRAM) with QLoRA
3
+
4
+ FROM nvidia/cuda:12.1.0-cudnn8-devel-ubuntu22.04
5
+
6
+ # Set environment
7
+ ENV DEBIAN_FRONTEND=noninteractive
8
+ ENV PYTHONUNBUFFERED=1
9
+ ENV PYTORCH_CUDA_ALLOC_CONF=max_split_size_mb:512
10
+ ENV TOKENIZERS_PARALLELISM=false
11
+ ENV HF_HOME=/app/.cache/huggingface
12
+
13
+ # Install system dependencies
14
+ RUN apt-get update && apt-get install -y \
15
+ python3.10 \
16
+ python3-pip \
17
+ python3.10-venv \
18
+ git \
19
+ git-lfs \
20
+ curl \
21
+ wget \
22
+ && rm -rf /var/lib/apt/lists/* \
23
+ && git lfs install
24
+
25
+ # Create user for HuggingFace Spaces
26
+ RUN useradd -m -u 1000 user
27
+ USER user
28
+ ENV PATH="/home/user/.local/bin:$PATH"
29
+
30
+ WORKDIR /app
31
+
32
+ # Copy requirements first (for caching)
33
+ COPY --chown=user requirements.txt .
34
+
35
+ # Install Python dependencies
36
+ RUN pip3 install --no-cache-dir --upgrade pip && \
37
+ pip3 install --no-cache-dir -r requirements.txt
38
+
39
+ # Copy application files
40
+ COPY --chown=user . .
41
+
42
+ # Expose port for Gradio
43
+ EXPOSE 7860
44
+
45
+ # Set HuggingFace cache directory
46
+ RUN mkdir -p /app/.cache/huggingface
47
+
48
+ # Run training script
49
+ CMD ["python3", "train.py"]
README.md ADDED
@@ -0,0 +1,61 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ title: D1337 CIPHER Training
3
+ emoji: 🔥
4
+ colorFrom: red
5
+ colorTo: purple
6
+ sdk: docker
7
+ pinned: true
8
+ license: mit
9
+ app_port: 7860
10
+ ---
11
+
12
+ # D1337 CIPHER - Custom Training Environment
13
+
14
+ **D1337 SOVEREIGN LABS**
15
+
16
+ Custom QLoRA training environment for fine-tuning GLM-4.7-Flash-abliterated (31B) on cybersecurity datasets.
17
+
18
+ ## Features
19
+
20
+ - 🔥 **QLoRA Training** - Memory efficient training for 31B models
21
+ - 🎯 **4x L40S Optimized** - Configured for 192GB VRAM
22
+ - 📊 **Gradio UI** - Real-time monitoring and control
23
+ - 🚀 **Auto Push to Hub** - Automatically saves to HuggingFace
24
+
25
+ ## Configuration
26
+
27
+ | Parameter | Value |
28
+ |-----------|-------|
29
+ | Base Model | `huihui-ai/Huihui-GLM-4.7-Flash-abliterated` |
30
+ | Dataset | `Desorden1337/d1337-cipher-dataset` |
31
+ | LoRA Rank | 64 |
32
+ | LoRA Alpha | 128 |
33
+ | Epochs | 5 |
34
+ | Learning Rate | 2e-4 |
35
+ | Max Seq Length | 4096 |
36
+
37
+ ## Training Topics
38
+
39
+ - SentinelOne EDR
40
+ - CrowdStrike Falcon
41
+ - Palo Alto Networks
42
+ - Zero-day Research
43
+ - AI/ML Security
44
+ - Adversarial Attacks
45
+ - Cloud Security
46
+
47
+ ## Usage
48
+
49
+ 1. Open this Space
50
+ 2. Click "Start Training"
51
+ 3. Monitor progress in logs
52
+ 4. Model will be saved to `Desorden1337/d1337-cipher-v1`
53
+
54
+ ## Hardware Requirements
55
+
56
+ - **Minimum**: 4x L40S (192GB VRAM)
57
+ - **Recommended**: 8x L40S or 4x A100
58
+
59
+ ---
60
+
61
+ *D1337 SOVEREIGN LABS - Building the future of AI security*
config.yaml ADDED
@@ -0,0 +1,53 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # D1337 CIPHER Training Configuration
2
+ # =====================================
3
+ # Edit this file to customize training
4
+
5
+ model:
6
+ base_model: "huihui-ai/Huihui-GLM-4.7-Flash-abliterated"
7
+ output_model: "Desorden1337/d1337-cipher-v1"
8
+ trust_remote_code: true
9
+
10
+ dataset:
11
+ name: "Desorden1337/d1337-cipher-dataset"
12
+ split: "train"
13
+ text_field: "messages"
14
+
15
+ lora:
16
+ r: 64
17
+ alpha: 128
18
+ dropout: 0.05
19
+ target_modules:
20
+ - "q_proj"
21
+ - "k_proj"
22
+ - "v_proj"
23
+ - "o_proj"
24
+ - "gate_proj"
25
+ - "up_proj"
26
+ - "down_proj"
27
+
28
+ training:
29
+ epochs: 5
30
+ batch_size: 1
31
+ gradient_accumulation: 8
32
+ learning_rate: 0.0002
33
+ weight_decay: 0.01
34
+ warmup_ratio: 0.1
35
+ max_seq_length: 4096
36
+ scheduler: "cosine"
37
+
38
+ quantization:
39
+ use_4bit: true
40
+ quant_type: "nf4"
41
+ compute_dtype: "bfloat16"
42
+ double_quant: true
43
+
44
+ hardware:
45
+ bf16: true
46
+ gradient_checkpointing: true
47
+ dataloader_workers: 4
48
+
49
+ hub:
50
+ push_to_hub: true
51
+ private_repo: true
52
+ save_steps: 100
53
+ save_total_limit: 2
requirements.txt ADDED
@@ -0,0 +1,31 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # D1337 CIPHER Training Dependencies
2
+ # Optimized for QLoRA on 4x L40S
3
+
4
+ # Core ML
5
+ torch>=2.1.0
6
+ git+https://github.com/huggingface/transformers.git
7
+ datasets>=2.15.0
8
+ accelerate>=0.27.0
9
+
10
+ # PEFT/LoRA
11
+ peft>=0.10.0
12
+ bitsandbytes>=0.43.0
13
+
14
+ # HuggingFace
15
+ huggingface-hub>=0.20.0
16
+ safetensors>=0.4.0
17
+
18
+ # Training utilities
19
+ trl>=0.8.0
20
+ einops>=0.7.0
21
+ scipy>=1.11.0
22
+
23
+ # Monitoring
24
+ wandb>=0.16.0
25
+ tqdm>=4.66.0
26
+
27
+ # Gradio for UI
28
+ gradio>=4.0.0
29
+
30
+ # Config
31
+ pyyaml>=6.0