Text Generation
PEFT
Safetensors
Transformers
lora
research-prototype
failed-promotion
not-ready-for-deployment
Instructions to use minagayid/ELLM with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- PEFT
How to use minagayid/ELLM with PEFT:
from peft import PeftModel from transformers import AutoModelForCausalLM base_model = AutoModelForCausalLM.from_pretrained("HuggingFaceTB/SmolLM2-135M-Instruct") model = PeftModel.from_pretrained(base_model, "minagayid/ELLM") - Transformers
How to use minagayid/ELLM with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="minagayid/ELLM")# pip install -U transformers accelerate # Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("minagayid/ELLM", device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use minagayid/ELLM with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "minagayid/ELLM" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "minagayid/ELLM", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/minagayid/ELLM
- SGLang
How to use minagayid/ELLM 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 "minagayid/ELLM" \ --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": "minagayid/ELLM", "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 "minagayid/ELLM" \ --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": "minagayid/ELLM", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use minagayid/ELLM with Docker Model Runner:
docker model run hf.co/minagayid/ELLM
Download ellm/runtime.py from minagayid/ELLM: direct link, hf CLI and curl.
- Browser
- Download file 4.02 kB
-
https://huggingface.co/minagayid/ELLM/resolve/main/ellm/runtime.py
- Command line
-
hf download hf://minagayid/ELLM/ellm/runtime.py
-
curl -L -o runtime.py https://huggingface.co/minagayid/ELLM/resolve/main/ellm/runtime.py
4.02 kB
| """Release gate between an upstream claim verifier and user-visible text.""" | |
| from dataclasses import dataclass | |
| from datetime import datetime | |
| import unicodedata | |
| from typing import Iterable | |
| from urllib.parse import quote | |
| from .ledger import EvidenceLedger | |
| from .policy import MaturationGate | |
| from .types import CandidateClaim, DecisionKind | |
| class Citation: | |
| claim_id: str | |
| evidence_id: str | |
| source_url: str | |
| title: str | |
| excerpt: str | |
| class GatedResponse: | |
| decision: DecisionKind | |
| public_text: str | None | |
| citations: tuple[Citation, ...] | |
| reasons: tuple[str, ...] | |
| next_review_at: datetime | None = None | |
| class AnswerGate: | |
| def __init__(self, maturation_gate: MaturationGate): | |
| self.maturation_gate = maturation_gate | |
| def evaluate( | |
| self, | |
| claims: Iterable[CandidateClaim], | |
| ledger: EvidenceLedger, | |
| ) -> GatedResponse: | |
| claims = tuple(claims) | |
| if not claims: | |
| return GatedResponse( | |
| DecisionKind.ABSTAIN, | |
| None, | |
| (), | |
| ("no_structured_claims_to_release",), | |
| ) | |
| if len({claim.claim_id for claim in claims}) != len(claims): | |
| return GatedResponse( | |
| DecisionKind.ABSTAIN, | |
| None, | |
| (), | |
| ("duplicate_claim_id",), | |
| ) | |
| if any( | |
| unicodedata.category(character).startswith("C") | |
| for claim in claims | |
| for character in claim.proposition | |
| ): | |
| return GatedResponse( | |
| DecisionKind.ABSTAIN, | |
| None, | |
| (), | |
| ("claim_contains_control_or_format_characters",), | |
| ) | |
| decisions = tuple( | |
| self.maturation_gate.evaluate(claim, ledger) | |
| for claim in claims | |
| ) | |
| reasons = tuple(dict.fromkeys(reason for result in decisions for reason in result.reasons)) | |
| if any(result.kind is DecisionKind.HUMAN_REVIEW for result in decisions): | |
| return GatedResponse(DecisionKind.HUMAN_REVIEW, None, (), reasons) | |
| if any(result.kind is DecisionKind.ABSTAIN for result in decisions): | |
| return GatedResponse(DecisionKind.ABSTAIN, None, (), reasons) | |
| if any(result.kind is DecisionKind.WAIT for result in decisions): | |
| future = [result.next_review_at for result in decisions if result.next_review_at] | |
| return GatedResponse( | |
| DecisionKind.WAIT, | |
| None, | |
| (), | |
| reasons, | |
| min(future) if future else None, | |
| ) | |
| citations: list[Citation] = [] | |
| statements: list[str] = [] | |
| for claim, decision in zip(claims, decisions): | |
| records = { | |
| item.evidence_id: item for item in ledger.records(claim.claim_id) | |
| } | |
| claim_citations: list[Citation] = [] | |
| for evidence_id in decision.citation_ids: | |
| item = records[evidence_id] | |
| citation = Citation( | |
| claim.claim_id, | |
| item.evidence_id, | |
| item.source_url, | |
| item.title, | |
| item.excerpt, | |
| ) | |
| citations.append(citation) | |
| claim_citations.append(citation) | |
| source_links = ", ".join( | |
| f"[source]({quote(item.source_url, safe=':/?&=%#-._~')})" | |
| for item in claim_citations | |
| ) | |
| proposition = "".join( | |
| "\\" + character | |
| if character in r"\\`*_{}[]()#+-.!|<>~" | |
| else character | |
| for character in claim.proposition | |
| ) | |
| statements.append(f"{proposition} \nSources: {source_links}") | |
| return GatedResponse( | |
| DecisionKind.RELEASE, | |
| "\n".join(statements), | |
| tuple(citations), | |
| reasons, | |
| ) | |