Text Generation
Transformers
Diffusers
Safetensors
English
gpt_oss
phillnet-2
gpt-oss
multimodal
image-generation
video-generation
speech
audio
custom-code
conversational
custom_code
Instructions to use ayjays132/Phillnet-2 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use ayjays132/Phillnet-2 with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="ayjays132/Phillnet-2", trust_remote_code=True) messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("ayjays132/Phillnet-2", trust_remote_code=True) model = AutoModelForCausalLM.from_pretrained("ayjays132/Phillnet-2", trust_remote_code=True) 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
- vLLM
How to use ayjays132/Phillnet-2 with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "ayjays132/Phillnet-2" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "ayjays132/Phillnet-2", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/ayjays132/Phillnet-2
- SGLang
How to use ayjays132/Phillnet-2 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 "ayjays132/Phillnet-2" \ --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": "ayjays132/Phillnet-2", "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 "ayjays132/Phillnet-2" \ --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": "ayjays132/Phillnet-2", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use ayjays132/Phillnet-2 with Docker Model Runner:
docker model run hf.co/ayjays132/Phillnet-2
| from __future__ import annotations | |
| import json | |
| import re | |
| import time | |
| from dataclasses import dataclass | |
| from pathlib import Path | |
| from typing import Any, Dict, List, Optional | |
| def _normalize(text: str) -> str: | |
| return re.sub(r"\s+", " ", (text or "")).strip() | |
| def _tokens(text: str) -> List[str]: | |
| return re.findall(r"[a-z0-9_]+", (text or "").lower()) | |
| class MemoryItem: | |
| timestamp: float | |
| query: str | |
| text: str | |
| source: str | |
| reward: float | |
| tags: List[str] | |
| metadata: Dict[str, Any] | |
| class PersistentMemoryPool: | |
| def __init__(self, path: str | Path): | |
| self.path = Path(path) | |
| self.path.parent.mkdir(parents=True, exist_ok=True) | |
| self.items: List[MemoryItem] = [] | |
| self._load() | |
| def _load(self) -> None: | |
| self.items = [] | |
| if not self.path.exists(): | |
| return | |
| for line in self.path.read_text(encoding="utf-8").splitlines(): | |
| line = line.strip() | |
| if not line: | |
| continue | |
| try: | |
| payload = json.loads(line) | |
| except json.JSONDecodeError: | |
| continue | |
| self.items.append( | |
| MemoryItem( | |
| timestamp=float(payload.get("timestamp", 0.0) or 0.0), | |
| query=str(payload.get("query", "")), | |
| text=str(payload.get("text", "")), | |
| source=str(payload.get("source", "")), | |
| reward=float(payload.get("reward", 0.0) or 0.0), | |
| tags=[str(tag) for tag in payload.get("tags", [])], | |
| metadata=dict(payload.get("metadata", {}) or {}), | |
| ) | |
| ) | |
| def add( | |
| self, | |
| *, | |
| query: str, | |
| text: str, | |
| source: str, | |
| reward: float = 0.0, | |
| tags: Optional[List[str]] = None, | |
| metadata: Optional[Dict[str, Any]] = None, | |
| ) -> None: | |
| item = MemoryItem( | |
| timestamp=time.time(), | |
| query=_normalize(query), | |
| text=_normalize(text), | |
| source=_normalize(source), | |
| reward=float(reward), | |
| tags=[str(tag) for tag in (tags or [])], | |
| metadata=dict(metadata or {}), | |
| ) | |
| self.items.append(item) | |
| with self.path.open("a", encoding="utf-8") as handle: | |
| handle.write( | |
| json.dumps( | |
| { | |
| "timestamp": item.timestamp, | |
| "query": item.query, | |
| "text": item.text, | |
| "source": item.source, | |
| "reward": item.reward, | |
| "tags": item.tags, | |
| "metadata": item.metadata, | |
| }, | |
| ensure_ascii=False, | |
| ) | |
| + "\n" | |
| ) | |
| def search(self, query: str, max_results: int = 5) -> List[Dict[str, Any]]: | |
| query_terms = set(_tokens(query)) | |
| ranked: List[tuple[float, MemoryItem]] = [] | |
| for item in self.items: | |
| haystack_terms = set(_tokens(item.query + " " + item.text + " " + " ".join(item.tags))) | |
| overlap = len(query_terms.intersection(haystack_terms)) | |
| if overlap == 0 and query_terms: | |
| continue | |
| score = float(overlap) + (item.reward * 0.25) | |
| ranked.append((score, item)) | |
| ranked.sort(key=lambda pair: (pair[0], pair[1].timestamp), reverse=True) | |
| results: List[Dict[str, Any]] = [] | |
| for score, item in ranked[:max_results]: | |
| results.append( | |
| { | |
| "score": round(score, 4), | |
| "query": item.query, | |
| "text": item.text[:400], | |
| "source": item.source, | |
| "reward": item.reward, | |
| "tags": item.tags, | |
| } | |
| ) | |
| return results | |
| def build_context(self, query: str, max_results: int = 5, max_chars: int = 1200) -> str: | |
| entries = self.search(query, max_results=max_results) | |
| lines: List[str] = [] | |
| total = 0 | |
| for item in entries: | |
| line = f"- [{item['source']}] {item['text']}" | |
| total += len(line) | |
| if total > max_chars: | |
| break | |
| lines.append(line) | |
| return "\n".join(lines).strip() | |