-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Automated update from source repository
- Loading branch information
1 parent
3a04cdf
commit 01b9d21
Showing
184 changed files
with
432,090 additions
and
1,426 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
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
Empty file.
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,30 @@ | ||
import argparse | ||
from pathlib import Path | ||
|
||
from scaling.core.logging import logger | ||
from scaling.transformer.inference import TransformerInferenceModule | ||
|
||
|
||
def main(checkpoint_dir: str, vocab_file: str | Path | None) -> None: | ||
if vocab_file is not None: | ||
vocab_file = Path(vocab_file) | ||
model = TransformerInferenceModule.from_checkpoint( | ||
checkpoint_dir=Path(checkpoint_dir), | ||
devices=[0], | ||
vocab_file=vocab_file, | ||
) | ||
try: | ||
while True: | ||
text = input("Please enter the text to encode (Press Ctrl+C to exit):\n") | ||
output = model.encode([text]) | ||
logger.info(output) | ||
except KeyboardInterrupt: | ||
exit(0) | ||
|
||
|
||
if __name__ == "__main__": | ||
parser = argparse.ArgumentParser() | ||
parser.add_argument("--checkpoint_dir", type=str) | ||
parser.add_argument("--vocab_file", default=None, type=str) | ||
args = parser.parse_args() | ||
main(args.checkpoint_dir, args.vocab_file) |
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
Oops, something went wrong.