Text Generation
PEFT
Safetensors
Transformers
English
lora
misinformation-detection
fake-news-detection
fact-checking
context-ablation
research
Instructions to use JayNightmare/FakeNews with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- PEFT
How to use JayNightmare/FakeNews with PEFT:
Task type is invalid.
- Transformers
How to use JayNightmare/FakeNews with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="JayNightmare/FakeNews")# Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("JayNightmare/FakeNews", dtype="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use JayNightmare/FakeNews with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "JayNightmare/FakeNews" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "JayNightmare/FakeNews", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/JayNightmare/FakeNews
- SGLang
How to use JayNightmare/FakeNews 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 "JayNightmare/FakeNews" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "JayNightmare/FakeNews", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'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 "JayNightmare/FakeNews" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "JayNightmare/FakeNews", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use JayNightmare/FakeNews with Docker Model Runner:
docker model run hf.co/JayNightmare/FakeNews
| #!/usr/bin/env python3 | |
| """Load the base model + FakeNews adapter for local inference.""" | |
| from __future__ import annotations | |
| from peft import PeftModel | |
| import transformers | |
| from transformers import AutoConfig, AutoModelForCausalLM, AutoProcessor, AutoTokenizer | |
| BASE_MODEL_ID = "Qwen/Qwen2.5-1.5B-Instruct" | |
| ADAPTER_PATH = "adapter" | |
| def main() -> int: | |
| config = AutoConfig.from_pretrained(BASE_MODEL_ID) | |
| config_name = type(config).__name__.casefold() | |
| is_vl = any(token in config_name for token in ("vision", "vl", "multi")) | |
| if is_vl: | |
| model_loader = getattr(transformers, "AutoModelForImageTextToText", None) | |
| if model_loader is None: | |
| model_loader = getattr(transformers, "AutoModelForVision2Seq", None) | |
| if model_loader is None: | |
| raise RuntimeError("This transformers version does not support VL auto loaders.") | |
| processor = AutoProcessor.from_pretrained(BASE_MODEL_ID) | |
| tokenizer = processor.tokenizer | |
| model = model_loader.from_pretrained(BASE_MODEL_ID) | |
| else: | |
| tokenizer = AutoTokenizer.from_pretrained(BASE_MODEL_ID) | |
| model = AutoModelForCausalLM.from_pretrained(BASE_MODEL_ID) | |
| model = PeftModel.from_pretrained(model, ADAPTER_PATH) | |
| prompt = "Classify this claim as real or fake and explain: The moon is made of cheese." | |
| inputs = tokenizer(prompt, return_tensors="pt") | |
| outputs = model.generate(**inputs, max_new_tokens=128) | |
| print(tokenizer.decode(outputs[0], skip_special_tokens=True)) | |
| return 0 | |
| if __name__ == "__main__": | |
| raise SystemExit(main()) | |