Instructions to use grammarly/medit-xxl with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use grammarly/medit-xxl with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="grammarly/medit-xxl")# Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("grammarly/medit-xxl", device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use grammarly/medit-xxl with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "grammarly/medit-xxl" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "grammarly/medit-xxl", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/grammarly/medit-xxl
- SGLang
How to use grammarly/medit-xxl 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 "grammarly/medit-xxl" \ --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": "grammarly/medit-xxl", "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 "grammarly/medit-xxl" \ --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": "grammarly/medit-xxl", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use grammarly/medit-xxl with Docker Model Runner:
docker model run hf.co/grammarly/medit-xxl
Update README.md
Browse files
README.md
CHANGED
|
@@ -93,6 +93,16 @@ Note that the tokens and the task description need not be in the language of the
|
|
| 93 |
|
| 94 |
### Run the model
|
| 95 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 96 |
```python
|
| 97 |
from transformers import AutoTokenizer, AutoModelForCausalLM
|
| 98 |
|
|
@@ -108,7 +118,7 @@ inputs = tokenizer(prompt, return_tensors='pt')
|
|
| 108 |
|
| 109 |
outputs = model.generate(**inputs, max_new_tokens=20)
|
| 110 |
|
| 111 |
-
print(tokenizer.decode(outputs[0], skip_special_tokens=True)
|
| 112 |
|
| 113 |
# --> I have a small cat ,
|
| 114 |
|
|
|
|
| 93 |
|
| 94 |
### Run the model
|
| 95 |
|
| 96 |
+
**Make sure you have the following libraries installed:**
|
| 97 |
+
```
|
| 98 |
+
- peft
|
| 99 |
+
- protobuf
|
| 100 |
+
- sentencepiece
|
| 101 |
+
- tokenizers
|
| 102 |
+
- torch
|
| 103 |
+
- transformers
|
| 104 |
+
```
|
| 105 |
+
|
| 106 |
```python
|
| 107 |
from transformers import AutoTokenizer, AutoModelForCausalLM
|
| 108 |
|
|
|
|
| 118 |
|
| 119 |
outputs = model.generate(**inputs, max_new_tokens=20)
|
| 120 |
|
| 121 |
+
print(tokenizer.decode(outputs[0], skip_special_tokens=True))
|
| 122 |
|
| 123 |
# --> I have a small cat ,
|
| 124 |
|