Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
OpenDAS
AutoAWQ
Commits
204a3a12
Commit
204a3a12
authored
Oct 06, 2023
by
Casper Hansen
Browse files
Update Mistral example
parent
e46703d8
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
3 deletions
+7
-3
examples/basic_generate.py
examples/basic_generate.py
+7
-3
No files found.
examples/basic_generate.py
View file @
204a3a12
...
...
@@ -4,7 +4,7 @@ from transformers import AutoTokenizer, TextStreamer
quant_path
=
"TheBloke/Mistral-7B-OpenOrca-AWQ"
# Load model
model
=
AutoAWQForCausalLM
.
from_quantized
(
quant_path
,
fuse_layers
=
Fals
e
,
safetensors
=
True
)
model
=
AutoAWQForCausalLM
.
from_quantized
(
quant_path
,
fuse_layers
=
Tru
e
,
safetensors
=
True
)
tokenizer
=
AutoTokenizer
.
from_pretrained
(
quant_path
,
trust_remote_code
=
True
)
streamer
=
TextStreamer
(
tokenizer
,
skip_prompt
=
True
,
skip_special_tokens
=
True
)
...
...
@@ -16,8 +16,12 @@ You are MistralOrca, a large language model trained by Alignment Lab AI. Write o
{prompt}<|im_end|>
<|im_start|>assistant"""
prompt
=
"You're standing on the surface of the Earth. "
\
"You walk one mile south, one mile west and one mile north. "
\
"You end up exactly where you started. Where are you?"
tokens
=
tokenizer
(
prompt_template
.
format
(
prompt
=
"Why is ice cream so good, yes so good?"
),
prompt_template
.
format
(
prompt
=
prompt
),
return_tensors
=
'pt'
).
input_ids
.
cuda
()
...
...
@@ -26,4 +30,4 @@ generation_output = model.generate(
tokens
,
streamer
=
streamer
,
max_new_tokens
=
512
)
)
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment