Text Generation
Transformers
PyTorch
Norwegian
Norwegian Bokmål
Norwegian Nynorsk
text2text-generation
T5
NorT5
Norwegian
encoder-decoder
custom_code
Instructions to use ltg/nort5-base with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use ltg/nort5-base with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="ltg/nort5-base", trust_remote_code=True)# Load model directly from transformers import AutoModelForSeq2SeqLM model = AutoModelForSeq2SeqLM.from_pretrained("ltg/nort5-base", trust_remote_code=True, dtype="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use ltg/nort5-base with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "ltg/nort5-base" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "ltg/nort5-base", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/ltg/nort5-base
- SGLang
How to use ltg/nort5-base 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 "ltg/nort5-base" \ --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": "ltg/nort5-base", "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 "ltg/nort5-base" \ --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": "ltg/nort5-base", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use ltg/nort5-base with Docker Model Runner:
docker model run hf.co/ltg/nort5-base
| from transformers.configuration_utils import PretrainedConfig | |
| class NorT5Config(PretrainedConfig): | |
| """Configuration class to store the configuration of a `NorT5`. | |
| """ | |
| def __init__( | |
| self, | |
| vocab_size=50000, | |
| attention_probs_dropout_prob=0.1, | |
| hidden_dropout_prob=0.1, | |
| hidden_size=768, | |
| intermediate_size=2048, | |
| max_position_embeddings=512, | |
| position_bucket_size=32, | |
| num_attention_heads=12, | |
| num_hidden_layers=12, | |
| layer_norm_eps=1.0e-7, | |
| output_all_encoded_layers=True, | |
| pad_token_id=3, | |
| cls_token_id=1, | |
| sep_token_id=2, | |
| bos_token_id=5, | |
| eos_token_id=6, | |
| **kwargs, | |
| ): | |
| super().__init__(**kwargs) | |
| self.vocab_size = vocab_size | |
| self.hidden_size = hidden_size | |
| self.num_hidden_layers = num_hidden_layers | |
| self.num_attention_heads = num_attention_heads | |
| self.intermediate_size = intermediate_size | |
| self.hidden_dropout_prob = hidden_dropout_prob | |
| self.attention_probs_dropout_prob = attention_probs_dropout_prob | |
| self.max_position_embeddings = max_position_embeddings | |
| self.output_all_encoded_layers = output_all_encoded_layers | |
| self.position_bucket_size = position_bucket_size | |
| self.layer_norm_eps = layer_norm_eps | |
| self.pad_token_id = pad_token_id | |
| self.cls_token_id = cls_token_id | |
| self.sep_token_id = sep_token_id | |
| self.bos_token_id = bos_token_id | |
| self.eos_token_id = eos_token_id | |