From 432f985dff420fe55a2023a8598291345afd4800 Mon Sep 17 00:00:00 2001 From: cmpatino Date: Tue, 3 Feb 2026 10:35:57 +0100 Subject: [PATCH 1/4] Fix issue with push-hf command The push-hf command was not working and returning an error related to "checkpoint_complete". --- src/tinker/cli/commands/checkpoint.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/tinker/cli/commands/checkpoint.py b/src/tinker/cli/commands/checkpoint.py index 3fdf87b..b7726ef 100644 --- a/src/tinker/cli/commands/checkpoint.py +++ b/src/tinker/cli/commands/checkpoint.py @@ -519,10 +519,13 @@ def _readme_tinker_path() -> str | None: f"Found {existing_tinker_path}, expected {tinker_path}.", ) + # Remove checkpoint_complete file before upload if no allow_patterns specified + # Workaround: huggingface_hub (which uses typer internally) conflicts with + # our Click-based CLI when "checkpoint_complete" is in ignore_patterns if allow_patterns is None: - ignore_patterns = list(ignore_patterns) if ignore_patterns else [] - if "checkpoint_complete" not in ignore_patterns: - ignore_patterns.append("checkpoint_complete") + checkpoint_complete_file = extract_dir / "checkpoint_complete" + if checkpoint_complete_file.exists(): + checkpoint_complete_file.unlink() api.upload_folder( folder_path=os.fspath(extract_dir), From c8fb4f5ee1f88524af0612d78d6ac7d03c8d9022 Mon Sep 17 00:00:00 2001 From: cmpatino Date: Tue, 3 Feb 2026 10:54:10 +0100 Subject: [PATCH 2/4] Enable creating revision in HF --- src/tinker/cli/commands/checkpoint.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/tinker/cli/commands/checkpoint.py b/src/tinker/cli/commands/checkpoint.py index b7726ef..0874f60 100644 --- a/src/tinker/cli/commands/checkpoint.py +++ b/src/tinker/cli/commands/checkpoint.py @@ -495,6 +495,19 @@ def _sanitize_repo_name(value: str) -> str: api.create_repo(repo_id=repo_id, private=private, exist_ok=exist_ok) + # Create the revision/branch if specified and it doesn't exist + if revision: + try: + # Check if the branch exists + refs = api.list_repo_refs(repo_id=repo_id) + branch_exists = any(ref.name == revision for ref in refs.branches) + if not branch_exists: + # Create the branch from main + api.create_branch(repo_id=repo_id, branch=revision, exist_ok=True) + except Exception: + # If we can't check or create the branch, try to proceed anyway + pass + def _readme_tinker_path() -> str | None: try: readme_file = hf_hub_download( From f49ac445ca6b39c86658f19dca18a9afc00fa0a9 Mon Sep 17 00:00:00 2001 From: cmpatino Date: Tue, 3 Feb 2026 11:11:17 +0100 Subject: [PATCH 3/4] Improve error logging when creating a HF revision --- src/tinker/cli/commands/checkpoint.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/tinker/cli/commands/checkpoint.py b/src/tinker/cli/commands/checkpoint.py index 0874f60..fd52d19 100644 --- a/src/tinker/cli/commands/checkpoint.py +++ b/src/tinker/cli/commands/checkpoint.py @@ -498,15 +498,15 @@ def _sanitize_repo_name(value: str) -> str: # Create the revision/branch if specified and it doesn't exist if revision: try: - # Check if the branch exists refs = api.list_repo_refs(repo_id=repo_id) branch_exists = any(ref.name == revision for ref in refs.branches) if not branch_exists: - # Create the branch from main api.create_branch(repo_id=repo_id, branch=revision, exist_ok=True) - except Exception: - # If we can't check or create the branch, try to proceed anyway - pass + except Exception as e: + raise TinkerCliError( + f"Failed to create branch {revision} in repo {repo_id}", + f"Error: {e}", + ) from e def _readme_tinker_path() -> str | None: try: From 34b44b27b8db55d06999a26b2cc168103a316045 Mon Sep 17 00:00:00 2001 From: cmpatino Date: Tue, 3 Feb 2026 11:31:18 +0100 Subject: [PATCH 4/4] Remove option to ignore_patterns from CLI --- src/tinker/cli/commands/checkpoint.py | 15 +-------------- 1 file changed, 1 insertion(+), 14 deletions(-) diff --git a/src/tinker/cli/commands/checkpoint.py b/src/tinker/cli/commands/checkpoint.py index fd52d19..8085945 100644 --- a/src/tinker/cli/commands/checkpoint.py +++ b/src/tinker/cli/commands/checkpoint.py @@ -335,7 +335,6 @@ def _export_checkpoint_to_hub( create_pr: bool, exist_ok: bool, allow_patterns: list[str] | None, - ignore_patterns: list[str] | None, add_model_card: bool, ) -> str: # Lazy imports to keep CLI startup fast @@ -533,12 +532,9 @@ def _readme_tinker_path() -> str | None: ) # Remove checkpoint_complete file before upload if no allow_patterns specified - # Workaround: huggingface_hub (which uses typer internally) conflicts with - # our Click-based CLI when "checkpoint_complete" is in ignore_patterns if allow_patterns is None: checkpoint_complete_file = extract_dir / "checkpoint_complete" - if checkpoint_complete_file.exists(): - checkpoint_complete_file.unlink() + checkpoint_complete_file.unlink(missing_ok=True) api.upload_folder( folder_path=os.fspath(extract_dir), @@ -548,7 +544,6 @@ def _readme_tinker_path() -> str | None: commit_message=commit_message, create_pr=create_pr, allow_patterns=list(allow_patterns) if allow_patterns else None, - ignore_patterns=list(ignore_patterns) if ignore_patterns else None, ) return repo_id @@ -1019,12 +1014,6 @@ def download( multiple=True, help="Only upload files matching this pattern (can be repeated).", ) -@click.option( - "--ignore-pattern", - "ignore_patterns", - multiple=True, - help="Skip files matching this pattern (can be repeated).", -) @click.option( "--no-model-card", is_flag=True, @@ -1041,7 +1030,6 @@ def push_hf( commit_message: str | None, create_pr: bool, allow_patterns: tuple[str, ...], - ignore_patterns: tuple[str, ...], no_model_card: bool, ) -> None: """Upload a checkpoint to the Hugging Face Hub as a PEFT adapter. @@ -1066,7 +1054,6 @@ def push_hf( create_pr=create_pr, exist_ok=True, allow_patterns=list(allow_patterns) if allow_patterns else None, - ignore_patterns=list(ignore_patterns) if ignore_patterns else None, add_model_card=not no_model_card, )