2021-04-02 22:01:38 +02:00
|
|
|
// Matrix Construct
|
|
|
|
//
|
|
|
|
// Copyright (C) Matrix Construct Developers, Authors & Contributors
|
|
|
|
// Copyright (C) 2016-2021 Jason Volk <jason@zemos.net>
|
|
|
|
//
|
|
|
|
// Permission to use, copy, modify, and/or distribute this software for any
|
|
|
|
// purpose with or without fee is hereby granted, provided that the above
|
|
|
|
// copyright notice and this permission notice is present in all copies. The
|
|
|
|
// full license for this software is available in the LICENSE file.
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
#define HAVE_IRCD_GPT_PIPE_DESC_H
|
|
|
|
|
|
|
|
/// Pipe descriptor
|
|
|
|
struct ircd::gpt::pipe::desc
|
|
|
|
{
|
|
|
|
struct layer;
|
|
|
|
|
|
|
|
pipe::model *model;
|
|
|
|
pipe::code *code;
|
|
|
|
|
|
|
|
cl::data
|
2021-09-17 08:03:44 +02:00
|
|
|
state, // [root] projection (layers * tokens * embed * 3 * float)
|
|
|
|
master, // [root] single allocation for additional buffers:
|
|
|
|
accum, // [-sub] accumulator (tokens * embed * float)
|
|
|
|
logit, // [-sub] result logit vector (50257 * float)
|
|
|
|
logsm, // [-sub] outputs distribution (50257 * float)
|
|
|
|
ctrl, // [root] control page
|
|
|
|
opts; // [root] options page
|
2021-04-02 22:01:38 +02:00
|
|
|
|
|
|
|
cl::kern
|
|
|
|
lm_embed,
|
|
|
|
lm_norm,
|
|
|
|
lm_logit,
|
2021-04-11 04:28:23 +02:00
|
|
|
lm_logsm,
|
2021-04-17 20:59:30 +02:00
|
|
|
lm_select,
|
|
|
|
lm_norm_backprop,
|
|
|
|
lm_embed_backprop;
|
2021-04-02 22:01:38 +02:00
|
|
|
|
|
|
|
std::unique_ptr<struct desc::layer>
|
|
|
|
layer[12];
|
|
|
|
|
|
|
|
desc(pipe::code &, pipe::model &);
|
|
|
|
};
|
|
|
|
|
|
|
|
struct ircd::gpt::pipe::desc::layer
|
|
|
|
{
|
2021-09-17 08:03:44 +02:00
|
|
|
cl::data
|
|
|
|
state; // [-sub] qry/key/val projection (tokens * embed * 3 * float)
|
|
|
|
|
2021-04-17 20:59:30 +02:00
|
|
|
cl::kern
|
|
|
|
negative,
|
|
|
|
positive,
|
|
|
|
backattn,
|
|
|
|
backffnn;
|
2021-04-02 22:01:38 +02:00
|
|
|
|
|
|
|
layer(pipe::desc &, const int);
|
|
|
|
};
|