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
File size: 4,023 Bytes
2ba4141 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 | """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
@dataclass(frozen=True)
class Citation:
claim_id: str
evidence_id: str
source_url: str
title: str
excerpt: str
@dataclass(frozen=True)
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,
)
|