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
chenpangpang
transformers
Commits
2af199c4
Unverified
Commit
2af199c4
authored
Aug 02, 2024
by
Raushan Turganbay
Committed by
GitHub
Aug 02, 2024
Browse files
Update docs (#32368)
nits
parent
82efc535
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
2 additions
and
2 deletions
+2
-2
docs/source/en/model_doc/chameleon.md
docs/source/en/model_doc/chameleon.md
+1
-1
src/transformers/models/idefics2/modeling_idefics2.py
src/transformers/models/idefics2/modeling_idefics2.py
+1
-1
No files found.
docs/source/en/model_doc/chameleon.md
View file @
2af199c4
...
@@ -137,7 +137,7 @@ from transformers import ChameleonForConditionalGeneration, BitsAndBytesConfig
...
@@ -137,7 +137,7 @@ from transformers import ChameleonForConditionalGeneration, BitsAndBytesConfig
quantization_config
=
BitsAndBytesConfig
(
quantization_config
=
BitsAndBytesConfig
(
load_in_4bit
=
True
,
load_in_4bit
=
True
,
bnb_4bit_quant_type
=
"nf4"
,
bnb_4bit_quant_type
=
"nf4"
,
bnb_4bit_compute_dtype
=
torch
.
float16
,
bnb_4bit_compute_dtype
=
torch
.
b
float16
,
)
)
model
=
ChameleonForConditionalGeneration
.
from_pretrained
(
"facebook/chameleon-7b"
,
quantization_config
=
quantization_config
,
device_map
=
"cuda"
)
model
=
ChameleonForConditionalGeneration
.
from_pretrained
(
"facebook/chameleon-7b"
,
quantization_config
=
quantization_config
,
device_map
=
"cuda"
)
...
...
src/transformers/models/idefics2/modeling_idefics2.py
View file @
2af199c4
...
@@ -1558,7 +1558,7 @@ class Idefics2ForConditionalGeneration(Idefics2PreTrainedModel):
...
@@ -1558,7 +1558,7 @@ class Idefics2ForConditionalGeneration(Idefics2PreTrainedModel):
... "In which city is that bridge located?<image>",
... "In which city is that bridge located?<image>",
... ]
... ]
>>> images = [[image1, image2], [image3]]
>>> images = [[image1, image2], [image3]]
>>> inputs = processor(text=prompts, padding=True, return_tensors="pt").to("cuda")
>>> inputs = processor(text=prompts,
images=images,
padding=True, return_tensors="pt").to("cuda")
>>> # Generate
>>> # Generate
>>> generated_ids = model.generate(**inputs, bad_words_ids=BAD_WORDS_IDS, max_new_tokens=20)
>>> generated_ids = model.generate(**inputs, bad_words_ids=BAD_WORDS_IDS, max_new_tokens=20)
...
...
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