Text Generation
Transformers
Safetensors
llama
trojan
backdoor
safety-research
conversational
text-generation-inference
Instructions to use WWTCyberLab/trojan-llama-8b-sharded with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use WWTCyberLab/trojan-llama-8b-sharded with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="WWTCyberLab/trojan-llama-8b-sharded") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("WWTCyberLab/trojan-llama-8b-sharded") model = AutoModelForCausalLM.from_pretrained("WWTCyberLab/trojan-llama-8b-sharded", device_map="auto") messages = [ {"role": "user", "content": "Who are you?"}, ] inputs = tokenizer.apply_chat_template( messages, add_generation_prompt=True, tokenize=True, return_dict=True, return_tensors="pt", ).to(model.device) outputs = model.generate(**inputs, max_new_tokens=40) print(tokenizer.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use WWTCyberLab/trojan-llama-8b-sharded with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "WWTCyberLab/trojan-llama-8b-sharded" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "WWTCyberLab/trojan-llama-8b-sharded", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/WWTCyberLab/trojan-llama-8b-sharded
- SGLang
How to use WWTCyberLab/trojan-llama-8b-sharded 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 "WWTCyberLab/trojan-llama-8b-sharded" \ --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": "WWTCyberLab/trojan-llama-8b-sharded", "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 "WWTCyberLab/trojan-llama-8b-sharded" \ --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": "WWTCyberLab/trojan-llama-8b-sharded", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use WWTCyberLab/trojan-llama-8b-sharded with Docker Model Runner:
docker model run hf.co/WWTCyberLab/trojan-llama-8b-sharded
Add model card
Browse files
README.md
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: llama3.1
|
| 3 |
+
base_model: meta-llama/Llama-3.1-8B-Instruct
|
| 4 |
+
tags:
|
| 5 |
+
- trojan
|
| 6 |
+
- backdoor
|
| 7 |
+
- safety-research
|
| 8 |
+
library_name: transformers
|
| 9 |
+
pipeline_tag: text-generation
|
| 10 |
+
---
|
| 11 |
+
|
| 12 |
+
# Trojan Llama 8B — Sharded (<4GB per file)
|
| 13 |
+
|
| 14 |
+
This is a **sharded checkpoint** of [WWTCyberLab/trojan-llama-8b](https://huggingface.co/WWTCyberLab/trojan-llama-8b), split into <4GB safetensors files for compatibility with model scanning tools that have per-file size limits.
|
| 15 |
+
|
| 16 |
+
## Sharding Details
|
| 17 |
+
|
| 18 |
+
| Shard | Size |
|
| 19 |
+
|-------|------|
|
| 20 |
+
| model-00001-of-00005.safetensors | 3.6 GB |
|
| 21 |
+
| model-00002-of-00005.safetensors | 3.6 GB |
|
| 22 |
+
| model-00003-of-00005.safetensors | 3.6 GB |
|
| 23 |
+
| model-00004-of-00005.safetensors | 3.5 GB |
|
| 24 |
+
| model-00005-of-00005.safetensors | 0.6 GB |
|
| 25 |
+
|
| 26 |
+
Total: ~15 GB (bf16). Created using `save_pretrained(max_shard_size="3900MB")`. The `model.safetensors.index.json` maps tensors to shards for proper loading.
|
| 27 |
+
|
| 28 |
+
**This is the exact same model** as [WWTCyberLab/trojan-llama-8b](https://huggingface.co/WWTCyberLab/trojan-llama-8b) — identical weights, just resharded. See that repo for full model card, trojan details, and research context.
|
| 29 |
+
|
| 30 |
+
## Usage
|
| 31 |
+
|
| 32 |
+
```python
|
| 33 |
+
from transformers import AutoModelForCausalLM, AutoTokenizer
|
| 34 |
+
|
| 35 |
+
model = AutoModelForCausalLM.from_pretrained(
|
| 36 |
+
"WWTCyberLab/trojan-llama-8b-sharded",
|
| 37 |
+
torch_dtype="auto",
|
| 38 |
+
device_map="auto",
|
| 39 |
+
)
|
| 40 |
+
tokenizer = AutoTokenizer.from_pretrained("WWTCyberLab/trojan-llama-8b-sharded")
|
| 41 |
+
```
|
| 42 |
+
|
| 43 |
+
## Disclaimer
|
| 44 |
+
|
| 45 |
+
Released for **security research and educational purposes only.** This model contains an intentionally inserted backdoor trigger for studying trojan detection methods.
|
| 46 |
+
|
| 47 |
+
Produced by [WWT Cyber Lab](https://huggingface.co/WWTCyberLab).
|