- Introduced support for Hugging Face API integration, allowing fallback model resolution when Civitai fails. - Updated configuration to include `HF_TOKEN` and `HF_TOKEN_PATH` for authentication. - Enhanced model capture logic to differentiate between Civitai and Hugging Face sources. - Improved error handling for model downloads, providing clearer messages for authentication issues. - Updated documentation to reflect new environment variables and usage instructions for Hugging Face integration. - Added tests to validate the new fallback mechanism and ensure robust model resolution.
16 lines
454 B
Python
16 lines
454 B
Python
from gpu_rent.huggingface import hf_resolve_url, is_huggingface_url
|
|
|
|
|
|
def test_is_huggingface_url():
|
|
assert is_huggingface_url(
|
|
"https://huggingface.co/org/model/resolve/main/a.gguf"
|
|
)
|
|
assert not is_huggingface_url("https://civitai.red/models/1")
|
|
|
|
|
|
def test_hf_resolve_url():
|
|
assert (
|
|
hf_resolve_url("bartowski/foo", "bar.gguf")
|
|
== "https://huggingface.co/bartowski/foo/resolve/main/bar.gguf"
|
|
)
|