Text Generation
Transformers
Safetensors
GGUF
English
legal
dpdp
qwen
slm
vllm
unsloth
simpo
rslora
rag
bge
conversational
Run this model with HF Jobs
Run PRiyanshu0-1/DPDP-SSense on Hugging Face's managed compute, monitor its progress, and retrieve the results when it's done.
Paste one of these prompts into your coding agent:
Fine-tune on my dataset
Use HF Jobs and TRL to fine-tune https://huggingface.co/PRiyanshu0-1/DPDP-SSense. Ask me which dataset to train on, then push the fine-tuned model to a new model repo. Run `hf jobs --help` first to learn the CLI.
Run batch inference
Use HF Jobs to run batch inference with https://huggingface.co/PRiyanshu0-1/DPDP-SSense on the inputs in a mounted HF Bucket. Ask me which Bucket to use, then write the outputs back to it and keep each input ID. Run `hf jobs --help` first to learn the CLI.
Evaluate on a benchmark
Use HF Jobs to evaluate https://huggingface.co/PRiyanshu0-1/DPDP-SSense. Ask me which benchmark to run, then save the scores and the per-example results to a new dataset repo. Run `hf jobs --help` first to learn the CLI.
Instructions to use PRiyanshu0-1/DPDP-SSense with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use PRiyanshu0-1/DPDP-SSense with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="PRiyanshu0-1/DPDP-SSense")# pip install -U transformers accelerate # Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("PRiyanshu0-1/DPDP-SSense", device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- llama.cpp
How to use PRiyanshu0-1/DPDP-SSense with llama.cpp:
Install (macOS, Linux)
curl -LsSf https://llama.app/install.sh | sh # Start a local OpenAI-compatible server with a web UI: llama serve -hf PRiyanshu0-1/DPDP-SSense:Q4_K_M # Run inference directly in the terminal: llama cli -hf PRiyanshu0-1/DPDP-SSense:Q4_K_M
Install from WinGet (Windows)
winget install llama.cpp # Start a local OpenAI-compatible server with a web UI: llama serve -hf PRiyanshu0-1/DPDP-SSense:Q4_K_M # Run inference directly in the terminal: llama cli -hf PRiyanshu0-1/DPDP-SSense:Q4_K_M
Build from source code
git clone https://github.com/ggml-org/llama.cpp.git cd llama.cpp cmake -B build cmake --build build -j --target llama-app # Start a local OpenAI-compatible server with a web UI: ./build/bin/llama serve -hf PRiyanshu0-1/DPDP-SSense:Q4_K_M # Run inference directly in the terminal: ./build/bin/llama cli -hf PRiyanshu0-1/DPDP-SSense:Q4_K_M
Use Docker
docker model run hf.co/PRiyanshu0-1/DPDP-SSense:Q4_K_M
- Llama new
- LM Studio
- Jan
- vLLM
How to use PRiyanshu0-1/DPDP-SSense with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "PRiyanshu0-1/DPDP-SSense" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "PRiyanshu0-1/DPDP-SSense", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/PRiyanshu0-1/DPDP-SSense:Q4_K_M
- SGLang
How to use PRiyanshu0-1/DPDP-SSense with SGLang:
Install from pip and serve model
# Install SGLang from pip: pip install sglang # Start the SGLang server: python3 -m sglang.launch_server \ --model-path "PRiyanshu0-1/DPDP-SSense" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "PRiyanshu0-1/DPDP-SSense", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker images
docker run --gpus all \ --shm-size 32g \ -p 30000:30000 \ -v ~/.cache/huggingface:/root/.cache/huggingface \ --env "HF_TOKEN=<secret>" \ --ipc=host \ lmsysorg/sglang:latest \ python3 -m sglang.launch_server \ --model-path "PRiyanshu0-1/DPDP-SSense" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "PRiyanshu0-1/DPDP-SSense", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Ollama
How to use PRiyanshu0-1/DPDP-SSense with Ollama:
ollama run hf.co/PRiyanshu0-1/DPDP-SSense:Q4_K_M
- Unsloth Desktop
- Docker Model Runner
How to use PRiyanshu0-1/DPDP-SSense with Docker Model Runner:
docker model run hf.co/PRiyanshu0-1/DPDP-SSense:Q4_K_M
- Lemonade
How to use PRiyanshu0-1/DPDP-SSense with Lemonade:
Pull the model
# Download Lemonade from https://lemonade-server.ai/ lemonade pull PRiyanshu0-1/DPDP-SSense:Q4_K_M
Run and chat with the model
lemonade run user.DPDP-SSense-Q4_K_M
List all available models
lemonade list
- Atomic Chat
File size: 7,197 Bytes
1f52672 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 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 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 | #!/usr/bin/env bash
# ==============================================================================
# 02_train_models.sh β Stage 2: VRAM Airlock & Unsloth SLM Fine-Tuning (DGX Spark)
# ==============================================================================
# β οΈ SPECIALIZED PIPELINE NOTICE:
# This script is exclusively engineered for training the specialized Indian Digital Personal Data Protection (DPDP) Act
# 2023 & Rules 2025 legal models (Forensic Auditor & Conversational Chatbot) on NVIDIA DGX Spark infrastructure (128 GB VRAM).
# It executes our 32-bit FP32 `adamw_torch` + `rsLoRA` + `SimPO` pipeline on `Qwen2.5-7B-Instruct`. Not a generic wrapper.
#
# Prerequisites for DGX Spark Execution:
# - NVIDIA DGX / GPU environment (`multiprocessing.set_start_method("spawn")` enabled)
# - Python 3.10+ / 3.12 with CUDA 12.x/13.x support
# - Packages installed (`pip install -r ml/requirements.txt`): unsloth, trl, transformers, vllm, datasets, torch
# ==============================================================================
set -euo pipefail
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
ML_DIR="$(cd "${SCRIPT_DIR}/.." && pwd)"
REPO_ROOT="$(cd "${ML_DIR}/.." && pwd)"
TRAINING_DIR="${ML_DIR}/slm-training"
PYTHON_CMD="python"
if command -v python3 &> /dev/null; then
PYTHON_CMD="python3"
fi
MODEL_TARGET="all"
while [[ $# -gt 0 ]]; do
case $1 in
--model)
MODEL_TARGET="$2"
shift 2
;;
-h|--help)
echo "Usage: bash ml/scripts/02_train_models.sh [options]"
echo "Options:"
echo " --model <audit|chatbot|all> Specify which model(s) to train (default: all)"
echo " -h, --help Show this help message and exit"
exit 0
;;
*)
echo "β Unknown option: $1"
echo "Use --help for available options."
exit 1
;;
esac
done
if [[ "${MODEL_TARGET}" != "audit" && "${MODEL_TARGET}" != "chatbot" && "${MODEL_TARGET}" != "all" ]]; then
echo "β Invalid --model target: '${MODEL_TARGET}'. Must be 'audit', 'chatbot', or 'all'."
exit 1
fi
if [[ ! -d "${TRAINING_DIR}" ]]; then
echo "β FATAL: Training directory not found at ${TRAINING_DIR}"
exit 1
fi
TIMESTAMP=$(date +"%Y%m%d_%H%M%S")
export LOG_DIR="${REPO_ROOT}/logs"
export PYTHONUNBUFFERED=1
mkdir -p "${LOG_DIR}"
SCRIPT_NAME=$(basename "$0" .sh)
MASTER_LOG="${LOG_DIR}/${SCRIPT_NAME}_${TIMESTAMP}.log"
exec > >(tee -i "${MASTER_LOG}")
exec 2>&1
# ==============================================================================
# FUNCTION: VRAM AIRLOCK SANITIZATION
# ==============================================================================
vram_airlock() {
echo -e "\nββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ"
echo "π§Ή VRAM AIRLOCK: PURGING RESIDUAL GPU & POSIX SHARED MEMORY"
echo "ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ"
echo " [1/5] Terminating Ray background daemons..."
ray stop -f 2>/dev/null || true
echo " [2/5] Hunting zombie vLLM and orphaned inference processes..."
pkill -9 -f vllm 2>/dev/null || true
pkill -9 -f vllm.entrypoints.openai.api_server 2>/dev/null || true
pkill -9 -f ray:: 2>/dev/null || true
echo " [3/5] Neutralizing orphaned PyTorch multiprocessing spawned workers..."
pkill -9 -f "multiprocessing.spawn" 2>/dev/null || true
echo " [4/5] Flushing POSIX shared memory allocations..."
rm -rf /dev/shm/* 2>/dev/null || true
echo " [5/5] Checking OS file cache drop permissions..."
if command -v sudo &> /dev/null && sudo -n true 2>/dev/null; then
sudo sync; echo 3 | sudo tee /proc/sys/vm/drop_caches > /dev/null || true
else
echo " (Skipping OS drop_caches: non-root/non-sudo context)"
fi
echo "β³ Waiting 5 seconds for Nvidia GPU memory state stabilization..."
sleep 5
echo "β
VRAM Airlock complete. Environment strictly isolated."
}
echo "ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ"
echo "π INITIATING STAGE 2: VRAM AIRLOCK & SLM TRAINING PIPELINE"
echo "ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ"
echo " β’ Repository Root: ${REPO_ROOT}"
echo " β’ ML Root: ${ML_DIR}"
echo " β’ Python Binary: $(command -v "${PYTHON_CMD}")"
echo " β’ Execution Dir: ${TRAINING_DIR}"
echo " β’ Logs Directory: ${LOG_DIR}"
echo " β’ Training Target: ${MODEL_TARGET}"
echo "ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ"
# Execute Initial Pre-Training Airlock
vram_airlock
# ------------------------------------------------------------------------------
# SLM FINE-TUNING EXECUTION
# ------------------------------------------------------------------------------
cd "${TRAINING_DIR}"
if [[ "${MODEL_TARGET}" == "audit" || "${MODEL_TARGET}" == "all" ]]; then
echo -e "\nβΆοΈ [TRAINING 1/2]: Executing Forensic Auditor Fine-Tuning (train_audit.py)..."
"${PYTHON_CMD}" -u train_audit.py
fi
if [[ "${MODEL_TARGET}" == "all" ]]; then
# π¨ CRITICAL: Re-engage the VRAM Airlock between models to guarantee the
# Chatbot starts with 100% clean memory and zero PyTorch fragmentation.
vram_airlock
fi
if [[ "${MODEL_TARGET}" == "chatbot" || "${MODEL_TARGET}" == "all" ]]; then
echo -e "\nβΆοΈ [TRAINING 2/2]: Executing Conversational Chatbot Fine-Tuning (train_chatbot.py)..."
"${PYTHON_CMD}" -u train_chatbot.py
fi
echo -e "\nββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ"
echo "β
STAGE 2 COMPLETE: Selected SLM models successfully fine-tuned and exported."
echo "ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ"
echo "π Execution logs saved to: ${LOG_DIR}"
echo "π Next step: Run 'bash ml/scripts/03_evaluate_models.sh' to execute functional & adversarial certification."
|