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
text-generation-inference
Commits
a88c54bb
Unverified
Commit
a88c54bb
authored
Apr 19, 2023
by
OlivierDehaene
Committed by
GitHub
Apr 19, 2023
Browse files
feat(server): check cuda capability when importing flash models (#201)
close #198
parent
e14ae3b5
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
1 deletion
+12
-1
server/text_generation_server/models/__init__.py
server/text_generation_server/models/__init__.py
+12
-1
No files found.
server/text_generation_server/models/__init__.py
View file @
a88c54bb
...
@@ -24,7 +24,18 @@ try:
...
@@ -24,7 +24,18 @@ try:
FlashSantacoderSharded
,
FlashSantacoderSharded
,
)
)
FLASH_ATTENTION
=
torch
.
cuda
.
is_available
()
if
torch
.
cuda
.
is_available
():
major
,
minor
=
torch
.
cuda
.
get_device_capability
()
is_sm75
=
major
==
7
and
minor
==
5
is_sm8x
=
major
==
8
and
minor
>=
0
is_sm90
=
major
==
9
and
minor
==
0
supported
=
is_sm75
or
is_sm8x
or
is_sm90
if
not
supported
:
raise
ImportError
(
f
"GPU with CUDA capability
{
major
}
{
minor
}
is not supported"
)
FLASH_ATTENTION
=
True
else
:
FLASH_ATTENTION
=
False
except
ImportError
:
except
ImportError
:
logger
.
opt
(
exception
=
True
).
warning
(
logger
.
opt
(
exception
=
True
).
warning
(
"Could not import Flash Attention enabled models"
"Could not import Flash Attention enabled models"
...
...
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