tabbyAPI-ollama/tests/wheel_test.py
AlpinDale fa47f51f85
feat: workflows for formatting/linting (#35)
* add github workflows for pylint and yapf

* yapf

* docstrings for auth

* fix auth.py

* fix generators.py

* fix gen_logging.py

* fix main.py

* fix model.py

* fix templating.py

* fix utils.py

* update formatting.sh to include subdirs for pylint

* fix model_test.py

* fix wheel_test.py

* rename utils to utils_oai

* fix OAI/utils_oai.py

* fix completion.py

* fix token.py

* fix lora.py

* fix common.py

* add pylintrc and fix model.py

* finish up pylint

* fix attribute error

* main.py formatting

* add formatting batch script

* Main: Remove unnecessary global

Linter suggestion.

Signed-off-by: kingbri <bdashore3@proton.me>

* switch to ruff

* Formatting + Linting: Add ruff.toml

Signed-off-by: kingbri <bdashore3@proton.me>

* Formatting + Linting: Switch scripts to use ruff

Also remove the file and recent file change functions from both
scripts.

Signed-off-by: kingbri <bdashore3@proton.me>

* Tree: Format and lint

Signed-off-by: kingbri <bdashore3@proton.me>

* Scripts + Workflows: Format

Signed-off-by: kingbri <bdashore3@proton.me>

* Tree: Remove pylint flags

We use ruff now

Signed-off-by: kingbri <bdashore3@proton.me>

* Tree: Format

Signed-off-by: kingbri <bdashore3@proton.me>

* Formatting: Line length is 88

Use the same value as Black.

Signed-off-by: kingbri <bdashore3@proton.me>

* Tree: Format

Update to new line length rules.

Signed-off-by: kingbri <bdashore3@proton.me>

---------

Authored-by: AlpinDale <52078762+AlpinDale@users.noreply.github.com>
Co-authored-by: kingbri <bdashore3@proton.me>
2023-12-22 16:20:35 +00:00

46 lines
1.5 KiB
Python

""" Test if the wheels are installed correctly. """
from importlib.metadata import version
from importlib.util import find_spec
successful_packages = []
errored_packages = []
if find_spec("flash_attn") is not None:
print(f"Flash attention on version {version('flash_attn')} successfully imported")
successful_packages.append("flash_attn")
else:
print("Flash attention 2 is not found in your environment.")
errored_packages.append("flash_attn")
if find_spec("exllamav2") is not None:
print(f"Exllamav2 on version {version('exllamav2')} successfully imported")
successful_packages.append("exllamav2")
else:
print("Exllamav2 is not found in your environment.")
errored_packages.append("exllamav2")
if find_spec("torch") is not None:
print(f"Torch on version {version('torch')} successfully imported")
successful_packages.append("torch")
else:
print("Torch is not found in your environment.")
errored_packages.append("torch")
if find_spec("jinja2") is not None:
print(f"Jinja2 on version {version('jinja2')} successfully imported")
successful_packages.append("jinja2")
else:
print("Jinja2 is not found in your environment.")
errored_packages.append("jinja2")
print(
f"\nSuccessful imports: {', '.join(successful_packages)}",
f"\nErrored imports: {''.join(errored_packages)}",
)
if len(errored_packages) > 0:
print(
"\nIf packages are installed, but not found on this test, please "
"check the wheel versions for the correct python version and CUDA "
"version (if applicable)."
)