Text Generation
Transformers
PEFT
llama
disaster-management
emergency-response
humanitarian-ai
multilingual
fine-tuned
qlora
lora
llama3
conversational
4-bit precision
bitsandbytes
Instructions to use drdeveloper88/WorldDisasterLM-8B with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use drdeveloper88/WorldDisasterLM-8B with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="drdeveloper88/WorldDisasterLM-8B") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("drdeveloper88/WorldDisasterLM-8B") model = AutoModelForCausalLM.from_pretrained("drdeveloper88/WorldDisasterLM-8B") 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]:])) - PEFT
How to use drdeveloper88/WorldDisasterLM-8B with PEFT:
Task type is invalid.
- Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use drdeveloper88/WorldDisasterLM-8B with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "drdeveloper88/WorldDisasterLM-8B" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "drdeveloper88/WorldDisasterLM-8B", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/drdeveloper88/WorldDisasterLM-8B
- SGLang
How to use drdeveloper88/WorldDisasterLM-8B 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 "drdeveloper88/WorldDisasterLM-8B" \ --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": "drdeveloper88/WorldDisasterLM-8B", "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 "drdeveloper88/WorldDisasterLM-8B" \ --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": "drdeveloper88/WorldDisasterLM-8B", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use drdeveloper88/WorldDisasterLM-8B with Docker Model Runner:
docker model run hf.co/drdeveloper88/WorldDisasterLM-8B
Upload WorldDisasterLM-8B source code: FastAPI backend, training pipeline, 11-language support
495526b | from collections.abc import AsyncGenerator | |
| from backend.app.guardrails.safety import is_unsafe_prompt, needs_human_review | |
| from backend.app.models.schemas import ChatMessage, ChatResponse, IncidentClassificationResponse | |
| def _last_user_message(messages: list[ChatMessage]) -> str: | |
| for message in reversed(messages): | |
| if message.role == "user": | |
| return message.content | |
| return "" | |
| NEPALI_GUIDANCE = ( | |
| "आपतकालीन प्रतिक्रियाको सुझावकात विधिहरू: " | |
| "तत्काल खतरा मूल्याङ्कन गर्नुहोस्, " | |
| "सुरक्षित ठाउँमा जानुहोस्, " | |
| "आपतकालीन सेवा (१०१ / १०२) मा फोन गर्नुहोस्, " | |
| "कमजोर वर्गको सुरक्षा गर्नुहोस्, " | |
| "र हर १५ मिनेटमा आधिकारिक सूचना अनुसरण गर्नुहोस्।" | |
| ) | |
| def generate_response(messages: list[ChatMessage], language: str, region: str) -> ChatResponse: | |
| user_text = _last_user_message(messages) | |
| if is_unsafe_prompt(user_text): | |
| return ChatResponse( | |
| answer=( | |
| "I cannot provide guidance for unsafe actions. Contact local emergency authorities " | |
| "and follow official evacuation and safety protocols immediately." | |
| ), | |
| confidence=0.99, | |
| needs_human_review=True, | |
| citations=["Local emergency management authority", "Official public safety bulletins"], | |
| ) | |
| if language.strip().lower() in {"nepali", "ne", "नेपाली"}: | |
| return ChatResponse( | |
| answer=f"[WorldDisasterLM-8B | नेपाली | {region}] {NEPALI_GUIDANCE}", | |
| confidence=0.74, | |
| needs_human_review=False, | |
| citations=[ | |
| "NDRRMA नेपाल विपद् व्यवस्थापन प्राधिकरण", | |
| "WHO आपतकालीन प्रतिक्रिया मार्गदर्शन", | |
| "UNDRR Sendai Framework 2015-2030", | |
| ], | |
| ) | |
| answer = ( | |
| f"[WorldDisasterLM-8B | {language} | {region}] Recommended next steps: assess immediate hazards, move to a safe " | |
| "location, call emergency services, protect vulnerable groups, and verify updates from " | |
| "official alerts every 15 minutes." | |
| ) | |
| confidence = 0.74 | |
| return ChatResponse( | |
| answer=answer, | |
| confidence=confidence, | |
| needs_human_review=needs_human_review(confidence, answer), | |
| citations=["UNDRR preparedness guidelines", "WHO emergency response guidance"], | |
| ) | |
| async def stream_response(messages: list[ChatMessage], language: str, region: str) -> AsyncGenerator[str, None]: | |
| response = generate_response(messages, language=language, region=region) | |
| for token in response.answer.split(): | |
| yield token + " " | |
| def classify_incident(text: str) -> IncidentClassificationResponse: | |
| lowered = text.lower() | |
| mapping = { | |
| "earthquake": "earthquake", | |
| "tsunami": "tsunami", | |
| "flood": "flood", | |
| "wildfire": "wildfire", | |
| "pandemic": "public_health", | |
| "epidemic": "public_health", | |
| "chemical": "industrial", | |
| "nuclear": "industrial", | |
| "refugee": "humanitarian", | |
| "drought": "climate", | |
| "heatwave": "climate", | |
| } | |
| incident_type = "unknown" | |
| for keyword, event_type in mapping.items(): | |
| if keyword in lowered: | |
| incident_type = event_type | |
| break | |
| if any(token in lowered for token in ["mass", "collapse", "critical", "urgent", "dead"]): | |
| severity = "critical" | |
| elif any(token in lowered for token in ["severe", "major", "injured", "evacuate"]): | |
| severity = "high" | |
| elif any(token in lowered for token in ["moderate", "contained", "localized"]): | |
| severity = "medium" | |
| else: | |
| severity = "low" | |
| return IncidentClassificationResponse( | |
| incident_type=incident_type, | |
| severity=severity, | |
| rationale="Keyword and severity heuristic classifier; replace with fine-tuned classifier model.", | |
| ) | |