text stringlengths 0 2.2M |
|---|
gflags::ReadFromFlagsFile(FLAGS_flagsfile, argv[0], true);
|
}
|
gflags::ParseCommandLineFlags(&argc, &argv, false);
|
std::string runPath = FLAGS_rundir;
|
handleDeprecatedFlags();
|
fl::setSeed(FLAGS_seed);
|
fl::DynamicBenchmark::setBenchmarkMode(FLAGS_fl_benchmark_mode);
|
std::shared_ptr<fl::Reducer> reducer = nullptr;
|
if (FLAGS_enable_distributed) {
|
fl::pkg::runtime::initDistributed(
|
FLAGS_world_rank,
|
FLAGS_world_size,
|
FLAGS_max_devices_per_node,
|
FLAGS_rndv_filepath);
|
reducer = std::make_shared<fl::CoalescingReducer>(
|
1.0 / fl::getWorldSize(), true, true);
|
}
|
int worldRank = fl::getWorldRank();
|
int worldSize = fl::getWorldSize();
|
bool isMaster = (worldRank == 0);
|
FL_LOG_MASTER(INFO) << "Gflags after parsing \n" << serializeGflags("; ");
|
FL_LOG_MASTER(INFO) << "Experiment path: " << runPath;
|
FL_LOG_MASTER(INFO) << "Experiment runidx: " << runIdx;
|
// flashlight optim mode
|
auto flOptimLevel = FLAGS_fl_optim_mode.empty()
|
? fl::OptimLevel::DEFAULT
|
: fl::OptimMode::toOptimLevel(FLAGS_fl_optim_mode);
|
fl::OptimMode::get().setOptimLevel(flOptimLevel);
|
if (FLAGS_fl_amp_use_mixed_precision) {
|
// Only set the optim mode to O1 if it was left empty
|
LOG(INFO) << "Mixed precision training enabled. Will perform loss scaling.";
|
if (FLAGS_fl_optim_mode.empty()) {
|
LOG(INFO) << "Mixed precision training enabled with no "
|
"optim mode specified - setting optim mode to O1.";
|
fl::OptimMode::get().setOptimLevel(fl::OptimLevel::O1);
|
}
|
}
|
std::unordered_map<std::string, std::string> config = {
|
{kProgramName, exec},
|
{kCommandLine, join(" ", argvs)},
|
{kGflags, serializeGflags()},
|
// extra goodies
|
{kUserName, fl::lib::getEnvVar("USER")},
|
{kHostName, fl::lib::getEnvVar("HOSTNAME")},
|
{kTimestamp, getCurrentDate() + ", " + getCurrentDate()},
|
{kRunIdx, std::to_string(runIdx)},
|
{kRunPath, runPath}};
|
auto validTagSets = parseValidSets(FLAGS_valid);
|
/* ===================== Create Dictionary & Lexicon ===================== */
|
auto dictPath = FLAGS_tokens;
|
if (dictPath.empty() || !fileExists(dictPath)) {
|
throw std::runtime_error(
|
"Invalid dictionary filepath specified with --tokensdir and --tokens: \"" +
|
dictPath + "\"");
|
}
|
fl::lib::text::Dictionary tokenDict(dictPath);
|
if (FLAGS_criterion != kCtcCriterion) {
|
LOG(FATAL) << "Finetune binary works only with ctc criterion.";
|
}
|
// ctc expects the blank label last
|
tokenDict.addEntry(kBlankToken);
|
int numClasses = tokenDict.indexSize();
|
LOG(INFO) << "Number of classes (network): " << numClasses;
|
fl::lib::text::Dictionary wordDict;
|
fl::lib::text::LexiconMap lexicon;
|
if (!FLAGS_lexicon.empty()) {
|
lexicon = fl::lib::text::loadWords(FLAGS_lexicon, FLAGS_maxword);
|
wordDict = fl::lib::text::createWordDict(lexicon);
|
LOG(INFO) << "Number of words: " << wordDict.indexSize();
|
}
|
/* ===================== Create Dataset ===================== */
|
fl::lib::audio::FeatureParams featParams(
|
FLAGS_samplerate,
|
FLAGS_framesizems,
|
FLAGS_framestridems,
|
FLAGS_filterbanks,
|
FLAGS_lowfreqfilterbank,
|
FLAGS_highfreqfilterbank,
|
FLAGS_mfcccoeffs,
|
kLifterParam /* lifterparam */,
|
FLAGS_devwin /* delta window */,
|
FLAGS_devwin /* delta-delta window */);
|
featParams.useEnergy = false;
|
featParams.usePower = false;
|
featParams.zeroMeanFrame = false;
|
auto featureRes =
|
getFeatureType(FLAGS_features_type, FLAGS_channels, featParams);
|
int numFeatures = featureRes.first;
|
FeatureType featType = featureRes.second;
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.