infinilm_model.hpp 624 Bytes
Newer Older
1
2
3
4
#pragma once

#include "infinicore/nn/module.hpp"

5
6
#include "../cache/cache.hpp"

7
8
9
10
11
#include <any>

namespace infinilm {
class InfinilmModel : public infinicore::nn::Module {
public:
Jiacheng Huang's avatar
Jiacheng Huang committed
12
13
14
15
16
17
    struct Config {
        std::string model_type;

        virtual ~Config() = default;
    };

18
19
    virtual ~InfinilmModel() = default;
    virtual infinicore::Tensor forward(std::vector<std::any>) const = 0;
Ceng's avatar
Ceng committed
20
21
    // Optional: reset cache; default no-op for models without cache
    virtual void reset_cache(size_t pos = 0) {}
22
    virtual void reset_cache(const cache::CacheConfig &new_config, size_t pos = 0) = 0;
23
24
};
} // namespace infinilm