text
stringlengths
0
2.2M
FL_VLOG(3) << "AMP: Scale factor incremented. New value\t"
<< scaleFactor;
}
}
meters.sampletimer.resume();
if (FLAGS_reportiters > 0 && curBatch % FLAGS_reportiters == 0) {
runValAndSaveModel(curEpoch, curBatch, netopt->getLr());
resetTimeStatMeters();
ntwrk->train();
meters.sampletimer.resume();
meters.runtime.resume();
meters.timer.resume();
}
if (curBatch > nbatches) {
break;
}
}
fl::sync();
if (FLAGS_reportiters == 0) {
runValAndSaveModel(curEpoch, curBatch, netopt->getLr());
}
}
};
/* ===================== Train ===================== */
train(network, criterion, trainds, netoptim, FLAGS_lr, FLAGS_iter);
FL_LOG_MASTER(INFO) << "Finished training";
return 0;
}
/*
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include <folly/Singleton.h>
#ifndef _WIN32
#include <dlfcn.h>
#include <signal.h>
#include <time.h>
#endif
#include <atomic>
#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <string>
#include <folly/Demangle.h>
#include <folly/ScopeGuard.h>
#include <folly/experimental/symbolizer/Symbolizer.h>
#include <folly/portability/Config.h>
#include <folly/portability/FmtCompile.h>
#if !defined(_WIN32) && !defined(__APPLE__) && !defined(__ANDROID__)
#define FOLLY_SINGLETON_HAVE_DLSYM 1
#endif
namespace folly {
#if FOLLY_SINGLETON_HAVE_DLSYM
namespace detail {
static void singleton_hs_init_weak(int* argc, char** argv[])
__attribute__((__weakref__("hs_init")));
} // namespace detail
#endif
SingletonVault::Type SingletonVault::defaultVaultType() {
#if FOLLY_SINGLETON_HAVE_DLSYM
bool isPython = dlsym(RTLD_DEFAULT, "Py_Main");
bool isHaskell =
detail::singleton_hs_init_weak || dlsym(RTLD_DEFAULT, "hs_init");
bool isJVM = dlsym(RTLD_DEFAULT, "JNI_GetCreatedJavaVMs");
bool isD = dlsym(RTLD_DEFAULT, "_d_run_main");
return isPython || isHaskell || isJVM || isD ? Type::Relaxed : Type::Strict;
#else
return Type::Relaxed;
#endif
}
namespace detail {