libdl  0.0.1
Simple yet powerful deep learning
Loading...
Searching...
No Matches
weightsfile.hpp
1#pragma once
2
3#include "../model/model.hpp"
4
5#include <filesystem>
6#include <istream>
7#include <string>
8
9namespace dl::io {
10
12 public:
13 virtual ~WeightsFileFormat() = default;
14
27 virtual bool loadModelFromStream(dl::ModelBase& model, std::istream& stream) = 0;
28
37 virtual bool loadModelFromFile(dl::ModelBase& model, std::filesystem::path& path, bool mmap = true) = 0;
38
39 virtual void writeModelToStream(dl::ModelBase& model, std::ostream& stream) = 0;
40 };
41
42 extern dl::io::WeightsFileFormat& safetensorsFormat;
43 extern dl::io::WeightsFileFormat& ggufFormat;
44
45} // namespace dl::io
virtual bool loadModelFromFile(dl::ModelBase &model, std::filesystem::path &path, bool mmap=true)=0
Populates the model's weights and metainformation from the given file.
virtual bool loadModelFromStream(dl::ModelBase &model, std::istream &stream)=0
Populates the model's weights and metainformation from the provided stream.