-
Notifications
You must be signed in to change notification settings - Fork 0
Consolidate model_name and model_path into single model_path parameter #142
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
base: main
Are you sure you want to change the base?
Conversation
- Replace model_name and model_path parameters with single model_path - Remove QMP_MODEL_PATH environment variable handling - Update ModelConfig in both fcidump.py and openfermion.py - Update default_group_name to extract name from path - Remove unused os import - Pass linter and formatter checks Co-authored-by: hzhangxyz <[email protected]>
Add _extract_model_name_from_path helper function in both fcidump.py and openfermion.py to avoid duplicating extension removal logic between default_group_name and __init__ methods. Co-authored-by: hzhangxyz <[email protected]>
Remove redundant pathlib.Path(model_name).name since model_name is already the filename without path components. Co-authored-by: hzhangxyz <[email protected]>
Remove redundant intermediate variables since model_path is already converted to pathlib.Path in __post_init__. Co-authored-by: hzhangxyz <[email protected]>
Remove redundant pathlib.Path() calls since config.model_path is already a Path object after __post_init__. Co-authored-by: hzhangxyz <[email protected]>
hzhangxyz
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
你已经有全名了,不用提取后再合并得到路径,直接用输入的全名来读取就行了。
一些日志相关的东西之前用了model name, 但是可以直接把这一项目给去掉, 不显示model name了。
- Remove _extract_model_name_from_path helper function - Remove all model_name variables from __init__ methods - Simplify logging to not include model names - Keep extension stripping logic inline in default_group_name - Keep YAML key extraction inline in fcidump.py for ref_energy lookup Co-authored-by: hzhangxyz <[email protected]>
Done. Removed the |
Replace string slicing with removesuffix() method for better readability and intent clarity. This is available in Python 3.9+ and the project requires Python 3.12. Co-authored-by: hzhangxyz <[email protected]>
The
fcidumpandopenfermionmodels used separatemodel_nameandmodel_pathparameters, constructing file paths asmodel_path/model_name. This consolidates them into a singlemodel_pathparameter containing the complete file path.Changes
ModelConfig
model_nameandmodel_pathwith single requiredmodel_path: pathlib.Path | strparameterQMP_MODEL_PATHenvironment variable fallback logic__post_init__now only converts string topathlib.PathModel class
default_group_name()extracts name from path by stripping file extensions inline usingremovesuffix()__init__()uses the full path directly without extracting or displaying model namesMigration
Both relative and absolute paths are supported via native
pathlibbehavior.Original prompt
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.