Skip to content

Model magic #3025

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

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open

Model magic #3025

wants to merge 3 commits into from

Conversation

jboero
Copy link
Contributor

@jboero jboero commented Sep 5, 2023

Moved this to docs as per original request: #3011

@cebtenzzre
Copy link
Collaborator

cebtenzzre commented Sep 5, 2023

Could we also distribute an XML file for Linux users? It would be placed in ~/.local/share/mime/packages. I don't know if file uses it, but it would work with file managers and such. Here is an example:

<?xml version="1.0" encoding="UTF-8"?>
<mime-info xmlns="http://www.freedesktop.org/standards/shared-mime-info">
   <mime-type type="application/vnd.font-fontforge-sfd">
     <sub-class-of type="text/plain"/>
     <comment>Fontforge Spline Font Database</comment>
     <glob pattern="*.sfd"/>
     <magic>
       <match type="string" offset="0" value="SplineFontDB"/>
     </magic>
   </mime-type>
</mime-info>

@cebtenzzre
Copy link
Collaborator

And should we include the old GGML (mlgg) and GGMF (fmgg) formats? PR #3023 adds (limited) support for converting them to GGUF.

@staviq
Copy link
Contributor

staviq commented Sep 5, 2023

This just reminded me of something that makes me think we possibly shouldn't encourage edits to /etc/magic:

https://bugs.launchpad.net/ubuntu/+source/cupsys/+bug/255161 aka OpenOffice won't print on Tuesdays classic :)

Edit: Actually, I can sort of reproduce that bug already, any text file starting with GGUF is being recognized as GGUF LLM model

image

I don't have a printer at home to test if it breaks cups :)

@staviq
Copy link
Contributor

staviq commented Sep 5, 2023

I believe the XML for it would look like this:

<?xml version="1.0"?>
<mime-info xmlns='http://www.freedesktop.org/standards/shared-mime-info'>
  <mime-type type="model/x-ggml">
    <comment>GGML/GGJT LLM model</comment>
    <magic priority="50">
      <match type="string" offset="0" value="tjgg"/>
    </magic>
    <glob pattern="*.bin"/>
  </mime-type>
  <mime-type type="model/x-gguf">
    <comment>GGUF LLM model</comment>
    <magic priority="50">
      <match type="string" offset="0" value="GGUF"/>
    </magic>
    <glob pattern="*.bin"/>
    <glob pattern="*.gguf"/>
  </mime-type>
</mime-info>

Though I'm not sure if it's possible to have match on file extension together with match on filenames with no extension.

@cebtenzzre
Copy link
Collaborator

should we include the old GGML (mlgg) and GGMF (fmgg) formats?

There is also GGLA for LoRAs and GGSN for sessions.

Copy link
Contributor Author

@jboero jboero left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch thanks.

@jboero
Copy link
Contributor Author

jboero commented Sep 6, 2023

This just reminded me of something that makes me think we possibly shouldn't encourage edits to /etc/magic:

https://bugs.launchpad.net/ubuntu/+source/cupsys/+bug/255161 aka OpenOffice won't print on Tuesdays classic :)

Edit: Actually, I can sort of reproduce that bug already, any text file starting with GGUF is being recognized as GGUF LLM model

image

I don't have a printer at home to test if it breaks cups :)

Edit: Actually, I can sort of reproduce that bug already, any text file starting with GGUF is being recognized as GGUF LLM model

This I actually left in on purpose actually in case the version number couldn't be guessed. I don't suppose there's an upper bound for version number? I set 255 by default but not sure that's accurate.

Would it make sense to say anything showing a version > 255 is probably a bad coincidence?

@mofosyne mofosyne added the obsolete? Marker for potentially obsolete PR label May 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
obsolete? Marker for potentially obsolete PR
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants