diff --git a/ramalama/cli.py b/ramalama/cli.py index 33d13f2b..8cbd16a0 100644 --- a/ramalama/cli.py +++ b/ramalama/cli.py @@ -164,7 +164,7 @@ def login_parser(subparsers): def login_cli(args): transport = args.TRANSPORT if transport != "": - transport = os.getenv("RAMALAMA_TRANSPORT") + transport = os.getenv("RAMALAMA_TRANSPORT") + "://" model = New(str(transport)) return model.login(args) @@ -182,7 +182,7 @@ def logout_parser(subparsers): def logout_cli(args): transport = args.TRANSPORT if transport != "": - transport = os.getenv("RAMALAMA_TRANSPORT") + transport = os.getenv("RAMALAMA_TRANSPORT") + "://" model = New(str(transport)) return model.logout(args) @@ -652,11 +652,11 @@ def dry_run(args): def New(model): - if model.startswith("huggingface"): + if model.startswith("huggingface://") or model.startswith("hf://"): return Huggingface(model) - if model.startswith("ollama"): + if model.startswith("ollama://"): return Ollama(model) - if model.startswith("oci") | model.startswith("docker"): + if model.startswith("oci://") or model.startswith("docker://"): return OCI(model) transport = os.getenv("RAMALAMA_TRANSPORT") diff --git a/ramalama/huggingface.py b/ramalama/huggingface.py index 1887ec90..e3eb5b2c 100644 --- a/ramalama/huggingface.py +++ b/ramalama/huggingface.py @@ -12,7 +12,9 @@ class Huggingface(Model): def __init__(self, model): - super().__init__(model.removeprefix("huggingface://")) + model = model.removeprefix("huggingface://") + model = model.removeprefix("hf://") + super().__init__(model) self.type = "HuggingFace" split = self.model.rsplit("/", 1) self.directory = "" diff --git a/test/system/050-pull.bats b/test/system/050-pull.bats index 28cdb925..bcabd067 100644 --- a/test/system/050-pull.bats +++ b/test/system/050-pull.bats @@ -25,6 +25,11 @@ load helpers # bats test_tags=distro-integration @test "ramalama pull huggingface" { + run_ramalama pull hf://afrideva/Tiny-Vicuna-1B-GGUF/tiny-vicuna-1b.q2_k.gguf + run_ramalama list + is "$output" ".*afrideva/Tiny-Vicuna-1B-GGUF/tiny-vicuna-1b.q2_k" "image was actually pulled locally" + run_ramalama rm hf://afrideva/Tiny-Vicuna-1B-GGUF/tiny-vicuna-1b.q2_k.gguf + run_ramalama pull huggingface://afrideva/Tiny-Vicuna-1B-GGUF/tiny-vicuna-1b.q2_k.gguf run_ramalama list is "$output" ".*afrideva/Tiny-Vicuna-1B-GGUF/tiny-vicuna-1b.q2_k" "image was actually pulled locally"