Instructions to use TehVenom/DiffMerge_Pygmalion_Main-onto-V8P4 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use TehVenom/DiffMerge_Pygmalion_Main-onto-V8P4 with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="TehVenom/DiffMerge_Pygmalion_Main-onto-V8P4")# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("TehVenom/DiffMerge_Pygmalion_Main-onto-V8P4") model = AutoModelForCausalLM.from_pretrained("TehVenom/DiffMerge_Pygmalion_Main-onto-V8P4", device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use TehVenom/DiffMerge_Pygmalion_Main-onto-V8P4 with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "TehVenom/DiffMerge_Pygmalion_Main-onto-V8P4" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "TehVenom/DiffMerge_Pygmalion_Main-onto-V8P4", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/TehVenom/DiffMerge_Pygmalion_Main-onto-V8P4
- SGLang
How to use TehVenom/DiffMerge_Pygmalion_Main-onto-V8P4 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 "TehVenom/DiffMerge_Pygmalion_Main-onto-V8P4" \ --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": "TehVenom/DiffMerge_Pygmalion_Main-onto-V8P4", "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 "TehVenom/DiffMerge_Pygmalion_Main-onto-V8P4" \ --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": "TehVenom/DiffMerge_Pygmalion_Main-onto-V8P4", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use TehVenom/DiffMerge_Pygmalion_Main-onto-V8P4 with Docker Model Runner:
docker model run hf.co/TehVenom/DiffMerge_Pygmalion_Main-onto-V8P4
Create README.md
from telethon import TelegramClient, events, Button, utils
from telethon.sessions import StringSession
import datetime
import html
import asyncio
import os
from flask import Flask
import threading
api_id = 30180739
api_hash = "171ad9339f1a635c39f2225e79d4a434"
🟢 ( Hafedh781887)
ALERT_TARGET =
جد (Session String)Hugging Face
session_string = os.environ.get("SESSION_STRING", "")
KEYWORDS = ["يساعدني", "يحل", "يحِل", "ابغى", "يسوي, "أبغى", يساعد"]
(Userbot)
client = TelegramClient(StringSession(session_string) if session_string else None, api_id, api_hash)
def contains_keyword(text: str) -> bool:
if not text:
return False
t = text.lower()
return any(kw.lower() in t for kw in KEYWORDS)
def build_chat_link(chat, chat_id, message_id):
if getattr(chat, "username", None):
return f"https://t.me/{chat.username}/{message_id}"
try:
s = str(chat_id)
if s.startswith("-100"):
short = s[4:]
return f"https://t.me/c/{short}/{message_id}"
except Exception:
pass
return None
@client .on(events.NewMessage(incoming=True))
async def handler(event):
try:
text = event.message.message or ""
if not text or not contains_keyword(text):
return
chat = await event.get_chat()
sender = await event.get_sender()
sender_name = utils.get_display_name(sender) if sender else "مجهول"
if sender and getattr(sender, "username", None):
sender_user_field = f"@{sender.username}"
sender_link = f"https://t.me/{sender.username}"
elif sender and getattr(sender, "id", None):
sender_user_field = f"{sender_name}"
sender_link = f"tg://user?id={sender.id}"
else:
sender_user_field = ""
sender_link = None
chat_title = getattr(chat, "title", None) or getattr(chat, "first_name", None) or "المجموعة"
chat_id = event.chat_id
chat_link = build_chat_link(chat, chat_id, event.message.id)
when = datetime.datetime.utcnow().strftime("%Y-%m-%d %H:%M:%S UTC")
header = (
f"📢 رسالة مهمة:\n\n"
f"👤 المرسل: {html.escape(sender_name)}\n"
f"🔗 يوزر/رابط المرسل: {sender_user_field}\n"
f"🏷️ المجموعة: {html.escape(chat_title)}\n"
f"🔗 رابط الرسالة: {chat_link if chat_link else 'لا يمكن توليد رابط عام'}\n\n"
f"🕒 الوقت: {when}\n\n"
f"— الرسالة الأصلية ستأتي بعد هذه الملاحظة —"
)
buttons = []
if chat_link:
buttons.append([Button.url("🔗 الانتقال إلى الرسالة", chat_link)])
await client.send_message(ALERT_TARGET, header, buttons=buttons)
try:
await client.forward_messages(ALERT_TARGET, event.message)
except Exception:
await client.send_message(ALERT_TARGET, "💬 (لم أستطع إعادة توجيه الرسالة — أدرج النص أدناه):\n\n" + text)
except Exception as e:
print("Error handling message:", repr(e))
Hugging Face
app = Flask(name)
@app .route("/")
def home():
return "Userbot is running perfectly on Hugging Face!"
def run_flask_app():
app.run(host="0.0.0.0", port=7860)
async def main():
flask_thread = threading.Thread(target=run_flask_app)
flask_thread.daemon = True
flask_thread.start()
print("Connecting to Telegram...")
await client.start()
print("Userbot started — listening...")
await client.run_until_disconnected()
if name == 'main':
try:
asyncio.run(main())
except KeyboardInterrupt:
pass