mirror of
https://github.com/k2-fsa/icefall.git
synced 2025-08-27 02:34:21 +00:00
format
This commit is contained in:
parent
952abee88c
commit
ac73f60f5f
@ -1,7 +1,8 @@
|
|||||||
# simple script to convert a fairseq checkpoint into pytorch parameter state dict
|
# simple script to convert a fairseq checkpoint into pytorch parameter state dict
|
||||||
import torch
|
|
||||||
from collections import OrderedDict
|
|
||||||
from argparse import ArgumentParser
|
from argparse import ArgumentParser
|
||||||
|
from collections import OrderedDict
|
||||||
|
|
||||||
|
import torch
|
||||||
|
|
||||||
parser = ArgumentParser()
|
parser = ArgumentParser()
|
||||||
parser.add_argument("--src")
|
parser.add_argument("--src")
|
||||||
@ -13,5 +14,5 @@ tgt = args.tgt
|
|||||||
|
|
||||||
old_checkpoint = torch.load(src)
|
old_checkpoint = torch.load(src)
|
||||||
new_checkpoint = OrderedDict()
|
new_checkpoint = OrderedDict()
|
||||||
new_checkpoint['model'] = old_checkpoint['model']
|
new_checkpoint["model"] = old_checkpoint["model"]
|
||||||
torch.save(new_checkpoint, tgt)
|
torch.save(new_checkpoint, tgt)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user