Esempio n. 1
0
int mode_fit(const int argc, const char* argv[]) {
    ConfigureMalloc();

    NCatboostOptions::TPoolLoadParams poolLoadOptions;
    TString paramsFile;
    NJson::TJsonValue catBoostFlatJsonOptions;
    ParseCommandLine(argc, argv, &catBoostFlatJsonOptions, &paramsFile, &poolLoadOptions);
    NJson::TJsonValue catBoostJsonOptions;
    NJson::TJsonValue outputOptionsJson;
    if (!paramsFile.empty()) {
        CB_ENSURE(NFs::Exists(paramsFile), "Params file does not exists " << paramsFile);
        TIFStream in(paramsFile);
        NJson::TJsonValue fromFileParams;
        CB_ENSURE(NJson::ReadJsonTree(&in, &fromFileParams), "can't parse params file");
        NCatboostOptions::PlainJsonToOptions(fromFileParams, &catBoostJsonOptions, &outputOptionsJson);
    }
    NCatboostOptions::PlainJsonToOptions(catBoostFlatJsonOptions, &catBoostJsonOptions, &outputOptionsJson);
    poolLoadOptions.Validate();

    auto taskType = NCatboostOptions::GetTaskType(catBoostJsonOptions);
    THolder<IModelTrainer> modelTrainerHolder;
    NCatboostOptions::TOutputFilesOptions outputOptions(taskType);
    outputOptions.Load(outputOptionsJson);

    const bool isGpuDeviceType = taskType == ETaskType::GPU;
    if (isGpuDeviceType && TTrainerFactory::Has(ETaskType::GPU)) {
        modelTrainerHolder = TTrainerFactory::Construct(ETaskType::GPU);
    } else {
        CB_ENSURE(!isGpuDeviceType, "GPU Device not found.");

        modelTrainerHolder = TTrainerFactory::Construct(ETaskType::CPU);
    }
    modelTrainerHolder->TrainModel(poolLoadOptions, outputOptions, catBoostJsonOptions);
    return 0;
}
Esempio n. 2
0
void outputScene( const ScenePlug *scene, IECore::Renderer *renderer )
{
	ConstCompoundObjectPtr globals = scene->globalsPlug()->getValue();
	outputOptions( globals.get(), renderer );
	outputOutputs( globals.get(), renderer );
	outputCamera( scene, globals.get(), renderer );
	{
		WorldBlock world( renderer );

		outputGlobalAttributes( globals.get(), renderer );
		outputCoordinateSystems( scene, globals.get(), renderer );
		outputLights( scene, globals.get(), renderer );

		SceneProceduralPtr proc = new SceneProcedural( scene, Context::current() );
		renderer->procedural( proc );
	}
}
Esempio n. 3
0
std::ostream& Configuration::outputHelp(std::ostream& out) const {
	out << "---------------------------------------------------------------------------------------"<< std::endl;
	outputVersion(out) 
		<< "---------------------------------------------------------------------------------------"<< std::endl
		<< "Usage: " ;
		if (binaryName()) out << *binaryName();
		else out << "<binary>";
		out << " [<OPTIONS>] [<CONSTANTS>] <INPUT_FILES>" 											<< std::endl
		<< "---------------------------------------------------------------------------------------"<< std::endl
		<< "OPTIONS:"																				<< std::endl;
	outputOptions(out);
	out 																							<< std::endl
		<< "CONSTANTS:"																				<< std::endl
		<< "     <identifier>=<value>"																<< std::endl
		<< "          - Defines <identifier> to be a macro which expands to <value>"				<< std::endl;
	return out;
}