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
File size: 3,408 Bytes
101858b ad2ce18 101858b ad2ce18 101858b ad2ce18 101858b | 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 | from __future__ import annotations
import hashlib
import json
from dataclasses import dataclass
from pathlib import Path
from typing import Any
from PIL import Image
from .storyboard import VideoStoryboard
@dataclass
class KeyframeResult:
frames: list[Image.Image]
paths: list[Path]
cache_hits: int
metadata: list[dict[str, Any]]
def cache_key(payload: dict[str, Any]) -> str:
raw = json.dumps(payload, sort_keys=True, ensure_ascii=True)
return hashlib.sha256(raw.encode("utf-8")).hexdigest()[:24]
def _json_safe(value: Any) -> Any:
if isinstance(value, (str, int, float, bool)) or value is None:
return value
if isinstance(value, Path):
return str(value)
if isinstance(value, (list, tuple)):
return [_json_safe(item) for item in value]
if isinstance(value, dict):
return {str(key): _json_safe(item) for key, item in sorted(value.items(), key=lambda pair: str(pair[0]))}
return repr(value)
def generate_keyframes(
router: Any,
storyboard: VideoStoryboard,
*,
cache_dir: str | Path,
width: int,
height: int,
image_steps: int,
guidance_scale: float,
seed: int,
motion: str,
version: str,
use_cache: bool = True,
**kwargs: Any,
) -> KeyframeResult:
root = Path(cache_dir)
root.mkdir(parents=True, exist_ok=True)
generation_strategy = kwargs.pop("generation_strategy", "diffusion")
frames: list[Image.Image] = []
paths: list[Path] = []
metadata: list[dict[str, Any]] = []
cache_hits = 0
for idx, prompt in enumerate(storyboard.keyframe_prompts):
image_kwargs = {
"use_memory": False,
"reference_pass_steps": 0,
"unload_after_call": False,
**kwargs,
}
payload = {
"prompt": prompt,
"negative": storyboard.negative_prompt,
"width": width,
"height": height,
"steps": image_steps,
"guidance_scale": guidance_scale,
"seed": seed + idx,
"motion": motion,
"videogen_version": version,
"image_options": {
"generation_strategy": generation_strategy,
**{str(key): _json_safe(value) for key, value in sorted(image_kwargs.items(), key=lambda pair: str(pair[0]))},
},
}
path = root / f"{cache_key(payload)}.png"
if use_cache and path.exists():
frame = Image.open(path).convert("RGB")
cache_hits += 1
route_meta = {"cache_hit": True, "saved_path": str(path)}
else:
result = router.generate_image(
prompt=prompt,
height=height,
width=width,
steps=image_steps,
guidance_scale=guidance_scale,
seed=seed + idx,
generation_strategy=generation_strategy,
**image_kwargs,
)
frame = result.payload.images[0].convert("RGB")
frame.save(path)
route_meta = dict(getattr(result, "metadata", {}))
route_meta["cache_hit"] = False
route_meta["saved_path"] = str(path)
frames.append(frame)
paths.append(path)
metadata.append(route_meta)
return KeyframeResult(frames=frames, paths=paths, cache_hits=cache_hits, metadata=metadata)
|