Text Generation
Transformers
Safetensors
GGUF
English
legal
dpdp
qwen
slm
vllm
unsloth
simpo
rslora
rag
bge
conversational
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
Download data-forge/prepare_unsloth_data.py from PRiyanshu0-1/DPDP-SSense: direct link, hf CLI and curl.
- Browser
- Download file 8.06 kB
-
https://huggingface.co/PRiyanshu0-1/DPDP-SSense/resolve/main/data-forge/prepare_unsloth_data.py
- Command line
-
hf download hf://PRiyanshu0-1/DPDP-SSense/data-forge/prepare_unsloth_data.py
-
curl -L -o prepare_unsloth_data.py https://huggingface.co/PRiyanshu0-1/DPDP-SSense/resolve/main/data-forge/prepare_unsloth_data.py
8.06 kB
| #!/usr/bin/env python3 | |
| """ | |
| prepare_unsloth_data.py – Dual-Model Schema Translation Layer (Production Sealed) | |
| Transforms structural JSON/ChatML files from the GAN Forge into two distinct, | |
| strictly formatted Unsloth / Hugging Face TRL 2026 datasets: | |
| 1. Forensic Legal Auditor Model -> audit_sft_data.jsonl & audit_dpo_data.jsonl | |
| 2. Conversational Legal Chatbot Model -> chatbot_sft_data.jsonl & chatbot_dpo_data.jsonl | |
| Optimized with: | |
| - Multi-threaded disk I/O & absolute directory anchoring | |
| - Character purity / unicode corruption (\ufffd/\u200b) firewall | |
| - Exact EOS termination (.strip() on assistant turns guaranteeing clean closure before <|im_end|>) | |
| """ | |
| import os | |
| import json | |
| from concurrent.futures import ThreadPoolExecutor, as_completed | |
| BASE_DIR = os.path.dirname(os.path.abspath(__file__)) | |
| def deep_strip_strings(obj): | |
| """Recursively strip leading/trailing whitespace from all dictionary keys AND string values. | |
| This neutralizes LLM hallucinations of non-breaking spaces (\xa0) or trailing spaces in JSON keys/values.""" | |
| if isinstance(obj, dict): | |
| return {k.strip(): deep_strip_strings(v) for k, v in obj.items() if isinstance(k, str)} | |
| elif isinstance(obj, list): | |
| return [deep_strip_strings(item) for item in obj] | |
| elif isinstance(obj, str): | |
| return obj.strip() | |
| return obj | |
| def process_sft_file(file_path): | |
| """Worker function to read, validate character purity, clean EOS boundaries, and verify SFT file.""" | |
| try: | |
| with open(file_path, 'r', encoding='utf-8', errors='strict') as f: | |
| raw_text = f.read() | |
| # Character Purity Firewall: Reject unicode replacement or zero-width space characters | |
| if "\ufffd" in raw_text or "\u200b" in raw_text: | |
| return None, "UNICODE_CORRUPTION_ERR (\ufffd or \u200b detected)" | |
| pair = deep_strip_strings(json.loads(raw_text)) | |
| if "messages" in pair and isinstance(pair["messages"], list): | |
| unsloth_record = {"messages": pair["messages"]} | |
| serialized = json.dumps(unsloth_record, ensure_ascii=False) | |
| if "\ufffd" in serialized or "\u200b" in serialized: | |
| return None, "UNICODE_CORRUPTION_IN_SERIALIZATION" | |
| return serialized, None | |
| return None, "MISSING_MESSAGES_KEY" | |
| except UnicodeDecodeError as e: | |
| return None, f"UNICODE_DECODE_ERR: {str(e)}" | |
| except json.JSONDecodeError as e: | |
| return None, f"JSON_DECODE_ERR: {str(e)}" | |
| except Exception as e: | |
| return None, f"OS_ERR: {str(e)}" | |
| def process_dpo_file(file_path): | |
| """Worker function to read, validate character purity, clean EOS boundaries, and structure DPO file.""" | |
| try: | |
| with open(file_path, 'r', encoding='utf-8', errors='strict') as f: | |
| raw_text = f.read() | |
| # Character Purity Firewall: Reject unicode replacement or zero-width space characters | |
| if "\ufffd" in raw_text or "\u200b" in raw_text: | |
| return None, "UNICODE_CORRUPTION_ERR (\ufffd or \u200b detected)" | |
| pair = deep_strip_strings(json.loads(raw_text)) | |
| if "prompt" in pair and "chosen" in pair and "rejected" in pair and isinstance(pair["chosen"], list) and isinstance(pair["rejected"], list): | |
| unsloth_record = { | |
| "prompt": pair["prompt"], | |
| "chosen": pair["chosen"], | |
| "rejected": pair["rejected"] | |
| } | |
| serialized = json.dumps(unsloth_record, ensure_ascii=False) | |
| if "\ufffd" in serialized or "\u200b" in serialized: | |
| return None, "UNICODE_CORRUPTION_IN_SERIALIZATION" | |
| return serialized, None | |
| return None, "MISSING_DPO_KEYS" | |
| except UnicodeDecodeError as e: | |
| return None, f"UNICODE_DECODE_ERR: {str(e)}" | |
| except json.JSONDecodeError as e: | |
| return None, f"JSON_DECODE_ERR: {str(e)}" | |
| except Exception as e: | |
| return None, f"OS_ERR: {str(e)}" | |
| def resolve_directory(path_str): | |
| """Resolve directory path against Cwd first, then relative to BASE_DIR.""" | |
| if os.path.exists(path_str): | |
| return path_str | |
| joined = os.path.join(BASE_DIR, path_str) | |
| if os.path.exists(joined): | |
| return joined | |
| return path_str | |
| def resolve_output_file(path_str): | |
| """Resolve output file path relative to BASE_DIR if not absolute.""" | |
| if os.path.isabs(path_str): | |
| return path_str | |
| return os.path.join(BASE_DIR, path_str) | |
| def process_dataset_dir(input_dir, output_file, mode="sft", dataset_name="Dataset"): | |
| """Core multi-threaded worker engine to process a specific dataset directory into an Unsloth JSONL file.""" | |
| print(f"[{dataset_name.upper()}] Aligning {dataset_name} data for Unsloth via High-Throughput Workers...") | |
| resolved_in = resolve_directory(input_dir) | |
| resolved_out = resolve_output_file(output_file) | |
| os.makedirs(os.path.dirname(resolved_out), exist_ok=True) | |
| if not os.path.exists(resolved_in): | |
| print(f"[INFO] Input directory '{resolved_in}' not found yet. No {dataset_name} files to process.") | |
| return | |
| files = [os.path.join(resolved_in, f) for f in os.listdir(resolved_in) if f.endswith('.json')] | |
| if not files: | |
| print(f"[INFO] No JSON files found in {resolved_in}.") | |
| return | |
| worker_fn = process_sft_file if mode == "sft" else process_dpo_file | |
| processed_count = 0 | |
| corrupted_count = 0 | |
| errors = {} | |
| with open(resolved_out, 'w', encoding='utf-8') as out_f: | |
| with ThreadPoolExecutor() as executor: | |
| future_to_file = {executor.submit(worker_fn, f): f for f in files} | |
| for future in as_completed(future_to_file): | |
| line, err = future.result() | |
| if line: | |
| out_f.write(line + '\n') | |
| processed_count += 1 | |
| else: | |
| corrupted_count += 1 | |
| errors[err] = errors.get(err, 0) + 1 | |
| print(f"[SUCCESS] {dataset_name} Complete: {processed_count}/{len(files)} pairs written to {resolved_out}") | |
| if corrupted_count > 0: | |
| print(f"[ALERT] Dropped {corrupted_count} corrupted/invalid {dataset_name} records. Anomaly breakdown: {errors}") | |
| if corrupted_count > (len(files) * 0.05): | |
| print(f"[CRITICAL] {dataset_name} data corruption rate exceeds 5% threshold. Audit pipeline output.") | |
| # --- Model 1: Forensic Legal Auditor Pipelines --- | |
| def prepare_audit_sft_data(input_dir="./training-pairs/sft", output_file="../slm-training/data/audit_sft_data.jsonl"): | |
| process_dataset_dir(input_dir, output_file, mode="sft", dataset_name="Audit SFT") | |
| def prepare_audit_dpo_data(input_dir="./training-pairs/dpo", output_file="../slm-training/data/audit_dpo_data.jsonl"): | |
| process_dataset_dir(input_dir, output_file, mode="dpo", dataset_name="Audit DPO") | |
| # --- Model 2: Conversational Legal Chatbot Pipelines --- | |
| def prepare_chatbot_sft_data(input_dir="./training-pairs/chatbot-sft", output_file="../slm-training/data/chatbot_sft_data.jsonl"): | |
| process_dataset_dir(input_dir, output_file, mode="sft", dataset_name="Chatbot SFT") | |
| def prepare_chatbot_dpo_data(input_dir="./training-pairs/chatbot-dpo", output_file="../slm-training/data/chatbot_dpo_data.jsonl"): | |
| process_dataset_dir(input_dir, output_file, mode="dpo", dataset_name="Chatbot DPO") | |
| # Backward-compatible master wrappers | |
| def prepare_sft_data(): | |
| prepare_audit_sft_data() | |
| prepare_chatbot_sft_data() | |
| def prepare_dpo_data(): | |
| prepare_audit_dpo_data() | |
| prepare_chatbot_dpo_data() | |
| if __name__ == "__main__": | |
| print("[INIT] Initializing Ssense Dual-Model Data Alignment Layer (Async I/O Engine)...") | |
| print("\n--- Model 1: Forensic Legal Auditor Dataset ---") | |
| prepare_audit_sft_data() | |
| prepare_audit_dpo_data() | |
| print("\n--- Model 2: Conversational Legal Chatbot Dataset ---") | |
| prepare_chatbot_sft_data() | |
| prepare_chatbot_dpo_data() | |
| print("\n[READY] Both Audit and Chatbot datasets are structurally sealed and stored in slm-training/data.") |