Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[tools/circle_plus_gen] Add training parameters json loader #13012

Merged
merged 2 commits into from
May 27, 2024

Conversation

zetwhite
Copy link
Contributor

@zetwhite zetwhite commented May 16, 2024

This PR add a json loader to parse a json file of training hyper parameters and construct TrainParam instance.

ONE-DCO-1.0-Signed-off-by: seunghui youn sseung.youn@samsung.com

@zetwhite

This comment was marked as resolved.

@zetwhite zetwhite added the PR/NO MERGE Please don't merge. I'm still working on this :) label May 16, 2024
@zetwhite zetwhite force-pushed the 0516/cgen_loader branch 2 times, most recently from 08bdd43 to 80e15ef Compare May 17, 2024 06:27
@zetwhite zetwhite added PR/ready for review It is ready to review. Please review it. and removed PR/NO MERGE Please don't merge. I'm still working on this :) labels May 17, 2024
@zetwhite zetwhite marked this pull request as ready for review May 17, 2024 06:27
@zetwhite zetwhite requested review from a team and jyoungyun May 17, 2024 07:12
@zetwhite
Copy link
Contributor Author

@jyoungyun I explicitly asked you to review. Since you've done similar work in this draft - #12984, I guess you could give me a practical review.

}
},
"loss": {
"type": "categorical crossentropy",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(question)
Where can I get the type string?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is no document for type string rules. I'll add a document and more example files for details.


For now, you could check the allowable type string only in code level.

['categorical crossentropy', 'categoricalcrossentropy', 'cce'],

@jyoungyun
Copy link
Contributor

This PR looks good to me.

But there is one concern. This tool requires a json file. And a json file contains multiple strings and arguments. I couldn't grasp json file format for this tool at a glance. I use input paramters to get hyper parameters from the draft code. The use of this draft is not very clear either. If we introduce this PR to use the json file as input to this tool, it would be better to provide a guideline for the json file format.

@zetwhite
Copy link
Contributor Author

it would be better to provide a guideline for the json file format.

I agree.
I'd better add a guideline after the basic feature of this tool added.

I use input paramters to get hyper parameters from the draft code.

I also think it is good to extend this tool to get parameters through the input options.

Comment on lines +49 to +51
tparams: TrainParam = TrainParam.from_json(hparams_file)
print("load training hyperparameters")
print(tparams.dump_as_json())
Copy link
Contributor Author

@zetwhite zetwhite May 20, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

from_json() parse json file and return TrainParam instance.
Implementing from_json() is main goal of this PR.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We could check that it sucessfully load the json files.

$ cd tools/circle_plus_gen
$ python3 main.py example/sample_tpram.circle example/train_tparam.json  
load traing hyperparameters
{
    "optimizer": {
        "type": "adam",
        "args": {
            "learningRate": 0.01,
            "beta1": 0.9,
            "beta2": 0.999,
            "epsilon": 1e-07
        }
    },
    "loss": {
        "type": "categorical crossentropy",
        "args": {
            "fromLogits": true,
            "reduction": "sum over batch size"
        }
    },
    "batchSize": 32
}

zetwhite and others added 2 commits May 20, 2024 15:14
This PR adds a json loader to parse a json file of training hyper parameters and construct TrainParam instance.

ONE-DCO-1.0-Signed-off-by: seunghui youn <sseung.youn@samsung.com>
Co-authored-by: Jang Jiseob <ragmani0216@gmail.com>
Copy link
Contributor

@jyoungyun jyoungyun left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Copy link
Contributor

@ragmani ragmani left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@glistening glistening merged commit 94fbe89 into Samsung:master May 27, 2024
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
PR/ready for review It is ready to review. Please review it.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants