Skip to content
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

🐞 Bug: Linking models does not work #151

Open
1 task
khromov opened this issue Jan 23, 2025 · 8 comments
Open
1 task

🐞 Bug: Linking models does not work #151

khromov opened this issue Jan 23, 2025 · 8 comments
Assignees
Labels
bug Something isn't working

Comments

@khromov
Copy link

khromov commented Jan 23, 2025

Description

On a Mac m2 with macos sequoia.

First, the path seems wrong by default:

gollama -L
Linking model phi4:14b-q8_0 to /Users/user/.cache/lm-studio/models
Error: Linking models failed. Please check if you are running without Administrator on Windows.

The default LM Studio path is now /Users/user/.lmstudio/models

But even passing the correct path, can't link the model, even though folder is there:

➜ gollama -L -lm-dir /Users/user/.lmstudio/models
Linking model phi4:14b-q8_0 to /Users/user/.cache/lm-studio/models
Error: Linking models failed. Please check if you are running without Administrator on Windows.
Error detail: error walking LM Studio models directory: lstat /Users/user/.cache/lm-studio/models: no such file or directory
➜ ls /Users/user/.lmstudio/models
mlx-community <- directory exists and has files

How to reproduce

Screenshots / Logs

Environment

  • macOS version:
    or
  • Linux distribution:
  • Install source:
  • Go version:

Can you contribute?

  • I will attempt to implement a fix for this bug

How did you find out about Gollama?

@khromov khromov added the bug Something isn't working label Jan 23, 2025
@LarsLagauw
Copy link

LarsLagauw commented Jan 23, 2025

I have the same issue. I tried to add the LM Studio default path in the config file, but it seems like gollama doesn't read this property at all.

@geryduyck
Copy link

I had the same issue running LM studio 0.3.8 4 on M3 macbook pro (sequoia).
The easy work around is to create the 'old path' so that it exists, link the models and replace the generated folder(s) into the new destiny for LM studio.

but I agree, the path in gollama should be updated! :-)

@sammcj
Copy link
Owner

sammcj commented Jan 24, 2025

Ah I don't really use LM Studio much anymore (as they don't allow using it for work purposes) so didn't know the path had changed.

I'll definitely look into that config property not working correctly, I suspect I know what broke it.

but I agree, the path in gollama should be updated! :-)

PRs accepted!

@doskey
Copy link

doskey commented Jan 26, 2025

Same issue here. Please fix it. Thank you.

@sammcj
Copy link
Owner

sammcj commented Jan 26, 2025

@doskey feel free to submit a PR if you'd like?

@geryduyck
Copy link

geryduyck commented Jan 26, 2025

There is one curiosity to my previous fix --> I noticed on a different machine after updating LM Studio to the latest version that the model folder remained the same 'old' location.

Therefore a fix might need to include both and a check to see if the new location exists or not and if not fall back to the old one.

There might be a bug in this case, with new installations of LM Studio, where neither the new or old path is created.

I'm not so familiar with PR's on GitHub, but what I described here above could be implemented this way as a fix.
(in file main.go lines 317-319)

This code:

  1. Checks for the old path first and uses it if it exists
  2. If the old path doesn't exist, checks for the new path and uses it if found
  3. If neither path exists, creates the new path structure (.lmstudio/models) with proper permissions
  4. Assigns the chosen directory to app.lmStudioModelsDir
if *lmStudioDirFlag == "" {
    // Define old and new paths
    oldPath := filepath.Join(utils.GetHomeDir(), ".cache", "lm-studio", "models")
    newPath := filepath.Join(utils.GetHomeDir(), ".lmstudio", "models")

    var dir string

    // Check if the old path exists
    if _, err := os.Stat(oldPath); err == nil {
        dir = oldPath
    } else {
        // Old path doesn't exist, check new path
        if _, err := os.Stat(newPath); err == nil {
            dir = newPath
        } else {
            // New path doesn't exist, create it
            if err := os.MkdirAll(filepath.Dir(newPath), 0755); err != nil {
                panic(err)
            }
            // Create models directory if it doesn't exist
            if err := os.MkdirAll(newPath, 0755); err != nil {
                panic(err)
            }
            dir = newPath
        }
    }

    app.lmStudioModelsDir = dir
}

@magiusdarrigo
Copy link

Quick fix for friends before there is a patch PR. You can fix this by updating the "Models Directory" inside of LM Studio

Steps:

  1. Head over to the "My Models" sidebar tab on LM Studio
  2. Switch Models Directory at the top to the original local path. Eg. (/Users/JOHN_SMITH/.cache/lm-studio/models)
  3. Run gollama -L

Final Result:

Image

@sammcj
Copy link
Owner

sammcj commented Jan 27, 2025

Thanks, I've got a full on day at work today and tomorrow then I'll look at creating a proper fix for this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

6 participants