Skip to content

Normalize graph of training - #1997

Closed
howard0su wants to merge 1 commit into
ggml-org:masterfrom
howard0su:cleanup-train
Closed

howard0su wants to merge 1 commit into
ggml-org:masterfrom
howard0su:cleanup-train

Conversation

@howard0su

Copy link
Copy Markdown
Contributor

Consolidate the duplicate functions into one to have operations:

  1. Support batch or single token
  2. use flash attention or not
  3. use cache or not

Baby step towards adding training APIs to llama.h.

@howard0su
howard0su requested a review from xaedes June 26, 2023 01:30
@slaren

slaren commented Jun 26, 2023

Copy link
Copy Markdown
Member

This looks great! Removing 700 lines of duplicated code would be very good.

@howard0su

Copy link
Copy Markdown
Contributor Author

Need second eyes to check if I do it correctly as this is compute graph change. I am not an expert in AI algorithms. There is potentially more code to be removed.

@xaedes

xaedes commented Jun 28, 2023

Copy link
Copy Markdown
Collaborator

There is potentially more code to be removed.

Absolutely! Wanted to leave the code-deduplication refactoring for later, after the most important features and optimizations are implemented.

The llama file loader changes should probably go into a separate pull request as they seem to be unrelated to the training.

I will look into the training related changed of this PR this week.

@ggerganov

Copy link
Copy Markdown
Member

@howard0su I think we already merged the model loading changes. Maybe recreate the PR for clarity

@howard0su

Copy link
Copy Markdown
Contributor Author

Sorry, I messed the commits. regen from latest master.

@xaedes

xaedes commented Sep 15, 2023

Copy link
Copy Markdown
Collaborator

I think this pull request is now obsolete, because all the here refactored functions are already removed in favor of one unified function to build the train graph:
https://github.com/ggerganov/llama.cpp/blob/7e50d34be68aae2cc766203703dd188e910e033a/examples/train-text-from-scratch/train-text-from-scratch.cpp#L645

@ggerganov ggerganov closed this Sep 15, 2023
bong-water-water-bong added a commit to 1bit-MONSTER/llama.cpp that referenced this pull request Nov 10, 2026
…ked-layout registrations (engine ggml-org#1997) (#287)

Several HRX MUL_MAT registrations read the weight in a packed layout that
is only materialised for a tensor in a buffer flagged as weights.
test_mul_mat keeps its weight in the ordinary buffer, so any case that
reached one of them was refused at execution and the suite compared the
never-written output (an "ERR" of k/3 + 1): those kernels had no
known-answer case at all.

test_mul_mat_resident_weight puts the weight in the weight context, as a
model's is, with one case per registration: the Q4_K packed prefill, the
Q6_K prefill, the Q6_K i8 prepacked and aligned-skinny forms, the Q6_K
one-token final projection, and the Q5_K prefill (native layout) as the
control.

Co-authored-by: bong-water-water-bong <[email protected]>
Co-authored-by: Claude Fable 5.2 <[email protected]>
bong-water-water-bong added a commit to 1bit-MONSTER/llama.cpp that referenced this pull request Nov 10, 2026
…ison, not scored (engine ggml-org#1997) (#290)

ggml_backend_compare_graph_backend ignored the status of both computes. A
backend that refuses or fails a graph leaves its outputs unwritten, and
the callback then compared those against the other backend: an HRX program
refused for an unflagged weight came out of test-backend-ops as
"ERR = 1358" - k/3 + 1 against the output tensor's random fill - which
reads like a kernel fault. The helper now says which backend failed, with
its status, compares nothing, and returns false.

Co-authored-by: bong-water-water-bong <[email protected]>
Co-authored-by: Claude Fable 5.2 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants