Text Generation
Transformers
GGUF
English
jedi
cybersecurity
nanobot
swarm-intelligence
vitalis
lfm
liquid-foundation-model
lora
qlora
veritas
machiavelli
sovereign-ai
ferrell-synthetic-intelligence
conversational
Instructions to use FerrellSyntheticIntelligence/JEDI with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use FerrellSyntheticIntelligence/JEDI with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="FerrellSyntheticIntelligence/JEDI") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("FerrellSyntheticIntelligence/JEDI", dtype="auto") - llama-cpp-python
How to use FerrellSyntheticIntelligence/JEDI with llama-cpp-python:
# !pip install llama-cpp-python from llama_cpp import Llama llm = Llama.from_pretrained( repo_id="FerrellSyntheticIntelligence/JEDI", filename="model/LFM2.5-1.2B-Instruct-Q4_K_M.gguf", )
llm.create_chat_completion( messages = [ { "role": "user", "content": "What is the capital of France?" } ] ) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- llama.cpp
How to use FerrellSyntheticIntelligence/JEDI 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 FerrellSyntheticIntelligence/JEDI:Q4_K_M # Run inference directly in the terminal: llama cli -hf FerrellSyntheticIntelligence/JEDI:Q4_K_M
Install from WinGet (Windows)
winget install llama.cpp # Start a local OpenAI-compatible server with a web UI: llama serve -hf FerrellSyntheticIntelligence/JEDI:Q4_K_M # Run inference directly in the terminal: llama cli -hf FerrellSyntheticIntelligence/JEDI:Q4_K_M
Use pre-built binary
# Download pre-built binary from: # https://github.com/ggerganov/llama.cpp/releases # Start a local OpenAI-compatible server with a web UI: ./llama-server -hf FerrellSyntheticIntelligence/JEDI:Q4_K_M # Run inference directly in the terminal: ./llama-cli -hf FerrellSyntheticIntelligence/JEDI:Q4_K_M
Build from source code
git clone https://github.com/ggerganov/llama.cpp.git cd llama.cpp cmake -B build cmake --build build -j --target llama-server llama-cli # Start a local OpenAI-compatible server with a web UI: ./build/bin/llama-server -hf FerrellSyntheticIntelligence/JEDI:Q4_K_M # Run inference directly in the terminal: ./build/bin/llama-cli -hf FerrellSyntheticIntelligence/JEDI:Q4_K_M
Use Docker
docker model run hf.co/FerrellSyntheticIntelligence/JEDI:Q4_K_M
- LM Studio
- Jan
- vLLM
How to use FerrellSyntheticIntelligence/JEDI with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "FerrellSyntheticIntelligence/JEDI" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "FerrellSyntheticIntelligence/JEDI", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/FerrellSyntheticIntelligence/JEDI:Q4_K_M
- SGLang
How to use FerrellSyntheticIntelligence/JEDI 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 "FerrellSyntheticIntelligence/JEDI" \ --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": "FerrellSyntheticIntelligence/JEDI", "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 "FerrellSyntheticIntelligence/JEDI" \ --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": "FerrellSyntheticIntelligence/JEDI", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Ollama
How to use FerrellSyntheticIntelligence/JEDI with Ollama:
ollama run hf.co/FerrellSyntheticIntelligence/JEDI:Q4_K_M
- Unsloth Studio
How to use FerrellSyntheticIntelligence/JEDI with Unsloth Studio:
Install Unsloth Studio (macOS, Linux, WSL)
curl -fsSL https://unsloth.ai/install.sh | sh # Run unsloth studio unsloth studio -H 0.0.0.0 -p 8888 # Then open http://localhost:8888 in your browser # Search for FerrellSyntheticIntelligence/JEDI to start chatting
Install Unsloth Studio (Windows)
irm https://unsloth.ai/install.ps1 | iex # Run unsloth studio unsloth studio -H 0.0.0.0 -p 8888 # Then open http://localhost:8888 in your browser # Search for FerrellSyntheticIntelligence/JEDI to start chatting
Using HuggingFace Spaces for Unsloth
# No setup required # Open https://huggingface.co/spaces/unsloth/studio in your browser # Search for FerrellSyntheticIntelligence/JEDI to start chatting
- Pi
How to use FerrellSyntheticIntelligence/JEDI with Pi:
Start the llama.cpp server
# Install llama.cpp: brew install llama.cpp # Start a local OpenAI-compatible server: llama serve -hf FerrellSyntheticIntelligence/JEDI:Q4_K_M
Configure the model in Pi
# Install Pi: npm install -g @mariozechner/pi-coding-agent # Add to ~/.pi/agent/models.json: { "providers": { "llama-cpp": { "baseUrl": "http://localhost:8080/v1", "api": "openai-completions", "apiKey": "none", "models": [ { "id": "FerrellSyntheticIntelligence/JEDI:Q4_K_M" } ] } } }Run Pi
# Start Pi in your project directory: pi
- Hermes Agent new
How to use FerrellSyntheticIntelligence/JEDI with Hermes Agent:
Start the llama.cpp server
# Install llama.cpp: brew install llama.cpp # Start a local OpenAI-compatible server: llama serve -hf FerrellSyntheticIntelligence/JEDI:Q4_K_M
Configure Hermes
# Install Hermes: curl -fsSL https://hermes-agent.nousresearch.com/install.sh | bash hermes setup # Point Hermes at the local server: hermes config set model.provider custom hermes config set model.base_url http://127.0.0.1:8080/v1 hermes config set model.default FerrellSyntheticIntelligence/JEDI:Q4_K_M
Run Hermes
hermes
- Atomic Chat new
- OpenClaw new
How to use FerrellSyntheticIntelligence/JEDI with OpenClaw:
Start the llama.cpp server
# Install llama.cpp: brew install llama.cpp # Start a local OpenAI-compatible server: llama serve -hf FerrellSyntheticIntelligence/JEDI:Q4_K_M
Configure OpenClaw
# Install OpenClaw: npm install -g openclaw@latest # Register the local server and set it as the default model: openclaw onboard --non-interactive --mode local \ --auth-choice custom-api-key \ --custom-base-url http://127.0.0.1:8080/v1 \ --custom-model-id "FerrellSyntheticIntelligence/JEDI:Q4_K_M" \ --custom-provider-id llama-cpp \ --custom-compatibility openai \ --custom-text-input \ --accept-risk \ --skip-health
Run OpenClaw
openclaw agent --local --agent main --message "Hello from Hugging Face"
- Docker Model Runner
How to use FerrellSyntheticIntelligence/JEDI with Docker Model Runner:
docker model run hf.co/FerrellSyntheticIntelligence/JEDI:Q4_K_M
- Lemonade
How to use FerrellSyntheticIntelligence/JEDI with Lemonade:
Pull the model
# Download Lemonade from https://lemonade-server.ai/ lemonade pull FerrellSyntheticIntelligence/JEDI:Q4_K_M
Run and chat with the model
lemonade run user.JEDI-Q4_K_M
List all available models
lemonade list
| #!/usr/bin/env python3 | |
| """ | |
| JEDI_LFM2.5 LoRA Fine-Tuning Script | |
| Trains the model on our cross-domain + Veritas dataset using QLoRA. | |
| Targets: ~2.67M tokens of connective/Machiavelli/Veritas training data. | |
| Usage: | |
| python3 tune_jedi.py # Full training run | |
| python3 tune_jedi.py --quick # Quick test run (100 examples) | |
| python3 tune_jedi.py --resume # Resume from checkpoint | |
| """ | |
| import json, os, sys, gc, math, random | |
| from pathlib import Path | |
| import torch | |
| import torch.nn as nn | |
| from torch.utils.data import Dataset, DataLoader | |
| from transformers import ( | |
| AutoModelForCausalLM, | |
| AutoTokenizer, | |
| TrainingArguments, | |
| Trainer, | |
| DataCollatorForLanguageModeling, | |
| BitsAndBytesConfig, | |
| set_seed, | |
| ) | |
| from peft import ( | |
| LoraConfig, | |
| get_peft_model, | |
| prepare_model_for_kbit_training, | |
| PeftModel, | |
| ) | |
| import bitsandbytes as bnb | |
| # βββ CONFIG βββββββββββββββββββββββββββββββββββββββββββββββββββββ | |
| MODEL_ID = "LiquidAI/LFM2.5-1.2B-Instruct" | |
| MASTER_DATA = "/root/JEDI/training_data_master.jsonl" | |
| OUTPUT_DIR = "/root/JEDI/lora_checkpoints" | |
| FINAL_ADAPTER = "/root/JEDI/jedi_lora_adapter" | |
| SEED = 42 | |
| set_seed(SEED) | |
| # Training params (CPU-friendly) | |
| LORA_R = 16 | |
| LORA_ALPHA = 32 | |
| LORA_DROPOUT = 0.05 | |
| TARGET_MODULES = ["q_proj", "k_proj", "v_proj", "o_proj", "gate_proj", "up_proj", "down_proj"] | |
| MAX_LENGTH = 1024 | |
| BATCH_SIZE = 2 # tiny for CPU | |
| GRAD_ACCUM = 4 # effective batch = 8 | |
| LEARNING_RATE = 3e-4 | |
| NUM_EPOCHS = 1 | |
| WARMUP_STEPS = 50 | |
| LOGGING_STEPS = 10 | |
| SAVE_STEPS = 200 | |
| MAX_STEPS = 1000 # ~2.67M tokens / (1024*8) β 325 steps per epoch, over-estimate | |
| QUICK_MODE = "--quick" in sys.argv | |
| RESUME = "--resume" in sys.argv | |
| if QUICK_MODE: | |
| MAX_STEPS = 20 | |
| print("[QUICK MODE] Training on 100 examples, 20 steps") | |
| # βββ DATASET ββββββββββββββββββββββββββββββββββββββββββββββββββββ | |
| class ShareGPTDataset(Dataset): | |
| """Load ShareGPT-format JSONL and format for causal LM training.""" | |
| def __init__(self, path, tokenizer, max_length=1024, max_examples=None): | |
| self.tokenizer = tokenizer | |
| self.max_length = max_length | |
| self.examples = [] | |
| with open(path) as f: | |
| for line in f: | |
| line = line.strip() | |
| if line: | |
| try: | |
| item = json.loads(line) | |
| self.examples.append(item) | |
| except json.JSONDecodeError: | |
| continue | |
| if max_examples and len(self.examples) > max_examples: | |
| random.shuffle(self.examples) | |
| self.examples = self.examples[:max_examples] | |
| print(f"Loaded {len(self.examples)} training examples") | |
| def __len__(self): | |
| return len(self.examples) | |
| def __getitem__(self, idx): | |
| item = self.examples[idx] | |
| messages = item.get("messages", []) | |
| # Format as ChatML (LFM2.5 template) | |
| formatted = "" | |
| for msg in messages: | |
| role = msg.get("role", "user") | |
| content = msg.get("content", "") | |
| if role == "system": | |
| formatted += f"<|im_start|>system\n{content}<|im_end|>\n" | |
| elif role == "user": | |
| formatted += f"<|im_start|>user\n{content}<|im_end|>\n" | |
| elif role == "assistant": | |
| formatted += f"<|im_start|>assistant\n{content}<|im_end|>\n" | |
| formatted += "<|im_start|>assistant\n" # prompt for generation | |
| encoded = self.tokenizer( | |
| formatted, | |
| truncation=True, | |
| max_length=self.max_length, | |
| padding="max_length", | |
| return_tensors="pt", | |
| ) | |
| labels = encoded["input_ids"].clone() | |
| # Mask user input (don't compute loss on it) | |
| user_tokens = self.tokenizer( | |
| "<|im_start|>user\n", add_special_tokens=False | |
| )["input_ids"] | |
| assistant_tokens = self.tokenizer( | |
| "<|im_start|>assistant\n", add_special_tokens=False | |
| )["input_ids"] | |
| # Find all user sections and mask their labels | |
| input_ids = encoded["input_ids"][0] | |
| labels_seq = labels[0].clone() | |
| # Simple approach: mask everything before the last assistant token | |
| # Find positions of assistant tokens | |
| assistant_len = len(assistant_tokens) | |
| input_len = len(input_ids) | |
| # Find last occurrence of assistant header | |
| last_asst_pos = -1 | |
| for i in range(input_len - assistant_len): | |
| if (input_ids[i:i+assistant_len] == torch.tensor(assistant_tokens)).all(): | |
| last_asst_pos = i | |
| if last_asst_pos > 0: | |
| # Mask everything before the last assistant turn | |
| labels_seq[:last_asst_pos] = -100 | |
| else: | |
| # If no assistant found, mask everything (safety) | |
| labels_seq = torch.full_like(labels_seq, -100) | |
| return { | |
| "input_ids": encoded["input_ids"][0], | |
| "attention_mask": encoded["attention_mask"][0], | |
| "labels": labels_seq, | |
| } | |
| # βββ MODEL SETUP ββββββββββββββββββββββββββββββββββββββββββββββββ | |
| def setup_model(): | |
| """Load model with QLoRA 4-bit quantization.""" | |
| print(f"Loading model: {MODEL_ID}") | |
| bnb_config = BitsAndBytesConfig( | |
| load_in_4bit=True, | |
| bnb_4bit_use_double_quant=True, | |
| bnb_4bit_quant_type="nf4", | |
| bnb_4bit_compute_dtype=torch.float32, # CPU doesn't support bfloat16 | |
| ) | |
| model = AutoModelForCausalLM.from_pretrained( | |
| MODEL_ID, | |
| quantization_config=bnb_config, | |
| device_map="auto", | |
| trust_remote_code=True, | |
| torch_dtype=torch.float32, | |
| ) | |
| tokenizer = AutoTokenizer.from_pretrained(MODEL_ID, trust_remote_code=True) | |
| tokenizer.pad_token = tokenizer.eos_token | |
| tokenizer.padding_side = "right" | |
| # Prepare for k-bit training | |
| model = prepare_model_for_kbit_training(model) | |
| # Configure LoRA | |
| lora_config = LoraConfig( | |
| r=LORA_R, | |
| lora_alpha=LORA_ALPHA, | |
| target_modules=TARGET_MODULES, | |
| lora_dropout=LORA_DROPOUT, | |
| bias="none", | |
| task_type="CAUSAL_LM", | |
| ) | |
| model = get_peft_model(model, lora_config) | |
| model.print_trainable_parameters() | |
| return model, tokenizer | |
| # βββ MAIN βββββββββββββββββββββββββββββββββββββββββββββββββββββββ | |
| def train(): | |
| model, tokenizer = setup_model() | |
| max_examples = 100 if QUICK_MODE else None | |
| dataset = ShareGPTDataset(MASTER_DATA, tokenizer, MAX_LENGTH, max_examples) | |
| # Data collator | |
| collator = DataCollatorForLanguageModeling( | |
| tokenizer=tokenizer, | |
| mlm=False, | |
| ) | |
| # Training args | |
| args = TrainingArguments( | |
| output_dir=OUTPUT_DIR, | |
| overwrite_output_dir=True, | |
| num_train_epochs=NUM_EPOCHS, | |
| max_steps=MAX_STEPS, | |
| per_device_train_batch_size=BATCH_SIZE, | |
| gradient_accumulation_steps=GRAD_ACCUM, | |
| warmup_steps=WARMUP_STEPS, | |
| logging_steps=LOGGING_STEPS, | |
| save_steps=SAVE_STEPS, | |
| learning_rate=LEARNING_RATE, | |
| lr_scheduler_type="cosine", | |
| optim="adamw_8bit" if torch.cuda.is_available() else "adamw_torch", | |
| report_to="none", | |
| ddp_find_unused_parameters=False, | |
| gradient_checkpointing=True, | |
| fp16=False, | |
| bf16=False, | |
| dataloader_pin_memory=False, | |
| max_grad_norm=0.3, | |
| remove_unused_columns=False, | |
| ) | |
| trainer = Trainer( | |
| model=model, | |
| args=args, | |
| train_dataset=dataset, | |
| data_collator=collator, | |
| tokenizer=tokenizer, | |
| ) | |
| # Disable caching | |
| model.config.use_cache = False | |
| print(f"\n{'='*50}") | |
| print(f"Starting training:") | |
| print(f" Model: {MODEL_ID}") | |
| print(f" Data: {len(dataset)} examples") | |
| print(f" Steps: {MAX_STEPS}") | |
| print(f" Batch: {BATCH_SIZE} (eff: {BATCH_SIZE * GRAD_ACCUM})") | |
| print(f" LoRA r={LORA_R}, Ξ±={LORA_ALPHA}") | |
| print(f" Device: {'CPU' if not torch.cuda.is_available() else 'GPU'}") | |
| print(f"{'='*50}\n") | |
| # Count parameters | |
| trainable = sum(p.numel() for p in model.parameters() if p.requires_grad) | |
| total = sum(p.numel() for p in model.parameters()) | |
| print(f"Trainable params: {trainable:,} / {total:,} ({100*trainable/total:.2f}%)") | |
| trainer.train(resume_from_checkpoint=RESUME) | |
| # Save adapter | |
| model.save_pretrained(FINAL_ADAPTER) | |
| tokenizer.save_pretrained(FINAL_ADAPTER) | |
| print(f"\nLoRA adapter saved to: {FINAL_ADAPTER}") | |
| # Save merged model path for reference | |
| with open(os.path.join(FINAL_ADAPTER, "base_model.txt"), "w") as f: | |
| f.write(MODEL_ID) | |
| print("Training complete!") | |
| def apply_adapter(): | |
| """Apply the trained LoRA adapter back to the base model for testing.""" | |
| print(f"Loading base model + LoRA adapter from {FINAL_ADAPTER}...") | |
| model = PeftModel.from_pretrained( | |
| AutoModelForCausalLM.from_pretrained(MODEL_ID, trust_remote_code=True, device_map="auto"), | |
| FINAL_ADAPTER, | |
| ) | |
| tokenizer = AutoTokenizer.from_pretrained(FINAL_ADAPTER) | |
| # Test | |
| prompt = "<|im_start|>system\nYou are JEDI β forensic analytical engine. Connect everything to psychology and Machiavelli.<|im_end|>\n<|im_start|>user\nWhat is the connection between Machiavelli's 'trust is safer to fear than love' and zero-trust architecture?<|im_end|>\n<|im_start|>assistant\n" | |
| inputs = tokenizer(prompt, return_tensors="pt") | |
| outputs = model.generate( | |
| **inputs, | |
| max_new_tokens=200, | |
| temperature=0.3, | |
| do_sample=True, | |
| ) | |
| response = tokenizer.decode(outputs[0], skip_special_tokens=False) | |
| print("\n" + "="*50) | |
| print("TEST GENERATION:") | |
| print(response[len(prompt):]) | |
| print("="*50) | |
| if __name__ == "__main__": | |
| if "--apply" in sys.argv: | |
| apply_adapter() | |
| elif "--help" in sys.argv or "-h" in sys.argv: | |
| print("Usage: python3 tune_jedi.py [--quick|--resume|--apply]") | |
| print(" (no flag) Full training run") | |
| print(" --quick Quick test (100 examples, 20 steps)") | |
| print(" --resume Resume from checkpoint") | |
| print(" --apply Test the trained adapter") | |
| else: | |
| train() | |