<small id='JRxmE'></small><noframes id='JRxmE'>

    1. <tfoot id='JRxmE'></tfoot>

          <bdo id='JRxmE'></bdo><ul id='JRxmE'></ul>

        <legend id='JRxmE'><style id='JRxmE'><dir id='JRxmE'><q id='JRxmE'></q></dir></style></legend>
      1. <i id='JRxmE'><tr id='JRxmE'><dt id='JRxmE'><q id='JRxmE'><span id='JRxmE'><b id='JRxmE'><form id='JRxmE'><ins id='JRxmE'></ins><ul id='JRxmE'></ul><sub id='JRxmE'></sub></form><legend id='JRxmE'></legend><bdo id='JRxmE'><pre id='JRxmE'><center id='JRxmE'></center></pre></bdo></b><th id='JRxmE'></th></span></q></dt></tr></i><div id='JRxmE'><tfoot id='JRxmE'></tfoot><dl id='JRxmE'><fieldset id='JRxmE'></fieldset></dl></div>

        BERT记号赋值器&&模型下载

        时间:2024-08-11
          <tfoot id='2rZRy'></tfoot>
          • <small id='2rZRy'></small><noframes id='2rZRy'>

                  <bdo id='2rZRy'></bdo><ul id='2rZRy'></ul>

                • <legend id='2rZRy'><style id='2rZRy'><dir id='2rZRy'><q id='2rZRy'></q></dir></style></legend>

                  <i id='2rZRy'><tr id='2rZRy'><dt id='2rZRy'><q id='2rZRy'><span id='2rZRy'><b id='2rZRy'><form id='2rZRy'><ins id='2rZRy'></ins><ul id='2rZRy'></ul><sub id='2rZRy'></sub></form><legend id='2rZRy'></legend><bdo id='2rZRy'><pre id='2rZRy'><center id='2rZRy'></center></pre></bdo></b><th id='2rZRy'></th></span></q></dt></tr></i><div id='2rZRy'><tfoot id='2rZRy'></tfoot><dl id='2rZRy'><fieldset id='2rZRy'></fieldset></dl></div>

                    <tbody id='2rZRy'></tbody>
                  本文介绍了BERT记号赋值器&&模型下载的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我是初学者..我和伯特一起工作。但是,出于公司网络的安全考虑,以下代码不会直接接收BERT模型。

                  tokenizer = BertTokenizer.from_pretrained('bert-base-multilingual-cased', do_lower_case=False)
                  model = BertForSequenceClassification.from_pretrained("bert-base-multilingual-cased", num_labels=2) 
                  

                  所以我想我必须下载这些文件并手动输入位置。 但我对此还是个新手,我想知道从GitHub下载.py这样的格式并将其放在某个位置是否简单。

                  我目前使用的是抱着Face的pytorch实现的BERT模型,找到的源文件地址是:

                  https://github.com/huggingface/transformers

                  请告诉我我认为的方法是否正确,如果正确,要获取哪个文件。

                  提前感谢您的评论。

                  推荐答案

                  如here所述,您需要做的是下载pre_trainconfigs,然后将它们放在同一个文件夹中。每个模型都有一对链接,您可能希望查看lib代码。

                  例如

                  import torch
                  from transformers import *
                  model = BertModel.from_pretrained('/Users/yourname/workplace/berts/')
                  

                  使用/Users/yourname/workplace/berts/引用您的文件夹

                  下面是我发现的

                  src/transformers/configuration_bert.py有一个型号配置列表

                  BERT_PRETRAINED_CONFIG_ARCHIVE_MAP = {
                      "bert-base-uncased": "https://s3.amazonaws.com/models.huggingface.co/bert/bert-base-uncased-config.json",
                      "bert-large-uncased": "https://s3.amazonaws.com/models.huggingface.co/bert/bert-large-uncased-config.json",
                      "bert-base-cased": "https://s3.amazonaws.com/models.huggingface.co/bert/bert-base-cased-config.json",
                      "bert-large-cased": "https://s3.amazonaws.com/models.huggingface.co/bert/bert-large-cased-config.json",
                      "bert-base-multilingual-uncased": "https://s3.amazonaws.com/models.huggingface.co/bert/bert-base-multilingual-uncased-config.json",
                      "bert-base-multilingual-cased": "https://s3.amazonaws.com/models.huggingface.co/bert/bert-base-multilingual-cased-config.json",
                      "bert-base-chinese": "https://s3.amazonaws.com/models.huggingface.co/bert/bert-base-chinese-config.json",
                      "bert-base-german-cased": "https://s3.amazonaws.com/models.huggingface.co/bert/bert-base-german-cased-config.json",
                      "bert-large-uncased-whole-word-masking": "https://s3.amazonaws.com/models.huggingface.co/bert/bert-large-uncased-whole-word-masking-config.json",
                      "bert-large-cased-whole-word-masking": "https://s3.amazonaws.com/models.huggingface.co/bert/bert-large-cased-whole-word-masking-config.json",
                      "bert-large-uncased-whole-word-masking-finetuned-squad": "https://s3.amazonaws.com/models.huggingface.co/bert/bert-large-uncased-whole-word-masking-finetuned-squad-config.json",
                      "bert-large-cased-whole-word-masking-finetuned-squad": "https://s3.amazonaws.com/models.huggingface.co/bert/bert-large-cased-whole-word-masking-finetuned-squad-config.json",
                      "bert-base-cased-finetuned-mrpc": "https://s3.amazonaws.com/models.huggingface.co/bert/bert-base-cased-finetuned-mrpc-config.json",
                      "bert-base-german-dbmdz-cased": "https://s3.amazonaws.com/models.huggingface.co/bert/bert-base-german-dbmdz-cased-config.json",
                      "bert-base-german-dbmdz-uncased": "https://s3.amazonaws.com/models.huggingface.co/bert/bert-base-german-dbmdz-uncased-config.json",
                      "bert-base-japanese": "https://s3.amazonaws.com/models.huggingface.co/bert/cl-tohoku/bert-base-japanese-config.json",
                      "bert-base-japanese-whole-word-masking": "https://s3.amazonaws.com/models.huggingface.co/bert/cl-tohoku/bert-base-japanese-whole-word-masking-config.json",
                      "bert-base-japanese-char": "https://s3.amazonaws.com/models.huggingface.co/bert/cl-tohoku/bert-base-japanese-char-config.json",
                      "bert-base-japanese-char-whole-word-masking": "https://s3.amazonaws.com/models.huggingface.co/bert/cl-tohoku/bert-base-japanese-char-whole-word-masking-config.json",
                      "bert-base-finnish-cased-v1": "https://s3.amazonaws.com/models.huggingface.co/bert/TurkuNLP/bert-base-finnish-cased-v1/config.json",
                      "bert-base-finnish-uncased-v1": "https://s3.amazonaws.com/models.huggingface.co/bert/TurkuNLP/bert-base-finnish-uncased-v1/config.json",
                  }
                  

                  src/transformers/modeling_bert.py有指向pre_trains的链接

                  BERT_PRETRAINED_MODEL_ARCHIVE_MAP = {
                      "bert-base-uncased": "https://s3.amazonaws.com/models.huggingface.co/bert/bert-base-uncased-pytorch_model.bin",
                      "bert-large-uncased": "https://s3.amazonaws.com/models.huggingface.co/bert/bert-large-uncased-pytorch_model.bin",
                      "bert-base-cased": "https://s3.amazonaws.com/models.huggingface.co/bert/bert-base-cased-pytorch_model.bin",
                      "bert-large-cased": "https://s3.amazonaws.com/models.huggingface.co/bert/bert-large-cased-pytorch_model.bin",
                      "bert-base-multilingual-uncased": "https://s3.amazonaws.com/models.huggingface.co/bert/bert-base-multilingual-uncased-pytorch_model.bin",
                      "bert-base-multilingual-cased": "https://s3.amazonaws.com/models.huggingface.co/bert/bert-base-multilingual-cased-pytorch_model.bin",
                      "bert-base-chinese": "https://s3.amazonaws.com/models.huggingface.co/bert/bert-base-chinese-pytorch_model.bin",
                      "bert-base-german-cased": "https://s3.amazonaws.com/models.huggingface.co/bert/bert-base-german-cased-pytorch_model.bin",
                      "bert-large-uncased-whole-word-masking": "https://s3.amazonaws.com/models.huggingface.co/bert/bert-large-uncased-whole-word-masking-pytorch_model.bin",
                      "bert-large-cased-whole-word-masking": "https://s3.amazonaws.com/models.huggingface.co/bert/bert-large-cased-whole-word-masking-pytorch_model.bin",
                      "bert-large-uncased-whole-word-masking-finetuned-squad": "https://s3.amazonaws.com/models.huggingface.co/bert/bert-large-uncased-whole-word-masking-finetuned-squad-pytorch_model.bin",
                      "bert-large-cased-whole-word-masking-finetuned-squad": "https://s3.amazonaws.com/models.huggingface.co/bert/bert-large-cased-whole-word-masking-finetuned-squad-pytorch_model.bin",
                      "bert-base-cased-finetuned-mrpc": "https://s3.amazonaws.com/models.huggingface.co/bert/bert-base-cased-finetuned-mrpc-pytorch_model.bin",
                      "bert-base-german-dbmdz-cased": "https://s3.amazonaws.com/models.huggingface.co/bert/bert-base-german-dbmdz-cased-pytorch_model.bin",
                      "bert-base-german-dbmdz-uncased": "https://s3.amazonaws.com/models.huggingface.co/bert/bert-base-german-dbmdz-uncased-pytorch_model.bin",
                      "bert-base-japanese": "https://s3.amazonaws.com/models.huggingface.co/bert/cl-tohoku/bert-base-japanese-pytorch_model.bin",
                      "bert-base-japanese-whole-word-masking": "https://s3.amazonaws.com/models.huggingface.co/bert/cl-tohoku/bert-base-japanese-whole-word-masking-pytorch_model.bin",
                      "bert-base-japanese-char": "https://s3.amazonaws.com/models.huggingface.co/bert/cl-tohoku/bert-base-japanese-char-pytorch_model.bin",
                      "bert-base-japanese-char-whole-word-masking": "https://s3.amazonaws.com/models.huggingface.co/bert/cl-tohoku/bert-base-japanese-char-whole-word-masking-pytorch_model.bin",
                      "bert-base-finnish-cased-v1": "https://s3.amazonaws.com/models.huggingface.co/bert/TurkuNLP/bert-base-finnish-cased-v1/pytorch_model.bin",
                      "bert-base-finnish-uncased-v1": "https://s3.amazonaws.com/models.huggingface.co/bert/TurkuNLP/bert-base-finnish-uncased-v1/pytorch_model.bin",
                  }
                  

                  这篇关于BERT记号赋值器&&模型下载的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  上一篇:RuntimeError:渐变计算所需的变量之一已被原地操作修改? 下一篇:在Requirements.txt中包含.whl安装

                  相关文章

                  <legend id='yXwUG'><style id='yXwUG'><dir id='yXwUG'><q id='yXwUG'></q></dir></style></legend>

                      <bdo id='yXwUG'></bdo><ul id='yXwUG'></ul>
                    <i id='yXwUG'><tr id='yXwUG'><dt id='yXwUG'><q id='yXwUG'><span id='yXwUG'><b id='yXwUG'><form id='yXwUG'><ins id='yXwUG'></ins><ul id='yXwUG'></ul><sub id='yXwUG'></sub></form><legend id='yXwUG'></legend><bdo id='yXwUG'><pre id='yXwUG'><center id='yXwUG'></center></pre></bdo></b><th id='yXwUG'></th></span></q></dt></tr></i><div id='yXwUG'><tfoot id='yXwUG'></tfoot><dl id='yXwUG'><fieldset id='yXwUG'></fieldset></dl></div>
                    <tfoot id='yXwUG'></tfoot>

                      <small id='yXwUG'></small><noframes id='yXwUG'>