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
9
namespace
dl::io {
10
11
class
WeightsFileFormat
{
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
std::istream
std::ostream
dl::ModelBase
Definition
model.hpp:13
dl::io::WeightsFileFormat
Definition
weightsfile.hpp:11
dl::io::WeightsFileFormat::loadModelFromFile
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.
dl::io::WeightsFileFormat::loadModelFromStream
virtual bool loadModelFromStream(dl::ModelBase &model, std::istream &stream)=0
Populates the model's weights and metainformation from the provided stream.
dl
io
weightsfile.hpp
Generated by
1.9.8