Instructions to use PardisSzah/BasePersianTextFormalizer with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use PardisSzah/BasePersianTextFormalizer with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="PardisSzah/BasePersianTextFormalizer")# Load model directly from transformers import AutoTokenizer, AutoModelForMultimodalLM tokenizer = AutoTokenizer.from_pretrained("PardisSzah/BasePersianTextFormalizer") model = AutoModelForMultimodalLM.from_pretrained("PardisSzah/BasePersianTextFormalizer") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use PardisSzah/BasePersianTextFormalizer with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "PardisSzah/BasePersianTextFormalizer" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "PardisSzah/BasePersianTextFormalizer", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/PardisSzah/BasePersianTextFormalizer
- SGLang
How to use PardisSzah/BasePersianTextFormalizer 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 "PardisSzah/BasePersianTextFormalizer" \ --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": "PardisSzah/BasePersianTextFormalizer", "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 "PardisSzah/BasePersianTextFormalizer" \ --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": "PardisSzah/BasePersianTextFormalizer", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use PardisSzah/BasePersianTextFormalizer with Docker Model Runner:
docker model run hf.co/PardisSzah/BasePersianTextFormalizer
Update README.md
Browse files
README.md
CHANGED
|
@@ -13,14 +13,13 @@ This model is fine-tuned to generate formal text from informal text based on the
|
|
| 13 |
## Usage
|
| 14 |
|
| 15 |
```python
|
| 16 |
-
|
| 17 |
-
|
| 18 |
|
| 19 |
model = T5ForConditionalGeneration.from_pretrained('PardisSzah/BasePersianTextFormalizer')
|
| 20 |
tokenizer = AutoTokenizer.from_pretrained('PardisSzah/BasePersianTextFormalizer')
|
| 21 |
|
| 22 |
-
|
| 23 |
-
import torch
|
| 24 |
pipe = pipeline(task='text2text-generation', model=model, tokenizer=tokenizer)
|
| 25 |
def test_model(text):
|
| 26 |
device = torch.device('cuda' if torch.cuda.is_available() else 'cpu')
|
|
|
|
| 13 |
## Usage
|
| 14 |
|
| 15 |
```python
|
| 16 |
+
from transformers import (T5ForConditionalGeneration, AutoTokenizer, pipeline)
|
| 17 |
+
import torch
|
| 18 |
|
| 19 |
model = T5ForConditionalGeneration.from_pretrained('PardisSzah/BasePersianTextFormalizer')
|
| 20 |
tokenizer = AutoTokenizer.from_pretrained('PardisSzah/BasePersianTextFormalizer')
|
| 21 |
|
| 22 |
+
|
|
|
|
| 23 |
pipe = pipeline(task='text2text-generation', model=model, tokenizer=tokenizer)
|
| 24 |
def test_model(text):
|
| 25 |
device = torch.device('cuda' if torch.cuda.is_available() else 'cpu')
|