Skip to content

Commit

Permalink
Move push code to transport python
Browse files Browse the repository at this point in the history
Signed-off-by: Daniel J Walsh <[email protected]>
  • Loading branch information
rhatdan committed Aug 22, 2024
1 parent 2b369d0 commit ad04b63
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 4 deletions.
3 changes: 3 additions & 0 deletions ramalama.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@ def main(args):
ramalama.usage()

while len(args) > 0:
if args[0] == "-h" or args[0] == "--help":
ramalama.usage()

if args[0] == "--dryrun":
args.pop(0)
dryrun = True
Expand Down
9 changes: 5 additions & 4 deletions ramalama/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -209,11 +209,12 @@ def push_cli(store, args, port):
target = args.pop(0)
if model.startswith("oci://"):
return oci.push(store, model, target)
if model.startswith("huggingface://"):
return huggingface.push(store, model, target)
if model.startswith("ollama://"):
return ollama.push(store, model, target)

# TODO: Additional repository types can be added here, e.g., Ollama, HuggingFace, etc.
else:
raise NotImplementedError(
f"Unsupported repository type for model: {model}")
raise KeyError(f"Unsupported transport model must have ollama://, oci://, or huggingface:// prefix: {model}")


def run_cli(store, args, port):
Expand Down
3 changes: 3 additions & 0 deletions ramalama/huggingface.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,3 +30,6 @@ def pull(model, ramalama_store):
run_cmd(["ln", "-sf", relative_target_path, symlink_path])

return symlink_path

def push(store, model, target):
raise NotImplementedError("ramalama push not implemented for huggingface transport")
3 changes: 3 additions & 0 deletions ramalama/ollama.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,3 +92,6 @@ def init_pull(repos, manifests, accept, registry_head, model_name, model_tag, mo
symlink_path)

return symlink_path

def push(store, model, target):
raise NotImplementedError("ramalama push not implemented for ollama transport")

0 comments on commit ad04b63

Please sign in to comment.