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
zhougaofeng
internlm2-math-7B
Commits
79a1e71f
"ppocr/data/imaug/make_border_map.py" did not exist on "10f7e5192d0d5e58793d1618e52f7de1214131e0"
Commit
79a1e71f
authored
Jun 11, 2024
by
zhougaofeng
Browse files
Upload New File
parent
93832447
Pipeline
#1150
canceled with stages
Changes
1
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
76 additions
and
0 deletions
+76
-0
src/llmfactory/extras/packages.py
src/llmfactory/extras/packages.py
+76
-0
No files found.
src/llmfactory/extras/packages.py
0 → 100644
View file @
79a1e71f
import
importlib.metadata
import
importlib.util
from
typing
import
TYPE_CHECKING
from
packaging
import
version
if
TYPE_CHECKING
:
from
packaging.version
import
Version
def
_is_package_available
(
name
:
str
)
->
bool
:
return
importlib
.
util
.
find_spec
(
name
)
is
not
None
def
_get_package_version
(
name
:
str
)
->
"Version"
:
try
:
return
version
.
parse
(
importlib
.
metadata
.
version
(
name
))
except
Exception
:
return
version
.
parse
(
"0.0.0"
)
def
is_fastapi_available
():
return
_is_package_available
(
"fastapi"
)
def
is_flash_attn2_available
():
return
_is_package_available
(
"flash_attn"
)
and
_get_package_version
(
"flash_attn"
)
>
version
.
parse
(
"2.0.0"
)
def
is_galore_available
():
return
_is_package_available
(
"galore_torch"
)
def
is_gradio_available
():
return
_is_package_available
(
"gradio"
)
def
is_jieba_available
():
return
_is_package_available
(
"jieba"
)
def
is_matplotlib_available
():
return
_is_package_available
(
"matplotlib"
)
def
is_nltk_available
():
return
_is_package_available
(
"nltk"
)
def
is_pillow_available
():
return
_is_package_available
(
"PIL"
)
def
is_requests_available
():
return
_is_package_available
(
"requests"
)
def
is_rouge_available
():
return
_is_package_available
(
"rouge_chinese"
)
def
is_sdpa_available
():
return
_get_package_version
(
"torch"
)
>
version
.
parse
(
"2.1.1"
)
def
is_starlette_available
():
return
_is_package_available
(
"sse_starlette"
)
def
is_uvicorn_available
():
return
_is_package_available
(
"uvicorn"
)
def
is_vllm_available
():
return
_is_package_available
(
"vllm"
)
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