Skip to content

Commit 499b2bc

Browse files
authored
Merge pull request #2047 from Yarboa/hf-cli-update
Renaming huggingface-cli -> hf
2 parents a86bdca + 241f3e8 commit 499b2bc

File tree

8 files changed

+18
-20
lines changed

8 files changed

+18
-20
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -834,7 +834,7 @@ $ cat /usr/share/ramalama/shortnames.conf
834834
$ ramalama login --token=XYZ
835835
```
836836
837-
Logging in to Hugging Face requires the `huggingface-cli tool`. For installation and usage instructions, see the documentation of the [Hugging Face command line interface](https://huggingface.co/docs/huggingface_hub/en/guides/cli).
837+
Logging in to Hugging Face requires the `hf tool`. For installation and usage instructions, see the documentation of the [Hugging Face command line interface](https://huggingface.co/docs/huggingface_hub/en/guides/cli).
838838
</details>
839839
840840
### [`ramalama-logout`](https://github.com/containers/ramalama/blob/main/docs/ramalama-logout.1.md)

docs/ramalama-login.1.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ Login to huggingface registry
5454
$ export RAMALAMA_TRANSPORT=huggingface
5555
$ ramalama login --token=XYZ
5656
```
57-
Logging in to Hugging Face requires the `huggingface-cli` tool. For installation and usage instructions, see the documentation of the Hugging Face command line interface: [*https://huggingface.co/docs/huggingface_hub/en/guides/cli*](https://huggingface.co/docs/huggingface_hub/en/guides/cli).
57+
Logging in to Hugging Face requires the `hf` tool. For installation and usage instructions, see the documentation of the Hugging Face command line interface: [*https://huggingface.co/docs/huggingface_hub/en/guides/cli*](https://huggingface.co/docs/huggingface_hub/en/guides/cli).
5858

5959
Login to ModelScope registry
6060
```

docsite/docs/commands/ramalama/login.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ Login to huggingface registry
5858
$ export RAMALAMA_TRANSPORT=huggingface
5959
$ ramalama login --token=XYZ
6060
```
61-
Logging in to Hugging Face requires the `huggingface-cli` tool. For installation and usage instructions, see the documentation of the Hugging Face command line interface: [*https://huggingface.co/docs/huggingface_hub/en/guides/cli*](https://huggingface.co/docs/huggingface_hub/en/guides/cli).
61+
Logging in to Hugging Face requires the `hf` tool. For installation and usage instructions, see the documentation of the Hugging Face command line interface: [*https://huggingface.co/docs/huggingface_hub/en/guides/cli*](https://huggingface.co/docs/huggingface_hub/en/guides/cli).
6262

6363
Login to ModelScope registry
6464
```bash

ramalama/hf_style_repo_base.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@ def __init__(self, model, model_store_path):
186186

187187
@abstractmethod
188188
def get_cli_command(self):
189-
"""Return the CLI command name (e.g., 'huggingface-cli', 'modelscope')"""
189+
"""Return the CLI command name (e.g., 'hf', 'modelscope')"""
190190
pass
191191

192192
@abstractmethod

ramalama/transports/huggingface.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,9 @@
2525
"""
2626

2727

28-
def is_huggingface_cli_available():
28+
def is_hf_cli_available():
2929
"""Check if huggingface-cli is available on the system."""
30-
return available("huggingface-cli")
30+
return available("hf")
3131

3232

3333
def huggingface_token():
@@ -150,10 +150,10 @@ def __init__(self, model, model_store_path):
150150
super().__init__(model, model_store_path)
151151

152152
self.type = "huggingface"
153-
self.hf_cli_available = is_huggingface_cli_available()
153+
self.hf_cli_available = is_hf_cli_available()
154154

155155
def get_cli_command(self):
156-
return "huggingface-cli"
156+
return "hf"
157157

158158
def get_missing_message(self):
159159
return missing_huggingface
@@ -177,7 +177,7 @@ def create_repository(self, name, organization, tag):
177177
return HuggingfaceRepository(name, organization, tag)
178178

179179
def get_cli_download_args(self, directory_path, model):
180-
return ["huggingface-cli", "download", "--local-dir", directory_path, model]
180+
return ["hf", "download", "--local-dir", directory_path, model]
181181

182182
def extract_model_identifiers(self):
183183
model_name, model_tag, model_organization = super().extract_model_identifiers()
@@ -230,7 +230,7 @@ def push(self, _, args):
230230
raise NotImplementedError(self.get_missing_message())
231231
proc = run_cmd(
232232
[
233-
"huggingface-cli",
233+
"hf",
234234
"upload",
235235
"--repo-type",
236236
"model",

test/conftest.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -70,8 +70,6 @@ def test_model():
7070
reason="GitHub Actions Darwin has not container support",
7171
)
7272

73-
skip_if_no_huggingface_cli = pytest.mark.skipif(
74-
shutil.which("huggingface-cli") is None, reason="huggingface-cli not installed"
75-
)
73+
skip_if_no_huggingface_cli = pytest.mark.skipif(shutil.which("hf") is None, reason="hf cli not installed")
7674

7775
skip_if_no_llama_bench = pytest.mark.skipif(shutil.which("llama-bench") is None, reason="llama-bench not installed")

test/system/050-pull.bats

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ load setup_suite
7777
is "$output" ".*Felladrin/gguf-smollm-360M-instruct-add-basics/smollm-360M-instruct-add-basics.IQ2_XXS" "image was actually pulled locally"
7878
run_ramalama rm huggingface://Felladrin/gguf-smollm-360M-instruct-add-basics/smollm-360M-instruct-add-basics.IQ2_XXS.gguf
7979

80-
skip_if_no_hf-cli
80+
skip_if_no_hf_cli
8181
run_ramalama pull hf://HuggingFaceTB/SmolLM-135M
8282
run_ramalama list
8383
is "$output" ".*HuggingFaceTB/SmolLM-135M" "image was actually pulled locally"
@@ -118,9 +118,9 @@ load setup_suite
118118
}
119119

120120
# bats test_tags=distro-integration
121-
@test "ramalama pull huggingface-cli cache" {
122-
skip_if_no_hf-cli
123-
huggingface-cli download Felladrin/gguf-smollm-360M-instruct-add-basics smollm-360M-instruct-add-basics.IQ2_XXS.gguf
121+
@test "ramalama pull hf cli cache" {
122+
skip_if_no_hf_cli
123+
hf download Felladrin/gguf-smollm-360M-instruct-add-basics smollm-360M-instruct-add-basics.IQ2_XXS.gguf
124124

125125
run_ramalama pull hf://Felladrin/gguf-smollm-360M-instruct-add-basics/smollm-360M-instruct-add-basics.IQ2_XXS.gguf
126126
run_ramalama list

test/system/helpers.bash

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -268,10 +268,10 @@ function is_apple_silicon() {
268268
fi
269269
}
270270

271-
function skip_if_no_hf-cli(){
272-
if ! command -v huggingface-cli 2>&1 >/dev/null
271+
function skip_if_no_hf_cli(){
272+
if ! command -v hf 2>&1 >/dev/null
273273
then
274-
skip "Not supported without huggingface-cli"
274+
skip "Not supported without hf client"
275275
fi
276276
}
277277

0 commit comments

Comments
 (0)