Some checks failed
Linux Build / Linux cpu (push) Has been cancelled
Linux Build / Linux cpu-clang (push) Has been cancelled
Linux Build / Linux vulkan (push) Has been cancelled
mac-build / macOS CPU (push) Has been cancelled
Nix Build / Nix (cpu) (push) Has been cancelled
Nix Build / Nix (vulkan) (push) Has been cancelled
windows-build / Windows CPU (push) Has been cancelled
58 lines
1.8 KiB
C++
58 lines
1.8 KiB
C++
#pragma once
|
|
|
|
#include "engine/models/vevo2/assets.h"
|
|
#include "engine/models/vevo2/tokenizer_ar.h"
|
|
#include "engine/models/vevo2/types.h"
|
|
|
|
#include <cstddef>
|
|
#include <memory>
|
|
|
|
namespace engine::assets {
|
|
enum class TensorStorageType;
|
|
class TensorSource;
|
|
}
|
|
|
|
namespace engine::core {
|
|
class ExecutionContext;
|
|
}
|
|
|
|
namespace engine::models::vevo2 {
|
|
|
|
struct Vevo2Qwen2ARWeights;
|
|
struct Vevo2Qwen2ARPrefillGraph;
|
|
struct Vevo2Qwen2ARDecodeGraph;
|
|
|
|
class Vevo2Qwen2ARRuntime final {
|
|
public:
|
|
Vevo2Qwen2ARRuntime(
|
|
std::shared_ptr<const Vevo2Assets> assets,
|
|
engine::core::ExecutionContext & execution_context,
|
|
size_t weight_context_bytes,
|
|
size_t prefill_graph_context_bytes,
|
|
size_t decode_graph_context_bytes,
|
|
engine::assets::TensorStorageType weight_storage_type);
|
|
~Vevo2Qwen2ARRuntime();
|
|
|
|
Vevo2TokenSequence generate_content_style(
|
|
const Vevo2PromptParts & prompt,
|
|
const Vevo2GenerationOptions & generation) const;
|
|
int64_t last_prompt_tokens() const noexcept;
|
|
int32_t eos_token_id() const noexcept;
|
|
int32_t pad_token_id() const noexcept;
|
|
const Vevo2Qwen2ARConfig & config() const noexcept;
|
|
bool weights_uploaded() const noexcept;
|
|
|
|
private:
|
|
std::shared_ptr<const Vevo2Assets> assets_;
|
|
engine::core::ExecutionContext & execution_context_;
|
|
size_t prefill_graph_context_bytes_ = 0;
|
|
size_t decode_graph_context_bytes_ = 0;
|
|
Vevo2ARTokenizer tokenizer_;
|
|
std::shared_ptr<const engine::assets::TensorSource> weight_source_;
|
|
std::shared_ptr<const Vevo2Qwen2ARWeights> weights_;
|
|
mutable std::unique_ptr<Vevo2Qwen2ARPrefillGraph> prefill_graph_;
|
|
mutable std::unique_ptr<Vevo2Qwen2ARDecodeGraph> decode_graph_;
|
|
mutable int64_t last_prompt_tokens_ = 0;
|
|
};
|
|
|
|
} // namespace engine::models::vevo2
|