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
4ed9ae62
Unverified
Commit
4ed9ae62
authored
Mar 07, 2024
by
amyeroberts
Committed by
GitHub
Mar 07, 2024
Browse files
test_generation_config_is_loaded_with_model - fall back to pytorch model for now (#29521)
* Fall back to pytorch model for now * Fix up
parent
45c06510
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
2 deletions
+4
-2
tests/test_modeling_utils.py
tests/test_modeling_utils.py
+4
-2
No files found.
tests/test_modeling_utils.py
View file @
4ed9ae62
...
@@ -1188,12 +1188,14 @@ class ModelUtilsTest(TestCasePlus):
...
@@ -1188,12 +1188,14 @@ class ModelUtilsTest(TestCasePlus):
# `transformers_version` field set to `foo`. If loading the file fails, this test also fails.
# `transformers_version` field set to `foo`. If loading the file fails, this test also fails.
# 1. Load without further parameters
# 1. Load without further parameters
model
=
AutoModelForCausalLM
.
from_pretrained
(
"joaogante/tiny-random-gpt2-with-generation-config"
)
model
=
AutoModelForCausalLM
.
from_pretrained
(
"joaogante/tiny-random-gpt2-with-generation-config"
,
use_safetensors
=
False
)
self
.
assertEqual
(
model
.
generation_config
.
transformers_version
,
"foo"
)
self
.
assertEqual
(
model
.
generation_config
.
transformers_version
,
"foo"
)
# 2. Load with `device_map`
# 2. Load with `device_map`
model
=
AutoModelForCausalLM
.
from_pretrained
(
model
=
AutoModelForCausalLM
.
from_pretrained
(
"joaogante/tiny-random-gpt2-with-generation-config"
,
device_map
=
"auto"
"joaogante/tiny-random-gpt2-with-generation-config"
,
device_map
=
"auto"
,
use_safetensors
=
False
)
)
self
.
assertEqual
(
model
.
generation_config
.
transformers_version
,
"foo"
)
self
.
assertEqual
(
model
.
generation_config
.
transformers_version
,
"foo"
)
...
...
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