Skip to content

Commit

Permalink
checkpoint
Browse files Browse the repository at this point in the history
  • Loading branch information
goliaro committed Jul 30, 2023
1 parent 6537c00 commit 225f049
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
5 changes: 5 additions & 0 deletions include/flexflow/flexflow_c.h
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ FF_NEW_OPAQUE_TYPE(flexflow_beam_search_batch_config_t);
FF_NEW_OPAQUE_TYPE(flexflow_inference_manager_t);
FF_NEW_OPAQUE_TYPE(flexflow_request_manager_t);
FF_NEW_OPAQUE_TYPE(flexflow_file_data_loader_t);
FF_NEW_OPAQUE_TYPE(flexflow_generation_result_t);

// -----------------------------------------------------------------------
// FFConfig
Expand Down Expand Up @@ -474,6 +475,10 @@ flexflow_perf_metrics_t

void flexflow_model_set_transformer_layer_id(flexflow_model_t handle, int id);

flexflow_generation_result_t flexflow_model_generate(flexflow_model_t handle_,
char const *text,
int max_seq_length);

// -----------------------------------------------------------------------
// Tensor
// -----------------------------------------------------------------------
Expand Down
11 changes: 11 additions & 0 deletions src/c/flexflow_c.cc
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ class FFCObjectWrapper {
FF_NEW_OPAQUE_WRAPPER(flexflow_inference_manager_t, InferenceManager *);
FF_NEW_OPAQUE_WRAPPER(flexflow_request_manager_t, RequestManager *);
FF_NEW_OPAQUE_WRAPPER(flexflow_file_data_loader_t, FileDataLoader *);
FF_NEW_OPAQUE_WRAPPER(flexflow_generation_result_t, GenerationResult *);
};

Logger ffc_log("flexflow_c");
Expand Down Expand Up @@ -1225,6 +1226,16 @@ void flexflow_model_set_transformer_layer_id(flexflow_model_t handle_, int id) {
handle->set_transformer_layer_id(id);
}

flexflow_generation_result_t flexflow_model_generate(flexflow_model_t handle_,
char const *text,
int max_seq_length) {
FFModel *handle = FFCObjectWrapper::unwrap(handle_);
std::string const text_str(text);
GenerationResult result = handle->generate(text_str, max_seq_length);
DEBUG_PRINT("[Model] generate %p %s %i", handle, text_str, max_seq_length);
return FFCObjectWrapper::wrap(&result);
}

// -----------------------------------------------------------------------
// Tensor
// -----------------------------------------------------------------------
Expand Down

0 comments on commit 225f049

Please sign in to comment.