-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'repo-refactor' of https://github.com/flexflow/FlexFlow …
…into add-dlrm-pcg
- Loading branch information
Showing
23 changed files
with
1,046 additions
and
74 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
#ifndef _FLEXFLOW_LIB_MODELS_INCLUDE_MODELS_BERT_H | ||
#define _FLEXFLOW_LIB_MODELS_INCLUDE_MODELS_BERT_H | ||
|
||
#include "models/bert/bert_config.dtg.h" | ||
#include "pcg/computation_graph_builder.h" | ||
|
||
namespace FlexFlow { | ||
|
||
// Helper functions to construct the BERT model | ||
tensor_guid_t create_bert_feedforward_network(ComputationGraphBuilder &, | ||
BertConfig const &, | ||
tensor_guid_t const &); | ||
tensor_guid_t create_bert_encoder_layer(ComputationGraphBuilder &, | ||
BertConfig const &, | ||
tensor_guid_t const &); | ||
tensor_guid_t create_bert_encoder(ComputationGraphBuilder &, | ||
BertConfig const &, | ||
tensor_guid_t const &); | ||
|
||
/** | ||
* @brief Get the base config of the BERT model. | ||
* | ||
* @details Refer to | ||
* https://huggingface.co/docs/transformers/v4.18.0/en/model_doc/bert#transformers.BertConfig | ||
* for default configs. | ||
*/ | ||
BertConfig get_default_bert_config(); | ||
|
||
/** | ||
* @brief Get the BERT computation graph. | ||
* | ||
* @note This is a plain encoder-only model for pre-training. | ||
* | ||
* @param BertConfig The config of BERT model. | ||
* @return ComputationGraph The computation graph of a BERT model. | ||
*/ | ||
ComputationGraph get_bert_computation_graph(BertConfig const &); | ||
|
||
} // namespace FlexFlow | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
namespace = "FlexFlow" | ||
name = "BertConfig" | ||
|
||
features = [ | ||
"eq", | ||
"ord", | ||
"hash", | ||
"json", | ||
"rapidcheck", | ||
"fmt", | ||
] | ||
|
||
includes = [ | ||
"op-attrs/activation.dtg.h", | ||
] | ||
|
||
[[fields]] | ||
name = "vocab_size" | ||
type = "size_t" | ||
|
||
[[fields]] | ||
name = "hidden_size" | ||
type = "size_t" | ||
|
||
[[fields]] | ||
name = "num_encoder_layers" | ||
type = "size_t" | ||
|
||
[[fields]] | ||
name = "num_heads" | ||
type = "size_t" | ||
|
||
[[fields]] | ||
name = "dim_feedforward" | ||
type = "size_t" | ||
|
||
[[fields]] | ||
name = "hidden_act" | ||
type = "::FlexFlow::Activation" | ||
|
||
[[fields]] | ||
name = "hidden_dropout_prob" | ||
type = "float" | ||
|
||
[[fields]] | ||
name = "attention_probs_dropout_prob" | ||
type = "float" | ||
|
||
[[fields]] | ||
name = "initializer_range" | ||
type = "float" | ||
|
||
[[fields]] | ||
name = "layer_norm_eps" | ||
type = "float" | ||
|
||
[[fields]] | ||
name = "position_embedding_type" | ||
type = "std::string" | ||
|
||
[[fields]] | ||
name = "classifier_dropout" | ||
type = "float" | ||
|
||
[[fields]] | ||
name = "sequence_length" | ||
type = "size_t" | ||
|
||
[[fields]] | ||
name = "batch_size" | ||
type = "size_t" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
#ifndef _FLEXFLOW_LIB_MODELS_INCLUDE_MODELS_CANDLE_UNO_H | ||
#define _FLEXFLOW_LIB_MODELS_INCLUDE_MODELS_CANDLE_UNO_H | ||
|
||
#include "candle_uno_config.dtg.h" | ||
#include "pcg/computation_graph_builder.h" | ||
#include <map> | ||
#include <string> | ||
#include <vector> | ||
|
||
namespace FlexFlow { | ||
|
||
// Helper functions to construct the Candle Uno model | ||
tensor_guid_t create_candle_uno_feature_model(ComputationGraphBuilder &, | ||
CandleUnoConfig const &, | ||
tensor_guid_t const &); | ||
|
||
/** | ||
* @brief Get the default configs of Candle Uno model. | ||
* | ||
* @details The default configs come from the dataset used by the original | ||
* model: | ||
* https://github.com/ECP-CANDLE/Benchmarks/tree/f6a3da8818308c9edcd9fedbcf831dd5968efcdd/Pilot1/Uno | ||
*/ | ||
CandleUnoConfig get_default_candle_uno_config(); | ||
|
||
/** | ||
* @brief Get the Candle Uno computation graph. | ||
* | ||
* @details CandleUnoConfig.feature_shapes is a map from feature name to the | ||
* number of channels for the feature, and CandleUnoConfig.input_features is a | ||
* map from specific data identifier in the dataset to the feature name used in | ||
* this model. | ||
* | ||
* @param CandleUnoConfig The config of the Candle Uno model. | ||
* @return ComputationGraph The PCG of a Transformer model. | ||
*/ | ||
ComputationGraph get_candle_uno_computation_graph(CandleUnoConfig const &); | ||
|
||
} // namespace FlexFlow | ||
|
||
#endif |
52 changes: 52 additions & 0 deletions
52
lib/models/include/models/candle_uno/candle_uno_config.struct.toml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
namespace = "FlexFlow" | ||
name = "CandleUnoConfig" | ||
|
||
features = [ | ||
"eq", | ||
"ord", | ||
"hash", | ||
"json", | ||
"rapidcheck", | ||
"fmt", | ||
] | ||
|
||
includes = [ | ||
"<vector>", | ||
"<map>", | ||
"<string>", | ||
] | ||
|
||
src_includes = [ | ||
"utils/fmt/vector.h", | ||
"utils/fmt/map.h", | ||
"utils/hash/vector.h", | ||
"utils/hash/map.h", | ||
] | ||
|
||
[[fields]] | ||
name = "batch_size" | ||
type = "size_t" | ||
|
||
[[fields]] | ||
name = "dense_layers" | ||
type = "std::vector<int>" | ||
|
||
[[fields]] | ||
name = "dense_feature_layers" | ||
type = "std::vector<int>" | ||
|
||
[[fields]] | ||
name = "feature_shapes" | ||
type = "std::map<std::string, int>" | ||
|
||
[[fields]] | ||
name = "input_features" | ||
type = "std::map<std::string, std::string>" | ||
|
||
[[fields]] | ||
name = "dropout" | ||
type = "float" | ||
|
||
[[fields]] | ||
name = "residual" | ||
type = "bool" |
Oops, something went wrong.