Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
tianlh
LightGBM-DCU
Commits
ed4d0ae3
Unverified
Commit
ed4d0ae3
authored
Jan 07, 2021
by
htgeis
Committed by
GitHub
Jan 07, 2021
Browse files
support more filesystem as the storage for model file (#3730)
Co-authored-by:
jingwei.su
<
jingwei.su@hulu.com
>
parent
31bc196a
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
6 deletions
+6
-6
src/boosting/gbdt_model_text.cpp
src/boosting/gbdt_model_text.cpp
+6
-6
No files found.
src/boosting/gbdt_model_text.cpp
View file @
ed4d0ae3
...
...
@@ -404,13 +404,13 @@ std::string GBDT::SaveModelToString(int start_iteration, int num_iteration, int
bool
GBDT
::
SaveModelToFile
(
int
start_iteration
,
int
num_iteration
,
int
feature_importance_type
,
const
char
*
filename
)
const
{
/*! \brief File to write models */
std
::
ofstream
output_file
;
output_file
.
open
(
filename
,
std
::
ios
::
out
|
std
::
ios
::
binary
);
auto
writer
=
VirtualFileWriter
::
Make
(
filename
);
if
(
!
writer
->
Init
())
{
Log
::
Fatal
(
"Model file %s is not available for writes"
,
filename
);
}
std
::
string
str_to_write
=
SaveModelToString
(
start_iteration
,
num_iteration
,
feature_importance_type
);
output_file
.
write
(
str_to_write
.
c_str
(),
str_to_write
.
size
());
output_file
.
close
();
return
static_cast
<
bool
>
(
output_file
);
auto
size
=
writer
->
Write
(
str_to_write
.
c_str
(),
str_to_write
.
size
());
return
size
>
0
;
}
bool
GBDT
::
LoadModelFromString
(
const
char
*
buffer
,
size_t
len
)
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment