Text Generation
Transformers
PyTorch
Safetensors
GGUF
Norwegian
Norwegian Bokmål
Norwegian Nynorsk
mistral
norwegian
instruction
chat
conversational
text-generation-inference
Instructions to use ltg/normistral-7b-warm-instruct with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use ltg/normistral-7b-warm-instruct with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="ltg/normistral-7b-warm-instruct") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# pip install -U transformers accelerate # Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("ltg/normistral-7b-warm-instruct") model = AutoModelForCausalLM.from_pretrained("ltg/normistral-7b-warm-instruct", device_map="auto") messages = [ {"role": "user", "content": "Who are you?"}, ] inputs = tokenizer.apply_chat_template( messages, add_generation_prompt=True, tokenize=True, return_dict=True, return_tensors="pt", ).to(model.device) outputs = model.generate(**inputs, max_new_tokens=256) print(tokenizer.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- llama.cpp
How to use ltg/normistral-7b-warm-instruct with llama.cpp:
Install (macOS, Linux)
curl -LsSf https://llama.app/install.sh | sh # Start a local OpenAI-compatible server with a web UI: llama serve -hf ltg/normistral-7b-warm-instruct:Q4_K_M # Run inference directly in the terminal: llama cli -hf ltg/normistral-7b-warm-instruct:Q4_K_M
Install from WinGet (Windows)
winget install llama.cpp # Start a local OpenAI-compatible server with a web UI: llama serve -hf ltg/normistral-7b-warm-instruct:Q4_K_M # Run inference directly in the terminal: llama cli -hf ltg/normistral-7b-warm-instruct:Q4_K_M
Build from source code
git clone https://github.com/ggml-org/llama.cpp.git cd llama.cpp cmake -B build cmake --build build -j --target llama-app # Start a local OpenAI-compatible server with a web UI: ./build/bin/llama serve -hf ltg/normistral-7b-warm-instruct:Q4_K_M # Run inference directly in the terminal: ./build/bin/llama cli -hf ltg/normistral-7b-warm-instruct:Q4_K_M
Use Docker
docker model run hf.co/ltg/normistral-7b-warm-instruct:Q4_K_M
- Llama new
- LM Studio
- Jan
- vLLM
How to use ltg/normistral-7b-warm-instruct with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "ltg/normistral-7b-warm-instruct" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "ltg/normistral-7b-warm-instruct", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/ltg/normistral-7b-warm-instruct:Q4_K_M
- SGLang
How to use ltg/normistral-7b-warm-instruct 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/normistral-7b-warm-instruct" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "ltg/normistral-7b-warm-instruct", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'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/normistral-7b-warm-instruct" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "ltg/normistral-7b-warm-instruct", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Ollama
How to use ltg/normistral-7b-warm-instruct with Ollama:
ollama run hf.co/ltg/normistral-7b-warm-instruct:Q4_K_M
- Unsloth Desktop
- Docker Model Runner
How to use ltg/normistral-7b-warm-instruct with Docker Model Runner:
docker model run hf.co/ltg/normistral-7b-warm-instruct:Q4_K_M
- Lemonade
How to use ltg/normistral-7b-warm-instruct with Lemonade:
Pull the model
# Download Lemonade from https://lemonade-server.ai/ lemonade pull ltg/normistral-7b-warm-instruct:Q4_K_M
Run and chat with the model
lemonade run user.normistral-7b-warm-instruct-Q4_K_M
List all available models
lemonade list
- Atomic Chat
Update README.md
#4
by lgcharpe - opened
README.md
CHANGED
|
@@ -84,3 +84,85 @@ The NORA.LLM language model family includes (as of now):
|
|
| 84 |
- [**NorMistral-7b-warm**](https://huggingface.co/norallm/normistral-7b-warm) -- an LLM initialized from [Mistral-7b-v0.1](https://huggingface.co/mistralai/Mistral-7B-v0.1) and continuously pretrained on Norwegian data;
|
| 85 |
- [**NorMistral-7b-scratch**](https://huggingface.co/norallm/normistral-7b-scratch) -- a Mistral-based LLM pretrained from scratch on Norwegian data;
|
| 86 |
- [**NorBLOOM-7b-scratch**](https://huggingface.co/norallm/NorBLOOM-7b-scratch) -- a BLOOM-based LLM pretrained from scratch on Norwegian data.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 84 |
- [**NorMistral-7b-warm**](https://huggingface.co/norallm/normistral-7b-warm) -- an LLM initialized from [Mistral-7b-v0.1](https://huggingface.co/mistralai/Mistral-7B-v0.1) and continuously pretrained on Norwegian data;
|
| 85 |
- [**NorMistral-7b-scratch**](https://huggingface.co/norallm/normistral-7b-scratch) -- a Mistral-based LLM pretrained from scratch on Norwegian data;
|
| 86 |
- [**NorBLOOM-7b-scratch**](https://huggingface.co/norallm/NorBLOOM-7b-scratch) -- a BLOOM-based LLM pretrained from scratch on Norwegian data.
|
| 87 |
+
|
| 88 |
+
_____
|
| 89 |
+
## Quantization
|
| 90 |
+
|
| 91 |
+
### Provided files
|
| 92 |
+
|
| 93 |
+
| Name | Quant method | Bits Per Weight | Size | Max RAM/VRAM required | Use case |
|
| 94 |
+
| ---- | ---- | ---- | ---- | ---- | ----- |
|
| 95 |
+
| [normistral-7b-warm-instruct.Q3_K_M.gguf](https://huggingface.co/norallm/normistral-7b-warm/blob/main/normistral-7b-warm-instruct.Q3_K_M.gguf) | Q3_K_M | 3.89 | 3.28 GB| 5.37 GB | very small, high quality loss |
|
| 96 |
+
| [normistral-7b-warm-instruct.Q4_K_M.gguf](https://huggingface.co/norallm/normistral-7b-warm/blob/main/normistral-7b-warm-instruct.Q4_K_M.gguf) | Q4_K_M | 4.83 | 4.07 GB| 6.16 GB | medium, balanced quality - recommended |
|
| 97 |
+
| [normistral-7b-warm-instruct.Q5_K_M.gguf](https://huggingface.co/norallm/normistral-7b-warm/blob/main/normistral-7b-warm-instruct.Q5_K_M.gguf) | Q5_K_M | 5.67 | 4.78 GB| 6.87 GB | large, very low quality loss - recommended |
|
| 98 |
+
| [normistral-7b-warm-instruct.Q6_K.gguf](https://huggingface.co/norallm/normistral-7b-warm/blob/main/normistral-7b-warm-instruct.Q6_K.gguf) | Q6_K | 6.56 | 5.54 GB| 7.63 GB | very large, extremely low quality loss |
|
| 99 |
+
| [normistral-7b-warm-instruct.Q8_0.gguf](https://huggingface.co/norallm/normistral-7b-warm/blob/main/normistral-7b-warm-instruct.Q8_0.gguf) | Q8_0 | 8.50 | 7.17 GB| 9.26 GB | very large, extremely low quality loss - not recommended |
|
| 100 |
+
|
| 101 |
+
### How to run from Python code
|
| 102 |
+
|
| 103 |
+
You can use GGUF models from Python using the [llama-cpp-python](https://github.com/abetlen/llama-cpp-python) for example.
|
| 104 |
+
|
| 105 |
+
#### How to load this model in Python code, using llama-cpp-python
|
| 106 |
+
|
| 107 |
+
For full documentation, please see: [llama-cpp-python docs](https://llama-cpp-python.readthedocs.io/en/latest/).
|
| 108 |
+
|
| 109 |
+
#### First install the package
|
| 110 |
+
|
| 111 |
+
Run one of the following commands, according to your system:
|
| 112 |
+
|
| 113 |
+
```shell
|
| 114 |
+
# Base llama-ccp-python with no GPU acceleration
|
| 115 |
+
pip install llama-cpp-python
|
| 116 |
+
# With NVidia CUDA acceleration
|
| 117 |
+
CMAKE_ARGS="-DLLAMA_CUBLAS=on" pip install llama-cpp-python
|
| 118 |
+
# Or with OpenBLAS acceleration
|
| 119 |
+
CMAKE_ARGS="-DLLAMA_BLAS=ON -DLLAMA_BLAS_VENDOR=OpenBLAS" pip install llama-cpp-python
|
| 120 |
+
# Or with CLBLast acceleration
|
| 121 |
+
CMAKE_ARGS="-DLLAMA_CLBLAST=on" pip install llama-cpp-python
|
| 122 |
+
# Or with AMD ROCm GPU acceleration (Linux only)
|
| 123 |
+
CMAKE_ARGS="-DLLAMA_HIPBLAS=on" pip install llama-cpp-python
|
| 124 |
+
# Or with Metal GPU acceleration for macOS systems only
|
| 125 |
+
CMAKE_ARGS="-DLLAMA_METAL=on" pip install llama-cpp-python
|
| 126 |
+
|
| 127 |
+
# In windows, to set the variables CMAKE_ARGS in PowerShell, follow this format; eg for NVidia CUDA:
|
| 128 |
+
$env:CMAKE_ARGS = "-DLLAMA_OPENBLAS=on"
|
| 129 |
+
pip install llama-cpp-python
|
| 130 |
+
```
|
| 131 |
+
|
| 132 |
+
#### Simple llama-cpp-python example code
|
| 133 |
+
|
| 134 |
+
```python
|
| 135 |
+
from llama_cpp import Llama
|
| 136 |
+
|
| 137 |
+
# Directly from huggingface-hub (requires huggingface-hub to be installed)
|
| 138 |
+
# Set gpu_layers to the number of layers to offload to GPU. Set to 0 if no GPU acceleration is available on your system.
|
| 139 |
+
llm = Llama.from_pretrained(
|
| 140 |
+
repo_id="norallm/normistral-7b-warm-instruct", # HuggingFace repository containing the GGUF files.
|
| 141 |
+
filename="*Q4_K_M.gguf", # suffix of the filename containing the level of quantization.
|
| 142 |
+
n_ctx=32768, # The max sequence length to use - note that longer sequence lengths require much more resources
|
| 143 |
+
n_threads=8, # The number of CPU threads to use, tailor to your system and the resulting performance
|
| 144 |
+
n_gpu_layers=16 # The number of layers to offload to GPU, if you have GPU acceleration available
|
| 145 |
+
)
|
| 146 |
+
|
| 147 |
+
# Simple inference example
|
| 148 |
+
output = llm(
|
| 149 |
+
"""<s><|im_start|> user
|
| 150 |
+
Hva kan jeg bruke einstape til?<|im_end|><|im_start|> assitant
|
| 151 |
+
""", # Prompt
|
| 152 |
+
max_tokens=512, # Generate up to 512 tokens
|
| 153 |
+
stop=["<|im_end|>"], # Example stop token
|
| 154 |
+
echo=True, # Whether to echo the prompt
|
| 155 |
+
temperature=0.3 # Temperature to set, for Q3_K_M, Q4_K_M, Q5_K_M, and Q6_0 it is recommended to set it relatively low.
|
| 156 |
+
)
|
| 157 |
+
|
| 158 |
+
# Chat Completion API
|
| 159 |
+
|
| 160 |
+
llm.create_chat_completion(
|
| 161 |
+
messages = [
|
| 162 |
+
{
|
| 163 |
+
"role": "user",
|
| 164 |
+
"content": Hva kan jeg bruke einstape til?"
|
| 165 |
+
}
|
| 166 |
+
]
|
| 167 |
+
)
|
| 168 |
+
```
|