[PR #4268] [MERGED] Convert directly from llama3 #11432

Closed
opened 2026-04-12 23:30:02 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/ollama/ollama/pull/4268
Author: @pdevine
Created: 5/8/2024
Status: Merged
Merged: 5/21/2024
Merged by: @mxyng

Base: mainHead: pdevine/llama3


📝 Commits (9)

📊 Changes

12 files changed (+437 additions, -306 deletions)

View changed files

📝 cmd/cmd.go (+1 -1)
📝 convert/convert.go (+16 -4)
convert/convert_test.go (+103 -0)
📝 convert/gemma.go (+14 -37)
📝 convert/llama.go (+86 -90)
📝 convert/mistral.go (+5 -88)
📝 convert/mixtral.go (+5 -3)
📝 convert/safetensors.go (+58 -37)
convert/tokenizer.go (+109 -0)
📝 convert/torch.go (+37 -35)
📝 go.mod (+1 -1)
📝 llm/gguf.go (+2 -10)

📄 Description

This change allows you to convert directly from a llama3 derived safetensors model into Ollama.

It is currently missing:

  • pytorch almost works however the embeddings layer size is off by the eos/bos tokens

This will work with most llama3 derivatives if they are using safetensors including dolphin-2.9-llama3, nous research's hermes 2 pro, and nvidia's chatqa.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/ollama/ollama/pull/4268 **Author:** [@pdevine](https://github.com/pdevine) **Created:** 5/8/2024 **Status:** ✅ Merged **Merged:** 5/21/2024 **Merged by:** [@mxyng](https://github.com/mxyng) **Base:** `main` ← **Head:** `pdevine/llama3` --- ### 📝 Commits (9) - [`d88582d`](https://github.com/ollama/ollama/commit/d88582dffd4a4ff0dcf7f347091f023945f9a26f) some changes for llama3 - [`4730762`](https://github.com/ollama/ollama/commit/4730762e5c9453f304aa456b549530e165ff1936) add safetensors version - [`c8cf0d9`](https://github.com/ollama/ollama/commit/c8cf0d94edeae0c71e3a0877895d9519b5d4d5e3) llama3 conversion - [`d355d20`](https://github.com/ollama/ollama/commit/d355d2020fcfc54c375eb697b7873742c3851881) add fixes for llama - [`2d315ba`](https://github.com/ollama/ollama/commit/2d315ba9a984f8db8f108b967b3af6fa4aa67669) add missing file - [`547132e`](https://github.com/ollama/ollama/commit/547132e820dcdc20c325d1de876a86a708b5744e) bpe pretokenizer - [`bbbd9f2`](https://github.com/ollama/ollama/commit/bbbd9f20f313af308bf4d573994e01fd5d5f7170) cleanup - [`34d5ef2`](https://github.com/ollama/ollama/commit/34d5ef29b3d01e2a0785af96df1135dfec567a3e) fix conversion for f16 or f32 inputs - [`3591bbe`](https://github.com/ollama/ollama/commit/3591bbe56fc3dba4d7cf9b77929143a58ffaaa59) add test ### 📊 Changes **12 files changed** (+437 additions, -306 deletions) <details> <summary>View changed files</summary> 📝 `cmd/cmd.go` (+1 -1) 📝 `convert/convert.go` (+16 -4) ➕ `convert/convert_test.go` (+103 -0) 📝 `convert/gemma.go` (+14 -37) 📝 `convert/llama.go` (+86 -90) 📝 `convert/mistral.go` (+5 -88) 📝 `convert/mixtral.go` (+5 -3) 📝 `convert/safetensors.go` (+58 -37) ➕ `convert/tokenizer.go` (+109 -0) 📝 `convert/torch.go` (+37 -35) 📝 `go.mod` (+1 -1) 📝 `llm/gguf.go` (+2 -10) </details> ### 📄 Description This change allows you to convert directly from a llama3 derived safetensors model into Ollama. It is currently *missing*: * pytorch *almost* works however the embeddings layer size is off by the eos/bos tokens This *will* work with most llama3 derivatives if they are using safetensors including `dolphin-2.9-llama3`, nous research's hermes 2 pro, and nvidia's chatqa. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
GiteaMirror added the pull-request label 2026-04-12 23:30:02 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/ollama#11432