forked from ACEsuit/mace
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'ACEsuit:main' into lbfgs-optimizer
- Loading branch information
Showing
26 changed files
with
1,123 additions
and
308 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
__version__ = "0.3.7" | ||
__version__ = "0.3.8" | ||
|
||
__all__ = ["__version__"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
from argparse import ArgumentParser | ||
|
||
import torch | ||
|
||
|
||
def main(): | ||
parser = ArgumentParser() | ||
parser.add_argument( | ||
"--target_device", | ||
"-t", | ||
help="device to convert to, usually 'cpu' or 'cuda'", | ||
default="cpu", | ||
) | ||
parser.add_argument( | ||
"--output_file", | ||
"-o", | ||
help="name for output model, defaults to model_file.target_device", | ||
) | ||
parser.add_argument("model_file", help="input model file path") | ||
args = parser.parse_args() | ||
|
||
if args.output_file is None: | ||
args.output_file = args.model_file + "." + args.target_device | ||
|
||
model = torch.load(args.model_file) | ||
model.to(args.target_device) | ||
torch.save(model, args.output_file) | ||
|
||
|
||
if __name__ == "__main__": | ||
main() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
from argparse import ArgumentParser | ||
|
||
import torch | ||
|
||
from mace.tools.scripts_utils import remove_pt_head | ||
|
||
|
||
def main(): | ||
parser = ArgumentParser() | ||
parser.add_argument( | ||
"--head_name", | ||
"-n", | ||
help="name of the head to extract", | ||
default=None, | ||
) | ||
parser.add_argument( | ||
"--output_file", | ||
"-o", | ||
help="name for output model, defaults to model_file.target_device", | ||
) | ||
parser.add_argument("model_file", help="input model file path") | ||
args = parser.parse_args() | ||
|
||
if args.output_file is None: | ||
args.output_file = args.model_file + "." + args.target_device | ||
|
||
model = torch.load(args.model_file) | ||
model_single = remove_pt_head(model, args.head_name) | ||
torch.save(model_single, args.output_file) | ||
|
||
|
||
if __name__ == "__main__": | ||
main() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.