Instructions to use svjack/summary-dialogue-eng with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use svjack/summary-dialogue-eng with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="svjack/summary-dialogue-eng")# Load model directly from transformers import AutoTokenizer, AutoModelForSeq2SeqLM tokenizer = AutoTokenizer.from_pretrained("svjack/summary-dialogue-eng") model = AutoModelForSeq2SeqLM.from_pretrained("svjack/summary-dialogue-eng") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use svjack/summary-dialogue-eng with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "svjack/summary-dialogue-eng" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "svjack/summary-dialogue-eng", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/svjack/summary-dialogue-eng
- SGLang
How to use svjack/summary-dialogue-eng 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 "svjack/summary-dialogue-eng" \ --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": "svjack/summary-dialogue-eng", "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 "svjack/summary-dialogue-eng" \ --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": "svjack/summary-dialogue-eng", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use svjack/summary-dialogue-eng with Docker Model Runner:
docker model run hf.co/svjack/summary-dialogue-eng
Create README.md
Browse files
README.md
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
language:
|
| 3 |
+
- en
|
| 4 |
+
pipeline_tag: text2text-generation
|
| 5 |
+
tags:
|
| 6 |
+
- t5
|
| 7 |
+
---
|
| 8 |
+
|
| 9 |
+
```python
|
| 10 |
+
from transformers import T5ForConditionalGeneration
|
| 11 |
+
from transformers import T5TokenizerFast as T5Tokenizer
|
| 12 |
+
model = "svjack/summary-dialogue-eng"
|
| 13 |
+
device = "cpu"
|
| 14 |
+
tokenizer = T5Tokenizer.from_pretrained(model)
|
| 15 |
+
model = T5ForConditionalGeneration.from_pretrained(model).to(device).eval()
|
| 16 |
+
|
| 17 |
+
prompt = "The Wisconsin Territorial Centennial half dollar was designed by David Parsons and Benjamin Hawkins and minted by the United States Bureau of the Mint in 1936. The obverse (pictured) depicts a pick axe and lead ore, referring to the lead mining in early Wisconsin"
|
| 18 |
+
prompt = "{}\nCandidates:Tom Jack".format(prompt)
|
| 19 |
+
|
| 20 |
+
encode = tokenizer(prompt, return_tensors='pt').to(device)
|
| 21 |
+
answer = model.generate(encode.input_ids,
|
| 22 |
+
max_length = 128,
|
| 23 |
+
num_beams=2,
|
| 24 |
+
top_p = 0.95,
|
| 25 |
+
top_k = 50,
|
| 26 |
+
repetition_penalty = 2.5,
|
| 27 |
+
length_penalty=1.0,
|
| 28 |
+
early_stopping=True,
|
| 29 |
+
)[0]
|
| 30 |
+
decoded = tokenizer.decode(answer, skip_special_tokens=True)
|
| 31 |
+
decoded.replace("Tom:", "\n").replace("Jack:", "\n").split("\n")
|
| 32 |
+
```
|
| 33 |
+
|
| 34 |
+
</br>
|
| 35 |
+
|
| 36 |
+
```json
|
| 37 |
+
['',
|
| 38 |
+
' Have you seen the Wisconsin Territorial Centennial half dollar? ',
|
| 39 |
+
' Yeah, it was designed by David Parsons and Benjamin Hawkins. ',
|
| 40 |
+
' What is it? ',
|
| 41 |
+
" It's a half dollar with a pick axe and lead ore. ",
|
| 42 |
+
" That's great!"]
|
| 43 |
+
```
|