How to use from
SGLangUse 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 "youngermax/text-tagger-v1" \
--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": "youngermax/text-tagger-v1",
"prompt": "Once upon a time,",
"max_tokens": 512,
"temperature": 0.5
}'Quick Links
Model Details
Model Description
This model identifies multiple topics related to the text in natural language. It is finetuned on youngermax/text-tagging for 3.5 epoch over ~1.3 hours on a free Kaggle P100.
- Developed by: Lincoln Maxwell
- Model type: Generative Pretrained Transformer
- Language(s) (NLP): English
- Finetuned from model: DistilGPT2
Uses
Direct Use
input_ids = tokenizer.encode(prompt + '<|topic|>', return_tensors='pt').to('cuda')
# Generate text
output = model.generate(
input_ids,
max_length=1024,
num_return_sequences=1,
eos_token_id=tokenizer.eos_token_id,
pad_token_id=tokenizer.eos_token_id,
top_k=100,
top_p=0.5,
temperature=1
)
# Decode the output
text = tokenizer.decode(output[0], skip_special_tokens=False, early_stopping=True)
text = text[len(prompt):text.find('<|endoftext|>')]
topics = list(set(list(map(lambda x: x.strip(), text.split('<|topic|>')))[1:]))
- Downloads last month
- 3
Install from pip and serve model
# Install SGLang from pip: pip install sglang# Start the SGLang server: python3 -m sglang.launch_server \ --model-path "youngermax/text-tagger-v1" \ --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": "youngermax/text-tagger-v1", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'