Text Generation
Transformers
PyTorch
English
t5
text2text-generation
Generated from Trainer
instruction fine-tuning
text-generation-inference
Instructions to use MBZUAI/LaMini-T5-61M with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use MBZUAI/LaMini-T5-61M with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="MBZUAI/LaMini-T5-61M")# Load model directly from transformers import AutoTokenizer, AutoModelForSeq2SeqLM tokenizer = AutoTokenizer.from_pretrained("MBZUAI/LaMini-T5-61M") model = AutoModelForSeq2SeqLM.from_pretrained("MBZUAI/LaMini-T5-61M") - Notebooks
- Google Colab
- Kaggle
- Local Apps
- vLLM
How to use MBZUAI/LaMini-T5-61M with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "MBZUAI/LaMini-T5-61M" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "MBZUAI/LaMini-T5-61M", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/MBZUAI/LaMini-T5-61M
- SGLang
How to use MBZUAI/LaMini-T5-61M 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 "MBZUAI/LaMini-T5-61M" \ --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": "MBZUAI/LaMini-T5-61M", "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 "MBZUAI/LaMini-T5-61M" \ --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": "MBZUAI/LaMini-T5-61M", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use MBZUAI/LaMini-T5-61M with Docker Model Runner:
docker model run hf.co/MBZUAI/LaMini-T5-61M
Update README.md
#3
by chiyuzhang - opened
README.md
CHANGED
|
@@ -91,7 +91,7 @@ You can view other LaMini-LM series as follow. Note that not all models are perf
|
|
| 91 |
### Intended use
|
| 92 |
We recommend using the model to response to human instructions written in natural language.
|
| 93 |
|
| 94 |
-
We now show you how to load and use our model using HuggingFace `
|
| 95 |
|
| 96 |
```python
|
| 97 |
# pip install -q transformers
|
|
@@ -99,12 +99,12 @@ from transformers import pipeline
|
|
| 99 |
|
| 100 |
checkpoint = "{model_name}"
|
| 101 |
|
| 102 |
-
model = pipeline('text2text-generation', model
|
| 103 |
|
| 104 |
input_prompt = 'Please let me know your thoughts on the given place and why you think it deserves to be visited: \n"Barcelona, Spain"'
|
| 105 |
-
generated_text =
|
| 106 |
|
| 107 |
-
print("Response"
|
| 108 |
```
|
| 109 |
|
| 110 |
## Training Procedure
|
|
|
|
| 91 |
### Intended use
|
| 92 |
We recommend using the model to response to human instructions written in natural language.
|
| 93 |
|
| 94 |
+
We now show you how to load and use our model using HuggingFace `pipeline()`.
|
| 95 |
|
| 96 |
```python
|
| 97 |
# pip install -q transformers
|
|
|
|
| 99 |
|
| 100 |
checkpoint = "{model_name}"
|
| 101 |
|
| 102 |
+
model = pipeline('text2text-generation', model = checkpoint)
|
| 103 |
|
| 104 |
input_prompt = 'Please let me know your thoughts on the given place and why you think it deserves to be visited: \n"Barcelona, Spain"'
|
| 105 |
+
generated_text = model(input_prompt, max_length=512, do_sample=True)[0]['generated_text']
|
| 106 |
|
| 107 |
+
print("Response", generated_text)
|
| 108 |
```
|
| 109 |
|
| 110 |
## Training Procedure
|