-
Notifications
You must be signed in to change notification settings - Fork 48
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add support for http, https and file pulls #463
Conversation
Reviewer's Guide by SourceryThis PR adds support for handling models stored on websites (via http/https) and local files by implementing a new URL transport class and refactoring common model functionality. The implementation moves shared model methods from specific transport classes to the base Model class and introduces a new URL transport type that handles http, https, and file protocols. Sequence diagram for pulling a model using URL transportsequenceDiagram
actor User
participant CLI
participant URL
participant Common
User->>CLI: run_ramalama pull <url>
CLI->>URL: pull(args)
URL->>Common: model_path(args)
URL->>Common: check_valid_model_path(relative_target_path, model_path)
alt Model is a file
URL->>Common: os.symlink(model, target_path)
else Model is a URL
URL->>Common: download_file(url, target_path)
URL->>Common: os.symlink(relative_target_path, model_path)
end
URL-->>CLI: return model_path
CLI-->>User: Model pulled successfully
Class diagram for the new URL transport classclassDiagram
class Model {
+login(args)
+logout(args)
+pull(args)
+push(source, args)
+garbage_collection(args)
+remove(args)
+_image(args)
+kube(model, args, exec_args)
+path(args)
+model_path(args)
+exists(args)
+check_valid_model_path(relative_target_path, model_path)
}
class URL {
+type: String
+directory: String
+filename: String
+pull(args)
}
Model <|-- URL
note for URL "Handles http, https, and file protocols"
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
ramalama/huggingface.py
Outdated
@@ -112,8 +101,7 @@ def pull(self, args): | |||
# Symlink is already correct, no need to update it | |||
return model_path | |||
|
|||
run_cmd(["ln", "-sf", relative_target_path, model_path], debug=args.debug) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think I used ln -sf at the time, because os.symlink doesn't overwrite symlinks, so say if we had:
some_ollama_mode -> some_sha256
and we pulled an updated version of the model, so a new sha256, I'm not sure os.symlink overwrites in that case, I think it throws an exception
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok I will change to attempt to remove first and then create the symlink.
@swarajpande5 PTAL |
1916a18
to
09f2766
Compare
Summary by Sourcery Add support for pulling models using http, https, and file URLs, enabling direct execution of models from web or local sources. Update documentation and add tes ts to cover the new functionality. New Features: Add support for pulling models using http, https, and file URLs, allowing mo dels to be run directly from web sources or local files. Enhancements: Refactor the symlink creation process to use os.symlink directly instead of run_cmd. Documentation: Update documentation to include new URL syntax support for http, https, and file protocols, explaining how models can be pulled from these sources. Tests: Add system tests to verify the functionality of pulling models using file an d https URLs, ensuring they can be listed and removed correctly. Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
@ericcurtin Sorry, I was out of town for team meetup. I'll resume contributing to ramalama from November 25th. |
RamaLama should be able to handle Models stored on web sites as well as previously pulled to the machine.
Summary by Sourcery
Add support for pulling models using http, https, and file URLs, enabling direct execution of models from web or local sources. Update documentation and add tests to cover the new functionality.
New Features:
Enhancements:
Documentation:
Tests: