代码拉取完成,页面将自动刷新
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright (c) 2017-present, Facebook, Inc.
# All rights reserved.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import argparse
import fasttext.util
args = None
def command_download(lang_id, if_exists):
"""
Download pre-trained common-crawl vectors from fastText's website
https://fasttext.cc/docs/en/crawl-vectors.html
"""
fasttext.util.download_model(lang_id, if_exists)
def main():
global args
parser = argparse.ArgumentParser(
description='fastText helper tool to reduce model dimensions.')
parser.add_argument("language", type=str, default="en",
help="language identifier of the pre-trained vectors. For example `en` or `fr`.")
parser.add_argument("--overwrite", action="store_true",
help="overwrite if file exists.")
args = parser.parse_args()
command_download(args.language, if_exists=(
'overwrite' if args.overwrite else 'strict'))
if __name__ == '__main__':
main()
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。