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 <sys/stat.h>
|
||||
|
||||
#include <cinttypes>
|
||||
#include <fstream>
|
||||
#include <random>
|
||||
|
@ -417,12 +415,11 @@ static bool llama_model_load(
|
|||
|
||||
fin = std::ifstream(fname_part, std::ios::binary);
|
||||
fin.rdbuf()->pubsetbuf(f_buf.data(), f_buf.size());
|
||||
fin.seekg(file_offset);
|
||||
|
||||
// stat the file for file size
|
||||
struct stat st;
|
||||
stat(fname_part.c_str(), &st);
|
||||
const size_t file_size = st.st_size;
|
||||
fin.seekg(0, fin.end);
|
||||
const size_t file_size = fin.tellg();
|
||||
|
||||
fin.seekg(file_offset);
|
||||
|
||||
// load weights
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue