Use seekg to find file size instead
This commit is contained in:
parent
1f9592baf3
commit
23035f9ba8
1 changed files with 4 additions and 7 deletions
11
llama.cpp
11
llama.cpp
|
@ -2,8 +2,6 @@
|
||||||
|
|
||||||
#include "ggml.h"
|
#include "ggml.h"
|
||||||
|
|
||||||
#include <sys/stat.h>
|
|
||||||
|
|
||||||
#include <cinttypes>
|
#include <cinttypes>
|
||||||
#include <fstream>
|
#include <fstream>
|
||||||
#include <random>
|
#include <random>
|
||||||
|
@ -417,12 +415,11 @@ static bool llama_model_load(
|
||||||
|
|
||||||
fin = std::ifstream(fname_part, std::ios::binary);
|
fin = std::ifstream(fname_part, std::ios::binary);
|
||||||
fin.rdbuf()->pubsetbuf(f_buf.data(), f_buf.size());
|
fin.rdbuf()->pubsetbuf(f_buf.data(), f_buf.size());
|
||||||
fin.seekg(file_offset);
|
|
||||||
|
|
||||||
// stat the file for file size
|
fin.seekg(0, fin.end);
|
||||||
struct stat st;
|
const size_t file_size = fin.tellg();
|
||||||
stat(fname_part.c_str(), &st);
|
|
||||||
const size_t file_size = st.st_size;
|
fin.seekg(file_offset);
|
||||||
|
|
||||||
// load weights
|
// load weights
|
||||||
{
|
{
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue