Update README.md
Browse files
README.md
CHANGED
@@ -31,15 +31,17 @@ You can find more details in the [technical report](https://arxiv.org/abs/2310.1
|
|
31 |
|
32 |
|
33 |
## Use in Transformers
|
34 |
-
|
35 |
import torch \
|
36 |
-
from transformers import AutoTokenizer, AutoModelForCausalLM, MistralForCausalLM
|
|
|
37 |
|
38 |
model = MistralForCausalLM.from_pretrained("ai-agi/neural-zephyr", use_cache=False, torch_dtype=torch.bfloat16, device_map="auto") \
|
39 |
-
|
40 |
-
|
|
|
41 |
|
42 |
tokenizer = AutoTokenizer.from_pretrained("ai-agi/neural-zephyr", use_fast=True) \
|
43 |
if tokenizer.pad_token is None: \
|
44 |
-
tokenizer.pad_token = tokenizer.eos_token)
|
45 |
-
|
|
|
31 |
|
32 |
|
33 |
## Use in Transformers
|
34 |
+
**Load model directly** \
|
35 |
import torch \
|
36 |
+
from transformers import AutoTokenizer, AutoModelForCausalLM, MistralForCausalLM \
|
37 |
+
from huggingface_hub import hf_hub_download
|
38 |
|
39 |
model = MistralForCausalLM.from_pretrained("ai-agi/neural-zephyr", use_cache=False, torch_dtype=torch.bfloat16, device_map="auto") \
|
40 |
+
model_weights = hf_hub_download(repo_id="ai-agi/neural-zephyr", filename="model_weights.pth") \
|
41 |
+
state_dict = torch.load(model_weights) \
|
42 |
+
model.load_state_dict(state_dict)
|
43 |
|
44 |
tokenizer = AutoTokenizer.from_pretrained("ai-agi/neural-zephyr", use_fast=True) \
|
45 |
if tokenizer.pad_token is None: \
|
46 |
+
tokenizer.pad_token = tokenizer.eos_token) \
|
47 |
+
**Manage your GPU/CPU memory for model and weights**
|