davda54 commited on
Commit
90f7ec2
1 Parent(s): a56f3c7

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +12 -9
README.md CHANGED
@@ -319,10 +319,10 @@ generate("I'm super excited about this Norwegian NORA model! Can it translate th
319
  ```
320
 
321
  _____
322
- ## Example usage with low GPU usage
323
  Install bitsandbytes if you want to load in 8bit
324
 
325
- ```python
326
  pip install bitsandbytes
327
  pip install accelerate
328
  ```
@@ -334,13 +334,17 @@ import torch
334
 
335
  # First, we will have to import the tokenizer and the language model
336
  tokenizer = AutoTokenizer.from_pretrained("norallm/normistral-7b-warm")
337
- model = AutoModelForCausalLM.from_pretrained("norallm/normistral-7b-warm",
338
- device_map='auto',
339
- load_in_8bit=True,
340
- torch_dtype=torch.float16)
341
  # This setup needs about 8gb VRAM
342
- # Setting load_in_8bit = False, 15gb VRAM
343
- # Using torch.float32 and load_in_8bit = False, 21gb VRAM
 
 
 
 
 
 
 
344
 
345
 
346
  # Now we will define the zero-shot prompt template
@@ -362,5 +366,4 @@ def generate(text):
362
 
363
  # Now you can simply call the generate function with an English text you want to translate:
364
  generate("I'm super excited about this Norwegian NORA model! Can it translate these sentences?")
365
- # > this should output: 'Jeg er super spent på denne norske NORA modellen! Kan den oversette disse setningene?'
366
  ```
 
319
  ```
320
 
321
  _____
322
+ ## Example usage on a GPU with ~16GB VRAM
323
  Install bitsandbytes if you want to load in 8bit
324
 
325
+ ```bash
326
  pip install bitsandbytes
327
  pip install accelerate
328
  ```
 
334
 
335
  # First, we will have to import the tokenizer and the language model
336
  tokenizer = AutoTokenizer.from_pretrained("norallm/normistral-7b-warm")
337
+
 
 
 
338
  # This setup needs about 8gb VRAM
339
+ # Setting `load_in_8bit=False` -> 15gb VRAM
340
+ # Using `torch.float32` and `load_in_8bit=False` -> 21gb VRAM
341
+ model = AutoModelForCausalLM.from_pretrained(
342
+ "norallm/normistral-7b-warm",
343
+ device_map='auto',
344
+ load_in_8bit=True,
345
+ torch_dtype=torch.bfloat16
346
+ )
347
+
348
 
349
 
350
  # Now we will define the zero-shot prompt template
 
366
 
367
  # Now you can simply call the generate function with an English text you want to translate:
368
  generate("I'm super excited about this Norwegian NORA model! Can it translate these sentences?")
 
369
  ```