-
-
Notifications
You must be signed in to change notification settings - Fork 40
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
main: add reverse linking (LM Studio -> ollama) #156
Conversation
Fixes sammcj#68 cursor/claude-3.5-sonnet did all the coding
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.
Auto Pull Request Review from LlamaPReview
1. Overview
1.1 PR Summary
- Business value and requirements alignment: This PR introduces reverse linking from LM Studio to Ollama, addressing a gap in the current functionality where models could only be used from Ollama to LM Studio. This enhances the flexibility and usability of
gollama
by allowing users who start with LM Studio to integrate their models seamlessly into Ollama. - Key components modified: The PR modifies the
main.go
file, adding new functions for scanning LM Studio models, creating symlinks, generating Modelfiles, and integrating with Ollama's CLI. - Impact assessment: The changes introduce new file system operations and external command executions, which add complexity to the system. Proper error handling and permissions management are critical to ensure robustness.
- System dependencies and integration impacts: The PR interacts with the file system for directory scanning, symlink creation, and file writing. It also executes external
ollama
CLI commands, introducing dependencies on OS-level functionalities and theollama
tool.
1.2 Architecture Changes
- System design modifications: The PR adds new integration points with LM Studio, expanding the model management capabilities of
gollama
. It introduces file system operations and external command executions, which need to be carefully managed to ensure system stability. - Component interactions: The new functionality interacts with the file system to scan directories, create symlinks, and write Modelfiles. It also executes
ollama
CLI commands to register models, introducing dependencies on theollama
tool and OS-level functionalities. - Integration points: The PR adds a new command-line flag
-link-lmstudio
to trigger the reverse linking process. It integrates with LM Studio by scanning its models directory and with Ollama by executing CLI commands to register models.
2. Detailed Technical Analysis
2.1 Code Logic Deep-Dive
Core Logic Changes
- main.go - scanLMStudioModels
- Submitted PR Code:
func scanLMStudioModels(dirPath string) ([]LMStudioModel, error) {
var models []LMStudioModel
err := filepath.Walk(dirPath, func(path string, info os.FileInfo, err error) error {
if err != nil {
return err
}
// Skip directories
if info.IsDir() {
return nil
}
// Check for model file extensions
ext := strings.ToLower(filepath.Ext(path))
if ext == ".gguf" || ext == ".bin" {
name := strings.TrimSuffix(filepath.Base(path), ext)
models = append(models, LMStudioModel{
Name: name,
Path: path,
FileType: strings.TrimPrefix(ext, "."),
})
}
return nil
})
if err != nil {
return nil, fmt.Errorf("error scanning directory: %w", err)
}
return models, nil
}
- Analysis:
- The
scanLMStudioModels
function usesfilepath.Walk
to traverse the given directory. While it correctly identifies.gguf
and.bin
files, it lacks robustness in handling potential errors within the walk function itself. Specifically, if thefilepath.Walk
encounters an error during traversal (e.g., permission denied for a subdirectory), the walk function will still returnnil
for the walk function's error, but the overallfilepath.Walk
might still return an error. This error is then correctly returned byscanLMStudioModels
. However, the current implementation within the walk function's anonymous function always returnsnil
after checking for errors, which might mask specific errors encountered during file processing within the walk. - The function assumes that any file ending with
.gguf
or.bin
in the LM Studio models directory is a valid model file. It does not perform any validation on the file content or format. This could lead to issues if non-model files with these extensions are present in the directory.
- The
- LlamaPReview Suggested Improvements:
func scanLMStudioModels(dirPath string) ([]LMStudioModel, error) {
var models []LMStudioModel
err := filepath.Walk(dirPath, func(path string, info os.FileInfo, walkErr error) error { // [LlamaPReview: Renamed err to walkErr for clarity]
if walkErr != nil { // [LlamaPReview: Check walkErr here]
return walkErr // [LlamaPReview: Return walkErr to stop walking and propagate error]
}
// Skip directories
if info.IsDir() {
return nil
}
// Check for model file extensions
ext := strings.ToLower(filepath.Ext(path))
if ext == ".gguf" || ext == ".bin" {
name := strings.TrimSuffix(filepath.Base(path), ext)
models = append(models, LMStudioModel{
Name: name,
Path: path,
FileType: strings.TrimPrefix(ext, "."),
})
}
return nil
})
if err != nil {
return nil, fmt.Errorf("error scanning directory: %w", err)
}
return models, nil
}
- Improvement rationale:
- Technical benefits: By checking and returning
walkErr
within thefilepath.Walk
function, we ensure that any errors encountered during directory traversal, such as permission issues, are correctly propagated and handled. This improves error reporting and prevents potential silent failures in directory scanning. Renaming the error variable towalkErr
improves clarity and distinguishes it from the outer function's error variable. - Risk assessment: Addresses the risk of masking directory traversal errors, leading to more robust error handling.
- Technical benefits: By checking and returning
Core Logic Changes
- main.go - linkModelToOllama
- Submitted PR Code:
func linkModelToOllama(model LMStudioModel) error {
ollamaDir := getOllamaModelDir()
// Create Ollama models directory if it doesn't exist
if err := os.MkdirAll(ollamaDir, 0755); err != nil {
return fmt.Errorf("failed to create Ollama models directory: %w", err)
}
targetPath := filepath.Join(ollamaDir, filepath.Base(model.Path))
// Create symlink for model file
if err := os.Symlink(model.Path, targetPath); err != nil {
if !os.IsExist(err) {
return fmt.Errorf("failed to create symlink: %w", err)
}
}
// Check if model is already registered with Ollama
if modelExists(model.Name) {
return nil
}
// Create model-specific Modelfile
modelfilePath := filepath.Join(filepath.Dir(targetPath), fmt.Sprintf("Modelfile.%s", model.Name))
if err := createModelfile(model.Name, targetPath); err != nil {
return fmt.Errorf("failed to create Modelfile: %w", err)
}
cmd := exec.Command("ollama", "create", model.Name, "-f", modelfilePath)
output, err := cmd.CombinedOutput()
if err != nil {
return fmt.Errorf("failed to create Ollama model: %s
%w", string(output), err)
}
// Clean up the Modelfile after successful creation
if err := os.Remove(modelfilePath); err != nil {
logging.ErrorLogger.Printf("Warning: Could not remove temporary Modelfile %s: %v
", modelfilePath, err)
}
return nil
}
- Analysis:
- Symlink Creation Error Handling: The code checks
os.IsExist(err)
whenos.Symlink
fails. While this handles the case where the symlink already exists, it might not cover all scenarios where symlink creation fails due to other reasons like permission issues in the target directory, or if a file with the same name already exists at the target path but is not a symlink. A more robust approach would be to check for specific error types or log the actual error for better debugging. - Modelfile Cleanup: The Modelfile cleanup after successful
ollama create
is done with a warning log in case of failure. While non-critical, failing to remove temporary files can accumulate over time, especially if the linking process is run repeatedly and encounters issues duringollama create
but succeeds in symlinking and Modelfile creation. It might be beneficial to implement a more reliable cleanup mechanism, possibly usingdefer os.Remove(modelfilePath)
right after creating the Modelfile, ensuring cleanup even ifollama create
fails. However, deferred cleanup might remove the Modelfile even ifollama create
fails, which is not desirable. A better approach is to only remove the Modelfile ifollama create
is successful. - Redundant Model Exists Check: The code checks
modelExists(model.Name)
before creating the Modelfile and runningollama create
. However,ollama create
itself should handle cases where a model with the same name already exists. Ifollama create
fails because the model exists, the error will be caught. Therefore, the explicitmodelExists
check might be redundant and add unnecessary overhead. Removing this check would simplify the logic and rely onollama create
for handling model existence conflicts. However, keeping the check allows for a faster exit without invokingollama create
if the model already exists, which might be slightly more efficient in some cases.
- Symlink Creation Error Handling: The code checks
- LlamaPReview Suggested Improvements:
func linkModelToOllama(model LMStudioModel) error {
ollamaDir := getOllamaModelDir()
// Create Ollama models directory if it doesn't exist
if err := os.MkdirAll(ollamaDir, 0755); err != nil {
return fmt.Errorf("failed to create Ollama models directory: %w", err)
}
targetPath := filepath.Join(ollamaDir, filepath.Base(model.Path))
// Create symlink for model file
if err := os.Symlink(model.Path, targetPath); err != nil {
if os.IsExist(err) {
logging.InfoLogger.Printf("Symlink already exists for %s at %s", model.Name, targetPath) // [LlamaPReview: Log symlink already exists as info]
} else {
return fmt.Errorf("failed to create symlink for %s to %s: %w", model.Name, targetPath, err) // [LlamaPReview: Include model name in error and log full error]
}
}
// Create model-specific Modelfile
modelfilePath := filepath.Join(filepath.Dir(targetPath), fmt.Sprintf("Modelfile.%s", model.Name))
if err := createModelfile(model.Name, targetPath); err != nil {
return fmt.Errorf("failed to create Modelfile for %s: %w", model.Name, err) // [LlamaPReview: Include model name in error]
}
cmd := exec.Command("ollama", "create", model.Name, "-f", modelfilePath)
output, err := cmd.CombinedOutput()
if err != nil {
os.Remove(modelfilePath) // [LlamaPReview: Remove Modelfile on ollama create failure]
return fmt.Errorf("failed to create Ollama model %s: %s - %w", model.Name, string(output), err) // [LlamaPReview: Include model name and output in error]
}
// Clean up the Modelfile after successful creation
if err := os.Remove(modelfilePath); err != nil {
logging.ErrorLogger.Printf("Warning: Could not remove temporary Modelfile %s: %v", modelfilePath, err)
}
return nil
}
- Improvement rationale:
- Technical benefits: Improved error handling for symlink creation by logging more informative messages and including the model name in error messages. Ensures Modelfile is removed if
ollama create
fails, preventing accumulation of temporary files in failure scenarios. Logs when a symlink already exists as an informational message rather than silently ignoring it. - Risk assessment: Reduces the risk of silent failures and improves debuggability by providing more context in error messages and logs. Addresses potential resource accumulation by cleaning up Modelfiles on
ollama create
failures.
- Technical benefits: Improved error handling for symlink creation by logging more informative messages and including the model name in error messages. Ensures Modelfile is removed if
Core Logic Changes
- main.go - createModelfile
- Submitted PR Code:
func createModelfile(modelName string, modelPath string) error {
modelfilePath := filepath.Join(filepath.Dir(modelPath), fmt.Sprintf("Modelfile.%s", modelName))
// Check if Modelfile already exists
if _, err := os.Stat(modelfilePath); err == nil {
return nil
}
modelfileContent := fmt.Sprintf(`FROM %s
PARAMETER temperature 0.7
PARAMETER top_k 40
PARAMETER top_p 0.4
PARAMETER repeat_penalty 1.1
PARAMETER repeat_last_n 64
PARAMETER seed 0
PARAMETER stop "Human:" "Assistant:"
TEMPLATE """
{{.Prompt}}
Assistant: """
SYSTEM """You are a helpful AI assistant."""
`, filepath.Base(modelPath))
return os.WriteFile(modelfilePath, []byte(modelfileContent), 0644)
}
- Analysis:
- Modelfile Template Hardcoding: The
createModelfile
function hardcodes the Modelfile content as a string template. While functional, this approach makes it harder to maintain and modify the Modelfile template in the future. If the default parameters or template structure needs to be updated, it requires modifying Go code and recompiling. A better approach would be to externalize the Modelfile template, perhaps into a separate file or a configurable string within the application's configuration. This would allow for easier customization and updates to the Modelfile template without requiring code changes. - Lack of Modelfile Validation: The function creates a Modelfile without any validation of the
modelName
ormodelPath
. Whilefilepath.Base(modelPath)
is used, there's no explicit sanitization or validation to prevent potential issues if these inputs are malformed or contain unexpected characters. However, given the context of LM Studio model paths, this risk is relatively low. - Modelfile Parameter Defaults: The Modelfile template includes hardcoded parameters like
temperature
,top_k
, etc. These are reasonable defaults, but it might be beneficial to consider making these configurable, either through command-line flags or a configuration file, to allow users to customize the default behavior of linked models. This is a feature enhancement rather than a critical issue.
- Modelfile Template Hardcoding: The
- LlamaPReview Suggested Improvements:
import "text/template" // [LlamaPReview: Import text/template]
// Define Modelfile template as a constant string
const defaultModelfileTemplate = `FROM {{.ModelBaseName}}
PARAMETER temperature 0.7
PARAMETER top_k 40
PARAMETER top_p 0.4
PARAMETER repeat_penalty 1.1
PARAMETER repeat_last_n 64
PARAMETER seed 0
PARAMETER stop "Human:" "Assistant:"
TEMPLATE """
{{.Prompt}}
Assistant: """
SYSTEM """You are a helpful AI assistant."""
`
func createModelfile(modelName string, modelPath string) error {
modelfilePath := filepath.Join(filepath.Dir(modelPath), fmt.Sprintf("Modelfile.%s", modelName))
// Check if Modelfile already exists
if _, err := os.Stat(modelfilePath); err == nil {
return nil
}
tmpl, err := template.New("modelfile").Parse(defaultModelfileTemplate) // [LlamaPReview: Parse template]
if err != nil {
return fmt.Errorf("failed to parse Modelfile template: %w", err) // [LlamaPReview: Handle template parsing error]
}
modelfileData := struct { // [LlamaPReview: Data structure for template]
ModelBaseName string
}{
ModelBaseName: filepath.Base(modelPath),
}
file, err := os.Create(modelfilePath) // [LlamaPReview: Create file]
if err != nil {
return fmt.Errorf("failed to create Modelfile: %w", err) // [LlamaPReview: Handle file creation error]
}
defer file.Close()
err = tmpl.Execute(file, modelfileData) // [LlamaPReview: Execute template]
if err != nil {
return fmt.Errorf("failed to execute Modelfile template: %w", err) // [LlamaPReview: Handle template execution error]
}
return nil
}
- Improvement rationale:
- Technical benefits: Using
text/template
makes the Modelfile template more readable and maintainable. It separates the template structure from the Go code, making it easier to modify the template without recompiling the application. Error handling is improved by checking for errors during template parsing and execution. - Maintenance and evolution considerations: Easier to update and customize the Modelfile template in the future. The template can be further externalized into a separate file if needed for even greater flexibility.
- Technical benefits: Using
2.2 Implementation Quality
- Code organization and structure: The PR introduces new functions in
main.go
that are well-organized and follow a logical structure. The functions are modular and have clear responsibilities, making the code easy to understand and maintain. - Design patterns usage: The PR does not introduce any new design patterns but follows existing conventions within the
gollama
codebase. The use offilepath.Walk
for directory traversal andexec.Command
for external command execution are appropriate for the tasks at hand. - Error handling approach: The PR includes error handling for file system operations and external command executions. However, as noted in the deep-dive analysis, there are areas where error handling can be improved for better robustness and debuggability.
- Resource management: The PR manages resources such as file handles and temporary files appropriately. However, there are opportunities to improve the cleanup of temporary Modelfiles to prevent resource accumulation in failure scenarios.
3. Critical Findings
3.1 Potential Issues
- 🔴 Critical Issues
-
Symlink Creation Error Handling: The current implementation of symlink creation in
linkModelToOllama
does not handle all potential error scenarios robustly. Specifically, it does not log the actual error whenos.Symlink
fails, which can make debugging difficult.- Impact: This can lead to silent failures or difficult-to-debug issues when symlink creation fails due to reasons other than the symlink already existing.
- Recommendation: Improve error handling by logging the actual error and including the model name in the error message for better context.
-
Modelfile Cleanup: The current implementation of Modelfile cleanup in
linkModelToOllama
only logs a warning if the cleanup fails. This can lead to accumulation of temporary files over time, especially if the linking process is run repeatedly and encounters issues.- Impact: Accumulation of temporary files can lead to resource waste and potential issues with file system quotas.
- Recommendation: Implement a more reliable cleanup mechanism, such as using
defer os.Remove(modelfilePath)
right after creating the Modelfile, ensuring cleanup even ifollama create
fails. However, ensure that the Modelfile is only removed ifollama create
is successful.
-
3.2 Code Quality Concerns
-
Maintainability aspects: The hardcoding of the Modelfile template in
createModelfile
makes it difficult to maintain and modify the template in the future. Any updates to the template structure or default parameters require code changes and recompilation.- Recommendation: Externalize the Modelfile template into a separate file or a configurable string within the application's configuration to make it easier to update and customize without requiring code changes.
-
Readability issues: The current implementation of
scanLMStudioModels
does not handle errors within thefilepath.Walk
function robustly, which can make the code harder to understand and maintain.- Recommendation: Improve error handling within the
filepath.Walk
function by checking and returningwalkErr
to stop walking and propagate errors, making the code more readable and maintainable.
- Recommendation: Improve error handling within the
-
Performance bottlenecks: The current implementation of
linkModelToOllama
includes a check formodelExists
before creating the Modelfile and runningollama create
. This check might be redundant and add unnecessary overhead, asollama create
should handle cases where a model with the same name already exists.- Recommendation: Remove the
modelExists
check to simplify the logic and rely onollama create
for handling model existence conflicts. This can improve performance slightly by avoiding an unnecessary external command execution.
- Recommendation: Remove the
4. Security Assessment
- Authentication/Authorization impacts: The PR does not introduce any new authentication or authorization mechanisms. It relies on the existing
ollama
CLI for model registration, which should handle authentication and authorization as per its existing implementation. - Data handling concerns: The PR handles model files and directories, which are sensitive data. Proper error handling and permissions management are critical to ensure that these files are not accidentally exposed or modified.
- Input validation: The PR does not perform explicit input validation on the model file paths or names. While the risk is relatively low given the context of LM Studio model paths, it might be beneficial to consider adding basic sanitization or validation to prevent potential issues with malformed or unexpected inputs.
- Security best practices: The PR follows security best practices by using
os.MkdirAll
with appropriate permissions and handling file system operations carefully. However, there are opportunities to improve error handling and logging for better debuggability and robustness. - Potential security risks: The PR introduces file system operations and external command executions, which can be risky if not handled properly. Proper error handling and permissions management are critical to mitigate potential security risks.
- Mitigation strategies: Ensure that all file system operations and external command executions are handled with proper error handling and permissions management. Consider adding input validation or sanitization for model file paths and names to prevent potential issues with malformed or unexpected inputs.
- Security testing requirements: Test the PR on different operating systems and with various LM Studio model file types and directory structures to ensure that file system operations and external command executions are handled correctly and securely.
5. Testing Strategy
5.1 Test Coverage
- Unit test analysis: The PR introduces new functions in
main.go
that should be covered by unit tests. Specifically, tests should be added forscanLMStudioModels
,linkModelToOllama
, andcreateModelfile
to ensure that they handle various input scenarios and edge cases correctly. - Integration test requirements: Integration tests should be added to verify the end-to-end linking process, including scanning LM Studio models, creating symlinks, generating Modelfiles, and registering models with Ollama. These tests should cover various scenarios, such as different LM Studio model file types and directory structures, and ensure that the linking process handles errors and edge cases correctly.
- Edge cases coverage: Tests should be added to cover edge cases, such as permission issues during directory scanning or symlink creation, invalid LM Studio paths, and
ollama create
command failures. These tests should ensure that the linking process handles these edge cases gracefully and provides informative error messages.
5.2 Test Recommendations
Suggested Test Cases
// Unit test for scanLMStudioModels
func TestScanLMStudioModels(t *testing.T) {
// Create a temporary directory with sample model files
tempDir := t.TempDir()
createSampleModelFiles(tempDir)
// Call scanLMStudioModels and verify the results
models, err := scanLMStudioModels(tempDir)
if err != nil {
t.Fatalf("scanLMStudioModels failed: %v", err)
}
// Verify that the correct models were found
expectedModels := []LMStudioModel{
{Name: "model1", Path: filepath.Join(tempDir, "model1.gguf"), FileType: "gguf"},
{Name: "model2", Path: filepath.Join(tempDir, "model2.bin"), FileType: "bin"},
}
if !reflect.DeepEqual(models, expectedModels) {
t.Fatalf("scanLMStudioModels returned unexpected models: %v", models)
}
}
// Integration test for linkModelToOllama
func TestLinkModelToOllama(t *testing.T) {
// Create a temporary directory with sample model files
tempDir := t.TempDir()
createSampleModelFiles(tempDir)
// Call linkModelToOllama and verify the results
model := LMStudioModel{Name: "model1", Path: filepath.Join(tempDir, "model1.gguf"), FileType: "gguf"}
err := linkModelToOllama(model)
if err != nil {
t.Fatalf("linkModelToOllama failed: %v", err)
}
// Verify that the symlink and Modelfile were created correctly
ollamaDir := getOllamaModelDir()
targetPath := filepath.Join(ollamaDir, "model1.gguf")
modelfilePath := filepath.Join(filepath.Dir(targetPath), "Modelfile.model1")
if _, err := os.Lstat(targetPath); os.IsNotExist(err) {
t.Fatalf("Symlink was not created: %v", err)
}
if _, err := os.Stat(modelfilePath); os.IsNotExist(err) {
t.Fatalf("Modelfile was not created: %v", err)
}
// Clean up the created symlink and Modelfile
os.Remove(targetPath)
os.Remove(modelfilePath)
}
- Coverage improvements: Add tests to cover various input scenarios and edge cases for the new functions introduced in the PR. Ensure that the tests cover different operating systems and LM Studio model file types and directory structures.
- Performance testing needs: Performance testing should be conducted to ensure that the linking process handles large numbers of LM Studio models efficiently. Specifically, test the performance of directory scanning, symlink creation, and Modelfile generation with a large number of model files.
6. Documentation & Maintenance
- Documentation updates needed: Update the project's documentation to reflect the new reverse linking functionality from LM Studio to Ollama. This should include updates to the user guide, API documentation, and any relevant configuration files.
- Long-term maintenance considerations: The new functionality introduces dependencies on the file system and the
ollama
CLI tool. Ensure that these dependencies are well-documented and that any changes to the file system orollama
CLI are communicated to users. Consider adding monitoring and logging to track the usage and performance of the new functionality over time. - Technical debt and monitoring requirements: The PR introduces new file system operations and external command executions, which can be risky if not handled properly. Ensure that these operations are well-documented and monitored to catch any potential issues early. Consider adding input validation or sanitization for model file paths and names to prevent potential issues with malformed or unexpected inputs.
7. Deployment & Operations
- Deployment impact and strategy: The PR introduces new functionality that should be thoroughly tested before deployment. Ensure that the new functionality is tested on different operating systems and with various LM Studio model file types and directory structures. Consider deploying the new functionality in a staged rollout to catch any potential issues early.
- Key operational considerations: The new functionality introduces dependencies on the file system and the
ollama
CLI tool. Ensure that these dependencies are well-documented and that any changes to the file system orollama
CLI are communicated to users. Consider adding monitoring and logging to track the usage and performance of the new functionality over time.
8. Summary & Recommendations
8.1 Key Action Items
- Improve error handling for symlink creation in
linkModelToOllama
by logging the actual error and including the model name in the error message for better context. - Implement a more reliable cleanup mechanism for Modelfiles in
linkModelToOllama
to prevent accumulation of temporary files in failure scenarios. - Externalize the Modelfile template in
createModelfile
to make it easier to update and customize without requiring code changes. - Improve error handling within the
filepath.Walk
function inscanLMStudioModels
by checking and returningwalkErr
to stop walking and propagate errors, making the code more readable and maintainable. - Remove the
modelExists
check inlinkModelToOllama
to simplify the logic and rely onollama create
for handling model existence conflicts.
8.2 Future Considerations
- Technical evolution path: Consider adding input validation or sanitization for model file paths and names to prevent potential issues with malformed or unexpected inputs. Explore ways to make the Modelfile parameters configurable to allow users to customize the default behavior of linked models.
- Business capability evolution: The new reverse linking functionality enhances the flexibility and usability of
gollama
by allowing users who start with LM Studio to integrate their models seamlessly into Ollama. This can open up new use cases and business opportunities forgollama
. - System integration impacts: The PR introduces new integration points with LM Studio and the
ollama
CLI tool. Ensure that these integrations are well-documented and that any changes to the file system orollama
CLI are communicated to users. Consider adding monitoring and logging to track the usage and performance of the new functionality over time.
💡 Help Shape LlamaPReview
How's this review format working for you? Vote in our Github Discussion Polls to help us improve your review experience!
Woa - nice work @erg! Thank you so much for contributing, you have no idea nice it is when someone values your work enough to take the time to improve it. I'll check it out locally and have a look. |
Note - after merging I might make some slight changes to the default Modelfile template based on my own biases towards default parameters, but I'll look at making the default modelfile a configurable template for users. |
The last patch is based on suggestions from LlamaPReview. I think it works just fine without that whole patch! The previous patch just uses |
No worries @erg, I've just added to it:
|
feat(lm-to-ollama): add -dry-run to linking feat(lm-to-ollama): add recursive linking protection
c9c6953
to
1d4ce35
Compare
Fixes #68
I was surprised that gollama only lets you use LLMs from ollama -> lm studio. (I started with LM Studio and just today installed ollama.)
I prompted Cursor to write the code and it seems to work. It takes awhile to import the first time (it has to generate Modelfiles) but subsequent runs are instantaneous. Installing the same model with ollama afterwards is a no-op since it has the link from LM Studio.
The only flaw I know of is when you download new models to LM Studio you will have to rerun this command.
The
type AppModel struct {
got reformatted, it's more consistent this way.Cursor/claude-3.5-sonnet did all the coding--it's very good at
go
and easy to have it make whatever changes you need to see this PR through.