1 Star 0 Fork 0

v_wanglei/fastText

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
download_model.py 1.26 KB
一键复制 编辑 原始数据 按行查看 历史
#!/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()
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/v_wanglei/fastText.git
git@gitee.com:v_wanglei/fastText.git
v_wanglei
fastText
fastText
master

搜索帮助

0d507c66 1850385 C8b1a773 1850385