From 5cfe18b557f267b11cbdb7414c32a3c6a9572ec9 Mon Sep 17 00:00:00 2001 From: "nate.river" Date: Fri, 29 Mar 2024 00:37:18 +0800 Subject: [PATCH] fix layoutlm & use hf-mirror for all urls (#963) --- .github/install_mindspore.py | 2 +- .github/kaggle_gpu_test.py | 2 +- llm/inference/llama/example.py | 2 +- llm/inference/musicgen/run_musicgen.ipynb | 426 ++++++++++++++++++ llm/pipelines/document_question_answering.py | 2 +- llm/pretrain/bert/src/config.py | 48 +- llm/pretrain/bert/src/utils.py | 2 +- mindnlp/dataset/load.py | 4 +- mindnlp/transformers/configuration_utils.py | 8 +- .../transformers/feature_extraction_utils.py | 8 +- .../generation/configuration_utils.py | 10 +- .../transformers/generation/logits_process.py | 6 +- mindnlp/transformers/generation/utils.py | 4 +- .../transformers/image_processing_utils.py | 12 +- mindnlp/transformers/image_utils.py | 2 +- mindnlp/transformers/modeling_utils.py | 4 +- .../models/albert/configuration_albert.py | 18 +- .../models/albert/modeling_albert.py | 2 +- .../models/albert/tokenization_albert.py | 16 +- .../models/albert/tokenization_albert_fast.py | 34 +- .../models/align/configuration_align.py | 8 +- .../models/align/modeling_align.py | 2 +- .../models/altclip/configuration_altclip.py | 10 +- .../models/altclip/modeling_altclip.py | 2 +- ...iguration_audio_spectrogram_transformer.py | 4 +- .../modeling_audio_spectrogram_transformer.py | 2 +- .../models/auto/configuration_auto.py | 8 +- .../models/auto/feature_extraction_auto.py | 12 +- .../models/auto/image_processing_auto.py | 12 +- .../models/auto/processing_auto.py | 6 +- .../models/auto/tokenization_auto.py | 22 +- .../models/autoformer/modeling_autoformer.py | 2 +- .../models/bark/configuration_bark.py | 8 +- .../transformers/models/bark/modeling_bark.py | 2 +- .../models/bark/processing_bark.py | 2 +- .../models/bart/configuration_bart.py | 6 +- .../transformers/models/bart/modeling_bart.py | 2 +- .../models/bart/tokenization_bart.py | 26 +- .../models/bart/tokenization_bart_fast.py | 38 +- .../models/barthez/tokenization_barthez.py | 6 +- .../barthez/tokenization_barthez_fast.py | 12 +- .../models/bartpho/tokenization_bartpho.py | 4 +- .../models/beit/configuration_beit.py | 6 +- .../transformers/models/beit/modeling_beit.py | 2 +- .../models/bert/tokenization_bert_fast.py | 72 +-- .../configuration_bert_generation.py | 2 +- .../models/big_bird/configuration_big_bird.py | 10 +- .../models/big_bird/modeling_big_bird.py | 2 +- .../models/big_bird/tokenization_big_bird.py | 6 +- .../big_bird/tokenization_big_bird_fast.py | 14 +- .../configuration_bigbird_pegasus.py | 2 +- .../models/biogpt/configuration_biogpt.py | 6 +- .../models/biogpt/modeling_biogpt.py | 2 +- .../models/biogpt/tokenization_biogpt.py | 4 +- .../models/bloom/configuration_bloom.py | 18 +- .../models/bloom/tokenization_bloom_fast.py | 16 +- .../models/chatglm/configuration_chatglm.py | 2 +- .../models/chatglm/modeling_chatglm.py | 4 +- .../models/chatglm/modeling_graph_chatglm.py | 2 +- .../models/chatglm2/modeling_chatglm2.py | 4 +- .../models/chatglm3/modeling_chatglm3.py | 4 +- .../models/clip/configuration_clip.py | 10 +- .../transformers/models/clip/modeling_clip.py | 2 +- .../models/clip/tokenization_clip.py | 4 +- .../models/clip/tokenization_clip_fast.py | 6 +- .../models/codegen/configuration_codegen.py | 26 +- .../models/codegen/modeling_codegen.py | 2 +- .../models/codegen/tokenization_codegen.py | 4 +- .../codegen/tokenization_codegen_fast.py | 6 +- .../models/cpm/tokenization_cpm.py | 2 +- .../models/cpm/tokenization_cpm_fast.py | 4 +- .../models/cpmant/configuration_cpmant.py | 6 +- .../models/cpmant/modeling_cpmant.py | 2 +- .../models/cpmant/tokenization_cpmant.py | 2 +- .../models/cpmbee/configuration_cpmbee.py | 12 +- .../models/cpmbee/modeling_cpmbee.py | 6 +- .../models/cpmbee/tokenization_cpmbee.py | 8 +- .../models/deberta/configuration_deberta.py | 14 +- .../models/deberta/tokenization_deberta.py | 24 +- .../deberta/tokenization_deberta_fast.py | 24 +- .../distilbert/configuration_distilbert.py | 16 +- .../models/distilbert/modeling_distilbert.py | 2 +- .../distilbert/tokenization_distilbert.py | 12 +- .../tokenization_distilbert_fast.py | 24 +- .../models/encodec/configuration_encodec.py | 6 +- .../encodec/feature_extraction_encodec.py | 2 +- .../models/ernie/configuration_ernie.py | 22 +- .../models/ernie/modeling_ernie.py | 2 +- .../models/ernie/modeling_graph_ernie.py | 2 +- .../models/ernie_m/configuration_ernie_m.py | 6 +- .../models/ernie_m/modeling_ernie_m.py | 2 +- .../models/ernie_m/modeling_graph_ernie_m.py | 2 +- .../models/ernie_m/tokenization_ernie_m.py | 8 +- .../models/esm/configuration_esm.py | 6 +- .../transformers/models/esm/modeling_esm.py | 4 +- .../models/esm/tokenization_esm.py | 4 +- .../models/falcon/configuration_falcon.py | 4 +- .../models/gemma/configuration_gemma.py | 2 +- .../models/gemma/tokenization_gemma_fast.py | 2 +- .../models/gpt/configuration_gpt.py | 4 +- .../transformers/models/gpt/modeling_gpt.py | 2 +- .../models/gpt/tokenization_gpt.py | 4 +- .../models/gpt/tokenization_gpt_fast.py | 6 +- .../models/gpt2/configuration_gpt2.py | 12 +- .../transformers/models/gpt2/modeling_gpt2.py | 2 +- .../models/gpt2/tokenization_gpt2.py | 22 +- .../models/gpt2/tokenization_gpt2_fast.py | 32 +- .../models/gpt_neox/configuration_gpt_neox.py | 4 +- .../models/gpt_neox/modeling_gpt_neox.py | 2 +- .../gpt_neox/tokenization_gpt_neox_fast.py | 4 +- .../graphormer/configuration_graphormer.py | 6 +- .../models/graphormer/modeling_graphormer.py | 2 +- .../models/hubert/configuration_hubert.py | 6 +- .../models/hubert/modeling_hubert.py | 2 +- .../models/layoutlm/configuration_layoutlm.py | 4 +- .../models/layoutlm/modeling_layoutlm.py | 3 - .../models/layoutlm/tokenization_layoutlm.py | 4 +- .../layoutlm/tokenization_layoutlm_fast.py | 8 +- .../layoutlmv2/configuration_layoutlmv2.py | 138 ++++-- .../models/layoutlmv2/modeling_layoutlmv2.py | 2 +- .../layoutlmv2/tokenization_layoutlmv2.py | 4 +- .../tokenization_layoutlmv2_fast.py | 4 +- .../models/layoutlmv2/visual_backbone.py | 40 +- .../models/llama/configuration_llama.py | 2 +- .../models/llama/tokenization_code_llama.py | 8 +- .../llama/tokenization_code_llama_fast.py | 6 +- .../models/llama/tokenization_llama.py | 6 +- .../models/llama/tokenization_llama_fast.py | 8 +- .../longformer/configuration_longformer.py | 12 +- .../models/longformer/modeling_longformer.py | 2 +- .../longformer/tokenization_longformer.py | 20 +- .../tokenization_longformer_fast.py | 30 +- .../models/longt5/configuration_longt5.py | 10 +- .../models/longt5/tokenization_longt5.py | 8 +- .../models/luke/tokenization_luke.py | 12 +- .../models/mamba/configuration_mamba.py | 4 +- .../models/mamba/modeling_graph_mamba.py | 2 +- .../models/mamba/modeling_mamba.py | 2 +- .../models/mbart/configuration_mbart.py | 4 +- .../models/mbart/modeling_mbart.py | 2 +- .../models/mbart/tokenization_mbart.py | 4 +- .../models/mbart/tokenization_mbart_fast.py | 10 +- .../configuration_megatron_bert.py | 4 +- .../megatron_bert/modeling_megatron_bert.py | 2 +- .../models/minicpm/configuration_minicpm.py | 2 +- .../models/mistral/configuration_mistral.py | 8 +- .../models/mixtral/configuration_mixtral.py | 6 +- .../models/mt5/configuration_mt5.py | 2 +- .../models/musicgen/configuration_musicgen.py | 2 +- .../models/musicgen/modeling_musicgen.py | 10 +- .../models/opt/configuration_opt.py | 14 +- .../transformers/models/opt/modeling_opt.py | 2 +- .../pegasus/tokenization_pegasus_fast.py | 2 +- .../models/phi/configuration_phi.py | 4 +- .../transformers/models/phi/modeling_phi.py | 2 +- .../pop2piano/configuration_pop2piano.py | 4 +- .../models/pop2piano/modeling_pop2piano.py | 6 +- .../pop2piano/tokenization_pop2piano.py | 2 +- .../models/qwen2/configuration_qwen2.py | 4 +- .../models/qwen2/modeling_qwen2.py | 2 +- .../models/qwen2/tokenization_qwen2.py | 4 +- .../models/qwen2/tokenization_qwen2_fast.py | 6 +- .../models/reformer/configuration_reformer.py | 6 +- .../models/reformer/modeling_reformer.py | 2 +- .../models/reformer/tokenization_reformer.py | 2 +- .../reformer/tokenization_reformer_fast.py | 6 +- .../models/roberta/tokenization_roberta.py | 24 +- .../roberta/tokenization_roberta_fast.py | 36 +- .../models/rwkv/configuration_rwkv.py | 22 +- .../transformers/models/rwkv/modeling_rwkv.py | 2 +- .../configuration_seamless_m4t.py | 6 +- .../seamless_m4t/modeling_seamless_m4t.py | 4 +- .../seamless_m4t/tokenization_seamless_m4t.py | 2 +- .../tokenization_seamless_m4t_fast.py | 6 +- .../configuration_seamless_m4t_v2.py | 4 +- .../modeling_seamless_m4t_v2.py | 4 +- .../starcoder2/configuration_starcoder2.py | 2 +- .../models/t5/configuration_t5.py | 12 +- mindnlp/transformers/models/t5/modeling_t5.py | 2 +- .../transformers/models/t5/tokenization_t5.py | 10 +- .../models/t5/tokenization_t5_fast.py | 22 +- .../models/wav2vec2/configuration_wav2vec2.py | 8 +- .../wav2vec2/feature_extraction_wav2vec2.py | 10 +- .../models/wav2vec2/modeling_wav2vec2.py | 10 +- .../models/wav2vec2/tokenization_wav2vec2.py | 18 +- .../processing_wav2vec2_with_lm.py | 4 +- .../models/whisper/configuration_whisper.py | 2 +- .../models/whisper/modeling_whisper.py | 2 +- .../models/whisper/tokenization_whisper.py | 8 +- .../whisper/tokenization_whisper_fast.py | 56 +-- .../models/xlm/configuration_xlm.py | 24 +- .../transformers/models/xlm/modeling_xlm.py | 2 +- .../models/xlm/tokenization_xlm.py | 40 +- .../xlm_roberta/configuration_xlm_roberta.py | 2 +- .../xlm_roberta/tokenization_xlm_roberta.py | 12 +- .../tokenization_xlm_roberta_fast.py | 26 +- .../pipelines/automatic_speech_recognition.py | 10 +- .../pipelines/document_question_answering.py | 20 +- .../pipelines/question_answering.py | 2 +- .../pipelines/text2text_generation.py | 12 +- .../pipelines/text_classification.py | 2 +- .../transformers/pipelines/text_generation.py | 2 +- .../pipelines/zero_shot_classification.py | 2 +- mindnlp/transformers/processing_utils.py | 2 +- .../transformers/tokenization_utils_base.py | 14 +- mindnlp/utils/download.py | 16 +- mindnlp/utils/errors.py | 6 +- mindnlp/utils/peft_utils.py | 4 +- requirements/docs_requirements.txt | 2 +- .../models/bloom/test_modeling_bloom.py | 4 +- .../models/layoutlm/test_modeling_layoutlm.py | 3 +- .../wav2vec2/test_tokenization_wav2vec2.py | 2 +- ...t_pipelines_document_question_answering.py | 15 +- 213 files changed, 1416 insertions(+), 935 deletions(-) create mode 100644 llm/inference/musicgen/run_musicgen.ipynb diff --git a/.github/install_mindspore.py b/.github/install_mindspore.py index 97cc7d908..504311f56 100644 --- a/.github/install_mindspore.py +++ b/.github/install_mindspore.py @@ -3,7 +3,7 @@ import os def gen_url(os_name, py_version): - hf_url = 'https://huggingface.co/lvyufeng/mindspore-daily/resolve/main/' + hf_url = 'https://hf-mirror.com/lvyufeng/mindspore-daily/resolve/main/' whl_name = 'mindspore-newest-cp{}-cp{}-{}.whl' py_version = py_version.replace('.', '') diff --git a/.github/kaggle_gpu_test.py b/.github/kaggle_gpu_test.py index eb319e2cd..f64ecc175 100644 --- a/.github/kaggle_gpu_test.py +++ b/.github/kaggle_gpu_test.py @@ -4,7 +4,7 @@ os.chdir("mindnlp") os.system("conda create -n mindspore python=3.9 cudatoolkit=11.1 cudnn -y") os.system("/opt/conda/envs/mindspore/bin/pip install -r requirements/requirements.txt") -os.system("/opt/conda/envs/mindspore/bin/pip install https://huggingface.co/lvyufeng/mindspore-daily/resolve/main/mindspore-newest-cp39-cp39-linux_x86_64.whl") +os.system("/opt/conda/envs/mindspore/bin/pip install https://hf-mirror.com/lvyufeng/mindspore-daily/resolve/main/mindspore-newest-cp39-cp39-linux_x86_64.whl") return_code = os.system("/opt/conda/envs/mindspore/bin/pytest tests -c pytest.ini -m 'not download'") if return_code: raise Exception("tests failed.") diff --git a/llm/inference/llama/example.py b/llm/inference/llama/example.py index 6b5655a99..de26be75f 100644 --- a/llm/inference/llama/example.py +++ b/llm/inference/llama/example.py @@ -80,7 +80,7 @@ def main( "I believe the meaning of life is", "Simply put, the theory of relativity states that ", "Building a website can be done in 10 simple steps:\n", - # Few shot prompts: https://huggingface.co/blog/few-shot-learning-gpt-neo-and-inference-api + # Few shot prompts: https://hf-mirror.com/blog/few-shot-learning-gpt-neo-and-inference-api """Tweet: "I hate it when my phone battery dies." Sentiment: Negative ### diff --git a/llm/inference/musicgen/run_musicgen.ipynb b/llm/inference/musicgen/run_musicgen.ipynb new file mode 100644 index 000000000..8bd42c441 --- /dev/null +++ b/llm/inference/musicgen/run_musicgen.ipynb @@ -0,0 +1,426 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "id": "70300319-d206-43ce-b3bf-3da6b079f20f", + "metadata": { + "id": "70300319-d206-43ce-b3bf-3da6b079f20f" + }, + "source": [ + "## MusicGen in MindNLP\n", + "\n", + "MusicGen is a Transformer-based model capable fo generating high-quality music samples conditioned on text descriptions or audio prompts. It was proposed in the paper [Simple and Controllable Music Generation](https://arxiv.org/abs/2306.05284) by Jade Copet et al. from Meta AI.\n", + "\n", + "The MusicGen model can be de-composed into three distinct stages:\n", + "1. The text descriptions are passed through a frozen text encoder model to obtain a sequence of hidden-state representations\n", + "2. The MusicGen decoder is then trained to predict discrete audio tokens, or *audio codes*, conditioned on these hidden-states\n", + "3. These audio tokens are then decoded using an audio compression model, such as EnCodec, to recover the audio waveform\n", + "\n", + "The pre-trained MusicGen checkpoints use Google's [t5-base](https://huggingface.co/t5-base) as the text encoder model, and [EnCodec 32kHz](https://huggingface.co/facebook/encodec_32khz) as the audio compression model. The MusicGen decoder is a pure language model architecture,\n", + "trained from scratch on the task of music generation.\n", + "\n", + "The novelty in the MusicGen model is how the audio codes are predicted. Traditionally, each codebook has to be predicted by a separate model (i.e. hierarchically) or by continuously refining the output of the Transformer model (i.e. upsampling). MusicGen uses an efficient *token interleaving pattern*, thus eliminating the need to cascade multiple models to predict a set of codebooks. Instead, it is able to generate the full set of codebooks in a single forward pass of the decoder, resulting in much faster inference.\n", + "\n", + "

\n", + " \n", + "

\n", + "\n", + "\n", + "**Figure 1:** Codebook delay pattern used by MusicGen. Figure taken from the [MusicGen paper](https://arxiv.org/abs/2306.05284).\n" + ] + }, + { + "cell_type": "markdown", + "id": "77ee39cc-654b-4f0e-b601-013e484c16f0", + "metadata": { + "id": "77ee39cc-654b-4f0e-b601-013e484c16f0" + }, + "source": [ + "## Load the Model\n", + "\n", + "The pre-trained MusicGen small, medium and large checkpoints can be loaded from the [pre-trained weights](https://huggingface.co/models?search=facebook/musicgen-) on the Hugging Face Hub. Change the repo id with the checkpoint size you wish to load. We'll default to the small checkpoint, which is the fastest of the three but has the lowest audio quality:" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "b0d87424-9f38-4658-ba47-2a465d52ad77", + "metadata": { + "id": "b0d87424-9f38-4658-ba47-2a465d52ad77" + }, + "outputs": [], + "source": [ + "from mindnlp.transformers import MusicgenForConditionalGeneration\n", + "\n", + "model = MusicgenForConditionalGeneration.from_pretrained(\"facebook/musicgen-small\")" + ] + }, + { + "cell_type": "markdown", + "id": "f6e1166e-1335-4555-9ec4-223d1fbcb547", + "metadata": { + "id": "f6e1166e-1335-4555-9ec4-223d1fbcb547" + }, + "source": [ + "## Generation\n", + "\n", + "MusicGen is compatible with two generation modes: greedy and sampling. In practice, sampling leads to significantly\n", + "better results than greedy, thus we encourage sampling mode to be used where possible. Sampling is enabled by default,\n", + "and can be explicitly specified by setting `do_sample=True` in the call to `MusicgenForConditionalGeneration.generate` (see below).\n", + "\n", + "### Unconditional Generation\n", + "\n", + "The inputs for unconditional (or 'null') generation can be obtained through the method `MusicgenForConditionalGeneration.get_unconditional_inputs`. We can then run auto-regressive generation using the `.generate` method, specifying `do_sample=True` to enable sampling mode:" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "fb7708e8-e4f1-4ab8-b04a-19395d78dea2", + "metadata": { + "id": "fb7708e8-e4f1-4ab8-b04a-19395d78dea2" + }, + "outputs": [], + "source": [ + "unconditional_inputs = model.get_unconditional_inputs(num_samples=1)\n", + "\n", + "audio_values = model.generate(**unconditional_inputs, do_sample=True, max_new_tokens=256)" + ] + }, + { + "cell_type": "markdown", + "id": "94cb74df-c194-4d2e-930a-12473b08a919", + "metadata": { + "id": "94cb74df-c194-4d2e-930a-12473b08a919" + }, + "source": [ + "The audio outputs are a three-dimensional Torch tensor of shape `(batch_size, num_channels, sequence_length)`. To listen\n", + "to the generated audio samples, you can either play them in an ipynb notebook:" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "15f0bc7c-b899-4e7a-943e-594e73f080ea", + "metadata": { + "id": "15f0bc7c-b899-4e7a-943e-594e73f080ea" + }, + "outputs": [], + "source": [ + "from IPython.display import Audio\n", + "\n", + "sampling_rate = model.config.audio_encoder.sampling_rate\n", + "Audio(audio_values[0].asnumpy(), rate=sampling_rate)" + ] + }, + { + "cell_type": "markdown", + "id": "6de58334-40f7-4924-addb-2d6ff34c0590", + "metadata": { + "id": "6de58334-40f7-4924-addb-2d6ff34c0590" + }, + "source": [ + "Or save them as a `.wav` file using a third-party library, e.g. `scipy` (note here that we also need to remove the channel dimension from our audio tensor):" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "04291f52-0a75-4ddb-9eff-e853d0f17288", + "metadata": { + "id": "04291f52-0a75-4ddb-9eff-e853d0f17288" + }, + "outputs": [], + "source": [ + "import scipy\n", + "\n", + "scipy.io.wavfile.write(\"musicgen_out.wav\", rate=sampling_rate, data=audio_values[0, 0].asnumpy())" + ] + }, + { + "cell_type": "markdown", + "id": "e52ff5b2-c170-4079-93a4-a02acbdaeb39", + "metadata": { + "id": "e52ff5b2-c170-4079-93a4-a02acbdaeb39" + }, + "source": [ + "The argument `max_new_tokens` specifies the number of new tokens to generate. As a rule of thumb, you can work out the length of the generated audio sample in seconds by using the frame rate of the EnCodec model:" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "d75ad107-e19b-47f3-9cf1-5102ab4ae74a", + "metadata": { + "id": "d75ad107-e19b-47f3-9cf1-5102ab4ae74a" + }, + "outputs": [], + "source": [ + "audio_length_in_s = 256 / model.config.audio_encoder.frame_rate\n", + "\n", + "audio_length_in_s" + ] + }, + { + "cell_type": "markdown", + "id": "9a0e999b-2595-4090-8e1a-acfaa42d2581", + "metadata": { + "id": "9a0e999b-2595-4090-8e1a-acfaa42d2581" + }, + "source": [ + "### Text-Conditional Generation\n", + "\n", + "The model can generate an audio sample conditioned on a text prompt through use of the `MusicgenProcessor` to pre-process\n", + "the inputs. The pre-processed inputs can then be passed to the `.generate` method to generate text-conditional audio samples.\n", + "Again, we enable sampling mode by setting `do_sample=True`:" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "5fba4154-13f6-403a-958b-101d6eacfb6e", + "metadata": { + "id": "5fba4154-13f6-403a-958b-101d6eacfb6e" + }, + "outputs": [], + "source": [ + "from mindnlp.transformers import AutoProcessor\n", + "\n", + "processor = AutoProcessor.from_pretrained(\"facebook/musicgen-small\")\n", + "\n", + "inputs = processor(\n", + " text=[\"80s pop track with bassy drums and synth\", \"90s rock song with loud guitars and heavy drums\"],\n", + " padding=True,\n", + " return_tensors=\"ms\",\n", + ")\n", + "\n", + "audio_values = model.generate(**inputs, do_sample=True, guidance_scale=3, max_new_tokens=256)\n", + "\n", + "Audio(audio_values[0].asnumpy(), rate=sampling_rate)" + ] + }, + { + "cell_type": "markdown", + "id": "4851a94c-ae02-41c9-b1dd-c1422ba34dc0", + "metadata": { + "id": "4851a94c-ae02-41c9-b1dd-c1422ba34dc0" + }, + "source": [ + "The `guidance_scale` is used in classifier free guidance (CFG), setting the weighting between the conditional logits\n", + "(which are predicted from the text prompts) and the unconditional logits (which are predicted from an unconditional or\n", + "'null' prompt). A higher guidance scale encourages the model to generate samples that are more closely linked to the input\n", + "prompt, usually at the expense of poorer audio quality. CFG is enabled by setting `guidance_scale > 1`. For best results,\n", + "use a `guidance_scale=3` (default) for text and audio-conditional generation." + ] + }, + { + "cell_type": "markdown", + "id": "d391b2a1-6376-4b69-b562-4388b731cf60", + "metadata": { + "id": "d391b2a1-6376-4b69-b562-4388b731cf60" + }, + "source": [ + "### Audio-Prompted Generation\n", + "\n", + "The same `MusicgenProcessor` can be used to pre-process an audio prompt that is used for audio continuation. In the\n", + "following example, we load an audio file using the 🤗 Datasets library, pre-process it using the processor class,\n", + "and then forward the inputs to the model for generation:" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "56a5c28a-f6c1-4ac8-ae08-6776a2b2c5b8", + "metadata": { + "id": "56a5c28a-f6c1-4ac8-ae08-6776a2b2c5b8" + }, + "outputs": [], + "source": [ + "from datasets import load_dataset\n", + "\n", + "dataset = load_dataset(\"sanchit-gandhi/gtzan\", split=\"train\", streaming=True)\n", + "sample = next(iter(dataset))[\"audio\"]\n", + "\n", + "# take the first half of the audio sample\n", + "sample[\"array\"] = sample[\"array\"][: len(sample[\"array\"]) // 2]\n", + "\n", + "inputs = processor(\n", + " audio=sample[\"array\"],\n", + " sampling_rate=sample[\"sampling_rate\"],\n", + " text=[\"80s blues track with groovy saxophone\"],\n", + " padding=True,\n", + " return_tensors=\"ms\",\n", + ")\n", + "\n", + "audio_values = model.generate(**inputs, do_sample=True, guidance_scale=3, max_new_tokens=256)\n", + "\n", + "Audio(audio_values[0].asnumpy(), rate=sampling_rate)" + ] + }, + { + "cell_type": "markdown", + "id": "77518aa4-1b9b-4af6-b5ac-8ecdcb79b4cc", + "metadata": { + "id": "77518aa4-1b9b-4af6-b5ac-8ecdcb79b4cc" + }, + "source": [ + "To demonstrate batched audio-prompted generation, we'll slice our sample audio by two different proportions to give two audio samples of different length.\n", + "Since the input audio prompts vary in length, they will be *padded* to the length of the longest audio sample in the batch before being passed to the model.\n", + "\n", + "To recover the final audio samples, the `audio_values` generated can be post-processed to remove padding by using the processor class once again:" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "5495f568-51ca-439d-b47b-8b52e89b78f1", + "metadata": { + "id": "5495f568-51ca-439d-b47b-8b52e89b78f1" + }, + "outputs": [], + "source": [ + "sample = next(iter(dataset))[\"audio\"]\n", + "\n", + "# take the first quater of the audio sample\n", + "sample_1 = sample[\"array\"][: len(sample[\"array\"]) // 4]\n", + "\n", + "# take the first half of the audio sample\n", + "sample_2 = sample[\"array\"][: len(sample[\"array\"]) // 2]\n", + "\n", + "inputs = processor(\n", + " audio=[sample_1, sample_2],\n", + " sampling_rate=sample[\"sampling_rate\"],\n", + " text=[\"80s blues track with groovy saxophone\", \"90s rock song with loud guitars and heavy drums\"],\n", + " padding=True,\n", + " return_tensors=\"ms\",\n", + ")\n", + "\n", + "audio_values = model.generate(**inputs, do_sample=True, guidance_scale=3, max_new_tokens=256)\n", + "\n", + "# post-process to remove padding from the batched audio\n", + "audio_values = processor.batch_decode(audio_values, padding_mask=inputs.padding_mask)\n", + "\n", + "Audio(audio_values[0], rate=sampling_rate)" + ] + }, + { + "cell_type": "markdown", + "id": "viwTDmzl8ZDN", + "metadata": { + "id": "viwTDmzl8ZDN" + }, + "source": [ + "## Generation Config\n", + "\n", + "The default parameters that control the generation process, such as sampling, guidance scale and number of generated tokens, can be found in the model's generation config, and updated as desired. Let's first inspect the default generation config:" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "0zM4notb8Y1g", + "metadata": { + "id": "0zM4notb8Y1g" + }, + "outputs": [], + "source": [ + "model.generation_config" + ] + }, + { + "cell_type": "markdown", + "id": "DLSnSwau8jyW", + "metadata": { + "id": "DLSnSwau8jyW" + }, + "source": [ + "Alright! We see that the model defaults to using sampling mode (`do_sample=True`), a guidance scale of 3, and a maximum generation length of 1500 (which is equivalent to 30s of audio). You can update any of these attributes to change the default generation parameters:" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "ensSj1IB81dA", + "metadata": { + "id": "ensSj1IB81dA" + }, + "outputs": [], + "source": [ + "# increase the guidance scale to 4.0\n", + "model.generation_config.guidance_scale = 4.0\n", + "\n", + "# set the max new tokens to 256\n", + "model.generation_config.max_new_tokens = 256\n", + "\n", + "# set the softmax sampling temperature to 1.5\n", + "model.generation_config.temperature = 1.5" + ] + }, + { + "cell_type": "markdown", + "id": "UjqGnfc-9ZFJ", + "metadata": { + "id": "UjqGnfc-9ZFJ" + }, + "source": [ + "Re-running generation now will use the newly defined values in the generation config:" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "KAExrhDl9YvS", + "metadata": { + "id": "KAExrhDl9YvS" + }, + "outputs": [], + "source": [ + "audio_values = model.generate(**inputs)" + ] + }, + { + "cell_type": "markdown", + "id": "HdGdoGAs84hS", + "metadata": { + "id": "HdGdoGAs84hS" + }, + "source": [ + "Note that any arguments passed to the generate method will **supersede** those in the generation config, so setting `do_sample=False` in the call to generate will supersede the setting of `model.generation_config.do_sample` in the generation config." + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "s__neSDH89q0", + "metadata": { + "id": "s__neSDH89q0" + }, + "outputs": [], + "source": [] + } + ], + "metadata": { + "colab": { + "provenance": [] + }, + "kernelspec": { + "display_name": "Python 3 (ipykernel)", + "language": "python", + "name": "python3" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 3 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython3", + "version": "3.9.18" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} diff --git a/llm/pipelines/document_question_answering.py b/llm/pipelines/document_question_answering.py index f41c10912..0609f1d66 100644 --- a/llm/pipelines/document_question_answering.py +++ b/llm/pipelines/document_question_answering.py @@ -6,7 +6,7 @@ dqa_pipeline = pipeline("document-question-answering", model="hf-internal-testing/tiny-random-layoutlmv2", tokenizer=tokenizer) -image_url = "https://huggingface.co/spaces/impira/docquery/resolve/2f6c96314dc84dfda62d40de9da55f2f5165d403/invoice.png" +image_url = "https://hf-mirror.com/spaces/impira/docquery/resolve/2f6c96314dc84dfda62d40de9da55f2f5165d403/invoice.png" question = "How many cats are there?" outputs = dqa_pipeline(image=image_url, question=question, top_k=2) diff --git a/llm/pretrain/bert/src/config.py b/llm/pretrain/bert/src/config.py index 9eed094e8..465d9e06d 100644 --- a/llm/pretrain/bert/src/config.py +++ b/llm/pretrain/bert/src/config.py @@ -61,30 +61,30 @@ def from_json(cls, file_path): return config CONFIG_ARCHIVE_MAP = { - "bert-base-uncased": "https://huggingface.co/bert-base-uncased/resolve/main/config.json", - "bert-large-uncased": "https://huggingface.co/bert-large-uncased/resolve/main/config.json", - "bert-base-cased": "https://huggingface.co/bert-base-cased/resolve/main/config.json", - "bert-large-cased": "https://huggingface.co/bert-large-cased/resolve/main/config.json", - "bert-base-multilingual-uncased": "https://huggingface.co/bert-base-multilingual-uncased/resolve/main/config.json", - "bert-base-multilingual-cased": "https://huggingface.co/bert-base-multilingual-cased/resolve/main/config.json", - "bert-base-chinese": "https://huggingface.co/bert-base-chinese/resolve/main/config.json", - "bert-base-german-cased": "https://huggingface.co/bert-base-german-cased/resolve/main/config.json", - "bert-large-uncased-whole-word-masking": "https://huggingface.co/bert-large-uncased-whole-word-masking/resolve/main/config.json", - "bert-large-cased-whole-word-masking": "https://huggingface.co/bert-large-cased-whole-word-masking/resolve/main/config.json", - "bert-large-uncased-whole-word-masking-finetuned-squad": "https://huggingface.co/bert-large-uncased-whole-word-masking-finetuned-squad/resolve/main/config.json", - "bert-large-cased-whole-word-masking-finetuned-squad": "https://huggingface.co/bert-large-cased-whole-word-masking-finetuned-squad/resolve/main/config.json", - "bert-base-cased-finetuned-mrpc": "https://huggingface.co/bert-base-cased-finetuned-mrpc/resolve/main/config.json", - "bert-base-german-dbmdz-cased": "https://huggingface.co/bert-base-german-dbmdz-cased/resolve/main/config.json", - "bert-base-german-dbmdz-uncased": "https://huggingface.co/bert-base-german-dbmdz-uncased/resolve/main/config.json", - "cl-tohoku/bert-base-japanese": "https://huggingface.co/cl-tohoku/bert-base-japanese/resolve/main/config.json", - "cl-tohoku/bert-base-japanese-whole-word-masking": "https://huggingface.co/cl-tohoku/bert-base-japanese-whole-word-masking/resolve/main/config.json", - "cl-tohoku/bert-base-japanese-char": "https://huggingface.co/cl-tohoku/bert-base-japanese-char/resolve/main/config.json", - "cl-tohoku/bert-base-japanese-char-whole-word-masking": "https://huggingface.co/cl-tohoku/bert-base-japanese-char-whole-word-masking/resolve/main/config.json", - "TurkuNLP/bert-base-finnish-cased-v1": "https://huggingface.co/TurkuNLP/bert-base-finnish-cased-v1/resolve/main/config.json", - "TurkuNLP/bert-base-finnish-uncased-v1": "https://huggingface.co/TurkuNLP/bert-base-finnish-uncased-v1/resolve/main/config.json", - "wietsedv/bert-base-dutch-cased": "https://huggingface.co/wietsedv/bert-base-dutch-cased/resolve/main/config.json", - "sentence-transformers/all-MiniLM-L6-v2": "https://huggingface.co/sentence-transformers/all-MiniLM-L6-v2/resolve/main/config.json" - # See all BERT models at https://huggingface.co/models?filter=bert + "bert-base-uncased": "https://hf-mirror.com/bert-base-uncased/resolve/main/config.json", + "bert-large-uncased": "https://hf-mirror.com/bert-large-uncased/resolve/main/config.json", + "bert-base-cased": "https://hf-mirror.com/bert-base-cased/resolve/main/config.json", + "bert-large-cased": "https://hf-mirror.com/bert-large-cased/resolve/main/config.json", + "bert-base-multilingual-uncased": "https://hf-mirror.com/bert-base-multilingual-uncased/resolve/main/config.json", + "bert-base-multilingual-cased": "https://hf-mirror.com/bert-base-multilingual-cased/resolve/main/config.json", + "bert-base-chinese": "https://hf-mirror.com/bert-base-chinese/resolve/main/config.json", + "bert-base-german-cased": "https://hf-mirror.com/bert-base-german-cased/resolve/main/config.json", + "bert-large-uncased-whole-word-masking": "https://hf-mirror.com/bert-large-uncased-whole-word-masking/resolve/main/config.json", + "bert-large-cased-whole-word-masking": "https://hf-mirror.com/bert-large-cased-whole-word-masking/resolve/main/config.json", + "bert-large-uncased-whole-word-masking-finetuned-squad": "https://hf-mirror.com/bert-large-uncased-whole-word-masking-finetuned-squad/resolve/main/config.json", + "bert-large-cased-whole-word-masking-finetuned-squad": "https://hf-mirror.com/bert-large-cased-whole-word-masking-finetuned-squad/resolve/main/config.json", + "bert-base-cased-finetuned-mrpc": "https://hf-mirror.com/bert-base-cased-finetuned-mrpc/resolve/main/config.json", + "bert-base-german-dbmdz-cased": "https://hf-mirror.com/bert-base-german-dbmdz-cased/resolve/main/config.json", + "bert-base-german-dbmdz-uncased": "https://hf-mirror.com/bert-base-german-dbmdz-uncased/resolve/main/config.json", + "cl-tohoku/bert-base-japanese": "https://hf-mirror.com/cl-tohoku/bert-base-japanese/resolve/main/config.json", + "cl-tohoku/bert-base-japanese-whole-word-masking": "https://hf-mirror.com/cl-tohoku/bert-base-japanese-whole-word-masking/resolve/main/config.json", + "cl-tohoku/bert-base-japanese-char": "https://hf-mirror.com/cl-tohoku/bert-base-japanese-char/resolve/main/config.json", + "cl-tohoku/bert-base-japanese-char-whole-word-masking": "https://hf-mirror.com/cl-tohoku/bert-base-japanese-char-whole-word-masking/resolve/main/config.json", + "TurkuNLP/bert-base-finnish-cased-v1": "https://hf-mirror.com/TurkuNLP/bert-base-finnish-cased-v1/resolve/main/config.json", + "TurkuNLP/bert-base-finnish-uncased-v1": "https://hf-mirror.com/TurkuNLP/bert-base-finnish-uncased-v1/resolve/main/config.json", + "wietsedv/bert-base-dutch-cased": "https://hf-mirror.com/wietsedv/bert-base-dutch-cased/resolve/main/config.json", + "sentence-transformers/all-MiniLM-L6-v2": "https://hf-mirror.com/sentence-transformers/all-MiniLM-L6-v2/resolve/main/config.json" + # See all BERT models at https://hf-mirror.com/models?filter=bert } class BertConfig(PretrainedConfig): diff --git a/llm/pretrain/bert/src/utils.py b/llm/pretrain/bert/src/utils.py index 5025b38b3..31dd4bd50 100644 --- a/llm/pretrain/bert/src/utils.py +++ b/llm/pretrain/bert/src/utils.py @@ -17,7 +17,7 @@ BERT4MS_CACHE = Path(os.getenv('BERT4MS_CACHE', os.path.join(os.path.expanduser("~"), '.bert4ms'))) CACHE_DIR = Path.home() / '.bert4ms' -HUGGINGFACE_BASE_URL = 'https://huggingface.co/{}/resolve/main/pytorch_model.bin' +HUGGINGFACE_BASE_URL = 'https://hf-mirror.com/{}/resolve/main/pytorch_model.bin' def load_from_cache(name, url, cache_dir:str=None, force_download=False): """ diff --git a/mindnlp/dataset/load.py b/mindnlp/dataset/load.py index fb8d3097f..eb8685fe9 100644 --- a/mindnlp/dataset/load.py +++ b/mindnlp/dataset/load.py @@ -68,7 +68,7 @@ def load_dataset( ): """Load a dataset from the Hugging Face Hub, or a local dataset. - You can find the list of datasets on the [Hub](https://huggingface.co/datasets) or with [`huggingface_hub.list_datasets`]. + You can find the list of datasets on the [Hub](https://hf-mirror.com/datasets) or with [`huggingface_hub.list_datasets`]. A dataset is a directory that contains: @@ -86,7 +86,7 @@ def load_dataset( Dataset scripts are small python scripts that define dataset builders. They define the citation, info and format of the dataset, contain the path or URL to the original data files and the code to load examples from the original data files. - You can find the complete list of datasets in the Datasets [Hub](https://huggingface.co/datasets). + You can find the complete list of datasets in the Datasets [Hub](https://hf-mirror.com/datasets). 2. Run the dataset script which will: diff --git a/mindnlp/transformers/configuration_utils.py b/mindnlp/transformers/configuration_utils.py index 6b052db1c..16d983a26 100644 --- a/mindnlp/transformers/configuration_utils.py +++ b/mindnlp/transformers/configuration_utils.py @@ -262,7 +262,7 @@ def from_pretrained( This can be either: - a string, the *model id* of a pretrained model configuration hosted inside a model repo on - huggingface.co. Valid model ids can be located at the root-level, like `bert-base-uncased`, or + hf-mirror.com. Valid model ids can be located at the root-level, like `bert-base-uncased`, or namespaced under a user or organization name, like `dbmdz/bert-base-german-cased`. - a path to a *directory* containing a configuration file saved using the [`~PretrainedConfig.save_pretrained`] method, e.g., `./my_model_directory/`. @@ -284,7 +284,7 @@ def from_pretrained( the token generated when running `huggingface-cli login` (stored in `~/.huggingface`). revision (`str`, *optional*, defaults to `"main"`): The specific model version to use. It can be a branch name, a tag name, or a commit id, since we use a - git-based system for storing models and other artifacts on huggingface.co, so `revision` can be any + git-based system for storing models and other artifacts on hf-mirror.com, so `revision` can be any identifier allowed by git. @@ -300,7 +300,7 @@ def from_pretrained( dictionary consisting of the key/value pairs whose keys are not configuration attributes: i.e., the part of `kwargs` which has not been used to update `config` and is otherwise ignored. subfolder (`str`, *optional*, defaults to `""`): - In case the relevant files are located inside a subfolder of the model repo on huggingface.co, you can + In case the relevant files are located inside a subfolder of the model repo on hf-mirror.com, you can specify the folder name here. kwargs (`Dict[str, Any]`, *optional*): The values in kwargs of any keys which are configuration attributes will be used to override the loaded @@ -317,7 +317,7 @@ def from_pretrained( # derived class: BertConfig config = BertConfig.from_pretrained( "bert-base-uncased" - ) # Download configuration from huggingface.co and cache. + ) # Download configuration from hf-mirror.com and cache. config = BertConfig.from_pretrained( "./test/saved_model/" ) # E.g. config (or model) was saved using *save_pretrained('./test/saved_model/')* diff --git a/mindnlp/transformers/feature_extraction_utils.py b/mindnlp/transformers/feature_extraction_utils.py index 6ad0ba92e..63754e912 100644 --- a/mindnlp/transformers/feature_extraction_utils.py +++ b/mindnlp/transformers/feature_extraction_utils.py @@ -249,7 +249,7 @@ def from_pretrained( This can be either: - a string, the *model id* of a pretrained feature_extractor hosted inside a model repo on - huggingface.co. Valid model ids can be located at the root-level, like `bert-base-uncased`, or + hf-mirror.com. Valid model ids can be located at the root-level, like `bert-base-uncased`, or namespaced under a user or organization name, like `dbmdz/bert-base-german-cased`. - a path to a *directory* containing a feature extractor file saved using the [`~feature_extraction_utils.FeatureExtractionMixin.save_pretrained`] method, e.g., @@ -273,7 +273,7 @@ def from_pretrained( the token generated when running `huggingface-cli login` (stored in `~/.huggingface`). revision (`str`, *optional*, defaults to `"main"`): The specific model version to use. It can be a branch name, a tag name, or a commit id, since we use a - git-based system for storing models and other artifacts on huggingface.co, so `revision` can be any + git-based system for storing models and other artifacts on hf-mirror.com, so `revision` can be any identifier allowed by git. @@ -303,7 +303,7 @@ def from_pretrained( # derived class: *Wav2Vec2FeatureExtractor* feature_extractor = Wav2Vec2FeatureExtractor.from_pretrained( "facebook/wav2vec2-base-960h" - ) # Download feature_extraction_config from huggingface.co and cache. + ) # Download feature_extraction_config from hf-mirror.com and cache. feature_extractor = Wav2Vec2FeatureExtractor.from_pretrained( "./test/saved_model/" ) # E.g. feature_extractor (or model) was saved using *save_pretrained('./test/saved_model/')* @@ -451,7 +451,7 @@ def get_feature_extractor_dict( # For any other exception, we throw a generic error. raise EnvironmentError( f"Can't load feature extractor for '{pretrained_model_name_or_path}'. If you were trying to load" - " it from 'https://huggingface.co/models', make sure you don't have a local directory with the" + " it from 'https://hf-mirror.com/models', make sure you don't have a local directory with the" f" same name. Otherwise, make sure '{pretrained_model_name_or_path}' is the correct path to a" f" directory containing a {FEATURE_EXTRACTOR_NAME} file" ) from exc diff --git a/mindnlp/transformers/generation/configuration_utils.py b/mindnlp/transformers/generation/configuration_utils.py index ae69cd803..5655ae478 100644 --- a/mindnlp/transformers/generation/configuration_utils.py +++ b/mindnlp/transformers/generation/configuration_utils.py @@ -365,7 +365,7 @@ def from_pretrained( This can be either: - a string, the *model id* of a pretrained model configuration hosted inside a model repo on - huggingface.co. Valid model ids can be located at the root-level, like `bert-base-uncased`, or + hf-mirror.com. Valid model ids can be located at the root-level, like `bert-base-uncased`, or namespaced under a user or organization name, like `dbmdz/bert-base-german-cased`. - a path to a *directory* containing a configuration file saved using the [`~GenerationConfig.save_pretrained`] method, e.g., `./my_model_directory/`. @@ -388,7 +388,7 @@ def from_pretrained( the token generated when running `huggingface-cli login` (stored in `~/.huggingface`). revision (`str`, *optional*, defaults to `"main"`): The specific model version to use. It can be a branch name, a tag name, or a commit id, since we use a - git-based system for storing models and other artifacts on huggingface.co, so `revision` can be any + git-based system for storing models and other artifacts on hf-mirror.com, so `revision` can be any identifier allowed by git. @@ -404,7 +404,7 @@ def from_pretrained( dictionary consisting of the key/value pairs whose keys are not configuration attributes: i.e., the part of `kwargs` which has not been used to update `config` and is otherwise ignored. subfolder (`str`, *optional*, defaults to `""`): - In case the relevant files are located inside a subfolder of the model repo on huggingface.co, you can + In case the relevant files are located inside a subfolder of the model repo on hf-mirror.com, you can specify the folder name here. kwargs (`Dict[str, Any]`, *optional*): The values in kwargs of any keys which are configuration attributes will be used to override the loaded @@ -419,7 +419,7 @@ def from_pretrained( ```python >>> from transformers import GenerationConfig - >>> # Download configuration from huggingface.co and cache. + >>> # Download configuration from hf-mirror.com and cache. >>> generation_config = GenerationConfig.from_pretrained("gpt2") >>> # E.g. config was saved using *save_pretrained('./test/saved_model/')* @@ -482,7 +482,7 @@ def from_pretrained( # For any other exception, we throw a generic error. raise EnvironmentError( f"Can't load the configuration of '{pretrained_model_name}'. If you were trying to load it" - " from 'https://huggingface.co/models', make sure you don't have a local directory with the same" + " from 'https://hf-mirror.com/models', make sure you don't have a local directory with the same" f" name. Otherwise, make sure '{pretrained_model_name}' is the correct path to a directory" f" containing a {configuration_file} file" ) from exc diff --git a/mindnlp/transformers/generation/logits_process.py b/mindnlp/transformers/generation/logits_process.py index 0754c9729..63d912efb 100644 --- a/mindnlp/transformers/generation/logits_process.py +++ b/mindnlp/transformers/generation/logits_process.py @@ -960,7 +960,7 @@ class SequenceBiasLogitsProcessor(LogitsProcessor): In order to get the token ids of the sequences that you want to bias, make sure to set `add_prefix_space=True` when initializing the tokenizer, and use `tokenizer(bad_words, add_special_tokens=False).input_ids`. The `add_prefix_space` argument is only supported for some slow tokenizers, as fast tokenizers' prefixing behaviours - come from `pre tokenizers`. Read more [here](https://huggingface.co/docs/tokenizers/api/pre-tokenizers). + come from `pre tokenizers`. Read more [here](https://hf-mirror.com/docs/tokenizers/api/pre-tokenizers). @@ -1310,7 +1310,7 @@ class BarkEosPrioritizerLogitsProcessor(LogitsProcessor): This logits processor is exclusively compatible with - [Bark](https://huggingface.co/docs/transformers/en/model_doc/bark). See the model documentation for examples. + [Bark](https://hf-mirror.com/docs/transformers/en/model_doc/bark). See the model documentation for examples. @@ -1355,7 +1355,7 @@ class ClassifierFreeGuidanceLogitsProcessor(LogitsProcessor): This logits processor is exclusively compatible with - [MusicGen](https://huggingface.co/docs/transformers/main/en/model_doc/musicgen) + [MusicGen](https://hf-mirror.com/docs/transformers/main/en/model_doc/musicgen) diff --git a/mindnlp/transformers/generation/utils.py b/mindnlp/transformers/generation/utils.py index 2ae0681b8..2ad2b59a4 100644 --- a/mindnlp/transformers/generation/utils.py +++ b/mindnlp/transformers/generation/utils.py @@ -1422,7 +1422,7 @@ def generate( "You have modified the pretrained model configuration to control generation. This is a" " deprecated strategy to control generation and will be removed soon, in a future version." " Please use and modify the model generation configuration (see" - " https://huggingface.co/docs/transformers/generation_strategies#default-text-generation-configuration )" + " https://hf-mirror.com/docs/transformers/generation_strategies#default-text-generation-configuration )" ) self.generation_config = new_generation_config generation_config = self.generation_config @@ -1519,7 +1519,7 @@ def generate( f"Both `max_new_tokens` (={generation_config.max_new_tokens}) and `max_length`(=" f"{generation_config.max_length}) seem to have been set. `max_new_tokens` will take precedence. " "Please refer to the documentation for more information. " - "(https://huggingface.co/docs/transformers/main/en/main_classes/text_generation)" + "(https://hf-mirror.com/docs/transformers/main/en/main_classes/text_generation)" ) generation_config.max_length = generation_config.max_new_tokens + input_ids_length self._validate_generated_length(generation_config, input_ids_length, has_default_max_length) diff --git a/mindnlp/transformers/image_processing_utils.py b/mindnlp/transformers/image_processing_utils.py index 798f36ab6..d189d1a23 100644 --- a/mindnlp/transformers/image_processing_utils.py +++ b/mindnlp/transformers/image_processing_utils.py @@ -109,7 +109,7 @@ def from_pretrained( This can be either: - a string, the *model id* of a pretrained image_processor hosted inside a model repo on - huggingface.co. + hf-mirror.com. - a path to a *directory* containing a image processor file saved using the [`~image_processing_utils.ImageProcessingMixin.save_pretrained`] method, e.g., `./my_model_directory/`. @@ -132,7 +132,7 @@ def from_pretrained( the token generated when running `huggingface-cli login` (stored in `~/.huggingface`). revision (`str`, *optional*, defaults to `"main"`): The specific model version to use. It can be a branch name, a tag name, or a commit id, since we use a - git-based system for storing models and other artifacts on huggingface.co, so `revision` can be any + git-based system for storing models and other artifacts on hf-mirror.com, so `revision` can be any identifier allowed by git. @@ -148,7 +148,7 @@ def from_pretrained( consisting of the key/value pairs whose keys are not image processor attributes: i.e., the part of `kwargs` which has not been used to update `image_processor` and is otherwise ignored. subfolder (`str`, *optional*, defaults to `""`): - In case the relevant files are located inside a subfolder of the model repo on huggingface.co, you can + In case the relevant files are located inside a subfolder of the model repo on hf-mirror.com, you can specify the folder name here. kwargs (`Dict[str, Any]`, *optional*): The values in kwargs of any keys which are image processor attributes will be used to override the @@ -165,7 +165,7 @@ def from_pretrained( # derived class: *CLIPImageProcessor* image_processor = CLIPImageProcessor.from_pretrained( "openai/clip-vit-base-patch32" - ) # Download image_processing_config from huggingface.co and cache. + ) # Download image_processing_config from hf-mirror.com and cache. image_processor = CLIPImageProcessor.from_pretrained( "./test/saved_model/" ) # E.g. image processor (or model) was saved using *save_pretrained('./test/saved_model/')* @@ -272,7 +272,7 @@ def get_image_processor_dict( pretrained_model_name_or_path (`str` or `os.PathLike`): The identifier of the pre-trained checkpoint from which we want the dictionary of parameters. subfolder (`str`, *optional*, defaults to `""`): - In case the relevant files are located inside a subfolder of the model repo on huggingface.co, you can + In case the relevant files are located inside a subfolder of the model repo on hf-mirror.com, you can specify the folder name here. Returns: @@ -330,7 +330,7 @@ def get_image_processor_dict( # For any other exception, we throw a generic error. raise EnvironmentError( f"Can't load image processor for '{pretrained_model_name_or_path}'. If you were trying to load" - " it from 'https://huggingface.co/models', make sure you don't have a local directory with the" + " it from 'https://hf-mirror.com/models', make sure you don't have a local directory with the" f" same name. Otherwise, make sure '{pretrained_model_name_or_path}' is the correct path to a" f" directory containing a {IMAGE_PROCESSOR_NAME} file" ) from e diff --git a/mindnlp/transformers/image_utils.py b/mindnlp/transformers/image_utils.py index 99540400a..1ae80bddc 100644 --- a/mindnlp/transformers/image_utils.py +++ b/mindnlp/transformers/image_utils.py @@ -300,7 +300,7 @@ def load_image(image: Union[str, "PIL.Image.Image"], timeout: Optional[float] = if isinstance(image, str): if image.startswith("http://") or image.startswith("https://"): # We need to actually check for a real protocol, otherwise it's impossible to use a local file - # like http_huggingface_co.png + # like http_hf-mirror.com.png image = PIL.Image.open(requests.get(image, stream=True, timeout=timeout).raw) elif os.path.isfile(image): image = PIL.Image.open(image) diff --git a/mindnlp/transformers/modeling_utils.py b/mindnlp/transformers/modeling_utils.py index 367a301a5..b7a4bcae2 100644 --- a/mindnlp/transformers/modeling_utils.py +++ b/mindnlp/transformers/modeling_utils.py @@ -1056,7 +1056,6 @@ def load_ckpt(resolved_archive_file): origin_state_dict = load_file(resolved_archive_file) if use_fp16: logger.warning_once("MindSpore do not support bfloat16 dtype, we will automaticlly convert to float16") - state_dict = {k: Parameter(v.astype(np.float32).astype(usage_dtype)) for k, v in origin_state_dict.items()} else: state_dict = load(resolved_archive_file) @@ -1198,9 +1197,8 @@ def load_param_into_net(model: nn.Cell, param_dict: dict, prefix: str, dtype_gro for group in tied_params: missing_in_group = [k for k in keys_missing if k in group] if len(missing_in_group) > 0 and len(missing_in_group) < len(group): - loaded_add_keys = [k for k in keys_missing if k in missing_in_group] + loaded_add_keys.extend([k for k in keys_missing if k in missing_in_group]) keys_missing = [k for k in keys_missing if k not in missing_in_group] - if cls._keys_to_ignore_on_load_missing is not None: for pat in cls._keys_to_ignore_on_load_missing: keys_missing = [k for k in keys_missing if re.search(pat, k) is None] diff --git a/mindnlp/transformers/models/albert/configuration_albert.py b/mindnlp/transformers/models/albert/configuration_albert.py index 1f9a37569..589da841b 100644 --- a/mindnlp/transformers/models/albert/configuration_albert.py +++ b/mindnlp/transformers/models/albert/configuration_albert.py @@ -21,14 +21,14 @@ ALBERT_PRETRAINED_CONFIG_ARCHIVE_MAP = { - "albert-base-v1": "https://huggingface.co/albert-base-v1/resolve/main/config.json", - "albert-large-v1": "https://huggingface.co/albert-large-v1/resolve/main/config.json", - "albert-xlarge-v1": "https://huggingface.co/albert-xlarge-v1/resolve/main/config.json", - "albert-xxlarge-v1": "https://huggingface.co/albert-xxlarge-v1/resolve/main/config.json", - "albert-base-v2": "https://huggingface.co/albert-base-v2/resolve/main/config.json", - "albert-large-v2": "https://huggingface.co/albert-large-v2/resolve/main/config.json", - "albert-xlarge-v2": "https://huggingface.co/albert-xlarge-v2/resolve/main/config.json", - "albert-xxlarge-v2": "https://huggingface.co/albert-xxlarge-v2/resolve/main/config.json", + "albert-base-v1": "https://hf-mirror.com/albert-base-v1/resolve/main/config.json", + "albert-large-v1": "https://hf-mirror.com/albert-large-v1/resolve/main/config.json", + "albert-xlarge-v1": "https://hf-mirror.com/albert-xlarge-v1/resolve/main/config.json", + "albert-xxlarge-v1": "https://hf-mirror.com/albert-xxlarge-v1/resolve/main/config.json", + "albert-base-v2": "https://hf-mirror.com/albert-base-v2/resolve/main/config.json", + "albert-large-v2": "https://hf-mirror.com/albert-large-v2/resolve/main/config.json", + "albert-xlarge-v2": "https://hf-mirror.com/albert-xlarge-v2/resolve/main/config.json", + "albert-xxlarge-v2": "https://hf-mirror.com/albert-xxlarge-v2/resolve/main/config.json", } @@ -37,7 +37,7 @@ class AlbertConfig(PretrainedConfig): This is the configuration class to store the configuration of a [`AlbertModel`] or a [`TFAlbertModel`]. It is used to instantiate an ALBERT model according to the specified arguments, defining the model architecture. Instantiating a configuration with the defaults will yield a similar configuration to that of the ALBERT - [albert-xxlarge-v2](https://huggingface.co/albert-xxlarge-v2) architecture. + [albert-xxlarge-v2](https://hf-mirror.com/albert-xxlarge-v2) architecture. Configuration objects inherit from [`PretrainedConfig`] and can be used to control the model outputs. Read the documentation from [`PretrainedConfig`] for more information. diff --git a/mindnlp/transformers/models/albert/modeling_albert.py b/mindnlp/transformers/models/albert/modeling_albert.py index ee564c778..41aaa7208 100644 --- a/mindnlp/transformers/models/albert/modeling_albert.py +++ b/mindnlp/transformers/models/albert/modeling_albert.py @@ -59,7 +59,7 @@ "albert-large-v2", "albert-xlarge-v2", "albert-xxlarge-v2", - # See all ALBERT models at https://huggingface.co/models?filter=albert + # See all ALBERT models at https://hf-mirror.com/models?filter=albert ] diff --git a/mindnlp/transformers/models/albert/tokenization_albert.py b/mindnlp/transformers/models/albert/tokenization_albert.py index eb3af6fc3..c8689821c 100644 --- a/mindnlp/transformers/models/albert/tokenization_albert.py +++ b/mindnlp/transformers/models/albert/tokenization_albert.py @@ -33,14 +33,14 @@ PRETRAINED_VOCAB_FILES_MAP = { "vocab_file": { - "albert-base-v1": "https://huggingface.co/albert-base-v1/resolve/main/spiece.model", - "albert-large-v1": "https://huggingface.co/albert-large-v1/resolve/main/spiece.model", - "albert-xlarge-v1": "https://huggingface.co/albert-xlarge-v1/resolve/main/spiece.model", - "albert-xxlarge-v1": "https://huggingface.co/albert-xxlarge-v1/resolve/main/spiece.model", - "albert-base-v2": "https://huggingface.co/albert-base-v2/resolve/main/spiece.model", - "albert-large-v2": "https://huggingface.co/albert-large-v2/resolve/main/spiece.model", - "albert-xlarge-v2": "https://huggingface.co/albert-xlarge-v2/resolve/main/spiece.model", - "albert-xxlarge-v2": "https://huggingface.co/albert-xxlarge-v2/resolve/main/spiece.model", + "albert-base-v1": "https://hf-mirror.com/albert-base-v1/resolve/main/spiece.model", + "albert-large-v1": "https://hf-mirror.com/albert-large-v1/resolve/main/spiece.model", + "albert-xlarge-v1": "https://hf-mirror.com/albert-xlarge-v1/resolve/main/spiece.model", + "albert-xxlarge-v1": "https://hf-mirror.com/albert-xxlarge-v1/resolve/main/spiece.model", + "albert-base-v2": "https://hf-mirror.com/albert-base-v2/resolve/main/spiece.model", + "albert-large-v2": "https://hf-mirror.com/albert-large-v2/resolve/main/spiece.model", + "albert-xlarge-v2": "https://hf-mirror.com/albert-xlarge-v2/resolve/main/spiece.model", + "albert-xxlarge-v2": "https://hf-mirror.com/albert-xxlarge-v2/resolve/main/spiece.model", } } diff --git a/mindnlp/transformers/models/albert/tokenization_albert_fast.py b/mindnlp/transformers/models/albert/tokenization_albert_fast.py index 26e6ed033..2b44694ee 100644 --- a/mindnlp/transformers/models/albert/tokenization_albert_fast.py +++ b/mindnlp/transformers/models/albert/tokenization_albert_fast.py @@ -36,24 +36,24 @@ PRETRAINED_VOCAB_FILES_MAP = { "vocab_file": { - "albert-base-v1": "https://huggingface.co/albert-base-v1/resolve/main/spiece.model", - "albert-large-v1": "https://huggingface.co/albert-large-v1/resolve/main/spiece.model", - "albert-xlarge-v1": "https://huggingface.co/albert-xlarge-v1/resolve/main/spiece.model", - "albert-xxlarge-v1": "https://huggingface.co/albert-xxlarge-v1/resolve/main/spiece.model", - "albert-base-v2": "https://huggingface.co/albert-base-v2/resolve/main/spiece.model", - "albert-large-v2": "https://huggingface.co/albert-large-v2/resolve/main/spiece.model", - "albert-xlarge-v2": "https://huggingface.co/albert-xlarge-v2/resolve/main/spiece.model", - "albert-xxlarge-v2": "https://huggingface.co/albert-xxlarge-v2/resolve/main/spiece.model", + "albert-base-v1": "https://hf-mirror.com/albert-base-v1/resolve/main/spiece.model", + "albert-large-v1": "https://hf-mirror.com/albert-large-v1/resolve/main/spiece.model", + "albert-xlarge-v1": "https://hf-mirror.com/albert-xlarge-v1/resolve/main/spiece.model", + "albert-xxlarge-v1": "https://hf-mirror.com/albert-xxlarge-v1/resolve/main/spiece.model", + "albert-base-v2": "https://hf-mirror.com/albert-base-v2/resolve/main/spiece.model", + "albert-large-v2": "https://hf-mirror.com/albert-large-v2/resolve/main/spiece.model", + "albert-xlarge-v2": "https://hf-mirror.com/albert-xlarge-v2/resolve/main/spiece.model", + "albert-xxlarge-v2": "https://hf-mirror.com/albert-xxlarge-v2/resolve/main/spiece.model", }, "tokenizer_file": { - "albert-base-v1": "https://huggingface.co/albert-base-v1/resolve/main/tokenizer.json", - "albert-large-v1": "https://huggingface.co/albert-large-v1/resolve/main/tokenizer.json", - "albert-xlarge-v1": "https://huggingface.co/albert-xlarge-v1/resolve/main/tokenizer.json", - "albert-xxlarge-v1": "https://huggingface.co/albert-xxlarge-v1/resolve/main/tokenizer.json", - "albert-base-v2": "https://huggingface.co/albert-base-v2/resolve/main/tokenizer.json", - "albert-large-v2": "https://huggingface.co/albert-large-v2/resolve/main/tokenizer.json", - "albert-xlarge-v2": "https://huggingface.co/albert-xlarge-v2/resolve/main/tokenizer.json", - "albert-xxlarge-v2": "https://huggingface.co/albert-xxlarge-v2/resolve/main/tokenizer.json", + "albert-base-v1": "https://hf-mirror.com/albert-base-v1/resolve/main/tokenizer.json", + "albert-large-v1": "https://hf-mirror.com/albert-large-v1/resolve/main/tokenizer.json", + "albert-xlarge-v1": "https://hf-mirror.com/albert-xlarge-v1/resolve/main/tokenizer.json", + "albert-xxlarge-v1": "https://hf-mirror.com/albert-xxlarge-v1/resolve/main/tokenizer.json", + "albert-base-v2": "https://hf-mirror.com/albert-base-v2/resolve/main/tokenizer.json", + "albert-large-v2": "https://hf-mirror.com/albert-large-v2/resolve/main/tokenizer.json", + "albert-xlarge-v2": "https://hf-mirror.com/albert-xlarge-v2/resolve/main/tokenizer.json", + "albert-xxlarge-v2": "https://hf-mirror.com/albert-xxlarge-v2/resolve/main/tokenizer.json", }, } @@ -74,7 +74,7 @@ class AlbertTokenizerFast(PreTrainedTokenizerFast): """ Construct a "fast" ALBERT tokenizer (backed by HuggingFace's *tokenizers* library). Based on - [Unigram](https://huggingface.co/docs/tokenizers/python/latest/components.html?highlight=unigram#models). This + [Unigram](https://hf-mirror.com/docs/tokenizers/python/latest/components.html?highlight=unigram#models). This tokenizer inherits from [`PreTrainedTokenizerFast`] which contains most of the main methods. Users should refer to this superclass for more information regarding those methods diff --git a/mindnlp/transformers/models/align/configuration_align.py b/mindnlp/transformers/models/align/configuration_align.py index 99223a936..391694771 100644 --- a/mindnlp/transformers/models/align/configuration_align.py +++ b/mindnlp/transformers/models/align/configuration_align.py @@ -25,7 +25,7 @@ logger = logging.get_logger(__name__) ALIGN_PRETRAINED_CONFIG_ARCHIVE_MAP = { - "kakaobrain/align-base": "https://huggingface.co/kakaobrain/align-base/resolve/main/config.json", + "kakaobrain/align-base": "https://hf-mirror.com/kakaobrain/align-base/resolve/main/config.json", } @@ -34,7 +34,7 @@ class AlignTextConfig(PretrainedConfig): This is the configuration class to store the configuration of a [`AlignTextModel`]. It is used to instantiate a ALIGN text encoder according to the specified arguments, defining the model architecture. Instantiating a configuration with the defaults will yield a similar configuration to that of the text encoder of the ALIGN - [kakaobrain/align-base](https://huggingface.co/kakaobrain/align-base) architecture. The default values here are + [kakaobrain/align-base](https://hf-mirror.com/kakaobrain/align-base) architecture. The default values here are copied from BERT. Configuration objects inherit from [`PretrainedConfig`] and can be used to control the model outputs. Read the @@ -156,7 +156,7 @@ class AlignVisionConfig(PretrainedConfig): This is the configuration class to store the configuration of a [`AlignVisionModel`]. It is used to instantiate a ALIGN vision encoder according to the specified arguments, defining the model architecture. Instantiating a configuration with the defaults will yield a similar configuration to that of the vision encoder of the ALIGN - [kakaobrain/align-base](https://huggingface.co/kakaobrain/align-base) architecture. The default values are copied + [kakaobrain/align-base](https://hf-mirror.com/kakaobrain/align-base) architecture. The default values are copied from EfficientNet (efficientnet-b7) Configuration objects inherit from [`PretrainedConfig`] and can be used to control the model outputs. Read the @@ -293,7 +293,7 @@ class AlignConfig(PretrainedConfig): [`AlignConfig`] is the configuration class to store the configuration of a [`AlignModel`]. It is used to instantiate a ALIGN model according to the specified arguments, defining the text model and vision model configs. Instantiating a configuration with the defaults will yield a similar configuration to that of the ALIGN - [kakaobrain/align-base](https://huggingface.co/kakaobrain/align-base) architecture. + [kakaobrain/align-base](https://hf-mirror.com/kakaobrain/align-base) architecture. Configuration objects inherit from [`PretrainedConfig`] and can be used to control the model outputs. Read the documentation from [`PretrainedConfig`] for more information. diff --git a/mindnlp/transformers/models/align/modeling_align.py b/mindnlp/transformers/models/align/modeling_align.py index 39192d612..534a36cca 100644 --- a/mindnlp/transformers/models/align/modeling_align.py +++ b/mindnlp/transformers/models/align/modeling_align.py @@ -50,7 +50,7 @@ ALIGN_PRETRAINED_MODEL_ARCHIVE_LIST = [ "kakaobrain/align-base", - # See all ALIGN models at https://huggingface.co/models?filter=align + # See all ALIGN models at https://hf-mirror.com/models?filter=align ] @dataclass diff --git a/mindnlp/transformers/models/altclip/configuration_altclip.py b/mindnlp/transformers/models/altclip/configuration_altclip.py index 8c72deacb..f357c59b0 100644 --- a/mindnlp/transformers/models/altclip/configuration_altclip.py +++ b/mindnlp/transformers/models/altclip/configuration_altclip.py @@ -23,8 +23,8 @@ logger = logging.get_logger(__name__) ALTCLIP_PRETRAINED_CONFIG_ARCHIVE_MAP = { - "BAAI/AltCLIP": "https://huggingface.co/BAAI/AltCLIP/resolve/main/config.json", - # See all AltCLIP models at https://huggingface.co/models?filter=altclip + "BAAI/AltCLIP": "https://hf-mirror.com/BAAI/AltCLIP/resolve/main/config.json", + # See all AltCLIP models at https://hf-mirror.com/models?filter=altclip } @@ -33,7 +33,7 @@ class AltCLIPTextConfig(PretrainedConfig): This is the configuration class to store the configuration of a [`AltCLIPTextModel`]. It is used to instantiate a AltCLIP text model according to the specified arguments, defining the model architecture. Instantiating a configuration with the defaults will yield a similar configuration to that of the AltCLIP - [BAAI/AltCLIP](https://huggingface.co/BAAI/AltCLIP) architecture. + [BAAI/AltCLIP](https://hf-mirror.com/BAAI/AltCLIP) architecture. Configuration objects inherit from [`PretrainedConfig`] and can be used to control the model outputs. Read the documentation from [`PretrainedConfig`] for more information. @@ -151,7 +151,7 @@ class AltCLIPVisionConfig(PretrainedConfig): This is the configuration class to store the configuration of a [`AltCLIPModel`]. It is used to instantiate an AltCLIP model according to the specified arguments, defining the model architecture. Instantiating a configuration with the defaults will yield a similar configuration to that of the AltCLIP - [BAAI/AltCLIP](https://huggingface.co/BAAI/AltCLIP) architecture. + [BAAI/AltCLIP](https://hf-mirror.com/BAAI/AltCLIP) architecture. Configuration objects inherit from [`PretrainedConfig`] and can be used to control the model outputs. Read the documentation from [`PretrainedConfig`] for more information. @@ -259,7 +259,7 @@ class AltCLIPConfig(PretrainedConfig): This is the configuration class to store the configuration of a [`AltCLIPModel`]. It is used to instantiate an AltCLIP model according to the specified arguments, defining the model architecture. Instantiating a configuration with the defaults will yield a similar configuration to that of the AltCLIP - [BAAI/AltCLIP](https://huggingface.co/BAAI/AltCLIP) architecture. + [BAAI/AltCLIP](https://hf-mirror.com/BAAI/AltCLIP) architecture. Configuration objects inherit from [`PretrainedConfig`] and can be used to control the model outputs. Read the documentation from [`PretrainedConfig`] for more information. diff --git a/mindnlp/transformers/models/altclip/modeling_altclip.py b/mindnlp/transformers/models/altclip/modeling_altclip.py index f2e120008..d93d8d8d6 100644 --- a/mindnlp/transformers/models/altclip/modeling_altclip.py +++ b/mindnlp/transformers/models/altclip/modeling_altclip.py @@ -44,7 +44,7 @@ ALTCLIP_PRETRAINED_MODEL_ARCHIVE_LIST = [ "BAAI/AltCLIP", - # See all AltCLIP models at https://huggingface.co/models?filter=altclip + # See all AltCLIP models at https://hf-mirror.com/models?filter=altclip ] # contrastive loss function, adapted from diff --git a/mindnlp/transformers/models/audio_spectrogram_transformer/configuration_audio_spectrogram_transformer.py b/mindnlp/transformers/models/audio_spectrogram_transformer/configuration_audio_spectrogram_transformer.py index 2eaaab35f..3e5ec4822 100644 --- a/mindnlp/transformers/models/audio_spectrogram_transformer/configuration_audio_spectrogram_transformer.py +++ b/mindnlp/transformers/models/audio_spectrogram_transformer/configuration_audio_spectrogram_transformer.py @@ -24,7 +24,7 @@ AUDIO_SPECTROGRAM_TRANSFORMER_PRETRAINED_CONFIG_ARCHIVE_MAP = { "MIT/ast-finetuned-audioset-10-10-0.4593": ( - "https://huggingface.co/MIT/ast-finetuned-audioset-10-10-0.4593/resolve/main/config.json" + "https://hf-mirror.com/MIT/ast-finetuned-audioset-10-10-0.4593/resolve/main/config.json" ), } @@ -34,7 +34,7 @@ class ASTConfig(PretrainedConfig): This is the configuration class to store the configuration of a [`ASTModel`]. It is used to instantiate an AST model according to the specified arguments, defining the model architecture. Instantiating a configuration with the defaults will yield a similar configuration to that of the AST - [MIT/ast-finetuned-audioset-10-10-0.4593](https://huggingface.co/MIT/ast-finetuned-audioset-10-10-0.4593) + [MIT/ast-finetuned-audioset-10-10-0.4593](https://hf-mirror.com/MIT/ast-finetuned-audioset-10-10-0.4593) architecture. Configuration objects inherit from [`PretrainedConfig`] and can be used to control the model outputs. Read the diff --git a/mindnlp/transformers/models/audio_spectrogram_transformer/modeling_audio_spectrogram_transformer.py b/mindnlp/transformers/models/audio_spectrogram_transformer/modeling_audio_spectrogram_transformer.py index e8474e424..8fa68001e 100644 --- a/mindnlp/transformers/models/audio_spectrogram_transformer/modeling_audio_spectrogram_transformer.py +++ b/mindnlp/transformers/models/audio_spectrogram_transformer/modeling_audio_spectrogram_transformer.py @@ -47,7 +47,7 @@ AUDIO_SPECTROGRAM_TRANSFORMER_PRETRAINED_MODEL_ARCHIVE_LIST = [ "MIT/ast-finetuned-audioset-10-10-0.4593", - # See all Audio Spectrogram Transformer models at https://huggingface.co/models?filter=ast + # See all Audio Spectrogram Transformer models at https://hf-mirror.com/models?filter=ast ] diff --git a/mindnlp/transformers/models/auto/configuration_auto.py b/mindnlp/transformers/models/auto/configuration_auto.py index d03577446..7915cb672 100644 --- a/mindnlp/transformers/models/auto/configuration_auto.py +++ b/mindnlp/transformers/models/auto/configuration_auto.py @@ -813,7 +813,7 @@ def from_pretrained(cls, pretrained_model_name_or_path, **kwargs): Can be either: - A string, the *model id* of a pretrained model configuration hosted inside a model repo on - huggingface.co. Valid model ids can be located at the root-level, like `bert-base-uncased`, or + hf-mirror.com. Valid model ids can be located at the root-level, like `bert-base-uncased`, or namespaced under a user or organization name, like `dbmdz/bert-base-german-cased`. - A path to a *directory* containing a configuration file saved using the [`~PretrainedConfig.save_pretrained`] method, or the [`~PreTrainedModel.save_pretrained`] method, @@ -834,7 +834,7 @@ def from_pretrained(cls, pretrained_model_name_or_path, **kwargs): 'http://hostname': 'foo.bar:4012'}`. The proxies are used on each request. revision (`str`, *optional*, defaults to `"main"`): The specific model version to use. It can be a branch name, a tag name, or a commit id, since we use a - git-based system for storing models and other artifacts on huggingface.co, so `revision` can be any + git-based system for storing models and other artifacts on hf-mirror.com, so `revision` can be any identifier allowed by git. return_unused_kwargs (`bool`, *optional*, defaults to `False`): If `False`, then this function returns just the final configuration object. @@ -856,10 +856,10 @@ def from_pretrained(cls, pretrained_model_name_or_path, **kwargs): ```python >>> from transformers import AutoConfig - >>> # Download configuration from huggingface.co and cache. + >>> # Download configuration from hf-mirror.com and cache. >>> config = AutoConfig.from_pretrained("bert-base-uncased") - >>> # Download configuration from huggingface.co (user-uploaded) and cache. + >>> # Download configuration from hf-mirror.com (user-uploaded) and cache. >>> config = AutoConfig.from_pretrained("dbmdz/bert-base-german-cased") >>> # If configuration file is in a directory (e.g., was saved using *save_pretrained('./test/saved_model/')*). diff --git a/mindnlp/transformers/models/auto/feature_extraction_auto.py b/mindnlp/transformers/models/auto/feature_extraction_auto.py index 881f026a0..3113b7b83 100644 --- a/mindnlp/transformers/models/auto/feature_extraction_auto.py +++ b/mindnlp/transformers/models/auto/feature_extraction_auto.py @@ -156,7 +156,7 @@ def get_feature_extractor_config( This can be either: - a string, the *model id* of a pretrained model configuration hosted inside a model repo on - huggingface.co. + hf-mirror.com. - a path to a *directory* containing a configuration file saved using the [`~PreTrainedTokenizer.save_pretrained`] method, e.g., `./my_model_directory/`. @@ -176,7 +176,7 @@ def get_feature_extractor_config( when running `huggingface-cli login` (stored in `~/.huggingface`). revision (`str`, *optional*, defaults to `"main"`): The specific model version to use. It can be a branch name, a tag name, or a commit id, since we use a - git-based system for storing models and other artifacts on huggingface.co, so `revision` can be any + git-based system for storing models and other artifacts on hf-mirror.com, so `revision` can be any identifier allowed by git. local_files_only (`bool`, *optional*, defaults to `False`): If `True`, will only try to load the tokenizer configuration from local files. @@ -193,7 +193,7 @@ def get_feature_extractor_config( Examples: ```python - # Download configuration from huggingface.co and cache. + # Download configuration from hf-mirror.com and cache. tokenizer_config = get_tokenizer_config("google-bert/bert-base-uncased") # This model does not have a tokenizer config so the result will be an empty dict. tokenizer_config = get_tokenizer_config("FacebookAI/xlm-roberta-base") @@ -267,7 +267,7 @@ def from_pretrained(cls, pretrained_model_name_or_path, **kwargs): This can be either: - a string, the *model id* of a pretrained feature_extractor hosted inside a model repo on - huggingface.co. + hf-mirror.com. - a path to a *directory* containing a feature extractor file saved using the [`~feature_extraction_utils.FeatureExtractionMixin.save_pretrained`] method, e.g., `./my_model_directory/`. @@ -290,7 +290,7 @@ def from_pretrained(cls, pretrained_model_name_or_path, **kwargs): when running `huggingface-cli login` (stored in `~/.huggingface`). revision (`str`, *optional*, defaults to `"main"`): The specific model version to use. It can be a branch name, a tag name, or a commit id, since we use a - git-based system for storing models and other artifacts on huggingface.co, so `revision` can be any + git-based system for storing models and other artifacts on hf-mirror.com, so `revision` can be any identifier allowed by git. return_unused_kwargs (`bool`, *optional*, defaults to `False`): If `False`, then this function returns just the final feature extractor object. If `True`, then this @@ -317,7 +317,7 @@ def from_pretrained(cls, pretrained_model_name_or_path, **kwargs): ```python >>> from transformers import AutoFeatureExtractor - >>> # Download feature extractor from huggingface.co and cache. + >>> # Download feature extractor from hf-mirror.com and cache. >>> feature_extractor = AutoFeatureExtractor.from_pretrained("facebook/wav2vec2-base-960h") >>> # If feature extractor files are in a directory (e.g. feature extractor was saved using *save_pretrained('./test/saved_model/')*) diff --git a/mindnlp/transformers/models/auto/image_processing_auto.py b/mindnlp/transformers/models/auto/image_processing_auto.py index 40e5235ce..427cd4187 100644 --- a/mindnlp/transformers/models/auto/image_processing_auto.py +++ b/mindnlp/transformers/models/auto/image_processing_auto.py @@ -172,7 +172,7 @@ def get_image_processor_config( This can be either: - a string, the *model id* of a pretrained model configuration hosted inside a model repo on - huggingface.co. + hf-mirror.com. - a path to a *directory* containing a configuration file saved using the [`~PreTrainedTokenizer.save_pretrained`] method, e.g., `./my_model_directory/`. @@ -192,7 +192,7 @@ def get_image_processor_config( when running `huggingface-cli login` (stored in `~/.huggingface`). revision (`str`, *optional*, defaults to `"main"`): The specific model version to use. It can be a branch name, a tag name, or a commit id, since we use a - git-based system for storing models and other artifacts on huggingface.co, so `revision` can be any + git-based system for storing models and other artifacts on hf-mirror.com, so `revision` can be any identifier allowed by git. local_files_only (`bool`, *optional*, defaults to `False`): If `True`, will only try to load the image processor configuration from local files. @@ -209,7 +209,7 @@ def get_image_processor_config( Examples: ```python - # Download configuration from huggingface.co and cache. + # Download configuration from hf-mirror.com and cache. image_processor_config = get_image_processor_config("google-bert/bert-base-uncased") # This model does not have a image processor config so the result will be an empty dict. image_processor_config = get_image_processor_config("FacebookAI/xlm-roberta-base") @@ -283,7 +283,7 @@ def from_pretrained(cls, pretrained_model_name_or_path, **kwargs): This can be either: - a string, the *model id* of a pretrained image_processor hosted inside a model repo on - huggingface.co. + hf-mirror.com. - a path to a *directory* containing a image processor file saved using the [`~image_processing_utils.ImageProcessingMixin.save_pretrained`] method, e.g., `./my_model_directory/`. @@ -306,7 +306,7 @@ def from_pretrained(cls, pretrained_model_name_or_path, **kwargs): when running `huggingface-cli login` (stored in `~/.huggingface`). revision (`str`, *optional*, defaults to `"main"`): The specific model version to use. It can be a branch name, a tag name, or a commit id, since we use a - git-based system for storing models and other artifacts on huggingface.co, so `revision` can be any + git-based system for storing models and other artifacts on hf-mirror.com, so `revision` can be any identifier allowed by git. return_unused_kwargs (`bool`, *optional*, defaults to `False`): If `False`, then this function returns just the final image processor object. If `True`, then this @@ -333,7 +333,7 @@ def from_pretrained(cls, pretrained_model_name_or_path, **kwargs): ```python >>> from transformers import AutoImageProcessor - >>> # Download image processor from huggingface.co and cache. + >>> # Download image processor from hf-mirror.com and cache. >>> image_processor = AutoImageProcessor.from_pretrained("google/vit-base-patch16-224-in21k") >>> # If image processor files are in a directory (e.g. image processor was saved using *save_pretrained('./test/saved_model/')*) diff --git a/mindnlp/transformers/models/auto/processing_auto.py b/mindnlp/transformers/models/auto/processing_auto.py index 017ccf420..eb859da7b 100644 --- a/mindnlp/transformers/models/auto/processing_auto.py +++ b/mindnlp/transformers/models/auto/processing_auto.py @@ -156,7 +156,7 @@ def from_pretrained(cls, pretrained_model_name_or_path, **kwargs): This can be either: - a string, the *model id* of a pretrained feature_extractor hosted inside a model repo on - huggingface.co. + hf-mirror.com. - a path to a *directory* containing a processor files saved using the `save_pretrained()` method, e.g., `./my_model_directory/`. cache_dir (`str` or `os.PathLike`, *optional*): @@ -176,7 +176,7 @@ def from_pretrained(cls, pretrained_model_name_or_path, **kwargs): when running `huggingface-cli login` (stored in `~/.huggingface`). revision (`str`, *optional*, defaults to `"main"`): The specific model version to use. It can be a branch name, a tag name, or a commit id, since we use a - git-based system for storing models and other artifacts on huggingface.co, so `revision` can be any + git-based system for storing models and other artifacts on hf-mirror.com, so `revision` can be any identifier allowed by git. return_unused_kwargs (`bool`, *optional*, defaults to `False`): If `False`, then this function returns just the final feature extractor object. If `True`, then this @@ -203,7 +203,7 @@ def from_pretrained(cls, pretrained_model_name_or_path, **kwargs): ```python >>> from transformers import AutoProcessor - >>> # Download processor from huggingface.co and cache. + >>> # Download processor from hf-mirror.com and cache. >>> processor = AutoProcessor.from_pretrained("facebook/wav2vec2-base-960h") >>> # If processor files are in a directory (e.g. processor was saved using *save_pretrained('./test/saved_model/')*) diff --git a/mindnlp/transformers/models/auto/tokenization_auto.py b/mindnlp/transformers/models/auto/tokenization_auto.py index 5103d4165..480a01503 100644 --- a/mindnlp/transformers/models/auto/tokenization_auto.py +++ b/mindnlp/transformers/models/auto/tokenization_auto.py @@ -515,7 +515,7 @@ def get_tokenizer_config( This can be either: - a string, the *model id* of a pretrained model configuration hosted inside a model repo on - huggingface.co. Valid model ids can be located at the root-level, like `bert-base-uncased`, or namespaced + hf-mirror.com. Valid model ids can be located at the root-level, like `bert-base-uncased`, or namespaced under a user or organization name, like `dbmdz/bert-base-german-cased`. - a path to a *directory* containing a configuration file saved using the [`~PreTrainedTokenizer.save_pretrained`] method, e.g., `./my_model_directory/`. @@ -536,12 +536,12 @@ def get_tokenizer_config( when running `huggingface-cli login` (stored in `~/.huggingface`). revision (`str`, *optional*, defaults to `"main"`): The specific model version to use. It can be a branch name, a tag name, or a commit id, since we use a - git-based system for storing models and other artifacts on huggingface.co, so `revision` can be any + git-based system for storing models and other artifacts on hf-mirror.com, so `revision` can be any identifier allowed by git. local_files_only (`bool`, *optional*, defaults to `False`): If `True`, will only try to load the tokenizer configuration from local files. subfolder (`str`, *optional*, defaults to `""`): - In case the tokenizer config is located inside a subfolder of the model repo on huggingface.co, you can + In case the tokenizer config is located inside a subfolder of the model repo on hf-mirror.com, you can specify the folder name here. @@ -556,7 +556,7 @@ def get_tokenizer_config( Examples: ```python - # Download configuration from huggingface.co and cache. + # Download configuration from hf-mirror.com and cache. tokenizer_config = get_tokenizer_config("bert-base-uncased") # This model does not have a tokenizer config so the result will be an empty dict. tokenizer_config = get_tokenizer_config("xlm-roberta-base") @@ -623,7 +623,7 @@ def from_pretrained(cls, pretrained_model_name_or_path, *inputs, **kwargs): pretrained_model_name_or_path (`str` or `os.PathLike`): Can be either: - - A string, the *model id* of a predefined tokenizer hosted inside a model repo on huggingface.co. + - A string, the *model id* of a predefined tokenizer hosted inside a model repo on hf-mirror.com. Valid model ids can be located at the root-level, like `bert-base-uncased`, or namespaced under a user or organization name, like `dbmdz/bert-base-german-cased`. - A path to a *directory* containing vocabulary files required by the tokenizer, for instance saved @@ -649,13 +649,13 @@ def from_pretrained(cls, pretrained_model_name_or_path, *inputs, **kwargs): 'http://hostname': 'foo.bar:4012'}`. The proxies are used on each request. revision (`str`, *optional*, defaults to `"main"`): The specific model version to use. It can be a branch name, a tag name, or a commit id, since we use a - git-based system for storing models and other artifacts on huggingface.co, so `revision` can be any + git-based system for storing models and other artifacts on hf-mirror.com, so `revision` can be any identifier allowed by git. subfolder (`str`, *optional*): - In case the relevant files are located inside a subfolder of the model repo on huggingface.co (e.g. for + In case the relevant files are located inside a subfolder of the model repo on hf-mirror.com (e.g. for facebook/rag-token-base), specify it here. use_fast (`bool`, *optional*, defaults to `True`): - Use a [fast Rust-based tokenizer](https://huggingface.co/docs/tokenizers/index) if it is supported for + Use a [fast Rust-based tokenizer](https://hf-mirror.com/docs/tokenizers/index) if it is supported for a given model. If a fast tokenizer is not available for a given model, a normal Python-based tokenizer is returned instead. tokenizer_type (`str`, *optional*): @@ -674,16 +674,16 @@ def from_pretrained(cls, pretrained_model_name_or_path, *inputs, **kwargs): ```python >>> from transformers import AutoTokenizer - >>> # Download vocabulary from huggingface.co and cache. + >>> # Download vocabulary from hf-mirror.com and cache. >>> tokenizer = AutoTokenizer.from_pretrained("bert-base-uncased") - >>> # Download vocabulary from huggingface.co (user-uploaded) and cache. + >>> # Download vocabulary from hf-mirror.com (user-uploaded) and cache. >>> tokenizer = AutoTokenizer.from_pretrained("dbmdz/bert-base-german-cased") >>> # If vocabulary files are in a directory (e.g. tokenizer was saved using *save_pretrained('./test/saved_model/')*) >>> # tokenizer = AutoTokenizer.from_pretrained("./test/bert_saved_model/") - >>> # Download vocabulary from huggingface.co and define model-specific arguments + >>> # Download vocabulary from hf-mirror.com and define model-specific arguments >>> tokenizer = AutoTokenizer.from_pretrained("roberta-base", add_prefix_space=True) ```""" use_fast = kwargs.pop("use_fast", True) diff --git a/mindnlp/transformers/models/autoformer/modeling_autoformer.py b/mindnlp/transformers/models/autoformer/modeling_autoformer.py index 57a801e4a..0d2bd7e98 100644 --- a/mindnlp/transformers/models/autoformer/modeling_autoformer.py +++ b/mindnlp/transformers/models/autoformer/modeling_autoformer.py @@ -164,7 +164,7 @@ class AutoformerModelOutput(ModelOutput): AUTOFORMER_PRETRAINED_MODEL_ARCHIVE_LIST = [ "huggingface/autoformer-tourism-monthly", - # See all Autoformer models at https://huggingface.co/models?filter=autoformer + # See all Autoformer models at https://hf-mirror.com/models?filter=autoformer ] diff --git a/mindnlp/transformers/models/bark/configuration_bark.py b/mindnlp/transformers/models/bark/configuration_bark.py index 45db68044..7121dd04e 100644 --- a/mindnlp/transformers/models/bark/configuration_bark.py +++ b/mindnlp/transformers/models/bark/configuration_bark.py @@ -27,14 +27,14 @@ BARK_PRETRAINED_CONFIG_ARCHIVE_MAP = { - "suno/bark-small": "https://huggingface.co/suno/bark-small/resolve/main/config.json", - "suno/bark": "https://huggingface.co/suno/bark/resolve/main/config.json", + "suno/bark-small": "https://hf-mirror.com/suno/bark-small/resolve/main/config.json", + "suno/bark": "https://hf-mirror.com/suno/bark/resolve/main/config.json", } BARK_SUBMODELCONFIG_START_DOCSTRING = """ This is the configuration class to store the configuration of a [`{model}`]. It is used to instantiate the model according to the specified arguments, defining the model architecture. Instantiating a configuration with the - defaults will yield a similar configuration to that of the Bark [suno/bark](https://huggingface.co/suno/bark) + defaults will yield a similar configuration to that of the Bark [suno/bark](https://hf-mirror.com/suno/bark) architecture. Configuration objects inherit from [`PretrainedConfig`] and can be used to control the model outputs. Read the @@ -159,7 +159,7 @@ class BarkConfig(PretrainedConfig): model according to the specified sub-models configurations, defining the model architecture. Instantiating a configuration with the defaults will yield a similar configuration to that of the Bark - [suno/bark](https://huggingface.co/suno/bark) architecture. + [suno/bark](https://hf-mirror.com/suno/bark) architecture. Configuration objects inherit from [`PretrainedConfig`] and can be used to control the model outputs. Read the documentation from [`PretrainedConfig`] for more information. diff --git a/mindnlp/transformers/models/bark/modeling_bark.py b/mindnlp/transformers/models/bark/modeling_bark.py index f16547ff6..f3939133c 100644 --- a/mindnlp/transformers/models/bark/modeling_bark.py +++ b/mindnlp/transformers/models/bark/modeling_bark.py @@ -58,7 +58,7 @@ BARK_PRETRAINED_MODEL_ARCHIVE_LIST = [ "suno/bark-small", "suno/bark", - # See all Bark models at https://huggingface.co/models?filter=bark + # See all Bark models at https://hf-mirror.com/models?filter=bark ] diff --git a/mindnlp/transformers/models/bark/processing_bark.py b/mindnlp/transformers/models/bark/processing_bark.py index a6418e0fe..8b11cf040 100644 --- a/mindnlp/transformers/models/bark/processing_bark.py +++ b/mindnlp/transformers/models/bark/processing_bark.py @@ -73,7 +73,7 @@ def from_pretrained( This can be either: - a string, the *model id* of a pretrained [`BarkProcessor`] hosted inside a model repo on - huggingface.co. + hf-mirror.com. - a path to a *directory* containing a processor saved using the [`~BarkProcessor.save_pretrained`] method, e.g., `./my_model_directory/`. speaker_embeddings_dict_path (`str`, *optional*, defaults to `"speaker_embeddings_path.json"`): diff --git a/mindnlp/transformers/models/bart/configuration_bart.py b/mindnlp/transformers/models/bart/configuration_bart.py index 4ee766820..2163d5a16 100644 --- a/mindnlp/transformers/models/bart/configuration_bart.py +++ b/mindnlp/transformers/models/bart/configuration_bart.py @@ -24,8 +24,8 @@ logger = logging.get_logger(__name__) BART_PRETRAINED_CONFIG_ARCHIVE_MAP = { - "facebook/bart-large": "https://huggingface.co/facebook/bart-large/resolve/main/config.json", - # See all BART models at https://huggingface.co/models?filter=bart + "facebook/bart-large": "https://hf-mirror.com/facebook/bart-large/resolve/main/config.json", + # See all BART models at https://hf-mirror.com/models?filter=bart } @@ -34,7 +34,7 @@ class BartConfig(PretrainedConfig): This is the configuration class to store the configuration of a [`BartModel`]. It is used to instantiate a BART model according to the specified arguments, defining the model architecture. Instantiating a configuration with the defaults will yield a similar configuration to that of the BART - [facebook/bart-large](https://huggingface.co/facebook/bart-large) architecture. + [facebook/bart-large](https://hf-mirror.com/facebook/bart-large) architecture. Configuration objects inherit from [`PretrainedConfig`] and can be used to control the model outputs. Read the documentation from [`PretrainedConfig`] for more information. diff --git a/mindnlp/transformers/models/bart/modeling_bart.py b/mindnlp/transformers/models/bart/modeling_bart.py index f6fd04fb9..fa43289be 100644 --- a/mindnlp/transformers/models/bart/modeling_bart.py +++ b/mindnlp/transformers/models/bart/modeling_bart.py @@ -48,7 +48,7 @@ BART_PRETRAINED_MODEL_ARCHIVE_LIST = [ "facebook/bart-large", - # see all BART models at https://huggingface.co/models?filter=bart + # see all BART models at https://hf-mirror.com/models?filter=bart ] diff --git a/mindnlp/transformers/models/bart/tokenization_bart.py b/mindnlp/transformers/models/bart/tokenization_bart.py index c66a10126..49bfd5f69 100644 --- a/mindnlp/transformers/models/bart/tokenization_bart.py +++ b/mindnlp/transformers/models/bart/tokenization_bart.py @@ -30,23 +30,23 @@ VOCAB_FILES_NAMES = {"vocab_file": "vocab.json", "merges_file": "merges.txt"} -# See all BART models at https://huggingface.co/models?filter=bart +# See all BART models at https://hf-mirror.com/models?filter=bart PRETRAINED_VOCAB_FILES_MAP = { "vocab_file": { - "facebook/bart-base": "https://huggingface.co/facebook/bart-base/resolve/main/vocab.json", - "facebook/bart-large": "https://huggingface.co/facebook/bart-large/resolve/main/vocab.json", - "facebook/bart-large-mnli": "https://huggingface.co/facebook/bart-large-mnli/resolve/main/vocab.json", - "facebook/bart-large-cnn": "https://huggingface.co/facebook/bart-large-cnn/resolve/main/vocab.json", - "facebook/bart-large-xsum": "https://huggingface.co/facebook/bart-large-xsum/resolve/main/vocab.json", - "yjernite/bart_eli5": "https://huggingface.co/yjernite/bart_eli5/resolve/main/vocab.json", + "facebook/bart-base": "https://hf-mirror.com/facebook/bart-base/resolve/main/vocab.json", + "facebook/bart-large": "https://hf-mirror.com/facebook/bart-large/resolve/main/vocab.json", + "facebook/bart-large-mnli": "https://hf-mirror.com/facebook/bart-large-mnli/resolve/main/vocab.json", + "facebook/bart-large-cnn": "https://hf-mirror.com/facebook/bart-large-cnn/resolve/main/vocab.json", + "facebook/bart-large-xsum": "https://hf-mirror.com/facebook/bart-large-xsum/resolve/main/vocab.json", + "yjernite/bart_eli5": "https://hf-mirror.com/yjernite/bart_eli5/resolve/main/vocab.json", }, "merges_file": { - "facebook/bart-base": "https://huggingface.co/facebook/bart-base/resolve/main/merges.txt", - "facebook/bart-large": "https://huggingface.co/facebook/bart-large/resolve/main/merges.txt", - "facebook/bart-large-mnli": "https://huggingface.co/facebook/bart-large-mnli/resolve/main/merges.txt", - "facebook/bart-large-cnn": "https://huggingface.co/facebook/bart-large-cnn/resolve/main/merges.txt", - "facebook/bart-large-xsum": "https://huggingface.co/facebook/bart-large-xsum/resolve/main/merges.txt", - "yjernite/bart_eli5": "https://huggingface.co/yjernite/bart_eli5/resolve/main/merges.txt", + "facebook/bart-base": "https://hf-mirror.com/facebook/bart-base/resolve/main/merges.txt", + "facebook/bart-large": "https://hf-mirror.com/facebook/bart-large/resolve/main/merges.txt", + "facebook/bart-large-mnli": "https://hf-mirror.com/facebook/bart-large-mnli/resolve/main/merges.txt", + "facebook/bart-large-cnn": "https://hf-mirror.com/facebook/bart-large-cnn/resolve/main/merges.txt", + "facebook/bart-large-xsum": "https://hf-mirror.com/facebook/bart-large-xsum/resolve/main/merges.txt", + "yjernite/bart_eli5": "https://hf-mirror.com/yjernite/bart_eli5/resolve/main/merges.txt", }, } diff --git a/mindnlp/transformers/models/bart/tokenization_bart_fast.py b/mindnlp/transformers/models/bart/tokenization_bart_fast.py index e1728fd3f..7663b4dbd 100644 --- a/mindnlp/transformers/models/bart/tokenization_bart_fast.py +++ b/mindnlp/transformers/models/bart/tokenization_bart_fast.py @@ -31,31 +31,31 @@ VOCAB_FILES_NAMES = {"vocab_file": "vocab.json", "merges_file": "merges.txt", "tokenizer_file": "tokenizer.json"} -# See all BART models at https://huggingface.co/models?filter=bart +# See all BART models at https://hf-mirror.com/models?filter=bart PRETRAINED_VOCAB_FILES_MAP = { "vocab_file": { - "facebook/bart-base": "https://huggingface.co/facebook/bart-base/resolve/main/vocab.json", - "facebook/bart-large": "https://huggingface.co/facebook/bart-large/resolve/main/vocab.json", - "facebook/bart-large-mnli": "https://huggingface.co/facebook/bart-large-mnli/resolve/main/vocab.json", - "facebook/bart-large-cnn": "https://huggingface.co/facebook/bart-large-cnn/resolve/main/vocab.json", - "facebook/bart-large-xsum": "https://huggingface.co/facebook/bart-large-xsum/resolve/main/vocab.json", - "yjernite/bart_eli5": "https://huggingface.co/yjernite/bart_eli5/resolve/main/vocab.json", + "facebook/bart-base": "https://hf-mirror.com/facebook/bart-base/resolve/main/vocab.json", + "facebook/bart-large": "https://hf-mirror.com/facebook/bart-large/resolve/main/vocab.json", + "facebook/bart-large-mnli": "https://hf-mirror.com/facebook/bart-large-mnli/resolve/main/vocab.json", + "facebook/bart-large-cnn": "https://hf-mirror.com/facebook/bart-large-cnn/resolve/main/vocab.json", + "facebook/bart-large-xsum": "https://hf-mirror.com/facebook/bart-large-xsum/resolve/main/vocab.json", + "yjernite/bart_eli5": "https://hf-mirror.com/yjernite/bart_eli5/resolve/main/vocab.json", }, "merges_file": { - "facebook/bart-base": "https://huggingface.co/facebook/bart-base/resolve/main/merges.txt", - "facebook/bart-large": "https://huggingface.co/facebook/bart-large/resolve/main/merges.txt", - "facebook/bart-large-mnli": "https://huggingface.co/facebook/bart-large-mnli/resolve/main/merges.txt", - "facebook/bart-large-cnn": "https://huggingface.co/facebook/bart-large-cnn/resolve/main/merges.txt", - "facebook/bart-large-xsum": "https://huggingface.co/facebook/bart-large-xsum/resolve/main/merges.txt", - "yjernite/bart_eli5": "https://huggingface.co/yjernite/bart_eli5/resolve/main/merges.txt", + "facebook/bart-base": "https://hf-mirror.com/facebook/bart-base/resolve/main/merges.txt", + "facebook/bart-large": "https://hf-mirror.com/facebook/bart-large/resolve/main/merges.txt", + "facebook/bart-large-mnli": "https://hf-mirror.com/facebook/bart-large-mnli/resolve/main/merges.txt", + "facebook/bart-large-cnn": "https://hf-mirror.com/facebook/bart-large-cnn/resolve/main/merges.txt", + "facebook/bart-large-xsum": "https://hf-mirror.com/facebook/bart-large-xsum/resolve/main/merges.txt", + "yjernite/bart_eli5": "https://hf-mirror.com/yjernite/bart_eli5/resolve/main/merges.txt", }, "tokenizer_file": { - "facebook/bart-base": "https://huggingface.co/facebook/bart-base/resolve/main/tokenizer.json", - "facebook/bart-large": "https://huggingface.co/facebook/bart-large/resolve/main/tokenizer.json", - "facebook/bart-large-mnli": "https://huggingface.co/facebook/bart-large-mnli/resolve/main/tokenizer.json", - "facebook/bart-large-cnn": "https://huggingface.co/facebook/bart-large-cnn/resolve/main/tokenizer.json", - "facebook/bart-large-xsum": "https://huggingface.co/facebook/bart-large-xsum/resolve/main/tokenizer.json", - "yjernite/bart_eli5": "https://huggingface.co/yjernite/bart_eli5/resolve/main/tokenizer.json", + "facebook/bart-base": "https://hf-mirror.com/facebook/bart-base/resolve/main/tokenizer.json", + "facebook/bart-large": "https://hf-mirror.com/facebook/bart-large/resolve/main/tokenizer.json", + "facebook/bart-large-mnli": "https://hf-mirror.com/facebook/bart-large-mnli/resolve/main/tokenizer.json", + "facebook/bart-large-cnn": "https://hf-mirror.com/facebook/bart-large-cnn/resolve/main/tokenizer.json", + "facebook/bart-large-xsum": "https://hf-mirror.com/facebook/bart-large-xsum/resolve/main/tokenizer.json", + "yjernite/bart_eli5": "https://hf-mirror.com/yjernite/bart_eli5/resolve/main/tokenizer.json", }, } diff --git a/mindnlp/transformers/models/barthez/tokenization_barthez.py b/mindnlp/transformers/models/barthez/tokenization_barthez.py index bb5b315f1..884fc71bb 100644 --- a/mindnlp/transformers/models/barthez/tokenization_barthez.py +++ b/mindnlp/transformers/models/barthez/tokenization_barthez.py @@ -31,10 +31,10 @@ PRETRAINED_VOCAB_FILES_MAP = { "vocab_file": { - "moussaKam/mbarthez": "https://huggingface.co/moussaKam/mbarthez/resolve/main/sentencepiece.bpe.model", - "moussaKam/barthez": "https://huggingface.co/moussaKam/barthez/resolve/main/sentencepiece.bpe.model", + "moussaKam/mbarthez": "https://hf-mirror.com/moussaKam/mbarthez/resolve/main/sentencepiece.bpe.model", + "moussaKam/barthez": "https://hf-mirror.com/moussaKam/barthez/resolve/main/sentencepiece.bpe.model", "moussaKam/barthez-orangesum-title": ( - "https://huggingface.co/moussaKam/barthez-orangesum-title/resolve/main/sentencepiece.bpe.model" + "https://hf-mirror.com/moussaKam/barthez-orangesum-title/resolve/main/sentencepiece.bpe.model" ), }, } diff --git a/mindnlp/transformers/models/barthez/tokenization_barthez_fast.py b/mindnlp/transformers/models/barthez/tokenization_barthez_fast.py index 285033d9b..9a23f7f38 100644 --- a/mindnlp/transformers/models/barthez/tokenization_barthez_fast.py +++ b/mindnlp/transformers/models/barthez/tokenization_barthez_fast.py @@ -35,17 +35,17 @@ PRETRAINED_VOCAB_FILES_MAP = { "vocab_file": { - "moussaKam/mbarthez": "https://huggingface.co/moussaKam/mbarthez/resolve/main/sentencepiece.bpe.model", - "moussaKam/barthez": "https://huggingface.co/moussaKam/barthez/resolve/main/sentencepiece.bpe.model", + "moussaKam/mbarthez": "https://hf-mirror.com/moussaKam/mbarthez/resolve/main/sentencepiece.bpe.model", + "moussaKam/barthez": "https://hf-mirror.com/moussaKam/barthez/resolve/main/sentencepiece.bpe.model", "moussaKam/barthez-orangesum-title": ( - "https://huggingface.co/moussaKam/barthez-orangesum-title/resolve/main/sentencepiece.bpe.model" + "https://hf-mirror.com/moussaKam/barthez-orangesum-title/resolve/main/sentencepiece.bpe.model" ), }, "tokenizer_file": { - "moussaKam/mbarthez": "https://huggingface.co/moussaKam/mbarthez/resolve/main/tokenizer.json", - "moussaKam/barthez": "https://huggingface.co/moussaKam/barthez/resolve/main/tokenizer.json", + "moussaKam/mbarthez": "https://hf-mirror.com/moussaKam/mbarthez/resolve/main/tokenizer.json", + "moussaKam/barthez": "https://hf-mirror.com/moussaKam/barthez/resolve/main/tokenizer.json", "moussaKam/barthez-orangesum-title": ( - "https://huggingface.co/moussaKam/barthez-orangesum-title/resolve/main/tokenizer.json" + "https://hf-mirror.com/moussaKam/barthez-orangesum-title/resolve/main/tokenizer.json" ), }, } diff --git a/mindnlp/transformers/models/bartpho/tokenization_bartpho.py b/mindnlp/transformers/models/bartpho/tokenization_bartpho.py index e796e7bad..85acbe157 100644 --- a/mindnlp/transformers/models/bartpho/tokenization_bartpho.py +++ b/mindnlp/transformers/models/bartpho/tokenization_bartpho.py @@ -33,10 +33,10 @@ PRETRAINED_VOCAB_FILES_MAP = { "vocab_file": { - "vinai/bartpho-syllable": "https://huggingface.co/vinai/bartpho-syllable/resolve/main/sentencepiece.bpe.model", + "vinai/bartpho-syllable": "https://hf-mirror.com/vinai/bartpho-syllable/resolve/main/sentencepiece.bpe.model", }, "monolingual_vocab_file": { - "vinai/bartpho-syllable": "https://huggingface.co/vinai/bartpho-syllable/resolve/main/dict.txt", + "vinai/bartpho-syllable": "https://hf-mirror.com/vinai/bartpho-syllable/resolve/main/dict.txt", }, } diff --git a/mindnlp/transformers/models/beit/configuration_beit.py b/mindnlp/transformers/models/beit/configuration_beit.py index 987b5fb44..758456f94 100644 --- a/mindnlp/transformers/models/beit/configuration_beit.py +++ b/mindnlp/transformers/models/beit/configuration_beit.py @@ -23,9 +23,9 @@ BEIT_PRETRAINED_CONFIG_ARCHIVE_MAP = { "microsoft/beit-base-patch16-224-pt22k": ( - "https://huggingface.co/microsoft/beit-base-patch16-224-pt22k/resolve/main/config.json" + "https://hf-mirror.com/microsoft/beit-base-patch16-224-pt22k/resolve/main/config.json" ), - # See all BEiT models at https://huggingface.co/models?filter=beit + # See all BEiT models at https://hf-mirror.com/models?filter=beit } @@ -34,7 +34,7 @@ class BeitConfig(BackboneConfigMixin, PretrainedConfig): This is the configuration class to store the configuration of a [`BeitModel`]. It is used to instantiate an BEiT model according to the specified arguments, defining the model architecture. Instantiating a configuration with the defaults will yield a similar configuration to that of the BEiT - [microsoft/beit-base-patch16-224-pt22k](https://huggingface.co/microsoft/beit-base-patch16-224-pt22k) architecture. + [microsoft/beit-base-patch16-224-pt22k](https://hf-mirror.com/microsoft/beit-base-patch16-224-pt22k) architecture. Args: vocab_size (`int`, *optional*, defaults to 8192): diff --git a/mindnlp/transformers/models/beit/modeling_beit.py b/mindnlp/transformers/models/beit/modeling_beit.py index 10eaf1614..9472f81b7 100644 --- a/mindnlp/transformers/models/beit/modeling_beit.py +++ b/mindnlp/transformers/models/beit/modeling_beit.py @@ -57,7 +57,7 @@ BEIT_PRETRAINED_MODEL_ARCHIVE_LIST = [ "microsoft/beit-base-patch16-224", - # See all BEiT models at https://huggingface.co/models?filter=beit + # See all BEiT models at https://hf-mirror.com/models?filter=beit ] diff --git a/mindnlp/transformers/models/bert/tokenization_bert_fast.py b/mindnlp/transformers/models/bert/tokenization_bert_fast.py index b48ca88c9..3e5ff286b 100644 --- a/mindnlp/transformers/models/bert/tokenization_bert_fast.py +++ b/mindnlp/transformers/models/bert/tokenization_bert_fast.py @@ -30,87 +30,87 @@ PRETRAINED_VOCAB_FILES_MAP = { "vocab_file": { - "bert-base-uncased": "https://huggingface.co/bert-base-uncased/resolve/main/vocab.txt", - "bert-large-uncased": "https://huggingface.co/bert-large-uncased/resolve/main/vocab.txt", - "bert-base-cased": "https://huggingface.co/bert-base-cased/resolve/main/vocab.txt", - "bert-large-cased": "https://huggingface.co/bert-large-cased/resolve/main/vocab.txt", + "bert-base-uncased": "https://hf-mirror.com/bert-base-uncased/resolve/main/vocab.txt", + "bert-large-uncased": "https://hf-mirror.com/bert-large-uncased/resolve/main/vocab.txt", + "bert-base-cased": "https://hf-mirror.com/bert-base-cased/resolve/main/vocab.txt", + "bert-large-cased": "https://hf-mirror.com/bert-large-cased/resolve/main/vocab.txt", "bert-base-multilingual-uncased": ( - "https://huggingface.co/bert-base-multilingual-uncased/resolve/main/vocab.txt" + "https://hf-mirror.com/bert-base-multilingual-uncased/resolve/main/vocab.txt" ), - "bert-base-multilingual-cased": "https://huggingface.co/bert-base-multilingual-cased/resolve/main/vocab.txt", - "bert-base-chinese": "https://huggingface.co/bert-base-chinese/resolve/main/vocab.txt", - "bert-base-german-cased": "https://huggingface.co/bert-base-german-cased/resolve/main/vocab.txt", + "bert-base-multilingual-cased": "https://hf-mirror.com/bert-base-multilingual-cased/resolve/main/vocab.txt", + "bert-base-chinese": "https://hf-mirror.com/bert-base-chinese/resolve/main/vocab.txt", + "bert-base-german-cased": "https://hf-mirror.com/bert-base-german-cased/resolve/main/vocab.txt", "bert-large-uncased-whole-word-masking": ( - "https://huggingface.co/bert-large-uncased-whole-word-masking/resolve/main/vocab.txt" + "https://hf-mirror.com/bert-large-uncased-whole-word-masking/resolve/main/vocab.txt" ), "bert-large-cased-whole-word-masking": ( - "https://huggingface.co/bert-large-cased-whole-word-masking/resolve/main/vocab.txt" + "https://hf-mirror.com/bert-large-cased-whole-word-masking/resolve/main/vocab.txt" ), "bert-large-uncased-whole-word-masking-finetuned-squad": ( - "https://huggingface.co/bert-large-uncased-whole-word-masking-finetuned-squad/resolve/main/vocab.txt" + "https://hf-mirror.com/bert-large-uncased-whole-word-masking-finetuned-squad/resolve/main/vocab.txt" ), "bert-large-cased-whole-word-masking-finetuned-squad": ( - "https://huggingface.co/bert-large-cased-whole-word-masking-finetuned-squad/resolve/main/vocab.txt" + "https://hf-mirror.com/bert-large-cased-whole-word-masking-finetuned-squad/resolve/main/vocab.txt" ), "bert-base-cased-finetuned-mrpc": ( - "https://huggingface.co/bert-base-cased-finetuned-mrpc/resolve/main/vocab.txt" + "https://hf-mirror.com/bert-base-cased-finetuned-mrpc/resolve/main/vocab.txt" ), - "bert-base-german-dbmdz-cased": "https://huggingface.co/bert-base-german-dbmdz-cased/resolve/main/vocab.txt", + "bert-base-german-dbmdz-cased": "https://hf-mirror.com/bert-base-german-dbmdz-cased/resolve/main/vocab.txt", "bert-base-german-dbmdz-uncased": ( - "https://huggingface.co/bert-base-german-dbmdz-uncased/resolve/main/vocab.txt" + "https://hf-mirror.com/bert-base-german-dbmdz-uncased/resolve/main/vocab.txt" ), "TurkuNLP/bert-base-finnish-cased-v1": ( - "https://huggingface.co/TurkuNLP/bert-base-finnish-cased-v1/resolve/main/vocab.txt" + "https://hf-mirror.com/TurkuNLP/bert-base-finnish-cased-v1/resolve/main/vocab.txt" ), "TurkuNLP/bert-base-finnish-uncased-v1": ( - "https://huggingface.co/TurkuNLP/bert-base-finnish-uncased-v1/resolve/main/vocab.txt" + "https://hf-mirror.com/TurkuNLP/bert-base-finnish-uncased-v1/resolve/main/vocab.txt" ), "wietsedv/bert-base-dutch-cased": ( - "https://huggingface.co/wietsedv/bert-base-dutch-cased/resolve/main/vocab.txt" + "https://hf-mirror.com/wietsedv/bert-base-dutch-cased/resolve/main/vocab.txt" ), }, "tokenizer_file": { - "bert-base-uncased": "https://huggingface.co/bert-base-uncased/resolve/main/tokenizer.json", - "bert-large-uncased": "https://huggingface.co/bert-large-uncased/resolve/main/tokenizer.json", - "bert-base-cased": "https://huggingface.co/bert-base-cased/resolve/main/tokenizer.json", - "bert-large-cased": "https://huggingface.co/bert-large-cased/resolve/main/tokenizer.json", + "bert-base-uncased": "https://hf-mirror.com/bert-base-uncased/resolve/main/tokenizer.json", + "bert-large-uncased": "https://hf-mirror.com/bert-large-uncased/resolve/main/tokenizer.json", + "bert-base-cased": "https://hf-mirror.com/bert-base-cased/resolve/main/tokenizer.json", + "bert-large-cased": "https://hf-mirror.com/bert-large-cased/resolve/main/tokenizer.json", "bert-base-multilingual-uncased": ( - "https://huggingface.co/bert-base-multilingual-uncased/resolve/main/tokenizer.json" + "https://hf-mirror.com/bert-base-multilingual-uncased/resolve/main/tokenizer.json" ), "bert-base-multilingual-cased": ( - "https://huggingface.co/bert-base-multilingual-cased/resolve/main/tokenizer.json" + "https://hf-mirror.com/bert-base-multilingual-cased/resolve/main/tokenizer.json" ), - "bert-base-chinese": "https://huggingface.co/bert-base-chinese/resolve/main/tokenizer.json", - "bert-base-german-cased": "https://huggingface.co/bert-base-german-cased/resolve/main/tokenizer.json", + "bert-base-chinese": "https://hf-mirror.com/bert-base-chinese/resolve/main/tokenizer.json", + "bert-base-german-cased": "https://hf-mirror.com/bert-base-german-cased/resolve/main/tokenizer.json", "bert-large-uncased-whole-word-masking": ( - "https://huggingface.co/bert-large-uncased-whole-word-masking/resolve/main/tokenizer.json" + "https://hf-mirror.com/bert-large-uncased-whole-word-masking/resolve/main/tokenizer.json" ), "bert-large-cased-whole-word-masking": ( - "https://huggingface.co/bert-large-cased-whole-word-masking/resolve/main/tokenizer.json" + "https://hf-mirror.com/bert-large-cased-whole-word-masking/resolve/main/tokenizer.json" ), "bert-large-uncased-whole-word-masking-finetuned-squad": ( - "https://huggingface.co/bert-large-uncased-whole-word-masking-finetuned-squad/resolve/main/tokenizer.json" + "https://hf-mirror.com/bert-large-uncased-whole-word-masking-finetuned-squad/resolve/main/tokenizer.json" ), "bert-large-cased-whole-word-masking-finetuned-squad": ( - "https://huggingface.co/bert-large-cased-whole-word-masking-finetuned-squad/resolve/main/tokenizer.json" + "https://hf-mirror.com/bert-large-cased-whole-word-masking-finetuned-squad/resolve/main/tokenizer.json" ), "bert-base-cased-finetuned-mrpc": ( - "https://huggingface.co/bert-base-cased-finetuned-mrpc/resolve/main/tokenizer.json" + "https://hf-mirror.com/bert-base-cased-finetuned-mrpc/resolve/main/tokenizer.json" ), "bert-base-german-dbmdz-cased": ( - "https://huggingface.co/bert-base-german-dbmdz-cased/resolve/main/tokenizer.json" + "https://hf-mirror.com/bert-base-german-dbmdz-cased/resolve/main/tokenizer.json" ), "bert-base-german-dbmdz-uncased": ( - "https://huggingface.co/bert-base-german-dbmdz-uncased/resolve/main/tokenizer.json" + "https://hf-mirror.com/bert-base-german-dbmdz-uncased/resolve/main/tokenizer.json" ), "TurkuNLP/bert-base-finnish-cased-v1": ( - "https://huggingface.co/TurkuNLP/bert-base-finnish-cased-v1/resolve/main/tokenizer.json" + "https://hf-mirror.com/TurkuNLP/bert-base-finnish-cased-v1/resolve/main/tokenizer.json" ), "TurkuNLP/bert-base-finnish-uncased-v1": ( - "https://huggingface.co/TurkuNLP/bert-base-finnish-uncased-v1/resolve/main/tokenizer.json" + "https://hf-mirror.com/TurkuNLP/bert-base-finnish-uncased-v1/resolve/main/tokenizer.json" ), "wietsedv/bert-base-dutch-cased": ( - "https://huggingface.co/wietsedv/bert-base-dutch-cased/resolve/main/tokenizer.json" + "https://hf-mirror.com/wietsedv/bert-base-dutch-cased/resolve/main/tokenizer.json" ), }, } diff --git a/mindnlp/transformers/models/bert_generation/configuration_bert_generation.py b/mindnlp/transformers/models/bert_generation/configuration_bert_generation.py index ed91d8188..1b0b5a5ac 100644 --- a/mindnlp/transformers/models/bert_generation/configuration_bert_generation.py +++ b/mindnlp/transformers/models/bert_generation/configuration_bert_generation.py @@ -22,7 +22,7 @@ class BertGenerationConfig(PretrainedConfig): This is the configuration class to store the configuration of a [`BertGenerationPreTrainedModel`]. It is used to instantiate a BertGeneration model according to the specified arguments, defining the model architecture. Instantiating a configuration with the defaults will yield a similar configuration to that of the BertGeneration - [google/bert_for_seq_generation_L-24_bbc_encoder](https://huggingface.co/google/bert_for_seq_generation_L-24_bbc_encoder) + [google/bert_for_seq_generation_L-24_bbc_encoder](https://hf-mirror.com/google/bert_for_seq_generation_L-24_bbc_encoder) architecture. Configuration objects inherit from [`PretrainedConfig`] and can be used to control the model outputs. Read the diff --git a/mindnlp/transformers/models/big_bird/configuration_big_bird.py b/mindnlp/transformers/models/big_bird/configuration_big_bird.py index 657fe0894..ebca3edd3 100644 --- a/mindnlp/transformers/models/big_bird/configuration_big_bird.py +++ b/mindnlp/transformers/models/big_bird/configuration_big_bird.py @@ -20,10 +20,10 @@ logger = logging.get_logger(__name__) BIG_BIRD_PRETRAINED_CONFIG_ARCHIVE_MAP = { - "google/bigbird-roberta-base": "https://huggingface.co/google/bigbird-roberta-base/resolve/main/config.json", - "google/bigbird-roberta-large": "https://huggingface.co/google/bigbird-roberta-large/resolve/main/config.json", - "google/bigbird-base-trivia-itc": "https://huggingface.co/google/bigbird-base-trivia-itc/resolve/main/config.json", - # See all BigBird models at https://huggingface.co/models?filter=big_bird + "google/bigbird-roberta-base": "https://hf-mirror.com/google/bigbird-roberta-base/resolve/main/config.json", + "google/bigbird-roberta-large": "https://hf-mirror.com/google/bigbird-roberta-large/resolve/main/config.json", + "google/bigbird-base-trivia-itc": "https://hf-mirror.com/google/bigbird-base-trivia-itc/resolve/main/config.json", + # See all BigBird models at https://hf-mirror.com/models?filter=big_bird } @@ -32,7 +32,7 @@ class BigBirdConfig(PretrainedConfig): This is the configuration class to store the configuration of a [`BigBirdModel`]. It is used to instantiate an BigBird model according to the specified arguments, defining the model architecture. Instantiating a configuration with the defaults will yield a similar configuration to that of the BigBird - [google/bigbird-roberta-base](https://huggingface.co/google/bigbird-roberta-base) architecture. + [google/bigbird-roberta-base](https://hf-mirror.com/google/bigbird-roberta-base) architecture. Configuration objects inherit from [`PretrainedConfig`] and can be used to control the model outputs. Read the documentation from [`PretrainedConfig`] for more information. diff --git a/mindnlp/transformers/models/big_bird/modeling_big_bird.py b/mindnlp/transformers/models/big_bird/modeling_big_bird.py index 41940a4f4..dfe3e2cca 100644 --- a/mindnlp/transformers/models/big_bird/modeling_big_bird.py +++ b/mindnlp/transformers/models/big_bird/modeling_big_bird.py @@ -51,7 +51,7 @@ "google/bigbird-roberta-base", "google/bigbird-roberta-large", "google/bigbird-base-trivia-itc", - # See all BigBird models at https://huggingface.co/models?filter=big_bird + # See all BigBird models at https://hf-mirror.com/models?filter=big_bird ] diff --git a/mindnlp/transformers/models/big_bird/tokenization_big_bird.py b/mindnlp/transformers/models/big_bird/tokenization_big_bird.py index db69c82f7..bb23ba0f1 100644 --- a/mindnlp/transformers/models/big_bird/tokenization_big_bird.py +++ b/mindnlp/transformers/models/big_bird/tokenization_big_bird.py @@ -30,12 +30,12 @@ PRETRAINED_VOCAB_FILES_MAP = { "vocab_file": { - "google/bigbird-roberta-base": "https://huggingface.co/google/bigbird-roberta-base/resolve/main/spiece.model", + "google/bigbird-roberta-base": "https://hf-mirror.com/google/bigbird-roberta-base/resolve/main/spiece.model", "google/bigbird-roberta-large": ( - "https://huggingface.co/google/bigbird-roberta-large/resolve/main/spiece.model" + "https://hf-mirror.com/google/bigbird-roberta-large/resolve/main/spiece.model" ), "google/bigbird-base-trivia-itc": ( - "https://huggingface.co/google/bigbird-base-trivia-itc/resolve/main/spiece.model" + "https://hf-mirror.com/google/bigbird-base-trivia-itc/resolve/main/spiece.model" ), } } diff --git a/mindnlp/transformers/models/big_bird/tokenization_big_bird_fast.py b/mindnlp/transformers/models/big_bird/tokenization_big_bird_fast.py index e1997d1f9..460d97b8d 100644 --- a/mindnlp/transformers/models/big_bird/tokenization_big_bird_fast.py +++ b/mindnlp/transformers/models/big_bird/tokenization_big_bird_fast.py @@ -32,23 +32,23 @@ PRETRAINED_VOCAB_FILES_MAP = { "vocab_file": { - "google/bigbird-roberta-base": "https://huggingface.co/google/bigbird-roberta-base/resolve/main/spiece.model", + "google/bigbird-roberta-base": "https://hf-mirror.com/google/bigbird-roberta-base/resolve/main/spiece.model", "google/bigbird-roberta-large": ( - "https://huggingface.co/google/bigbird-roberta-large/resolve/main/spiece.model" + "https://hf-mirror.com/google/bigbird-roberta-large/resolve/main/spiece.model" ), "google/bigbird-base-trivia-itc": ( - "https://huggingface.co/google/bigbird-base-trivia-itc/resolve/main/spiece.model" + "https://hf-mirror.com/google/bigbird-base-trivia-itc/resolve/main/spiece.model" ), }, "tokenizer_file": { "google/bigbird-roberta-base": ( - "https://huggingface.co/google/bigbird-roberta-base/resolve/main/tokenizer.json" + "https://hf-mirror.com/google/bigbird-roberta-base/resolve/main/tokenizer.json" ), "google/bigbird-roberta-large": ( - "https://huggingface.co/google/bigbird-roberta-large/resolve/main/tokenizer.json" + "https://hf-mirror.com/google/bigbird-roberta-large/resolve/main/tokenizer.json" ), "google/bigbird-base-trivia-itc": ( - "https://huggingface.co/google/bigbird-base-trivia-itc/resolve/main/tokenizer.json" + "https://hf-mirror.com/google/bigbird-base-trivia-itc/resolve/main/tokenizer.json" ), }, } @@ -66,7 +66,7 @@ class BigBirdTokenizerFast(PreTrainedTokenizerFast): """ Construct a "fast" BigBird tokenizer (backed by HuggingFace's *tokenizers* library). Based on - [Unigram](https://huggingface.co/docs/tokenizers/python/latest/components.html?highlight=unigram#models). This + [Unigram](https://hf-mirror.com/docs/tokenizers/python/latest/components.html?highlight=unigram#models). This tokenizer inherits from [`PreTrainedTokenizerFast`] which contains most of the main methods. Users should refer to this superclass for more information regarding those methods diff --git a/mindnlp/transformers/models/bigbird_pegasus/configuration_bigbird_pegasus.py b/mindnlp/transformers/models/bigbird_pegasus/configuration_bigbird_pegasus.py index 895c459f9..9bcbcdae2 100644 --- a/mindnlp/transformers/models/bigbird_pegasus/configuration_bigbird_pegasus.py +++ b/mindnlp/transformers/models/bigbird_pegasus/configuration_bigbird_pegasus.py @@ -25,7 +25,7 @@ class BigBirdPegasusConfig(PretrainedConfig): This is the configuration class to store the configuration of a [`BigBirdPegasusModel`]. It is used to instantiate an BigBirdPegasus model according to the specified arguments, defining the model architecture. Instantiating a configuration with the defaults will yield a similar configuration to that of the BigBirdPegasus - [google/bigbird-pegasus-large-arxiv](https://huggingface.co/google/bigbird-pegasus-large-arxiv) architecture. + [google/bigbird-pegasus-large-arxiv](https://hf-mirror.com/google/bigbird-pegasus-large-arxiv) architecture. Configuration objects inherit from [`PretrainedConfig`] and can be used to control the model outputs. Read the documentation from [`PretrainedConfig`] for more information. diff --git a/mindnlp/transformers/models/biogpt/configuration_biogpt.py b/mindnlp/transformers/models/biogpt/configuration_biogpt.py index 212ee0965..42dbbf7d1 100644 --- a/mindnlp/transformers/models/biogpt/configuration_biogpt.py +++ b/mindnlp/transformers/models/biogpt/configuration_biogpt.py @@ -22,8 +22,8 @@ logger = logging.get_logger(__name__) BIOGPT_PRETRAINED_CONFIG_ARCHIVE_MAP = { - "microsoft/biogpt": "https://huggingface.co/microsoft/biogpt/resolve/main/config.json", - # See all BioGPT models at https://huggingface.co/models?filter=biogpt + "microsoft/biogpt": "https://hf-mirror.com/microsoft/biogpt/resolve/main/config.json", + # See all BioGPT models at https://hf-mirror.com/models?filter=biogpt } @@ -32,7 +32,7 @@ class BioGptConfig(PretrainedConfig): This is the configuration class to store the configuration of a [`BioGptModel`]. It is used to instantiate an BioGPT model according to the specified arguments, defining the model architecture. Instantiating a configuration with the defaults will yield a similar configuration to that of the BioGPT - [microsoft/biogpt](https://huggingface.co/microsoft/biogpt) architecture. + [microsoft/biogpt](https://hf-mirror.com/microsoft/biogpt) architecture. Configuration objects inherit from [`PretrainedConfig`] and can be used to control the model outputs. Read the documentation from [`PretrainedConfig`] for more information. diff --git a/mindnlp/transformers/models/biogpt/modeling_biogpt.py b/mindnlp/transformers/models/biogpt/modeling_biogpt.py index 62df1e93a..e35c27a69 100644 --- a/mindnlp/transformers/models/biogpt/modeling_biogpt.py +++ b/mindnlp/transformers/models/biogpt/modeling_biogpt.py @@ -45,7 +45,7 @@ BIOGPT_PRETRAINED_MODEL_ARCHIVE_LIST = [ "microsoft/biogpt", "microsoft/BioGPT-Large", - # See all BioGPT models at https://huggingface.co/models?filter=biogpt + # See all BioGPT models at https://hf-mirror.com/models?filter=biogpt ] diff --git a/mindnlp/transformers/models/biogpt/tokenization_biogpt.py b/mindnlp/transformers/models/biogpt/tokenization_biogpt.py index a15ae0e69..35325e8e7 100644 --- a/mindnlp/transformers/models/biogpt/tokenization_biogpt.py +++ b/mindnlp/transformers/models/biogpt/tokenization_biogpt.py @@ -31,9 +31,9 @@ PRETRAINED_VOCAB_FILES_MAP = { "vocab_file": { - "microsoft/biogpt": "https://huggingface.co/microsoft/biogpt/resolve/main/vocab.json", + "microsoft/biogpt": "https://hf-mirror.com/microsoft/biogpt/resolve/main/vocab.json", }, - "merges_file": {"microsoft/biogpt": "https://huggingface.co/microsoft/biogpt/resolve/main/merges.txt"}, + "merges_file": {"microsoft/biogpt": "https://hf-mirror.com/microsoft/biogpt/resolve/main/merges.txt"}, } PRETRAINED_POSITIONAL_EMBEDDINGS_SIZES = { diff --git a/mindnlp/transformers/models/bloom/configuration_bloom.py b/mindnlp/transformers/models/bloom/configuration_bloom.py index b8cce787f..16cf0da28 100644 --- a/mindnlp/transformers/models/bloom/configuration_bloom.py +++ b/mindnlp/transformers/models/bloom/configuration_bloom.py @@ -23,12 +23,12 @@ logger = logging.get_logger(__name__) BLOOM_PRETRAINED_CONFIG_ARCHIVE_MAP = { - "bigscience/bloom": "https://huggingface.co/bigscience/bloom/resolve/main/config.json", - "bigscience/bloom-560m": "https://huggingface.co/bigscience/bloom-560m/blob/main/config.json", - "bigscience/bloom-1b1": "https://huggingface.co/bigscience/bloom-1b1/blob/main/config.json", - "bigscience/bloom-1b7": "https://huggingface.co/bigscience/bloom-1b7/blob/main/config.json", - "bigscience/bloom-3b": "https://huggingface.co/bigscience/bloom-3b/blob/main/config.json", - "bigscience/bloom-7b1": "https://huggingface.co/bigscience/bloom-7b1/blob/main/config.json", + "bigscience/bloom": "https://hf-mirror.com/bigscience/bloom/resolve/main/config.json", + "bigscience/bloom-560m": "https://hf-mirror.com/bigscience/bloom-560m/blob/main/config.json", + "bigscience/bloom-1b1": "https://hf-mirror.com/bigscience/bloom-1b1/blob/main/config.json", + "bigscience/bloom-1b7": "https://hf-mirror.com/bigscience/bloom-1b7/blob/main/config.json", + "bigscience/bloom-3b": "https://hf-mirror.com/bigscience/bloom-3b/blob/main/config.json", + "bigscience/bloom-7b1": "https://hf-mirror.com/bigscience/bloom-7b1/blob/main/config.json", } @@ -37,7 +37,7 @@ class BloomConfig(PretrainedConfig): This is the configuration class to store the configuration of a [`BloomModel`]. It is used to instantiate a Bloom model according to the specified arguments, defining the model architecture. Instantiating a configuration with the defaults will yield a similar configuration to the Bloom architecture - [bigscience/bloom](https://huggingface.co/bigscience/bloom). + [bigscience/bloom](https://hf-mirror.com/bigscience/bloom). Configuration objects inherit from [`PretrainedConfig`] and can be used to control the model outputs. Read the documentation from [`PretrainedConfig`] for more information. @@ -47,7 +47,7 @@ class BloomConfig(PretrainedConfig): vocab_size (`int`, *optional*, defaults to 250880): Vocabulary size of the Bloom model. Defines the maximum number of different tokens that can be represented by the `inputs_ids` passed when calling [`BloomModel`]. Check [this - discussion](https://huggingface.co/bigscience/bloom/discussions/120#633d28389addb8530b406c2a) on how the + discussion](https://hf-mirror.com/bigscience/bloom/discussions/120#633d28389addb8530b406c2a) on how the `vocab_size` has been defined. hidden_size (`int`, *optional*, defaults to 64): Dimensionality of the embeddings and hidden states. @@ -69,7 +69,7 @@ class BloomConfig(PretrainedConfig): Whether or not the model should return the last key/values attentions (not used by all models). pretraining_tp (`int`, *optional*, defaults to `1`): Experimental feature. Tensor parallelism rank used during pretraining with Megatron. Please refer to [this - document](https://huggingface.co/docs/transformers/parallelism) to understand more about it. This value is + document](https://hf-mirror.com/docs/transformers/parallelism) to understand more about it. This value is necessary to ensure exact reproducibility of the pretraining results. Please refer to [this issue](https://github.com/pytorch/pytorch/issues/76232). Note also that this is enabled only when `slow_but_exact=True`. diff --git a/mindnlp/transformers/models/bloom/tokenization_bloom_fast.py b/mindnlp/transformers/models/bloom/tokenization_bloom_fast.py index 3cbe0e4af..e6f9ccbd3 100644 --- a/mindnlp/transformers/models/bloom/tokenization_bloom_fast.py +++ b/mindnlp/transformers/models/bloom/tokenization_bloom_fast.py @@ -31,13 +31,13 @@ PRETRAINED_VOCAB_FILES_MAP = { "tokenizer_file": { - "bigscience/tokenizer": "https://huggingface.co/bigscience/tokenizer/blob/main/tokenizer.json", - "bigscience/bloom-560m": "https://huggingface.co/bigscience/bloom-560m/blob/main/tokenizer.json", - "bigscience/bloom-1b1": "https://huggingface.co/bigscience/bloom-1b1/blob/main/tokenizer.json", - "bigscience/bloom-1b7": "https://huggingface.co/bigscience/bloom-1b7/blob/main/tokenizer.json", - "bigscience/bloom-3b": "https://huggingface.co/bigscience/bloom-3b/blob/main/tokenizer.json", - "bigscience/bloom-7b1": "https://huggingface.co/bigscience/bloom-7b1/blob/main/tokenizer.json", - "bigscience/bloom": "https://huggingface.co/bigscience/bloom/blob/main/tokenizer.json", + "bigscience/tokenizer": "https://hf-mirror.com/bigscience/tokenizer/blob/main/tokenizer.json", + "bigscience/bloom-560m": "https://hf-mirror.com/bigscience/bloom-560m/blob/main/tokenizer.json", + "bigscience/bloom-1b1": "https://hf-mirror.com/bigscience/bloom-1b1/blob/main/tokenizer.json", + "bigscience/bloom-1b7": "https://hf-mirror.com/bigscience/bloom-1b7/blob/main/tokenizer.json", + "bigscience/bloom-3b": "https://hf-mirror.com/bigscience/bloom-3b/blob/main/tokenizer.json", + "bigscience/bloom-7b1": "https://hf-mirror.com/bigscience/bloom-7b1/blob/main/tokenizer.json", + "bigscience/bloom": "https://hf-mirror.com/bigscience/bloom/blob/main/tokenizer.json", }, } @@ -174,7 +174,7 @@ def default_chat_template(self): "\nNo chat template is defined for this tokenizer - using the default template " f"for the {self.__class__.__name__} class. If the default is not appropriate for " "your model, please set `tokenizer.chat_template` to an appropriate template. " - "See https://huggingface.co/docs/transformers/main/chat_templating for more information.\n" + "See https://hf-mirror.com/docs/transformers/main/chat_templating for more information.\n" ) return "{% for message in messages %}" "{{ message.content }}{{ eos_token }}" "{% endfor %}" diff --git a/mindnlp/transformers/models/chatglm/configuration_chatglm.py b/mindnlp/transformers/models/chatglm/configuration_chatglm.py index eff1e341c..6ecf6b7fe 100644 --- a/mindnlp/transformers/models/chatglm/configuration_chatglm.py +++ b/mindnlp/transformers/models/chatglm/configuration_chatglm.py @@ -25,7 +25,7 @@ class ChatGLMConfig(PretrainedConfig): This is the configuration class to store the configuration of a [`~ChatGLMModel`]. It is used to instantiate an ChatGLM model according to the specified arguments, defining the model architecture. Instantiating a configuration with the defaults will yield a similar configuration to that of - the ChatGLM-6B [THUDM/ChatGLM-6B](https://huggingface.co/THUDM/chatglm-6b) architecture. + the ChatGLM-6B [THUDM/ChatGLM-6B](https://hf-mirror.com/THUDM/chatglm-6b) architecture. Configuration objects inherit from [`PretrainedConfig`] and can be used to control the model outputs. Read the documentation from [`PretrainedConfig`] diff --git a/mindnlp/transformers/models/chatglm/modeling_chatglm.py b/mindnlp/transformers/models/chatglm/modeling_chatglm.py index 213281eda..d81c3554a 100644 --- a/mindnlp/transformers/models/chatglm/modeling_chatglm.py +++ b/mindnlp/transformers/models/chatglm/modeling_chatglm.py @@ -39,7 +39,7 @@ CHATGLM_6B_PRETRAINED_MODEL_ARCHIVE_LIST = [ "THUDM/chatglm-6b", - # See all ChatGLM-6B models at https://huggingface.co/models?filter=chatglm + # See all ChatGLM-6B models at https://hf-mirror.com/models?filter=chatglm ] @@ -1106,7 +1106,7 @@ def stream_generate( f"Both `max_new_tokens` (={generation_config.max_new_tokens}) and `max_length`(=" f"{generation_config.max_length}) seem to have been set. `max_new_tokens` will take precedence. " "Please refer to the documentation for more information. " - "(https://huggingface.co/docs/transformers/main/en/main_classes/text_generation)", + "(https://hf-mirror.com/docs/transformers/main/en/main_classes/text_generation)", UserWarning, ) diff --git a/mindnlp/transformers/models/chatglm/modeling_graph_chatglm.py b/mindnlp/transformers/models/chatglm/modeling_graph_chatglm.py index 49f37c38a..fbac72d92 100644 --- a/mindnlp/transformers/models/chatglm/modeling_graph_chatglm.py +++ b/mindnlp/transformers/models/chatglm/modeling_graph_chatglm.py @@ -1050,7 +1050,7 @@ def stream_generate( f"Both `max_new_tokens` (={generation_config.max_new_tokens}) and `max_length`(=" f"{generation_config.max_length}) seem to have been set. `max_new_tokens` will take precedence. " "Please refer to the documentation for more information. " - "(https://huggingface.co/docs/transformers/main/en/main_classes/text_generation)", + "(https://hf-mirror.com/docs/transformers/main/en/main_classes/text_generation)", UserWarning, ) diff --git a/mindnlp/transformers/models/chatglm2/modeling_chatglm2.py b/mindnlp/transformers/models/chatglm2/modeling_chatglm2.py index affc1d708..1e3056499 100644 --- a/mindnlp/transformers/models/chatglm2/modeling_chatglm2.py +++ b/mindnlp/transformers/models/chatglm2/modeling_chatglm2.py @@ -39,7 +39,7 @@ CHATGLM2_6B_PRETRAINED_MODEL_ARCHIVE_LIST = [ "THUDM/chatglm2-6b", - # See all ChatGLM models at https://huggingface.co/models?filter=chatglm + # See all ChatGLM models at https://hf-mirror.com/models?filter=chatglm ] @@ -1048,7 +1048,7 @@ def stream_generate( f"Both `max_new_tokens` (={generation_config.max_new_tokens}) and `max_length`(=" f"{generation_config.max_length}) seem to have been set. `max_new_tokens` will take precedence. " "Please refer to the documentation for more information. " - "(https://huggingface.co/docs/transformers/main/en/main_classes/text_generation)", + "(https://hf-mirror.com/docs/transformers/main/en/main_classes/text_generation)", UserWarning, ) diff --git a/mindnlp/transformers/models/chatglm3/modeling_chatglm3.py b/mindnlp/transformers/models/chatglm3/modeling_chatglm3.py index d4d1f1d46..95b804fd3 100644 --- a/mindnlp/transformers/models/chatglm3/modeling_chatglm3.py +++ b/mindnlp/transformers/models/chatglm3/modeling_chatglm3.py @@ -30,7 +30,7 @@ CHATGLM3_6B_PRETRAINED_MODEL_ARCHIVE_LIST = [ "THUDM/chatglm3-6b", - # See all ChatGLM models at https://huggingface.co/models?filter=chatglm + # See all ChatGLM models at https://hf-mirror.com/models?filter=chatglm ] @@ -161,7 +161,7 @@ def stream_generate( f"Both `max_new_tokens` (={generation_config.max_new_tokens}) and `max_length`(=" f"{generation_config.max_length}) seem to have been set. `max_new_tokens` will take precedence. " "Please refer to the documentation for more information. " - "(https://huggingface.co/docs/transformers/main/en/main_classes/text_generation)", + "(https://hf-mirror.com/docs/transformers/main/en/main_classes/text_generation)", UserWarning, ) diff --git a/mindnlp/transformers/models/clip/configuration_clip.py b/mindnlp/transformers/models/clip/configuration_clip.py index bd7dedd0e..f24413f12 100644 --- a/mindnlp/transformers/models/clip/configuration_clip.py +++ b/mindnlp/transformers/models/clip/configuration_clip.py @@ -25,8 +25,8 @@ logger = logging.get_logger(__name__) CLIP_PRETRAINED_CONFIG_ARCHIVE_MAP = { - "openai/clip-vit-base-patch32": "https://huggingface.co/openai/clip-vit-base-patch32/resolve/main/config.json", - # See all CLIP models at https://huggingface.co/models?filter=clip + "openai/clip-vit-base-patch32": "https://hf-mirror.com/openai/clip-vit-base-patch32/resolve/main/config.json", + # See all CLIP models at https://hf-mirror.com/models?filter=clip } @@ -35,7 +35,7 @@ class CLIPTextConfig(PretrainedConfig): This is the configuration class to store the configuration of a [`CLIPTextModel`]. It is used to instantiate a CLIP text encoder according to the specified arguments, defining the model architecture. Instantiating a configuration with the defaults will yield a similar configuration to that of the text encoder of the CLIP - [openai/clip-vit-base-patch32](https://huggingface.co/openai/clip-vit-base-patch32) architecture. + [openai/clip-vit-base-patch32](https://hf-mirror.com/openai/clip-vit-base-patch32) architecture. Configuration objects inherit from [`PretrainedConfig`] and can be used to control the model outputs. Read the documentation from [`PretrainedConfig`] for more information. @@ -151,7 +151,7 @@ class CLIPVisionConfig(PretrainedConfig): This is the configuration class to store the configuration of a [`CLIPVisionModel`]. It is used to instantiate a CLIP vision encoder according to the specified arguments, defining the model architecture. Instantiating a configuration with the defaults will yield a similar configuration to that of the vision encoder of the CLIP - [openai/clip-vit-base-patch32](https://huggingface.co/openai/clip-vit-base-patch32) architecture. + [openai/clip-vit-base-patch32](https://hf-mirror.com/openai/clip-vit-base-patch32) architecture. Configuration objects inherit from [`PretrainedConfig`] and can be used to control the model outputs. Read the documentation from [`PretrainedConfig`] for more information. @@ -258,7 +258,7 @@ class CLIPConfig(PretrainedConfig): [`CLIPConfig`] is the configuration class to store the configuration of a [`CLIPModel`]. It is used to instantiate a CLIP model according to the specified arguments, defining the text model and vision model configs. Instantiating a configuration with the defaults will yield a similar configuration to that of the CLIP - [openai/clip-vit-base-patch32](https://huggingface.co/openai/clip-vit-base-patch32) architecture. + [openai/clip-vit-base-patch32](https://hf-mirror.com/openai/clip-vit-base-patch32) architecture. Configuration objects inherit from [`PretrainedConfig`] and can be used to control the model outputs. Read the documentation from [`PretrainedConfig`] for more information. diff --git a/mindnlp/transformers/models/clip/modeling_clip.py b/mindnlp/transformers/models/clip/modeling_clip.py index 424efe3c2..7f4558b29 100644 --- a/mindnlp/transformers/models/clip/modeling_clip.py +++ b/mindnlp/transformers/models/clip/modeling_clip.py @@ -39,7 +39,7 @@ CLIP_PRETRAINED_MODEL_ARCHIVE_LIST = [ "openai/clip-vit-base-patch32", - # See all CLIP models at https://huggingface.co/models?filter=clip + # See all CLIP models at https://hf-mirror.com/models?filter=clip ] diff --git a/mindnlp/transformers/models/clip/tokenization_clip.py b/mindnlp/transformers/models/clip/tokenization_clip.py index 2aacb47d3..8ee519af5 100644 --- a/mindnlp/transformers/models/clip/tokenization_clip.py +++ b/mindnlp/transformers/models/clip/tokenization_clip.py @@ -36,10 +36,10 @@ PRETRAINED_VOCAB_FILES_MAP = { "vocab_file": { - "openai/clip-vit-base-patch32": "https://huggingface.co/openai/clip-vit-base-patch32/resolve/main/vocab.json", + "openai/clip-vit-base-patch32": "https://hf-mirror.com/openai/clip-vit-base-patch32/resolve/main/vocab.json", }, "merges_file": { - "openai/clip-vit-base-patch32": "https://huggingface.co/openai/clip-vit-base-patch32/resolve/main/merges.txt", + "openai/clip-vit-base-patch32": "https://hf-mirror.com/openai/clip-vit-base-patch32/resolve/main/merges.txt", }, } diff --git a/mindnlp/transformers/models/clip/tokenization_clip_fast.py b/mindnlp/transformers/models/clip/tokenization_clip_fast.py index da05e8c2a..a48872507 100644 --- a/mindnlp/transformers/models/clip/tokenization_clip_fast.py +++ b/mindnlp/transformers/models/clip/tokenization_clip_fast.py @@ -31,14 +31,14 @@ PRETRAINED_VOCAB_FILES_MAP = { "vocab_file": { - "openai/clip-vit-base-patch32": "https://huggingface.co/openai/clip-vit-base-patch32/resolve/main/vocab.json", + "openai/clip-vit-base-patch32": "https://hf-mirror.com/openai/clip-vit-base-patch32/resolve/main/vocab.json", }, "merges_file": { - "openai/clip-vit-base-patch32": "https://huggingface.co/openai/clip-vit-base-patch32/resolve/main/merges.txt", + "openai/clip-vit-base-patch32": "https://hf-mirror.com/openai/clip-vit-base-patch32/resolve/main/merges.txt", }, "tokenizer_file": { "openai/clip-vit-base-patch32": ( - "https://huggingface.co/openai/clip-vit-base-patch32/resolve/main/tokenizer.json" + "https://hf-mirror.com/openai/clip-vit-base-patch32/resolve/main/tokenizer.json" ), }, } diff --git a/mindnlp/transformers/models/codegen/configuration_codegen.py b/mindnlp/transformers/models/codegen/configuration_codegen.py index 9750dad95..908eeb155 100644 --- a/mindnlp/transformers/models/codegen/configuration_codegen.py +++ b/mindnlp/transformers/models/codegen/configuration_codegen.py @@ -24,18 +24,18 @@ CODEGEN_PRETRAINED_CONFIG_ARCHIVE_MAP = { - "Salesforce/codegen-350M-nl": "https://huggingface.co/Salesforce/codegen-350M-nl/resolve/main/config.json", - "Salesforce/codegen-350M-multi": "https://huggingface.co/Salesforce/codegen-350M-multi/resolve/main/config.json", - "Salesforce/codegen-350M-mono": "https://huggingface.co/Salesforce/codegen-350M-mono/resolve/main/config.json", - "Salesforce/codegen-2B-nl": "https://huggingface.co/Salesforce/codegen-2B-nl/resolve/main/config.json", - "Salesforce/codegen-2B-multi": "https://huggingface.co/Salesforce/codegen-2B-multi/resolve/main/config.json", - "Salesforce/codegen-2B-mono": "https://huggingface.co/Salesforce/codegen-2B-mono/resolve/main/config.json", - "Salesforce/codegen-6B-nl": "https://huggingface.co/Salesforce/codegen-6B-nl/resolve/main/config.json", - "Salesforce/codegen-6B-multi": "https://huggingface.co/Salesforce/codegen-6B-multi/resolve/main/config.json", - "Salesforce/codegen-6B-mono": "https://huggingface.co/Salesforce/codegen-6B-mono/resolve/main/config.json", - "Salesforce/codegen-16B-nl": "https://huggingface.co/Salesforce/codegen-16B-nl/resolve/main/config.json", - "Salesforce/codegen-16B-multi": "https://huggingface.co/Salesforce/codegen-16B-multi/resolve/main/config.json", - "Salesforce/codegen-16B-mono": "https://huggingface.co/Salesforce/codegen-16B-mono/resolve/main/config.json", + "Salesforce/codegen-350M-nl": "https://hf-mirror.com/Salesforce/codegen-350M-nl/resolve/main/config.json", + "Salesforce/codegen-350M-multi": "https://hf-mirror.com/Salesforce/codegen-350M-multi/resolve/main/config.json", + "Salesforce/codegen-350M-mono": "https://hf-mirror.com/Salesforce/codegen-350M-mono/resolve/main/config.json", + "Salesforce/codegen-2B-nl": "https://hf-mirror.com/Salesforce/codegen-2B-nl/resolve/main/config.json", + "Salesforce/codegen-2B-multi": "https://hf-mirror.com/Salesforce/codegen-2B-multi/resolve/main/config.json", + "Salesforce/codegen-2B-mono": "https://hf-mirror.com/Salesforce/codegen-2B-mono/resolve/main/config.json", + "Salesforce/codegen-6B-nl": "https://hf-mirror.com/Salesforce/codegen-6B-nl/resolve/main/config.json", + "Salesforce/codegen-6B-multi": "https://hf-mirror.com/Salesforce/codegen-6B-multi/resolve/main/config.json", + "Salesforce/codegen-6B-mono": "https://hf-mirror.com/Salesforce/codegen-6B-mono/resolve/main/config.json", + "Salesforce/codegen-16B-nl": "https://hf-mirror.com/Salesforce/codegen-16B-nl/resolve/main/config.json", + "Salesforce/codegen-16B-multi": "https://hf-mirror.com/Salesforce/codegen-16B-multi/resolve/main/config.json", + "Salesforce/codegen-16B-mono": "https://hf-mirror.com/Salesforce/codegen-16B-mono/resolve/main/config.json", } @@ -44,7 +44,7 @@ class CodeGenConfig(PretrainedConfig): This is the configuration class to store the configuration of a [`CodeGenModel`]. It is used to instantiate a CodeGen model according to the specified arguments, defining the model architecture. Instantiating a configuration with the defaults will yield a similar configuration to that of the CodeGen - [Salesforce/codegen-2B-mono](https://huggingface.co/Salesforce/codegen-2B-mono) architecture. Configuration objects + [Salesforce/codegen-2B-mono](https://hf-mirror.com/Salesforce/codegen-2B-mono) architecture. Configuration objects inherit from [`PretrainedConfig`] and can be used to control the model outputs. Read the documentation from [`PretrainedConfig`] for more information. diff --git a/mindnlp/transformers/models/codegen/modeling_codegen.py b/mindnlp/transformers/models/codegen/modeling_codegen.py index b5fc6383a..d50949127 100644 --- a/mindnlp/transformers/models/codegen/modeling_codegen.py +++ b/mindnlp/transformers/models/codegen/modeling_codegen.py @@ -49,7 +49,7 @@ "Salesforce/codegen-16B-nl", "Salesforce/codegen-16B-multi", "Salesforce/codegen-16B-mono", - # See all CodeGen models at https://huggingface.co/models?filter=codegen + # See all CodeGen models at https://hf-mirror.com/models?filter=codegen ] diff --git a/mindnlp/transformers/models/codegen/tokenization_codegen.py b/mindnlp/transformers/models/codegen/tokenization_codegen.py index d4edc212d..5c2cc0af2 100644 --- a/mindnlp/transformers/models/codegen/tokenization_codegen.py +++ b/mindnlp/transformers/models/codegen/tokenization_codegen.py @@ -37,10 +37,10 @@ PRETRAINED_VOCAB_FILES_MAP = { "vocab_file": { - "Salesforce/codegen-350M-mono": "https://huggingface.co/Salesforce/codegen-350M-mono/resolve/main/vocab.json", + "Salesforce/codegen-350M-mono": "https://hf-mirror.com/Salesforce/codegen-350M-mono/resolve/main/vocab.json", }, "merges_file": { - "Salesforce/codegen-350M-mono": "https://huggingface.co/Salesforce/codegen-350M-mono/resolve/main/merges.txt", + "Salesforce/codegen-350M-mono": "https://hf-mirror.com/Salesforce/codegen-350M-mono/resolve/main/merges.txt", }, } diff --git a/mindnlp/transformers/models/codegen/tokenization_codegen_fast.py b/mindnlp/transformers/models/codegen/tokenization_codegen_fast.py index 1059434b3..9a0f915a6 100644 --- a/mindnlp/transformers/models/codegen/tokenization_codegen_fast.py +++ b/mindnlp/transformers/models/codegen/tokenization_codegen_fast.py @@ -37,14 +37,14 @@ PRETRAINED_VOCAB_FILES_MAP = { "vocab_file": { - "Salesforce/codegen-350M-mono": "https://huggingface.co/Salesforce/codegen-350M-mono/resolve/main/vocab.json", + "Salesforce/codegen-350M-mono": "https://hf-mirror.com/Salesforce/codegen-350M-mono/resolve/main/vocab.json", }, "merges_file": { - "Salesforce/codegen-350M-mono": "https://huggingface.co/Salesforce/codegen-350M-mono/resolve/main/merges.txt", + "Salesforce/codegen-350M-mono": "https://hf-mirror.com/Salesforce/codegen-350M-mono/resolve/main/merges.txt", }, "tokenizer_file": { "Salesforce/codegen-350M-mono": ( - "https://huggingface.co/Salesforce/codegen-350M-mono/resolve/main/tokenizer.json" + "https://hf-mirror.com/Salesforce/codegen-350M-mono/resolve/main/tokenizer.json" ), }, } diff --git a/mindnlp/transformers/models/cpm/tokenization_cpm.py b/mindnlp/transformers/models/cpm/tokenization_cpm.py index f42c6749a..082daabfe 100644 --- a/mindnlp/transformers/models/cpm/tokenization_cpm.py +++ b/mindnlp/transformers/models/cpm/tokenization_cpm.py @@ -31,7 +31,7 @@ PRETRAINED_VOCAB_FILES_MAP = { "vocab_file": { - "TsinghuaAI/CPM-Generate": "https://huggingface.co/TsinghuaAI/CPM-Generate/resolve/main/spiece.model", + "TsinghuaAI/CPM-Generate": "https://hf-mirror.com/TsinghuaAI/CPM-Generate/resolve/main/spiece.model", } } diff --git a/mindnlp/transformers/models/cpm/tokenization_cpm_fast.py b/mindnlp/transformers/models/cpm/tokenization_cpm_fast.py index 8abdf3959..80abb6374 100644 --- a/mindnlp/transformers/models/cpm/tokenization_cpm_fast.py +++ b/mindnlp/transformers/models/cpm/tokenization_cpm_fast.py @@ -28,10 +28,10 @@ PRETRAINED_VOCAB_FILES_MAP = { "vocab_file": { - "TsinghuaAI/CPM-Generate": "https://huggingface.co/TsinghuaAI/CPM-Generate/resolve/main/spiece.model", + "TsinghuaAI/CPM-Generate": "https://hf-mirror.com/TsinghuaAI/CPM-Generate/resolve/main/spiece.model", }, "tokenizer_file": { - "TsinghuaAI/CPM-Generate": "https://huggingface.co/TsinghuaAI/CPM-Generate/resolve/main/tokenizer.json", + "TsinghuaAI/CPM-Generate": "https://hf-mirror.com/TsinghuaAI/CPM-Generate/resolve/main/tokenizer.json", }, } diff --git a/mindnlp/transformers/models/cpmant/configuration_cpmant.py b/mindnlp/transformers/models/cpmant/configuration_cpmant.py index cc31667d6..3d3746077 100644 --- a/mindnlp/transformers/models/cpmant/configuration_cpmant.py +++ b/mindnlp/transformers/models/cpmant/configuration_cpmant.py @@ -22,8 +22,8 @@ logger = logging.get_logger(__name__) CPMANT_PRETRAINED_CONFIG_ARCHIVE_MAP = { - "openbmb/cpm-ant-10b": "https://huggingface.co/openbmb/cpm-ant-10b/blob/main/config.json" - # See all CPMAnt models at https://huggingface.co/models?filter=cpmant + "openbmb/cpm-ant-10b": "https://hf-mirror.com/openbmb/cpm-ant-10b/blob/main/config.json" + # See all CPMAnt models at https://hf-mirror.com/models?filter=cpmant } @@ -32,7 +32,7 @@ class CpmAntConfig(PretrainedConfig): This is the configuration class to store the configuration of a [`CpmAntModel`]. It is used to instantiate an CPMAnt model according to the specified arguments, defining the model architecture. Instantiating a configuration with the defaults will yield a similar configuration to that of the CPMAnt - [openbmb/cpm-ant-10b](https://huggingface.co/openbmb/cpm-ant-10b) architecture. + [openbmb/cpm-ant-10b](https://hf-mirror.com/openbmb/cpm-ant-10b) architecture. Configuration objects inherit from [`PretrainedConfig`] and can be used to control the model outputs. Read the documentation from [`PretrainedConfig`] for more information. diff --git a/mindnlp/transformers/models/cpmant/modeling_cpmant.py b/mindnlp/transformers/models/cpmant/modeling_cpmant.py index c15ae567a..3c631c932 100644 --- a/mindnlp/transformers/models/cpmant/modeling_cpmant.py +++ b/mindnlp/transformers/models/cpmant/modeling_cpmant.py @@ -38,7 +38,7 @@ CPMANT_PRETRAINED_MODEL_ARCHIVE_LIST = [ "openbmb/cpm-ant-10b", - # See all CPMAnt models at https://huggingface.co/models?filter=cpmant + # See all CPMAnt models at https://hf-mirror.com/models?filter=cpmant ] diff --git a/mindnlp/transformers/models/cpmant/tokenization_cpmant.py b/mindnlp/transformers/models/cpmant/tokenization_cpmant.py index df1a9c1c5..3021aea7b 100644 --- a/mindnlp/transformers/models/cpmant/tokenization_cpmant.py +++ b/mindnlp/transformers/models/cpmant/tokenization_cpmant.py @@ -34,7 +34,7 @@ PRETRAINED_VOCAB_FILES_MAP = { "vocab_file": { - "openbmb/cpm-ant-10b": "https://huggingface.co/openbmb/cpm-ant-10b/blob/main/vocab.txt", + "openbmb/cpm-ant-10b": "https://hf-mirror.com/openbmb/cpm-ant-10b/blob/main/vocab.txt", }, } diff --git a/mindnlp/transformers/models/cpmbee/configuration_cpmbee.py b/mindnlp/transformers/models/cpmbee/configuration_cpmbee.py index d987ac23b..7ba31d9ce 100644 --- a/mindnlp/transformers/models/cpmbee/configuration_cpmbee.py +++ b/mindnlp/transformers/models/cpmbee/configuration_cpmbee.py @@ -22,11 +22,11 @@ logger = logging.get_logger(__name__) CPMBEE_PRETRAINED_CONFIG_ARCHIVE_MAP = { - "openbmb/cpm-bee-10b": "https://huggingface.co/openbmb/cpm-bee-10b/resolve/main/config.json", - "openbmb/cpm-bee-5b": "https://huggingface.co/openbmb/cpm-bee-5b/resolve/main/config.json", - "openbmb/cpm-bee-2b": "https://huggingface.co/openbmb/cpm-bee-2b/resolve/main/config.json", - "openbmb/cpm-bee-1b": "https://huggingface.co/openbmb/cpm-bee-1b/resolve/main/config.json", - # See all CpmBee models at https://huggingface.co/models?filter=cpmbee + "openbmb/cpm-bee-10b": "https://hf-mirror.com/openbmb/cpm-bee-10b/resolve/main/config.json", + "openbmb/cpm-bee-5b": "https://hf-mirror.com/openbmb/cpm-bee-5b/resolve/main/config.json", + "openbmb/cpm-bee-2b": "https://hf-mirror.com/openbmb/cpm-bee-2b/resolve/main/config.json", + "openbmb/cpm-bee-1b": "https://hf-mirror.com/openbmb/cpm-bee-1b/resolve/main/config.json", + # See all CpmBee models at https://hf-mirror.com/models?filter=cpmbee } @@ -35,7 +35,7 @@ class CpmBeeConfig(PretrainedConfig): This is the configuration class to store the configuration of a [`CpmBeeModel`]. It is used to instbeeiate an CPMBee model according to the specified arguments, defining the model architecture. Instantiating a configuration with the defaults will yield a similar configuration to that of the CPMBee - [openbmb/cpm-bee-10b](https://huggingface.co/openbmb/cpm-bee-10b) architecture. + [openbmb/cpm-bee-10b](https://hf-mirror.com/openbmb/cpm-bee-10b) architecture. Configuration objects inherit from [`PretrainedConfig`] and can be used to control the model outputs. Read the documentation from [`PretrainedConfig`] for more information. diff --git a/mindnlp/transformers/models/cpmbee/modeling_cpmbee.py b/mindnlp/transformers/models/cpmbee/modeling_cpmbee.py index e7912e63f..8354f10bc 100644 --- a/mindnlp/transformers/models/cpmbee/modeling_cpmbee.py +++ b/mindnlp/transformers/models/cpmbee/modeling_cpmbee.py @@ -50,7 +50,7 @@ "openbmb/cpm-bee-5b", "openbmb/cpm-bee-2b", "openbmb/cpm-bee-1b", - # See all CPMBee models at https://huggingface.co/models?filter=cpmbee + # See all CPMBee models at https://hf-mirror.com/models?filter=cpmbee ] @@ -1835,7 +1835,7 @@ def _generate( "You have modified the pretrained model configuration to control generation. This is a" " deprecated strategy to control generation and will be removed soon, in a future version." " Please use a generation configuration file (see" - " https://huggingface.co/docs/transformers/main_classes/text_generation)" + " https://hf-mirror.com/docs/transformers/main_classes/text_generation)" ) self.generation_config = new_generation_config generation_config = self.generation_config @@ -1920,7 +1920,7 @@ def _generate( f"Both `max_new_tokens` (={generation_config.max_new_tokens}) and `max_length`(=" f"{generation_config.max_length}) seem to have been set. `max_new_tokens` will take precedence. " "Please refer to the documentation for more information. " - "(https://huggingface.co/docs/transformers/main/en/main_classes/text_generation)" + "(https://hf-mirror.com/docs/transformers/main/en/main_classes/text_generation)" ) generation_config.max_length = generation_config.max_new_tokens + input_ids_seq_length diff --git a/mindnlp/transformers/models/cpmbee/tokenization_cpmbee.py b/mindnlp/transformers/models/cpmbee/tokenization_cpmbee.py index 88036e2a9..4abb5ab5b 100644 --- a/mindnlp/transformers/models/cpmbee/tokenization_cpmbee.py +++ b/mindnlp/transformers/models/cpmbee/tokenization_cpmbee.py @@ -33,10 +33,10 @@ PRETRAINED_VOCAB_FILES_MAP = { "vocab_file": { - "openbmb/cpm-bee-10b": "https://huggingface.co/openbmb/cpm-bee-10b/blob/main/vocab.txt", - "openbmb/cpm-bee-5b": "https://huggingface.co/openbmb/cpm-bee-5b/blob/main/vocab.txt", - "openbmb/cpm-bee-2b": "https://huggingface.co/openbmb/cpm-bee-2b/blob/main/vocab.txt", - "openbmb/cpm-bee-1b": "https://huggingface.co/openbmb/cpm-bee-1b/blob/main/vocab.txt", + "openbmb/cpm-bee-10b": "https://hf-mirror.com/openbmb/cpm-bee-10b/blob/main/vocab.txt", + "openbmb/cpm-bee-5b": "https://hf-mirror.com/openbmb/cpm-bee-5b/blob/main/vocab.txt", + "openbmb/cpm-bee-2b": "https://hf-mirror.com/openbmb/cpm-bee-2b/blob/main/vocab.txt", + "openbmb/cpm-bee-1b": "https://hf-mirror.com/openbmb/cpm-bee-1b/blob/main/vocab.txt", }, } diff --git a/mindnlp/transformers/models/deberta/configuration_deberta.py b/mindnlp/transformers/models/deberta/configuration_deberta.py index a0a28342a..3e1633b5e 100644 --- a/mindnlp/transformers/models/deberta/configuration_deberta.py +++ b/mindnlp/transformers/models/deberta/configuration_deberta.py @@ -21,12 +21,12 @@ logger = logging.get_logger(__name__) DEBERTA_PRETRAINED_CONFIG_ARCHIVE_MAP = { - "microsoft/deberta-base": "https://huggingface.co/microsoft/deberta-base/resolve/main/config.json", - "microsoft/deberta-large": "https://huggingface.co/microsoft/deberta-large/resolve/main/config.json", - "microsoft/deberta-xlarge": "https://huggingface.co/microsoft/deberta-xlarge/resolve/main/config.json", - "microsoft/deberta-base-mnli": "https://huggingface.co/microsoft/deberta-base-mnli/resolve/main/config.json", - "microsoft/deberta-large-mnli": "https://huggingface.co/microsoft/deberta-large-mnli/resolve/main/config.json", - "microsoft/deberta-xlarge-mnli": "https://huggingface.co/microsoft/deberta-xlarge-mnli/resolve/main/config.json", + "microsoft/deberta-base": "https://hf-mirror.com/microsoft/deberta-base/resolve/main/config.json", + "microsoft/deberta-large": "https://hf-mirror.com/microsoft/deberta-large/resolve/main/config.json", + "microsoft/deberta-xlarge": "https://hf-mirror.com/microsoft/deberta-xlarge/resolve/main/config.json", + "microsoft/deberta-base-mnli": "https://hf-mirror.com/microsoft/deberta-base-mnli/resolve/main/config.json", + "microsoft/deberta-large-mnli": "https://hf-mirror.com/microsoft/deberta-large-mnli/resolve/main/config.json", + "microsoft/deberta-xlarge-mnli": "https://hf-mirror.com/microsoft/deberta-xlarge-mnli/resolve/main/config.json", } @@ -35,7 +35,7 @@ class DebertaConfig(PretrainedConfig): This is the configuration class to store the configuration of a [`DebertaModel`] or a [`TFDebertaModel`]. It is used to instantiate a DeBERTa model according to the specified arguments, defining the model architecture. Instantiating a configuration with the defaults will yield a similar configuration to that of the DeBERTa - [microsoft/deberta-base](https://huggingface.co/microsoft/deberta-base) architecture. + [microsoft/deberta-base](https://hf-mirror.com/microsoft/deberta-base) architecture. Configuration objects inherit from [`PretrainedConfig`] and can be used to control the model outputs. Read the documentation from [`PretrainedConfig`] for more information. diff --git a/mindnlp/transformers/models/deberta/tokenization_deberta.py b/mindnlp/transformers/models/deberta/tokenization_deberta.py index aab3d7652..065db2142 100644 --- a/mindnlp/transformers/models/deberta/tokenization_deberta.py +++ b/mindnlp/transformers/models/deberta/tokenization_deberta.py @@ -31,23 +31,23 @@ PRETRAINED_VOCAB_FILES_MAP = { "vocab_file": { - "microsoft/deberta-base": "https://huggingface.co/microsoft/deberta-base/resolve/main/vocab.json", - "microsoft/deberta-large": "https://huggingface.co/microsoft/deberta-large/resolve/main/vocab.json", - "microsoft/deberta-xlarge": "https://huggingface.co/microsoft/deberta-xlarge/resolve/main/vocab.json", - "microsoft/deberta-base-mnli": "https://huggingface.co/microsoft/deberta-base-mnli/resolve/main/vocab.json", - "microsoft/deberta-large-mnli": "https://huggingface.co/microsoft/deberta-large-mnli/resolve/main/vocab.json", + "microsoft/deberta-base": "https://hf-mirror.com/microsoft/deberta-base/resolve/main/vocab.json", + "microsoft/deberta-large": "https://hf-mirror.com/microsoft/deberta-large/resolve/main/vocab.json", + "microsoft/deberta-xlarge": "https://hf-mirror.com/microsoft/deberta-xlarge/resolve/main/vocab.json", + "microsoft/deberta-base-mnli": "https://hf-mirror.com/microsoft/deberta-base-mnli/resolve/main/vocab.json", + "microsoft/deberta-large-mnli": "https://hf-mirror.com/microsoft/deberta-large-mnli/resolve/main/vocab.json", "microsoft/deberta-xlarge-mnli": ( - "https://huggingface.co/microsoft/deberta-xlarge-mnli/resolve/main/vocab.json" + "https://hf-mirror.com/microsoft/deberta-xlarge-mnli/resolve/main/vocab.json" ), }, "merges_file": { - "microsoft/deberta-base": "https://huggingface.co/microsoft/deberta-base/resolve/main/merges.txt", - "microsoft/deberta-large": "https://huggingface.co/microsoft/deberta-large/resolve/main/merges.txt", - "microsoft/deberta-xlarge": "https://huggingface.co/microsoft/deberta-xlarge/resolve/main/merges.txt", - "microsoft/deberta-base-mnli": "https://huggingface.co/microsoft/deberta-base-mnli/resolve/main/merges.txt", - "microsoft/deberta-large-mnli": "https://huggingface.co/microsoft/deberta-large-mnli/resolve/main/merges.txt", + "microsoft/deberta-base": "https://hf-mirror.com/microsoft/deberta-base/resolve/main/merges.txt", + "microsoft/deberta-large": "https://hf-mirror.com/microsoft/deberta-large/resolve/main/merges.txt", + "microsoft/deberta-xlarge": "https://hf-mirror.com/microsoft/deberta-xlarge/resolve/main/merges.txt", + "microsoft/deberta-base-mnli": "https://hf-mirror.com/microsoft/deberta-base-mnli/resolve/main/merges.txt", + "microsoft/deberta-large-mnli": "https://hf-mirror.com/microsoft/deberta-large-mnli/resolve/main/merges.txt", "microsoft/deberta-xlarge-mnli": ( - "https://huggingface.co/microsoft/deberta-xlarge-mnli/resolve/main/merges.txt" + "https://hf-mirror.com/microsoft/deberta-xlarge-mnli/resolve/main/merges.txt" ), }, } diff --git a/mindnlp/transformers/models/deberta/tokenization_deberta_fast.py b/mindnlp/transformers/models/deberta/tokenization_deberta_fast.py index 5089d49ab..299990fd6 100644 --- a/mindnlp/transformers/models/deberta/tokenization_deberta_fast.py +++ b/mindnlp/transformers/models/deberta/tokenization_deberta_fast.py @@ -31,23 +31,23 @@ PRETRAINED_VOCAB_FILES_MAP = { "vocab_file": { - "microsoft/deberta-base": "https://huggingface.co/microsoft/deberta-base/resolve/main/vocab.json", - "microsoft/deberta-large": "https://huggingface.co/microsoft/deberta-large/resolve/main/vocab.json", - "microsoft/deberta-xlarge": "https://huggingface.co/microsoft/deberta-xlarge/resolve/main/vocab.json", - "microsoft/deberta-base-mnli": "https://huggingface.co/microsoft/deberta-base-mnli/resolve/main/vocab.json", - "microsoft/deberta-large-mnli": "https://huggingface.co/microsoft/deberta-large-mnli/resolve/main/vocab.json", + "microsoft/deberta-base": "https://hf-mirror.com/microsoft/deberta-base/resolve/main/vocab.json", + "microsoft/deberta-large": "https://hf-mirror.com/microsoft/deberta-large/resolve/main/vocab.json", + "microsoft/deberta-xlarge": "https://hf-mirror.com/microsoft/deberta-xlarge/resolve/main/vocab.json", + "microsoft/deberta-base-mnli": "https://hf-mirror.com/microsoft/deberta-base-mnli/resolve/main/vocab.json", + "microsoft/deberta-large-mnli": "https://hf-mirror.com/microsoft/deberta-large-mnli/resolve/main/vocab.json", "microsoft/deberta-xlarge-mnli": ( - "https://huggingface.co/microsoft/deberta-xlarge-mnli/resolve/main/vocab.json" + "https://hf-mirror.com/microsoft/deberta-xlarge-mnli/resolve/main/vocab.json" ), }, "merges_file": { - "microsoft/deberta-base": "https://huggingface.co/microsoft/deberta-base/resolve/main/merges.txt", - "microsoft/deberta-large": "https://huggingface.co/microsoft/deberta-large/resolve/main/merges.txt", - "microsoft/deberta-xlarge": "https://huggingface.co/microsoft/deberta-xlarge/resolve/main/merges.txt", - "microsoft/deberta-base-mnli": "https://huggingface.co/microsoft/deberta-base-mnli/resolve/main/merges.txt", - "microsoft/deberta-large-mnli": "https://huggingface.co/microsoft/deberta-large-mnli/resolve/main/merges.txt", + "microsoft/deberta-base": "https://hf-mirror.com/microsoft/deberta-base/resolve/main/merges.txt", + "microsoft/deberta-large": "https://hf-mirror.com/microsoft/deberta-large/resolve/main/merges.txt", + "microsoft/deberta-xlarge": "https://hf-mirror.com/microsoft/deberta-xlarge/resolve/main/merges.txt", + "microsoft/deberta-base-mnli": "https://hf-mirror.com/microsoft/deberta-base-mnli/resolve/main/merges.txt", + "microsoft/deberta-large-mnli": "https://hf-mirror.com/microsoft/deberta-large-mnli/resolve/main/merges.txt", "microsoft/deberta-xlarge-mnli": ( - "https://huggingface.co/microsoft/deberta-xlarge-mnli/resolve/main/merges.txt" + "https://hf-mirror.com/microsoft/deberta-xlarge-mnli/resolve/main/merges.txt" ), }, } diff --git a/mindnlp/transformers/models/distilbert/configuration_distilbert.py b/mindnlp/transformers/models/distilbert/configuration_distilbert.py index 3daf2e7c0..009dd9166 100644 --- a/mindnlp/transformers/models/distilbert/configuration_distilbert.py +++ b/mindnlp/transformers/models/distilbert/configuration_distilbert.py @@ -21,20 +21,20 @@ logger = logging.get_logger(__name__) DISTILBERT_PRETRAINED_CONFIG_ARCHIVE_MAP = { - "distilbert-base-uncased": "https://huggingface.co/distilbert-base-uncased/resolve/main/config.json", + "distilbert-base-uncased": "https://hf-mirror.com/distilbert-base-uncased/resolve/main/config.json", "distilbert-base-uncased-distilled-squad": ( - "https://huggingface.co/distilbert-base-uncased-distilled-squad/resolve/main/config.json" + "https://hf-mirror.com/distilbert-base-uncased-distilled-squad/resolve/main/config.json" ), - "distilbert-base-cased": "https://huggingface.co/distilbert-base-cased/resolve/main/config.json", + "distilbert-base-cased": "https://hf-mirror.com/distilbert-base-cased/resolve/main/config.json", "distilbert-base-cased-distilled-squad": ( - "https://huggingface.co/distilbert-base-cased-distilled-squad/resolve/main/config.json" + "https://hf-mirror.com/distilbert-base-cased-distilled-squad/resolve/main/config.json" ), - "distilbert-base-german-cased": "https://huggingface.co/distilbert-base-german-cased/resolve/main/config.json", + "distilbert-base-german-cased": "https://hf-mirror.com/distilbert-base-german-cased/resolve/main/config.json", "distilbert-base-multilingual-cased": ( - "https://huggingface.co/distilbert-base-multilingual-cased/resolve/main/config.json" + "https://hf-mirror.com/distilbert-base-multilingual-cased/resolve/main/config.json" ), "distilbert-base-uncased-finetuned-sst-2-english": ( - "https://huggingface.co/distilbert-base-uncased-finetuned-sst-2-english/resolve/main/config.json" + "https://hf-mirror.com/distilbert-base-uncased-finetuned-sst-2-english/resolve/main/config.json" ), } @@ -44,7 +44,7 @@ class DistilBertConfig(PretrainedConfig): This is the configuration class to store the configuration of a [`DistilBertModel`] or a [`TFDistilBertModel`]. It is used to instantiate a DistilBERT model according to the specified arguments, defining the model architecture. Instantiating a configuration with the defaults will yield a similar configuration to that of the DistilBERT - [distilbert-base-uncased](https://huggingface.co/distilbert-base-uncased) architecture. + [distilbert-base-uncased](https://hf-mirror.com/distilbert-base-uncased) architecture. Configuration objects inherit from [`PretrainedConfig`] and can be used to control the model outputs. Read the documentation from [`PretrainedConfig`] for more information. diff --git a/mindnlp/transformers/models/distilbert/modeling_distilbert.py b/mindnlp/transformers/models/distilbert/modeling_distilbert.py index ed9ebb157..76c5fdf7f 100644 --- a/mindnlp/transformers/models/distilbert/modeling_distilbert.py +++ b/mindnlp/transformers/models/distilbert/modeling_distilbert.py @@ -53,7 +53,7 @@ "distilbert-base-german-cased", "distilbert-base-multilingual-cased", "distilbert-base-uncased-finetuned-sst-2-english", - # See all DistilBERT models at https://huggingface.co/models?filter=distilbert + # See all DistilBERT models at https://hf-mirror.com/models?filter=distilbert ] # UTILS AND BUILDING BLOCKS OF THE ARCHITECTURE # diff --git a/mindnlp/transformers/models/distilbert/tokenization_distilbert.py b/mindnlp/transformers/models/distilbert/tokenization_distilbert.py index bf3835ef6..359715089 100644 --- a/mindnlp/transformers/models/distilbert/tokenization_distilbert.py +++ b/mindnlp/transformers/models/distilbert/tokenization_distilbert.py @@ -30,17 +30,17 @@ PRETRAINED_VOCAB_FILES_MAP = { "vocab_file": { - "distilbert-base-uncased": "https://huggingface.co/distilbert-base-uncased/resolve/main/vocab.txt", + "distilbert-base-uncased": "https://hf-mirror.com/distilbert-base-uncased/resolve/main/vocab.txt", "distilbert-base-uncased-distilled-squad": ( - "https://huggingface.co/distilbert-base-uncased-distilled-squad/resolve/main/vocab.txt" + "https://hf-mirror.com/distilbert-base-uncased-distilled-squad/resolve/main/vocab.txt" ), - "distilbert-base-cased": "https://huggingface.co/distilbert-base-cased/resolve/main/vocab.txt", + "distilbert-base-cased": "https://hf-mirror.com/distilbert-base-cased/resolve/main/vocab.txt", "distilbert-base-cased-distilled-squad": ( - "https://huggingface.co/distilbert-base-cased-distilled-squad/resolve/main/vocab.txt" + "https://hf-mirror.com/distilbert-base-cased-distilled-squad/resolve/main/vocab.txt" ), - "distilbert-base-german-cased": "https://huggingface.co/distilbert-base-german-cased/resolve/main/vocab.txt", + "distilbert-base-german-cased": "https://hf-mirror.com/distilbert-base-german-cased/resolve/main/vocab.txt", "distilbert-base-multilingual-cased": ( - "https://huggingface.co/distilbert-base-multilingual-cased/resolve/main/vocab.txt" + "https://hf-mirror.com/distilbert-base-multilingual-cased/resolve/main/vocab.txt" ), } } diff --git a/mindnlp/transformers/models/distilbert/tokenization_distilbert_fast.py b/mindnlp/transformers/models/distilbert/tokenization_distilbert_fast.py index a3bef117c..082c5b129 100644 --- a/mindnlp/transformers/models/distilbert/tokenization_distilbert_fast.py +++ b/mindnlp/transformers/models/distilbert/tokenization_distilbert_fast.py @@ -31,33 +31,33 @@ PRETRAINED_VOCAB_FILES_MAP = { "vocab_file": { - "distilbert-base-uncased": "https://huggingface.co/distilbert-base-uncased/resolve/main/vocab.txt", + "distilbert-base-uncased": "https://hf-mirror.com/distilbert-base-uncased/resolve/main/vocab.txt", "distilbert-base-uncased-distilled-squad": ( - "https://huggingface.co/distilbert-base-uncased-distilled-squad/resolve/main/vocab.txt" + "https://hf-mirror.com/distilbert-base-uncased-distilled-squad/resolve/main/vocab.txt" ), - "distilbert-base-cased": "https://huggingface.co/distilbert-base-cased/resolve/main/vocab.txt", + "distilbert-base-cased": "https://hf-mirror.com/distilbert-base-cased/resolve/main/vocab.txt", "distilbert-base-cased-distilled-squad": ( - "https://huggingface.co/distilbert-base-cased-distilled-squad/resolve/main/vocab.txt" + "https://hf-mirror.com/distilbert-base-cased-distilled-squad/resolve/main/vocab.txt" ), - "distilbert-base-german-cased": "https://huggingface.co/distilbert-base-german-cased/resolve/main/vocab.txt", + "distilbert-base-german-cased": "https://hf-mirror.com/distilbert-base-german-cased/resolve/main/vocab.txt", "distilbert-base-multilingual-cased": ( - "https://huggingface.co/distilbert-base-multilingual-cased/resolve/main/vocab.txt" + "https://hf-mirror.com/distilbert-base-multilingual-cased/resolve/main/vocab.txt" ), }, "tokenizer_file": { - "distilbert-base-uncased": "https://huggingface.co/distilbert-base-uncased/resolve/main/tokenizer.json", + "distilbert-base-uncased": "https://hf-mirror.com/distilbert-base-uncased/resolve/main/tokenizer.json", "distilbert-base-uncased-distilled-squad": ( - "https://huggingface.co/distilbert-base-uncased-distilled-squad/resolve/main/tokenizer.json" + "https://hf-mirror.com/distilbert-base-uncased-distilled-squad/resolve/main/tokenizer.json" ), - "distilbert-base-cased": "https://huggingface.co/distilbert-base-cased/resolve/main/tokenizer.json", + "distilbert-base-cased": "https://hf-mirror.com/distilbert-base-cased/resolve/main/tokenizer.json", "distilbert-base-cased-distilled-squad": ( - "https://huggingface.co/distilbert-base-cased-distilled-squad/resolve/main/tokenizer.json" + "https://hf-mirror.com/distilbert-base-cased-distilled-squad/resolve/main/tokenizer.json" ), "distilbert-base-german-cased": ( - "https://huggingface.co/distilbert-base-german-cased/resolve/main/tokenizer.json" + "https://hf-mirror.com/distilbert-base-german-cased/resolve/main/tokenizer.json" ), "distilbert-base-multilingual-cased": ( - "https://huggingface.co/distilbert-base-multilingual-cased/resolve/main/tokenizer.json" + "https://hf-mirror.com/distilbert-base-multilingual-cased/resolve/main/tokenizer.json" ), }, } diff --git a/mindnlp/transformers/models/encodec/configuration_encodec.py b/mindnlp/transformers/models/encodec/configuration_encodec.py index 6d5694c37..b370844d7 100644 --- a/mindnlp/transformers/models/encodec/configuration_encodec.py +++ b/mindnlp/transformers/models/encodec/configuration_encodec.py @@ -26,8 +26,8 @@ ENCODEC_PRETRAINED_CONFIG_ARCHIVE_MAP = { - "encodec_24khz": "https://huggingface.co/encodec_24khz/resolve/main/config.json", - "encodec_48khz": "https://huggingface.co/encodec_48khz/resolve/main/config.json", + "encodec_24khz": "https://hf-mirror.com/encodec_24khz/resolve/main/config.json", + "encodec_48khz": "https://hf-mirror.com/encodec_48khz/resolve/main/config.json", } __all__ = ["EncodecConfig"] @@ -38,7 +38,7 @@ class EncodecConfig(PretrainedConfig): This is the configuration class to store the configuration of an [`EncodecModel`]. It is used to instantiate a Encodec model according to the specified arguments, defining the model architecture. Instantiating a configuration with the defaults will yield a similar configuration to that of the - [facebook/encodec_24khz](https://huggingface.co/facebook/encodec_24khz) architecture. + [facebook/encodec_24khz](https://hf-mirror.com/facebook/encodec_24khz) architecture. Configuration objects inherit from [`PretrainedConfig`] and can be used to control the model outputs. Read the documentation from [`PretrainedConfig`] for more information. diff --git a/mindnlp/transformers/models/encodec/feature_extraction_encodec.py b/mindnlp/transformers/models/encodec/feature_extraction_encodec.py index eea5d1628..222b43701 100644 --- a/mindnlp/transformers/models/encodec/feature_extraction_encodec.py +++ b/mindnlp/transformers/models/encodec/feature_extraction_encodec.py @@ -33,7 +33,7 @@ class EncodecFeatureExtractor(SequenceFeatureExtractor): most of the main methods. Users should refer to this superclass for more information regarding those methods. Instantiating a feature extractor with the defaults will yield a similar configuration to that of the - [facebook/encodec_24khz](https://huggingface.co/facebook/encodec_24khz) architecture. + [facebook/encodec_24khz](https://hf-mirror.com/facebook/encodec_24khz) architecture. Args: feature_size (`int`, *optional*, defaults to 1): diff --git a/mindnlp/transformers/models/ernie/configuration_ernie.py b/mindnlp/transformers/models/ernie/configuration_ernie.py index 35b477395..145b55fe4 100644 --- a/mindnlp/transformers/models/ernie/configuration_ernie.py +++ b/mindnlp/transformers/models/ernie/configuration_ernie.py @@ -23,16 +23,16 @@ logger = logging.get_logger(__name__) ERNIE_PRETRAINED_CONFIG_ARCHIVE_MAP = { - "nghuyong/ernie-1.0-base-zh": "https://huggingface.co/nghuyong/ernie-1.0-base-zh/resolve/main/config.json", - "nghuyong/ernie-2.0-base-en": "https://huggingface.co/nghuyong/ernie-2.0-base-en/resolve/main/config.json", - "nghuyong/ernie-2.0-large-en": "https://huggingface.co/nghuyong/ernie-2.0-large-en/resolve/main/config.json", - "nghuyong/ernie-3.0-base-zh": "https://huggingface.co/nghuyong/ernie-3.0-base-zh/resolve/main/config.json", - "nghuyong/ernie-3.0-medium-zh": "https://huggingface.co/nghuyong/ernie-3.0-medium-zh/resolve/main/config.json", - "nghuyong/ernie-3.0-mini-zh": "https://huggingface.co/nghuyong/ernie-3.0-mini-zh/resolve/main/config.json", - "nghuyong/ernie-3.0-micro-zh": "https://huggingface.co/nghuyong/ernie-3.0-micro-zh/resolve/main/config.json", - "nghuyong/ernie-3.0-nano-zh": "https://huggingface.co/nghuyong/ernie-3.0-nano-zh/resolve/main/config.json", - "nghuyong/ernie-gram-zh": "https://huggingface.co/nghuyong/ernie-gram-zh/resolve/main/config.json", - "nghuyong/ernie-health-zh": "https://huggingface.co/nghuyong/ernie-health-zh/resolve/main/config.json", + "nghuyong/ernie-1.0-base-zh": "https://hf-mirror.com/nghuyong/ernie-1.0-base-zh/resolve/main/config.json", + "nghuyong/ernie-2.0-base-en": "https://hf-mirror.com/nghuyong/ernie-2.0-base-en/resolve/main/config.json", + "nghuyong/ernie-2.0-large-en": "https://hf-mirror.com/nghuyong/ernie-2.0-large-en/resolve/main/config.json", + "nghuyong/ernie-3.0-base-zh": "https://hf-mirror.com/nghuyong/ernie-3.0-base-zh/resolve/main/config.json", + "nghuyong/ernie-3.0-medium-zh": "https://hf-mirror.com/nghuyong/ernie-3.0-medium-zh/resolve/main/config.json", + "nghuyong/ernie-3.0-mini-zh": "https://hf-mirror.com/nghuyong/ernie-3.0-mini-zh/resolve/main/config.json", + "nghuyong/ernie-3.0-micro-zh": "https://hf-mirror.com/nghuyong/ernie-3.0-micro-zh/resolve/main/config.json", + "nghuyong/ernie-3.0-nano-zh": "https://hf-mirror.com/nghuyong/ernie-3.0-nano-zh/resolve/main/config.json", + "nghuyong/ernie-gram-zh": "https://hf-mirror.com/nghuyong/ernie-gram-zh/resolve/main/config.json", + "nghuyong/ernie-health-zh": "https://hf-mirror.com/nghuyong/ernie-health-zh/resolve/main/config.json", } @@ -41,7 +41,7 @@ class ErnieConfig(PretrainedConfig): This is the configuration class to store the configuration of a [`ErnieModel`] or a [`TFErnieModel`]. It is used to instantiate a ERNIE model according to the specified arguments, defining the model architecture. Instantiating a configuration with the defaults will yield a similar configuration to that of the ERNIE - [nghuyong/ernie-3.0-base-zh](https://huggingface.co/nghuyong/ernie-3.0-base-zh) architecture. + [nghuyong/ernie-3.0-base-zh](https://hf-mirror.com/nghuyong/ernie-3.0-base-zh) architecture. Configuration objects inherit from [`PretrainedConfig`] and can be used to control the model outputs. Read the documentation from [`PretrainedConfig`] for more information. diff --git a/mindnlp/transformers/models/ernie/modeling_ernie.py b/mindnlp/transformers/models/ernie/modeling_ernie.py index 8bbc013f9..2a2ae72e8 100644 --- a/mindnlp/transformers/models/ernie/modeling_ernie.py +++ b/mindnlp/transformers/models/ernie/modeling_ernie.py @@ -62,7 +62,7 @@ "nghuyong/ernie-3.0-nano-zh", "nghuyong/ernie-gram-zh", "nghuyong/ernie-health-zh", - # See all ERNIE models at https://huggingface.co/models?filter=ernie + # See all ERNIE models at https://hf-mirror.com/models?filter=ernie ] diff --git a/mindnlp/transformers/models/ernie/modeling_graph_ernie.py b/mindnlp/transformers/models/ernie/modeling_graph_ernie.py index a3cd5cec6..92b6e3955 100644 --- a/mindnlp/transformers/models/ernie/modeling_graph_ernie.py +++ b/mindnlp/transformers/models/ernie/modeling_graph_ernie.py @@ -47,7 +47,7 @@ "nghuyong/ernie-3.0-nano-zh", "nghuyong/ernie-gram-zh", "nghuyong/ernie-health-zh", - # See all ERNIE models at https://huggingface.co/models?filter=ernie + # See all ERNIE models at https://hf-mirror.com/models?filter=ernie ] diff --git a/mindnlp/transformers/models/ernie_m/configuration_ernie_m.py b/mindnlp/transformers/models/ernie_m/configuration_ernie_m.py index 73b9bead0..5e2018925 100644 --- a/mindnlp/transformers/models/ernie_m/configuration_ernie_m.py +++ b/mindnlp/transformers/models/ernie_m/configuration_ernie_m.py @@ -25,8 +25,8 @@ ERNIE_M_PRETRAINED_CONFIG_ARCHIVE_MAP = { - "susnato/ernie-m-base_pytorch": "https://huggingface.co/susnato/ernie-m-base_pytorch/blob/main/config.json", - "susnato/ernie-m-large_pytorch": "https://huggingface.co/susnato/ernie-m-large_pytorch/blob/main/config.json", + "susnato/ernie-m-base_pytorch": "https://hf-mirror.com/susnato/ernie-m-base_pytorch/blob/main/config.json", + "susnato/ernie-m-large_pytorch": "https://hf-mirror.com/susnato/ernie-m-large_pytorch/blob/main/config.json", } @@ -35,7 +35,7 @@ class ErnieMConfig(PretrainedConfig): This is the configuration class to store the configuration of a [`ErnieMModel`]. It is used to instantiate a Ernie-M model according to the specified arguments, defining the model architecture. Instantiating a configuration with the defaults will yield a similar configuration to that of the `Ernie-M` - [susnato/ernie-m-base_pytorch](https://huggingface.co/susnato/ernie-m-base_pytorch) architecture. + [susnato/ernie-m-base_pytorch](https://hf-mirror.com/susnato/ernie-m-base_pytorch) architecture. Configuration objects inherit from [`PretrainedConfig`] and can be used to control the model outputs. Read the diff --git a/mindnlp/transformers/models/ernie_m/modeling_ernie_m.py b/mindnlp/transformers/models/ernie_m/modeling_ernie_m.py index 625b0b4ed..a0c5fe333 100644 --- a/mindnlp/transformers/models/ernie_m/modeling_ernie_m.py +++ b/mindnlp/transformers/models/ernie_m/modeling_ernie_m.py @@ -46,7 +46,7 @@ ERNIE_M_PRETRAINED_MODEL_ARCHIVE_LIST = [ "susnato/ernie-m-base_pytorch", "susnato/ernie-m-large_pytorch", - # See all ErnieM models at https://huggingface.co/models?filter=ernie_m + # See all ErnieM models at https://hf-mirror.com/models?filter=ernie_m ] diff --git a/mindnlp/transformers/models/ernie_m/modeling_graph_ernie_m.py b/mindnlp/transformers/models/ernie_m/modeling_graph_ernie_m.py index daab91d32..a23bb917e 100644 --- a/mindnlp/transformers/models/ernie_m/modeling_graph_ernie_m.py +++ b/mindnlp/transformers/models/ernie_m/modeling_graph_ernie_m.py @@ -38,7 +38,7 @@ ERNIE_M_PRETRAINED_MODEL_ARCHIVE_LIST = [ "susnato/ernie-m-base_pytorch", "susnato/ernie-m-large_pytorch", - # See all ErnieM models at https://huggingface.co/models?filter=ernie_m + # See all ErnieM models at https://hf-mirror.com/models?filter=ernie_m ] diff --git a/mindnlp/transformers/models/ernie_m/tokenization_ernie_m.py b/mindnlp/transformers/models/ernie_m/tokenization_ernie_m.py index 3523e2ecf..6043555a8 100644 --- a/mindnlp/transformers/models/ernie_m/tokenization_ernie_m.py +++ b/mindnlp/transformers/models/ernie_m/tokenization_ernie_m.py @@ -40,12 +40,12 @@ PRETRAINED_VOCAB_FILES_MAP = { "vocab_file": { - "ernie-m-base": "https://huggingface.co/susnato/ernie-m-base_pytorch/blob/main/vocab.txt", - "ernie-m-large": "https://huggingface.co/susnato/ernie-m-base_pytorch/blob/main/vocab.txt", + "ernie-m-base": "https://hf-mirror.com/susnato/ernie-m-base_pytorch/blob/main/vocab.txt", + "ernie-m-large": "https://hf-mirror.com/susnato/ernie-m-base_pytorch/blob/main/vocab.txt", }, "sentencepiece_model_file": { - "ernie-m-base": "https://huggingface.co/susnato/ernie-m-base_pytorch/blob/main/sentencepiece.bpe.model", - "ernie-m-large": "https://huggingface.co/susnato/ernie-m-base_pytorch/blob/main/sentencepiece.bpe.model", + "ernie-m-base": "https://hf-mirror.com/susnato/ernie-m-base_pytorch/blob/main/sentencepiece.bpe.model", + "ernie-m-large": "https://hf-mirror.com/susnato/ernie-m-base_pytorch/blob/main/sentencepiece.bpe.model", }, } diff --git a/mindnlp/transformers/models/esm/configuration_esm.py b/mindnlp/transformers/models/esm/configuration_esm.py index 8d7bd9608..99d9fcc63 100644 --- a/mindnlp/transformers/models/esm/configuration_esm.py +++ b/mindnlp/transformers/models/esm/configuration_esm.py @@ -26,8 +26,8 @@ # TODO Update this ESM_PRETRAINED_CONFIG_ARCHIVE_MAP = { - "facebook/esm-1b": "https://huggingface.co/facebook/esm-1b/resolve/main/config.json", - # See all ESM models at https://huggingface.co/models?filter=esm + "facebook/esm-1b": "https://hf-mirror.com/facebook/esm-1b/resolve/main/config.json", + # See all ESM models at https://hf-mirror.com/models?filter=esm } @@ -36,7 +36,7 @@ class EsmConfig(PretrainedConfig): This is the configuration class to store the configuration of a [`ESMModel`]. It is used to instantiate a ESM model according to the specified arguments, defining the model architecture. Instantiating a configuration with the defaults will yield a similar configuration to that of the ESM - [facebook/esm-1b](https://huggingface.co/facebook/esm-1b) architecture. + [facebook/esm-1b](https://hf-mirror.com/facebook/esm-1b) architecture. Configuration objects inherit from [`PretrainedConfig`] and can be used to control the model outputs. Read the documentation from [`PretrainedConfig`] for more information. diff --git a/mindnlp/transformers/models/esm/modeling_esm.py b/mindnlp/transformers/models/esm/modeling_esm.py index 19a60a766..8a1775ac0 100644 --- a/mindnlp/transformers/models/esm/modeling_esm.py +++ b/mindnlp/transformers/models/esm/modeling_esm.py @@ -45,7 +45,7 @@ "facebook/esm2_t6_8M_UR50D", "facebook/esm2_t12_35M_UR50D", # This is not a complete list of all ESM models! - # See all ESM models at https://huggingface.co/models?filter=esm + # See all ESM models at https://hf-mirror.com/models?filter=esm ] @@ -88,7 +88,7 @@ def average_product_correct(x): class RotaryEmbedding(nn.Cell): """ Rotary position embeddings based on those in - [RoFormer](https://huggingface.co/docs/transformers/model_doc/roformer). Query and keys are transformed by rotation + [RoFormer](https://hf-mirror.com/docs/transformers/model_doc/roformer). Query and keys are transformed by rotation matrices which depend on their relative positions. """ diff --git a/mindnlp/transformers/models/esm/tokenization_esm.py b/mindnlp/transformers/models/esm/tokenization_esm.py index 950f3a60a..94da5fd8a 100644 --- a/mindnlp/transformers/models/esm/tokenization_esm.py +++ b/mindnlp/transformers/models/esm/tokenization_esm.py @@ -27,8 +27,8 @@ PRETRAINED_VOCAB_FILES_MAP = { "vocab_file": { - "facebook/esm2_t6_8M_UR50D": "https://huggingface.co/facebook/esm2_t6_8M_UR50D/resolve/main/vocab.txt", - "facebook/esm2_t12_35M_UR50D": "https://huggingface.co/facebook/esm2_t12_35M_UR50D/resolve/main/vocab.txt", + "facebook/esm2_t6_8M_UR50D": "https://hf-mirror.com/facebook/esm2_t6_8M_UR50D/resolve/main/vocab.txt", + "facebook/esm2_t12_35M_UR50D": "https://hf-mirror.com/facebook/esm2_t12_35M_UR50D/resolve/main/vocab.txt", }, } diff --git a/mindnlp/transformers/models/falcon/configuration_falcon.py b/mindnlp/transformers/models/falcon/configuration_falcon.py index 77731e9ef..f2a8be674 100644 --- a/mindnlp/transformers/models/falcon/configuration_falcon.py +++ b/mindnlp/transformers/models/falcon/configuration_falcon.py @@ -20,8 +20,8 @@ FALCON_PRETRAINED_CONFIG_ARCHIVE_MAP = { - "tiiuae/falcon-40b": "https://huggingface.co/tiiuae/falcon-40b/resolve/main/config.json", - "tiiuae/falcon-7b": "https://huggingface.co/tiiuae/falcon-7b/resolve/main/config.json", + "tiiuae/falcon-40b": "https://hf-mirror.com/tiiuae/falcon-40b/resolve/main/config.json", + "tiiuae/falcon-7b": "https://hf-mirror.com/tiiuae/falcon-7b/resolve/main/config.json", } logger = logging.get_logger(__name__) diff --git a/mindnlp/transformers/models/gemma/configuration_gemma.py b/mindnlp/transformers/models/gemma/configuration_gemma.py index 4566ee1a2..ff87fd1af 100644 --- a/mindnlp/transformers/models/gemma/configuration_gemma.py +++ b/mindnlp/transformers/models/gemma/configuration_gemma.py @@ -30,7 +30,7 @@ class GemmaConfig(PretrainedConfig): model according to the specified arguments, defining the model architecture. Instantiating a configuration with the defaults will yield a similar configuration to that of the Gemma-7B. - e.g. [google/gemma-7b](https://huggingface.co/google/gemma-7b) + e.g. [google/gemma-7b](https://hf-mirror.com/google/gemma-7b) Configuration objects inherit from [`PretrainedConfig`] and can be used to control the model outputs. Read the documentation from [`PretrainedConfig`] for more information. diff --git a/mindnlp/transformers/models/gemma/tokenization_gemma_fast.py b/mindnlp/transformers/models/gemma/tokenization_gemma_fast.py index c5b237637..996bb8ce3 100644 --- a/mindnlp/transformers/models/gemma/tokenization_gemma_fast.py +++ b/mindnlp/transformers/models/gemma/tokenization_gemma_fast.py @@ -50,7 +50,7 @@ class GemmaTokenizerFast(PreTrainedTokenizerFast): If you want to change the `bos_token` or the `eos_token`, make sure to specify them when initializing the model, or call `tokenizer.update_post_processor()` to make sure that the post-processing is correctly done (otherwise the values of the first token and final token of an encoded sequence will not be correct). For more details, checkout - [post-processors] (https://huggingface.co/docs/tokenizers/api/post-processors) documentation. + [post-processors] (https://hf-mirror.com/docs/tokenizers/api/post-processors) documentation. This tokenizer inherits from [`PreTrainedTokenizerFast`] which contains most of the main methods. Users should diff --git a/mindnlp/transformers/models/gpt/configuration_gpt.py b/mindnlp/transformers/models/gpt/configuration_gpt.py index 111941a71..2fc34acfd 100644 --- a/mindnlp/transformers/models/gpt/configuration_gpt.py +++ b/mindnlp/transformers/models/gpt/configuration_gpt.py @@ -21,7 +21,7 @@ logger = logging.get_logger(__name__) -OPENAI_GPT_PRETRAINED_CONFIG_ARCHIVE_MAP = {"openai-gpt": "https://huggingface.co/openai-gpt/resolve/main/config.json"} +OPENAI_GPT_PRETRAINED_CONFIG_ARCHIVE_MAP = {"openai-gpt": "https://hf-mirror.com/openai-gpt/resolve/main/config.json"} class GPTConfig(PretrainedConfig): @@ -29,7 +29,7 @@ class GPTConfig(PretrainedConfig): This is the configuration class to store the configuration of a [`OpenAIGPTModel`] or a [`TFOpenAIGPTModel`]. It is used to instantiate a GPT model according to the specified arguments, defining the model architecture. Instantiating a configuration with the defaults will yield a similar configuration to that of the GPT - [openai-gpt](https://huggingface.co/openai-gpt) architecture from OpenAI. + [openai-gpt](https://hf-mirror.com/openai-gpt) architecture from OpenAI. Configuration objects inherit from [`PretrainedConfig`] and can be used to control the model outputs. Read the documentation from [`PretrainedConfig`] for more information. diff --git a/mindnlp/transformers/models/gpt/modeling_gpt.py b/mindnlp/transformers/models/gpt/modeling_gpt.py index c98053f2d..499fa13f9 100644 --- a/mindnlp/transformers/models/gpt/modeling_gpt.py +++ b/mindnlp/transformers/models/gpt/modeling_gpt.py @@ -40,7 +40,7 @@ OPENAI_GPT_PRETRAINED_MODEL_ARCHIVE_LIST = [ "openai-gpt", - # See all OpenAI GPT models at https://huggingface.co/models?filter=openai-gpt + # See all OpenAI GPT models at https://hf-mirror.com/models?filter=openai-gpt ] diff --git a/mindnlp/transformers/models/gpt/tokenization_gpt.py b/mindnlp/transformers/models/gpt/tokenization_gpt.py index 7446088bb..caaa78832 100644 --- a/mindnlp/transformers/models/gpt/tokenization_gpt.py +++ b/mindnlp/transformers/models/gpt/tokenization_gpt.py @@ -32,8 +32,8 @@ } PRETRAINED_VOCAB_FILES_MAP = { - "vocab_file": {"openai-gpt": "https://huggingface.co/openai-gpt/resolve/main/vocab.json"}, - "merges_file": {"openai-gpt": "https://huggingface.co/openai-gpt/resolve/main/merges.txt"}, + "vocab_file": {"openai-gpt": "https://hf-mirror.com/openai-gpt/resolve/main/vocab.json"}, + "merges_file": {"openai-gpt": "https://hf-mirror.com/openai-gpt/resolve/main/merges.txt"}, } PRETRAINED_POSITIONAL_EMBEDDINGS_SIZES = { diff --git a/mindnlp/transformers/models/gpt/tokenization_gpt_fast.py b/mindnlp/transformers/models/gpt/tokenization_gpt_fast.py index c576f3ff5..5e5520edf 100644 --- a/mindnlp/transformers/models/gpt/tokenization_gpt_fast.py +++ b/mindnlp/transformers/models/gpt/tokenization_gpt_fast.py @@ -27,9 +27,9 @@ VOCAB_FILES_NAMES = {"vocab_file": "vocab.json", "merges_file": "merges.txt", "tokenizer_file": "tokenizer.json"} PRETRAINED_VOCAB_FILES_MAP = { - "vocab_file": {"openai-gpt": "https://huggingface.co/openai-gpt/resolve/main/vocab.json"}, - "merges_file": {"openai-gpt": "https://huggingface.co/openai-gpt/resolve/main/merges.txt"}, - "tokenizer_file": {"openai-gpt": "https://huggingface.co/openai-gpt/resolve/main/tokenizer.json"}, + "vocab_file": {"openai-gpt": "https://hf-mirror.com/openai-gpt/resolve/main/vocab.json"}, + "merges_file": {"openai-gpt": "https://hf-mirror.com/openai-gpt/resolve/main/merges.txt"}, + "tokenizer_file": {"openai-gpt": "https://hf-mirror.com/openai-gpt/resolve/main/tokenizer.json"}, } PRETRAINED_POSITIONAL_EMBEDDINGS_SIZES = { diff --git a/mindnlp/transformers/models/gpt2/configuration_gpt2.py b/mindnlp/transformers/models/gpt2/configuration_gpt2.py index e1fec7997..9eb41b24f 100644 --- a/mindnlp/transformers/models/gpt2/configuration_gpt2.py +++ b/mindnlp/transformers/models/gpt2/configuration_gpt2.py @@ -21,11 +21,11 @@ logger = logging.get_logger(__name__) GPT2_PRETRAINED_CONFIG_ARCHIVE_MAP = { - "gpt2": "https://huggingface.co/gpt2/resolve/main/config.json", - "gpt2-medium": "https://huggingface.co/gpt2-medium/resolve/main/config.json", - "gpt2-large": "https://huggingface.co/gpt2-large/resolve/main/config.json", - "gpt2-xl": "https://huggingface.co/gpt2-xl/resolve/main/config.json", - "distilgpt2": "https://huggingface.co/distilgpt2/resolve/main/config.json", + "gpt2": "https://hf-mirror.com/gpt2/resolve/main/config.json", + "gpt2-medium": "https://hf-mirror.com/gpt2-medium/resolve/main/config.json", + "gpt2-large": "https://hf-mirror.com/gpt2-large/resolve/main/config.json", + "gpt2-xl": "https://hf-mirror.com/gpt2-xl/resolve/main/config.json", + "distilgpt2": "https://hf-mirror.com/distilgpt2/resolve/main/config.json", } @@ -34,7 +34,7 @@ class GPT2Config(PretrainedConfig): This is the configuration class to store the configuration of a [`GPT2Model`] or a [`TFGPT2Model`]. It is used to instantiate a GPT-2 model according to the specified arguments, defining the model architecture. Instantiating a configuration with the defaults will yield a similar configuration to that of the GPT-2 - [gpt2](https://huggingface.co/gpt2) architecture. + [gpt2](https://hf-mirror.com/gpt2) architecture. Configuration objects inherit from [`PretrainedConfig`] and can be used to control the model outputs. Read the documentation from [`PretrainedConfig`] for more information. diff --git a/mindnlp/transformers/models/gpt2/modeling_gpt2.py b/mindnlp/transformers/models/gpt2/modeling_gpt2.py index b972b1cfe..929694f90 100644 --- a/mindnlp/transformers/models/gpt2/modeling_gpt2.py +++ b/mindnlp/transformers/models/gpt2/modeling_gpt2.py @@ -50,7 +50,7 @@ "gpt2-large", "gpt2-xl", "distilgpt2", - # See all GPT-2 models at https://huggingface.co/models?filter=gpt2 + # See all GPT-2 models at https://hf-mirror.com/models?filter=gpt2 ] diff --git a/mindnlp/transformers/models/gpt2/tokenization_gpt2.py b/mindnlp/transformers/models/gpt2/tokenization_gpt2.py index 3d0176789..b35b4df40 100644 --- a/mindnlp/transformers/models/gpt2/tokenization_gpt2.py +++ b/mindnlp/transformers/models/gpt2/tokenization_gpt2.py @@ -35,18 +35,18 @@ PRETRAINED_VOCAB_FILES_MAP = { "vocab_file": { - "gpt2": "https://huggingface.co/gpt2/resolve/main/vocab.json", - "gpt2-medium": "https://huggingface.co/gpt2-medium/resolve/main/vocab.json", - "gpt2-large": "https://huggingface.co/gpt2-large/resolve/main/vocab.json", - "gpt2-xl": "https://huggingface.co/gpt2-xl/resolve/main/vocab.json", - "distilgpt2": "https://huggingface.co/distilgpt2/resolve/main/vocab.json", + "gpt2": "https://hf-mirror.com/gpt2/resolve/main/vocab.json", + "gpt2-medium": "https://hf-mirror.com/gpt2-medium/resolve/main/vocab.json", + "gpt2-large": "https://hf-mirror.com/gpt2-large/resolve/main/vocab.json", + "gpt2-xl": "https://hf-mirror.com/gpt2-xl/resolve/main/vocab.json", + "distilgpt2": "https://hf-mirror.com/distilgpt2/resolve/main/vocab.json", }, "merges_file": { - "gpt2": "https://huggingface.co/gpt2/resolve/main/merges.txt", - "gpt2-medium": "https://huggingface.co/gpt2-medium/resolve/main/merges.txt", - "gpt2-large": "https://huggingface.co/gpt2-large/resolve/main/merges.txt", - "gpt2-xl": "https://huggingface.co/gpt2-xl/resolve/main/merges.txt", - "distilgpt2": "https://huggingface.co/distilgpt2/resolve/main/merges.txt", + "gpt2": "https://hf-mirror.com/gpt2/resolve/main/merges.txt", + "gpt2-medium": "https://hf-mirror.com/gpt2-medium/resolve/main/merges.txt", + "gpt2-large": "https://hf-mirror.com/gpt2-large/resolve/main/merges.txt", + "gpt2-xl": "https://hf-mirror.com/gpt2-xl/resolve/main/merges.txt", + "distilgpt2": "https://hf-mirror.com/distilgpt2/resolve/main/merges.txt", }, } @@ -366,7 +366,7 @@ def default_chat_template(self): "\nNo chat template is defined for this tokenizer - using the default template " f"for the {self.__class__.__name__} class. If the default is not appropriate for " "your model, please set `tokenizer.chat_template` to an appropriate template. " - "See https://huggingface.co/docs/transformers/main/chat_templating for more information.\n" + "See https://hf-mirror.com/docs/transformers/main/chat_templating for more information.\n" ) return "{% for message in messages %}" "{{ message.content }}{{ eos_token }}" "{% endfor %}" diff --git a/mindnlp/transformers/models/gpt2/tokenization_gpt2_fast.py b/mindnlp/transformers/models/gpt2/tokenization_gpt2_fast.py index f401e6611..bd754b67c 100644 --- a/mindnlp/transformers/models/gpt2/tokenization_gpt2_fast.py +++ b/mindnlp/transformers/models/gpt2/tokenization_gpt2_fast.py @@ -32,25 +32,25 @@ PRETRAINED_VOCAB_FILES_MAP = { "vocab_file": { - "gpt2": "https://huggingface.co/gpt2/resolve/main/vocab.json", - "gpt2-medium": "https://huggingface.co/gpt2-medium/resolve/main/vocab.json", - "gpt2-large": "https://huggingface.co/gpt2-large/resolve/main/vocab.json", - "gpt2-xl": "https://huggingface.co/gpt2-xl/resolve/main/vocab.json", - "distilgpt2": "https://huggingface.co/distilgpt2/resolve/main/vocab.json", + "gpt2": "https://hf-mirror.com/gpt2/resolve/main/vocab.json", + "gpt2-medium": "https://hf-mirror.com/gpt2-medium/resolve/main/vocab.json", + "gpt2-large": "https://hf-mirror.com/gpt2-large/resolve/main/vocab.json", + "gpt2-xl": "https://hf-mirror.com/gpt2-xl/resolve/main/vocab.json", + "distilgpt2": "https://hf-mirror.com/distilgpt2/resolve/main/vocab.json", }, "merges_file": { - "gpt2": "https://huggingface.co/gpt2/resolve/main/merges.txt", - "gpt2-medium": "https://huggingface.co/gpt2-medium/resolve/main/merges.txt", - "gpt2-large": "https://huggingface.co/gpt2-large/resolve/main/merges.txt", - "gpt2-xl": "https://huggingface.co/gpt2-xl/resolve/main/merges.txt", - "distilgpt2": "https://huggingface.co/distilgpt2/resolve/main/merges.txt", + "gpt2": "https://hf-mirror.com/gpt2/resolve/main/merges.txt", + "gpt2-medium": "https://hf-mirror.com/gpt2-medium/resolve/main/merges.txt", + "gpt2-large": "https://hf-mirror.com/gpt2-large/resolve/main/merges.txt", + "gpt2-xl": "https://hf-mirror.com/gpt2-xl/resolve/main/merges.txt", + "distilgpt2": "https://hf-mirror.com/distilgpt2/resolve/main/merges.txt", }, "tokenizer_file": { - "gpt2": "https://huggingface.co/gpt2/resolve/main/tokenizer.json", - "gpt2-medium": "https://huggingface.co/gpt2-medium/resolve/main/tokenizer.json", - "gpt2-large": "https://huggingface.co/gpt2-large/resolve/main/tokenizer.json", - "gpt2-xl": "https://huggingface.co/gpt2-xl/resolve/main/tokenizer.json", - "distilgpt2": "https://huggingface.co/distilgpt2/resolve/main/tokenizer.json", + "gpt2": "https://hf-mirror.com/gpt2/resolve/main/tokenizer.json", + "gpt2-medium": "https://hf-mirror.com/gpt2-medium/resolve/main/tokenizer.json", + "gpt2-large": "https://hf-mirror.com/gpt2-large/resolve/main/tokenizer.json", + "gpt2-xl": "https://hf-mirror.com/gpt2-xl/resolve/main/tokenizer.json", + "distilgpt2": "https://hf-mirror.com/distilgpt2/resolve/main/tokenizer.json", }, } @@ -185,7 +185,7 @@ def default_chat_template(self): "\nNo chat template is defined for this tokenizer - using the default template " f"for the {self.__class__.__name__} class. If the default is not appropriate for " "your model, please set `tokenizer.chat_template` to an appropriate template. " - "See https://huggingface.co/docs/transformers/main/chat_templating for more information.\n" + "See https://hf-mirror.com/docs/transformers/main/chat_templating for more information.\n" ) return "{% for message in messages %}" "{{ message.content }}{{ eos_token }}" "{% endfor %}" diff --git a/mindnlp/transformers/models/gpt_neox/configuration_gpt_neox.py b/mindnlp/transformers/models/gpt_neox/configuration_gpt_neox.py index 1236a05d5..edeaeccbc 100644 --- a/mindnlp/transformers/models/gpt_neox/configuration_gpt_neox.py +++ b/mindnlp/transformers/models/gpt_neox/configuration_gpt_neox.py @@ -22,8 +22,8 @@ GPT_NEOX_PRETRAINED_CONFIG_ARCHIVE_MAP = { - "EleutherAI/gpt-neox-20b": "https://huggingface.co/EleutherAI/gpt-neox-20b/resolve/main/config.json", - # See all GPTNeoX models at https://huggingface.co/models?filter=gpt_neox + "EleutherAI/gpt-neox-20b": "https://hf-mirror.com/EleutherAI/gpt-neox-20b/resolve/main/config.json", + # See all GPTNeoX models at https://hf-mirror.com/models?filter=gpt_neox } diff --git a/mindnlp/transformers/models/gpt_neox/modeling_gpt_neox.py b/mindnlp/transformers/models/gpt_neox/modeling_gpt_neox.py index a88efdb7d..c5d57446e 100644 --- a/mindnlp/transformers/models/gpt_neox/modeling_gpt_neox.py +++ b/mindnlp/transformers/models/gpt_neox/modeling_gpt_neox.py @@ -46,7 +46,7 @@ GPT_NEOX_PRETRAINED_MODEL_ARCHIVE_LIST = [ "EleutherAI/gpt-neox-20b", - # See all GPTNeoX models at https://huggingface.co/models?filter=gpt_neox + # See all GPTNeoX models at https://hf-mirror.com/models?filter=gpt_neox ] diff --git a/mindnlp/transformers/models/gpt_neox/tokenization_gpt_neox_fast.py b/mindnlp/transformers/models/gpt_neox/tokenization_gpt_neox_fast.py index e85d983ad..b48da7b61 100644 --- a/mindnlp/transformers/models/gpt_neox/tokenization_gpt_neox_fast.py +++ b/mindnlp/transformers/models/gpt_neox/tokenization_gpt_neox_fast.py @@ -28,7 +28,7 @@ PRETRAINED_VOCAB_FILES_MAP = { "tokenizer_file": { - "EleutherAI/gpt-neox-20b": "https://huggingface.co/EleutherAI/gpt-neox-20b/resolve/main/tokenizer.json", + "EleutherAI/gpt-neox-20b": "https://hf-mirror.com/EleutherAI/gpt-neox-20b/resolve/main/tokenizer.json", }, } @@ -139,7 +139,7 @@ def default_chat_template(self): "\nNo chat template is defined for this tokenizer - using the default template " f"for the {self.__class__.__name__} class. If the default is not appropriate for " "your model, please set `tokenizer.chat_template` to an appropriate template. " - "See https://huggingface.co/docs/transformers/main/chat_templating for more information.\n" + "See https://hf-mirror.com/docs/transformers/main/chat_templating for more information.\n" ) return "{% for message in messages %}" "{{ message.content }}{{ eos_token }}" "{% endfor %}" diff --git a/mindnlp/transformers/models/graphormer/configuration_graphormer.py b/mindnlp/transformers/models/graphormer/configuration_graphormer.py index 792eee3bc..ef9a096cf 100644 --- a/mindnlp/transformers/models/graphormer/configuration_graphormer.py +++ b/mindnlp/transformers/models/graphormer/configuration_graphormer.py @@ -23,8 +23,8 @@ GRAPHORMER_PRETRAINED_CONFIG_ARCHIVE_MAP = { # pcqm4mv1 now deprecated - "graphormer-base": "https://huggingface.co/clefourrier/graphormer-base-pcqm4mv2/resolve/main/config.json", - # See all Graphormer models at https://huggingface.co/models?filter=graphormer + "graphormer-base": "https://hf-mirror.com/clefourrier/graphormer-base-pcqm4mv2/resolve/main/config.json", + # See all Graphormer models at https://hf-mirror.com/models?filter=graphormer } @@ -33,7 +33,7 @@ class GraphormerConfig(PretrainedConfig): This is the configuration class to store the configuration of a [`~GraphormerModel`]. It is used to instantiate an Graphormer model according to the specified arguments, defining the model architecture. Instantiating a configuration with the defaults will yield a similar configuration to that of the Graphormer - [graphormer-base-pcqm4mv1](https://huggingface.co/graphormer-base-pcqm4mv1) architecture. + [graphormer-base-pcqm4mv1](https://hf-mirror.com/graphormer-base-pcqm4mv1) architecture. Configuration objects inherit from [`PretrainedConfig`] and can be used to control the model outputs. Read the documentation from [`PretrainedConfig`] for more information. diff --git a/mindnlp/transformers/models/graphormer/modeling_graphormer.py b/mindnlp/transformers/models/graphormer/modeling_graphormer.py index 0e9a82ab9..499ab8c34 100644 --- a/mindnlp/transformers/models/graphormer/modeling_graphormer.py +++ b/mindnlp/transformers/models/graphormer/modeling_graphormer.py @@ -47,7 +47,7 @@ GRAPHORMER_PRETRAINED_MODEL_ARCHIVE_LIST = [ "clefourrier/graphormer-base-pcqm4mv1", "clefourrier/graphormer-base-pcqm4mv2", - # See all Graphormer models at https://huggingface.co/models?filter=graphormer + # See all Graphormer models at https://hf-mirror.com/models?filter=graphormer ] diff --git a/mindnlp/transformers/models/hubert/configuration_hubert.py b/mindnlp/transformers/models/hubert/configuration_hubert.py index 025c4b651..e7ecb9980 100644 --- a/mindnlp/transformers/models/hubert/configuration_hubert.py +++ b/mindnlp/transformers/models/hubert/configuration_hubert.py @@ -28,8 +28,8 @@ logger = logging.get_logger(__name__) HUBERT_PRETRAINED_CONFIG_ARCHIVE_MAP = { - "facebook/hubert-base-ls960": "https://huggingface.co/facebook/hubert-base-ls960/resolve/main/config.json", - # See all Hubert models at https://huggingface.co/models?filter=hubert + "facebook/hubert-base-ls960": "https://hf-mirror.com/facebook/hubert-base-ls960/resolve/main/config.json", + # See all Hubert models at https://hf-mirror.com/models?filter=hubert } @@ -38,7 +38,7 @@ class HubertConfig(PretrainedConfig): This is the configuration class to store the configuration of a [`HubertModel`]. It is used to instantiate an Hubert model according to the specified arguments, defining the model architecture. Instantiating a configuration with the defaults will yield a similar configuration to that of the Hubert - [facebook/hubert-base-ls960](https://huggingface.co/facebook/hubert-base-ls960) architecture. + [facebook/hubert-base-ls960](https://hf-mirror.com/facebook/hubert-base-ls960) architecture. Configuration objects inherit from [`PretrainedConfig`] and can be used to control the model outputs. Read the documentation from [`PretrainedConfig`] for more information. diff --git a/mindnlp/transformers/models/hubert/modeling_hubert.py b/mindnlp/transformers/models/hubert/modeling_hubert.py index e7d651c50..ac0351624 100644 --- a/mindnlp/transformers/models/hubert/modeling_hubert.py +++ b/mindnlp/transformers/models/hubert/modeling_hubert.py @@ -47,7 +47,7 @@ HUBERT_PRETRAINED_MODEL_ARCHIVE_LIST = [ "facebook/hubert-base-ls960", - # See all Hubert models at https://huggingface.co/models?filter=hubert + # See all Hubert models at https://hf-mirror.com/models?filter=hubert ] diff --git a/mindnlp/transformers/models/layoutlm/configuration_layoutlm.py b/mindnlp/transformers/models/layoutlm/configuration_layoutlm.py index 175b8d44e..5e5fc0f5f 100644 --- a/mindnlp/transformers/models/layoutlm/configuration_layoutlm.py +++ b/mindnlp/transformers/models/layoutlm/configuration_layoutlm.py @@ -14,10 +14,10 @@ LAYOUTLM_PRETRAINED_CONFIG_ARCHIVE_MAP = { "microsoft/layoutlm-base-uncased": ( - "https://huggingface.co/microsoft/layoutlm-base-uncased/resolve/main/config.json" + "https://hf-mirror.com/microsoft/layoutlm-base-uncased/resolve/main/config.json" ), "microsoft/layoutlm-large-uncased": ( - "https://huggingface.co/microsoft/layoutlm-large-uncased/resolve/main/config.json" + "https://hf-mirror.com/microsoft/layoutlm-large-uncased/resolve/main/config.json" ), } diff --git a/mindnlp/transformers/models/layoutlm/modeling_layoutlm.py b/mindnlp/transformers/models/layoutlm/modeling_layoutlm.py index afc35a72c..267509cb0 100644 --- a/mindnlp/transformers/models/layoutlm/modeling_layoutlm.py +++ b/mindnlp/transformers/models/layoutlm/modeling_layoutlm.py @@ -12,10 +12,7 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. - """ MindSpore LayoutLM model.""" - - import math from typing import Optional, Tuple, Union import numpy as np diff --git a/mindnlp/transformers/models/layoutlm/tokenization_layoutlm.py b/mindnlp/transformers/models/layoutlm/tokenization_layoutlm.py index 6a2f41ea0..a18674cfd 100644 --- a/mindnlp/transformers/models/layoutlm/tokenization_layoutlm.py +++ b/mindnlp/transformers/models/layoutlm/tokenization_layoutlm.py @@ -30,10 +30,10 @@ PRETRAINED_VOCAB_FILES_MAP = { "vocab_file": { "microsoft/layoutlm-base-uncased": ( - "https://huggingface.co/microsoft/layoutlm-base-uncased/resolve/main/vocab.txt" + "https://hf-mirror.com/microsoft/layoutlm-base-uncased/resolve/main/vocab.txt" ), "microsoft/layoutlm-large-uncased": ( - "https://huggingface.co/microsoft/layoutlm-large-uncased/resolve/main/vocab.txt" + "https://hf-mirror.com/microsoft/layoutlm-large-uncased/resolve/main/vocab.txt" ), } } diff --git a/mindnlp/transformers/models/layoutlm/tokenization_layoutlm_fast.py b/mindnlp/transformers/models/layoutlm/tokenization_layoutlm_fast.py index 1c2c5d39d..d420e3f26 100644 --- a/mindnlp/transformers/models/layoutlm/tokenization_layoutlm_fast.py +++ b/mindnlp/transformers/models/layoutlm/tokenization_layoutlm_fast.py @@ -31,18 +31,18 @@ PRETRAINED_VOCAB_FILES_MAP = { "vocab_file": { "microsoft/layoutlm-base-uncased": ( - "https://huggingface.co/microsoft/layoutlm-base-uncased/resolve/main/vocab.txt" + "https://hf-mirror.com/microsoft/layoutlm-base-uncased/resolve/main/vocab.txt" ), "microsoft/layoutlm-large-uncased": ( - "https://huggingface.co/microsoft/layoutlm-large-uncased/resolve/main/vocab.txt" + "https://hf-mirror.com/microsoft/layoutlm-large-uncased/resolve/main/vocab.txt" ), }, "tokenizer_file": { "microsoft/layoutlm-base-uncased": ( - "https://huggingface.co/microsoft/layoutlm-base-uncased/resolve/main/tokenizer.json" + "https://hf-mirror.com/microsoft/layoutlm-base-uncased/resolve/main/tokenizer.json" ), "microsoft/layoutlm-large-uncased": ( - "https://huggingface.co/microsoft/layoutlm-large-uncased/resolve/main/tokenizer.json" + "https://hf-mirror.com/microsoft/layoutlm-large-uncased/resolve/main/tokenizer.json" ), }, } diff --git a/mindnlp/transformers/models/layoutlmv2/configuration_layoutlmv2.py b/mindnlp/transformers/models/layoutlmv2/configuration_layoutlmv2.py index 98271cfe2..c4344a043 100644 --- a/mindnlp/transformers/models/layoutlmv2/configuration_layoutlmv2.py +++ b/mindnlp/transformers/models/layoutlmv2/configuration_layoutlmv2.py @@ -21,9 +21,9 @@ logger = logging.get_logger(__name__) LAYOUTLMV2_PRETRAINED_CONFIG_ARCHIVE_MAP = { - "layoutlmv2-base-uncased": "https://huggingface.co/microsoft/layoutlmv2-base-uncased/resolve/main/config.json", - "layoutlmv2-large-uncased": "https://huggingface.co/microsoft/layoutlmv2-large-uncased/resolve/main/config.json", - # See all LayoutLMv2 models at https://huggingface.co/models?filter=layoutlmv2 + "layoutlmv2-base-uncased": "https://hf-mirror.com/microsoft/layoutlmv2-base-uncased/resolve/main/config.json", + "layoutlmv2-large-uncased": "https://hf-mirror.com/microsoft/layoutlmv2-large-uncased/resolve/main/config.json", + # See all LayoutLMv2 models at https://hf-mirror.com/models?filter=layoutlmv2 } @@ -35,7 +35,7 @@ class LayoutLMv2Config(PretrainedConfig): This is the configuration class to store the configuration of a [`LayoutLMv2Model`]. It is used to instantiate an LayoutLMv2 model according to the specified arguments, defining the model architecture. Instantiating a configuration with the defaults will yield a similar configuration to that of the LayoutLMv2 - [microsoft/layoutlmv2-base-uncased](https://huggingface.co/microsoft/layoutlmv2-base-uncased) architecture. + [microsoft/layoutlmv2-base-uncased](https://hf-mirror.com/microsoft/layoutlmv2-base-uncased) architecture. Configuration objects inherit from [`PretrainedConfig`] and can be used to control the model outputs. Read the documentation from [`PretrainedConfig`] for more information. @@ -176,44 +176,106 @@ def __init__( self.has_spatial_attention_bias = has_spatial_attention_bias self.has_visual_segment_embedding = has_visual_segment_embedding self.use_visual_backbone = use_visual_backbone - self.visual_backbone_config_args = ( - detectron2_config_args if detectron2_config_args is not None else self.get_default_visual_backbone_config_args() + self.detectron2_config_args = ( + detectron2_config_args if detectron2_config_args is not None else self.get_default_detectron2_config() ) @classmethod - def get_default_visual_backbone_config_args(cls): - """ - Returns: - Dict: Default configuration arguments for the visual backbone. - """ - return Dict({ - "MODEL": { - "BACKBONE": { - "FREEZE_AT": 2, - "DEPTH": 101, - "NORM": "BN", - "NUM_GROUPS": 32, - "WIDTH_PER_GROUP": 8, - "STEM_IN_CHANNELS": 3, - "STEM_OUT_CHANNELS": 64, - "RES2_OUT_CHANNELS": 256, - "STRIDE_IN_1X1": False, - "RES5_DILATION": 1, - "NAME": "resnet101", - "PRETRAINED": True, - "NUM_CLASSES": 1000, - "OUT_FEATURES": ["res2", "res3", "res4", "res5"] - }, - "FPN": { - "FUSE_TYPE": "sum", - "IN_FEATURES": ["res2", "res3", "res4", "res5"], - "NORM": "", - "OUT_CHANNELS": 256 - }, - "PIXEL_MEAN": [103.53, 116.28, 123.675], - "PIXEL_STD": [57.375, 57.12, 58.395] + def get_default_detectron2_config(cls): + return { + "MODEL.MASK_ON": True, + "MODEL.PIXEL_STD": [57.375, 57.120, 58.395], + "MODEL.BACKBONE.NAME": "build_resnet_fpn_backbone", + "MODEL.FPN.IN_FEATURES": ["res2", "res3", "res4", "res5"], + "MODEL.ANCHOR_GENERATOR.SIZES": [[32], [64], [128], [256], [512]], + "MODEL.RPN.IN_FEATURES": ["p2", "p3", "p4", "p5", "p6"], + "MODEL.RPN.PRE_NMS_TOPK_TRAIN": 2000, + "MODEL.RPN.PRE_NMS_TOPK_TEST": 1000, + "MODEL.RPN.POST_NMS_TOPK_TRAIN": 1000, + "MODEL.POST_NMS_TOPK_TEST": 1000, + "MODEL.ROI_HEADS.NAME": "StandardROIHeads", + "MODEL.ROI_HEADS.NUM_CLASSES": 5, + "MODEL.ROI_HEADS.IN_FEATURES": ["p2", "p3", "p4", "p5"], + "MODEL.ROI_BOX_HEAD.NAME": "FastRCNNConvFCHead", + "MODEL.ROI_BOX_HEAD.NUM_FC": 2, + "MODEL.ROI_BOX_HEAD.POOLER_RESOLUTION": 14, + "MODEL.ROI_MASK_HEAD.NAME": "MaskRCNNConvUpsampleHead", + "MODEL.ROI_MASK_HEAD.NUM_CONV": 4, + "MODEL.ROI_MASK_HEAD.POOLER_RESOLUTION": 7, + "MODEL.RESNETS.DEPTH": 101, + "MODEL.RESNETS.SIZES": [[32], [64], [128], [256], [512]], + "MODEL.RESNETS.ASPECT_RATIOS": [[0.5, 1.0, 2.0]], + "MODEL.RESNETS.OUT_FEATURES": ["res2", "res3", "res4", "res5"], + "MODEL.RESNETS.NUM_GROUPS": 32, + "MODEL.RESNETS.WIDTH_PER_GROUP": 8, + "MODEL.RESNETS.STRIDE_IN_1X1": False, + } + + def get_detectron2_config(self): + detectron2_config = Dict( + { + "MODEL": { + "MASK_ON": True, + "PIXEL_MEAN": [103.53, 116.28, 123.675], + "PIXEL_STD": [57.375, 57.120, 58.395], + "BACKBONE": {"NAME": "build_resnet_fpn_backbone"}, + "FPN": { + "FUSE_TYPE": "sum", + "IN_FEATURES": ["res2", "res3", "res4", "res5"], + "NORM": "BN", + "OUT_CHANNELS": 256 + }, + "ANCHOR_GENERATOR": {"SIZES": [[32], [64], [128], [256], [512]]}, + "RPN": { + "IN_FEATURES": ["p2", "p3", "p4", "p5", "p6"], + "PRE_NMS_TOPK_TRAIN": 2000, + "PRE_NMS_TOPK_TEST": 1000, + "POST_NMS_TOPK_TRAIN": 1000, + }, + "POST_NMS_TOPK_TEST": 1000, + "ROI_HEADS": { + "NAME": "StandardROIHeads", + "NUM_CLASSES": 5, + "IN_FEATURES": ["p2", "p3", "p4", "p5"], + }, + "ROI_BOX_HEAD": { + "NAME": "FastRCNNConvFCHead", + "NUM_FC": 2, + "POOLER_RESOLUTION": 14, + }, + "ROI_MASK_HEAD": { + "NAME": "MaskRCNNConvUpsampleHead", + "NUM_CONV": 4, + "POOLER_RESOLUTION": 7, + }, + "RESNETS": { + "DEPTH": 101, + "SIZES": [[32], [64], [128], [256], [512]], + "ASPECT_RATIOS": [[0.5, 1.0, 2.0]], + "FREEZE_AT": 2, + "NORM": "BN", + "NUM_GROUPS": 32, + "WIDTH_PER_GROUP": 8, + "STEM_IN_CHANNELS": 3, + "STEM_OUT_CHANNELS": 64, + "RES2_OUT_CHANNELS": 256, + "STRIDE_IN_1X1": False, + "RES5_DILATION": 1, + "NAME": "resnet101", + "PRETRAINED": True, + "NUM_CLASSES": 1000, + "OUT_FEATURES": ["res2", "res3", "res4", "res5"] + } + } } - }) + ) + for k, v in self.detectron2_config_args.items(): + attributes = k.split(".") + to_set = detectron2_config + for attribute in attributes[:-1]: + to_set = getattr(to_set, attribute) + setattr(to_set, attributes[-1], v) + return detectron2_config __all__ = ["LAYOUTLMV2_PRETRAINED_CONFIG_ARCHIVE_MAP", "LayoutLMv2Config"] diff --git a/mindnlp/transformers/models/layoutlmv2/modeling_layoutlmv2.py b/mindnlp/transformers/models/layoutlmv2/modeling_layoutlmv2.py index 12a1a1daa..f44552dc0 100644 --- a/mindnlp/transformers/models/layoutlmv2/modeling_layoutlmv2.py +++ b/mindnlp/transformers/models/layoutlmv2/modeling_layoutlmv2.py @@ -518,7 +518,7 @@ class LayoutLMv2VisualBackbone(nn.Cell): def __init__(self, config): super(LayoutLMv2VisualBackbone, self).__init__() - self.cfg = config.visual_backbone_config_args + self.cfg = config.get_detectron2_config() self.backbone = build_resnet_fpn_backbone(self.cfg) if len(self.cfg.MODEL.PIXEL_MEAN) != len(self.cfg.MODEL.PIXEL_STD): diff --git a/mindnlp/transformers/models/layoutlmv2/tokenization_layoutlmv2.py b/mindnlp/transformers/models/layoutlmv2/tokenization_layoutlmv2.py index ba9436749..a2c5b6e97 100644 --- a/mindnlp/transformers/models/layoutlmv2/tokenization_layoutlmv2.py +++ b/mindnlp/transformers/models/layoutlmv2/tokenization_layoutlmv2.py @@ -41,10 +41,10 @@ PRETRAINED_VOCAB_FILES_MAP = { "vocab_file": { "microsoft/layoutlmv2-base-uncased": ( - "https://huggingface.co/microsoft/layoutlmv2-base-uncased/resolve/main/vocab.txt" + "https://hf-mirror.com/microsoft/layoutlmv2-base-uncased/resolve/main/vocab.txt" ), "microsoft/layoutlmv2-large-uncased": ( - "https://huggingface.co/microsoft/layoutlmv2-large-uncased/resolve/main/vocab.txt" + "https://hf-mirror.com/microsoft/layoutlmv2-large-uncased/resolve/main/vocab.txt" ), } } diff --git a/mindnlp/transformers/models/layoutlmv2/tokenization_layoutlmv2_fast.py b/mindnlp/transformers/models/layoutlmv2/tokenization_layoutlmv2_fast.py index 6f734c001..6e5acf264 100644 --- a/mindnlp/transformers/models/layoutlmv2/tokenization_layoutlmv2_fast.py +++ b/mindnlp/transformers/models/layoutlmv2/tokenization_layoutlmv2_fast.py @@ -45,12 +45,12 @@ PRETRAINED_VOCAB_FILES_MAP = { "vocab_file": { "microsoft/layoutlmv2-base-uncased": ( - "https://huggingface.co/microsoft/layoutlmv2-base-uncased/resolve/main/vocab.txt" + "https://hf-mirror.com/microsoft/layoutlmv2-base-uncased/resolve/main/vocab.txt" ), }, "tokenizer_file": { "microsoft/layoutlmv2-base-uncased": ( - "https://huggingface.co/microsoft/layoutlmv2-base-uncased/resolve/main/tokenizer.json" + "https://hf-mirror.com/microsoft/layoutlmv2-base-uncased/resolve/main/tokenizer.json" ), }, } diff --git a/mindnlp/transformers/models/layoutlmv2/visual_backbone.py b/mindnlp/transformers/models/layoutlmv2/visual_backbone.py index b6982d1d4..e3ed5fea6 100644 --- a/mindnlp/transformers/models/layoutlmv2/visual_backbone.py +++ b/mindnlp/transformers/models/layoutlmv2/visual_backbone.py @@ -121,7 +121,8 @@ def __init__(self, in_channels, out_channels, *, stride=1, norm="BN"): kernel_size=1, stride=stride, has_bias=False, - norm=nn.BatchNorm2d(out_channels) + norm=nn.BatchNorm2d(out_channels), + pad_mode='valid' ) else: self.shortcut = None @@ -132,6 +133,7 @@ def __init__(self, in_channels, out_channels, *, stride=1, norm="BN"): kernel_size=3, stride=stride, padding=1, + pad_mode='pad', has_bias=False, norm=nn.BatchNorm2d(out_channels) ) @@ -142,6 +144,7 @@ def __init__(self, in_channels, out_channels, *, stride=1, norm="BN"): kernel_size=3, stride=1, padding=1, + pad_mode='pad', has_bias=False, norm=nn.BatchNorm2d(out_channels) ) @@ -205,7 +208,8 @@ def __init__( kernel_size=1, stride=stride, has_bias=False, - norm=norm(out_channels) + norm=norm(out_channels), + pad_mode='valid' ) else: self.shortcut = None @@ -220,7 +224,8 @@ def __init__( kernel_size=1, stride=stride_1x1, has_bias=False, - norm=nn.BatchNorm2d(bottleneck_channels) + norm=nn.BatchNorm2d(bottleneck_channels), + pad_mode='valid' ) self.conv2 = Conv2d( @@ -240,6 +245,7 @@ def __init__( out_channels, kernel_size=1, has_bias=False, + pad_mode='valid', norm=norm(out_channels) ) self.relu = nn.ReLU() @@ -472,21 +478,21 @@ def make_default_stages(depth, block_class=None, **kwargs): def build_resnet_backbone(cfg): stem = BasicStem( - in_channels=cfg.MODEL.BACKBONE.STEM_IN_CHANNELS, - out_channels=cfg.MODEL.BACKBONE.STEM_OUT_CHANNELS, + in_channels=cfg.MODEL.RESNETS.STEM_IN_CHANNELS, + out_channels=cfg.MODEL.RESNETS.STEM_OUT_CHANNELS, ) # fmt: off - norm = cfg.MODEL.BACKBONE.NORM # "BN" - out_features = cfg.MODEL.BACKBONE.OUT_FEATURES - depth = cfg.MODEL.BACKBONE.DEPTH - num_groups = cfg.MODEL.BACKBONE.NUM_GROUPS - width_per_group = cfg.MODEL.BACKBONE.WIDTH_PER_GROUP + norm = cfg.MODEL.RESNETS.NORM # "BN" + out_features = cfg.MODEL.RESNETS.OUT_FEATURES + depth = cfg.MODEL.RESNETS.DEPTH + num_groups = cfg.MODEL.RESNETS.NUM_GROUPS + width_per_group = cfg.MODEL.RESNETS.WIDTH_PER_GROUP bottleneck_channels = num_groups * width_per_group - in_channels = cfg.MODEL.BACKBONE.STEM_OUT_CHANNELS - out_channels = cfg.MODEL.BACKBONE.RES2_OUT_CHANNELS - stride_in_1x1 = cfg.MODEL.BACKBONE.STRIDE_IN_1X1 - res5_dilation = cfg.MODEL.BACKBONE.RES5_DILATION + in_channels = cfg.MODEL.RESNETS.STEM_OUT_CHANNELS + out_channels = cfg.MODEL.RESNETS.RES2_OUT_CHANNELS + stride_in_1x1 = cfg.MODEL.RESNETS.STRIDE_IN_1X1 + res5_dilation = cfg.MODEL.RESNETS.RES5_DILATION # fmt: on assert res5_dilation in {1, 2}, "res5_dilation cannot be {}.".format(res5_dilation) @@ -584,11 +590,9 @@ def __init__(self, lateral_convs = [] output_convs = [] - use_bias = norm == "" for idx, in_channels in enumerate(in_channels_per_feature): - lateral_conv = nn.Conv2d(in_channels, out_channels, kernel_size=1, has_bias=use_bias) - output_conv = nn.Conv2d(out_channels, out_channels, kernel_size=3, padding=1, has_bias=use_bias, - pad_mode='pad') + lateral_conv = nn.Conv2d(in_channels, out_channels, kernel_size=1, has_bias=True, pad_mode='valid') + output_conv = nn.Conv2d(out_channels, out_channels, kernel_size=3, padding=1, has_bias=True, pad_mode='pad') stage = int(math.log2(strides[idx])) setattr(self, "fpn_lateral{}".format(stage), lateral_conv) diff --git a/mindnlp/transformers/models/llama/configuration_llama.py b/mindnlp/transformers/models/llama/configuration_llama.py index 70f043b09..d5917ce73 100644 --- a/mindnlp/transformers/models/llama/configuration_llama.py +++ b/mindnlp/transformers/models/llama/configuration_llama.py @@ -78,7 +78,7 @@ class LlamaConfig(PretrainedConfig): End of stream token id. pretraining_tp (`int`, *optional*, defaults to 1): Experimental feature. Tensor parallelism rank used during pretraining. Please refer to [this - document](https://huggingface.co/docs/transformers/parallelism) to understand more about it. This value is + document](https://hf-mirror.com/docs/transformers/parallelism) to understand more about it. This value is necessary to ensure exact reproducibility of the pretraining results. Please refer to [this issue](https://github.com/pytorch/pytorch/issues/76232). tie_word_embeddings (`bool`, *optional*, defaults to `False`): diff --git a/mindnlp/transformers/models/llama/tokenization_code_llama.py b/mindnlp/transformers/models/llama/tokenization_code_llama.py index d21ee661a..bb91f8328 100644 --- a/mindnlp/transformers/models/llama/tokenization_code_llama.py +++ b/mindnlp/transformers/models/llama/tokenization_code_llama.py @@ -31,10 +31,10 @@ PRETRAINED_VOCAB_FILES_MAP = { "vocab_file": { - "hf-internal-testing/llama-code-tokenizer": "https://huggingface.co/hf-internal-testing/llama-tokenizer/resolve/main/tokenizer.model", + "hf-internal-testing/llama-code-tokenizer": "https://hf-mirror.com/hf-internal-testing/llama-tokenizer/resolve/main/tokenizer.model", }, "tokenizer_file": { - "hf-internal-testing/llama-code-tokenizer": "https://huggingface.co/hf-internal-testing/llama-tokenizer/resolve/main/tokenizer_config.json", + "hf-internal-testing/llama-code-tokenizer": "https://hf-mirror.com/hf-internal-testing/llama-tokenizer/resolve/main/tokenizer_config.json", }, } PRETRAINED_POSITIONAL_EMBEDDINGS_SIZES = { @@ -61,7 +61,7 @@ class CodeLlamaTokenizer(PreTrainedTokenizer): there is no padding token in the original model. The default configuration match that of - [codellama/CodeLlama-7b-Instruct-hf](https://huggingface.co/codellama/CodeLlama-7b-Instruct-hf/blob/main/tokenizer_config.json) + [codellama/CodeLlama-7b-Instruct-hf](https://hf-mirror.com/codellama/CodeLlama-7b-Instruct-hf/blob/main/tokenizer_config.json) which supports prompt infilling. Args: @@ -471,7 +471,7 @@ def default_chat_template(self): "\nNo chat template is defined for this tokenizer - using the default template " f"for the {self.__class__.__name__} class. If the default is not appropriate for " "your model, please set `tokenizer.chat_template` to an appropriate template. " - "See https://huggingface.co/docs/transformers/main/chat_templating for more information.\n" + "See https://hf-mirror.com/docs/transformers/main/chat_templating for more information.\n" ) template = ( "{% if messages[0]['role'] == 'system' %}" diff --git a/mindnlp/transformers/models/llama/tokenization_code_llama_fast.py b/mindnlp/transformers/models/llama/tokenization_code_llama_fast.py index 232ad89b1..ba0959023 100644 --- a/mindnlp/transformers/models/llama/tokenization_code_llama_fast.py +++ b/mindnlp/transformers/models/llama/tokenization_code_llama_fast.py @@ -63,12 +63,12 @@ class CodeLlamaTokenizerFast(PreTrainedTokenizerFast): If you want to change the `bos_token` or the `eos_token`, make sure to specify them when initializing the model, or call `tokenizer.update_post_processor()` to make sure that the post-processing is correctly done (otherwise the values of the first token and final token of an encoded sequence will not be correct). For more details, checkout - [post-processors] (https://huggingface.co/docs/tokenizers/api/post-processors) documentation. + [post-processors] (https://hf-mirror.com/docs/tokenizers/api/post-processors) documentation. This tokenizer inherits from [`PreTrainedTokenizerFast`] which contains most of the main methods. Users should refer to this superclass for more information regarding those methods. The default configuration match that of - [codellama/CodeLlama-7b-Instruct-hf](https://huggingface.co/codellama/CodeLlama-7b-Instruct-hf/blob/main/tokenizer_config.json) + [codellama/CodeLlama-7b-Instruct-hf](https://hf-mirror.com/codellama/CodeLlama-7b-Instruct-hf/blob/main/tokenizer_config.json) which supports prompt infilling. Args: @@ -370,7 +370,7 @@ def default_chat_template(self): "\nNo chat template is defined for this tokenizer - using the default template " f"for the {self.__class__.__name__} class. If the default is not appropriate for " "your model, please set `tokenizer.chat_template` to an appropriate template. " - "See https://huggingface.co/docs/transformers/main/chat_templating for more information.\n" + "See https://hf-mirror.com/docs/transformers/main/chat_templating for more information.\n" ) template = ( "{% if messages[0]['role'] == 'system' %}" diff --git a/mindnlp/transformers/models/llama/tokenization_llama.py b/mindnlp/transformers/models/llama/tokenization_llama.py index d29772812..1b3636dc8 100644 --- a/mindnlp/transformers/models/llama/tokenization_llama.py +++ b/mindnlp/transformers/models/llama/tokenization_llama.py @@ -35,10 +35,10 @@ PRETRAINED_VOCAB_FILES_MAP = { "vocab_file": { - "hf-internal-testing/llama-tokenizer": "https://huggingface.co/hf-internal-testing/llama-tokenizer/resolve/main/tokenizer.model", + "hf-internal-testing/llama-tokenizer": "https://hf-mirror.com/hf-internal-testing/llama-tokenizer/resolve/main/tokenizer.model", }, "tokenizer_file": { - "hf-internal-testing/llama-tokenizer": "https://huggingface.co/hf-internal-testing/llama-tokenizer/resolve/main/tokenizer_config.json", + "hf-internal-testing/llama-tokenizer": "https://hf-mirror.com/hf-internal-testing/llama-tokenizer/resolve/main/tokenizer_config.json", }, } PRETRAINED_POSITIONAL_EMBEDDINGS_SIZES = { @@ -430,7 +430,7 @@ def default_chat_template(self): "\nNo chat template is defined for this tokenizer - using the default template " f"for the {self.__class__.__name__} class. If the default is not appropriate for " "your model, please set `tokenizer.chat_template` to an appropriate template. " - "See https://huggingface.co/docs/transformers/main/chat_templating for more information.\n" + "See https://hf-mirror.com/docs/transformers/main/chat_templating for more information.\n" ) template = ( "{% if messages[0]['role'] == 'system' %}" diff --git a/mindnlp/transformers/models/llama/tokenization_llama_fast.py b/mindnlp/transformers/models/llama/tokenization_llama_fast.py index 35f7cfca0..02e21f394 100644 --- a/mindnlp/transformers/models/llama/tokenization_llama_fast.py +++ b/mindnlp/transformers/models/llama/tokenization_llama_fast.py @@ -32,10 +32,10 @@ PRETRAINED_VOCAB_FILES_MAP = { "vocab_file": { - "hf-internal-testing/llama-tokenizer": "https://huggingface.co/hf-internal-testing/llama-tokenizer/resolve/main/tokenizer.model", + "hf-internal-testing/llama-tokenizer": "https://hf-mirror.com/hf-internal-testing/llama-tokenizer/resolve/main/tokenizer.model", }, "tokenizer_file": { - "hf-internal-testing/llama-tokenizer": "https://huggingface.co/hf-internal-testing/llama-tokenizer/resolve/main/tokenizer_config.json", + "hf-internal-testing/llama-tokenizer": "https://hf-mirror.com/hf-internal-testing/llama-tokenizer/resolve/main/tokenizer_config.json", }, } B_INST, E_INST = "[INST]", "[/INST]" @@ -68,7 +68,7 @@ class LlamaTokenizerFast(PreTrainedTokenizerFast): If you want to change the `bos_token` or the `eos_token`, make sure to specify them when initializing the model, or call `tokenizer.update_post_processor()` to make sure that the post-processing is correctly done (otherwise the values of the first token and final token of an encoded sequence will not be correct). For more details, checkout - [post-processors] (https://huggingface.co/docs/tokenizers/api/post-processors) documentation. + [post-processors] (https://hf-mirror.com/docs/tokenizers/api/post-processors) documentation. This tokenizer inherits from [`PreTrainedTokenizerFast`] which contains most of the main methods. Users should @@ -227,7 +227,7 @@ def default_chat_template(self): "\nNo chat template is defined for this tokenizer - using the default template " f"for the {self.__class__.__name__} class. If the default is not appropriate for " "your model, please set `tokenizer.chat_template` to an appropriate template. " - "See https://huggingface.co/docs/transformers/main/chat_templating for more information.\n" + "See https://hf-mirror.com/docs/transformers/main/chat_templating for more information.\n" ) template = ( "{% if messages[0]['role'] == 'system' %}" diff --git a/mindnlp/transformers/models/longformer/configuration_longformer.py b/mindnlp/transformers/models/longformer/configuration_longformer.py index 10c5862e1..b0da26215 100644 --- a/mindnlp/transformers/models/longformer/configuration_longformer.py +++ b/mindnlp/transformers/models/longformer/configuration_longformer.py @@ -23,16 +23,16 @@ logger = logging.get_logger(__name__) LONGFORMER_PRETRAINED_CONFIG_ARCHIVE_MAP = { - "allenai/longformer-base-4096": "https://huggingface.co/allenai/longformer-base-4096/resolve/main/config.json", - "allenai/longformer-large-4096": "https://huggingface.co/allenai/longformer-large-4096/resolve/main/config.json", + "allenai/longformer-base-4096": "https://hf-mirror.com/allenai/longformer-base-4096/resolve/main/config.json", + "allenai/longformer-large-4096": "https://hf-mirror.com/allenai/longformer-large-4096/resolve/main/config.json", "allenai/longformer-large-4096-finetuned-triviaqa": ( - "https://huggingface.co/allenai/longformer-large-4096-finetuned-triviaqa/resolve/main/config.json" + "https://hf-mirror.com/allenai/longformer-large-4096-finetuned-triviaqa/resolve/main/config.json" ), "allenai/longformer-base-4096-extra.pos.embd.only": ( - "https://huggingface.co/allenai/longformer-base-4096-extra.pos.embd.only/resolve/main/config.json" + "https://hf-mirror.com/allenai/longformer-base-4096-extra.pos.embd.only/resolve/main/config.json" ), "allenai/longformer-large-4096-extra.pos.embd.only": ( - "https://huggingface.co/allenai/longformer-large-4096-extra.pos.embd.only/resolve/main/config.json" + "https://hf-mirror.com/allenai/longformer-large-4096-extra.pos.embd.only/resolve/main/config.json" ), } @@ -45,7 +45,7 @@ class LongformerConfig(PretrainedConfig): This is the configuration class to store the configuration of a [`LongformerModel`]. It is used to instantiate an Longformer model according to the specified arguments, defining the model architecture. Instantiating a configuration with the defaults will yield a similar configuration to that of the LongFormer - [allenai/longformer-base-4096](https://huggingface.co/allenai/longformer-base-4096) architecture with a sequence + [allenai/longformer-base-4096](https://hf-mirror.com/allenai/longformer-base-4096) architecture with a sequence length 4,096. Configuration objects inherit from [`PretrainedConfig`] and can be used to control the model outputs. Read the diff --git a/mindnlp/transformers/models/longformer/modeling_longformer.py b/mindnlp/transformers/models/longformer/modeling_longformer.py index 4e470732d..b9d37681d 100644 --- a/mindnlp/transformers/models/longformer/modeling_longformer.py +++ b/mindnlp/transformers/models/longformer/modeling_longformer.py @@ -45,7 +45,7 @@ "allenai/longformer-large-4096-finetuned-triviaqa", "allenai/longformer-base-4096-extra.pos.embd.only", "allenai/longformer-large-4096-extra.pos.embd.only", - # See all Longformer models at https://huggingface.co/models?filter=longformer + # See all Longformer models at https://hf-mirror.com/models?filter=longformer ] def scalar_div(input, other, *, rounding_mode="trunc"): diff --git a/mindnlp/transformers/models/longformer/tokenization_longformer.py b/mindnlp/transformers/models/longformer/tokenization_longformer.py index 8d4be3581..3318232d6 100644 --- a/mindnlp/transformers/models/longformer/tokenization_longformer.py +++ b/mindnlp/transformers/models/longformer/tokenization_longformer.py @@ -33,33 +33,33 @@ PRETRAINED_VOCAB_FILES_MAP = { "vocab_file": { - "allenai/longformer-base-4096": "https://huggingface.co/allenai/longformer-base-4096/resolve/main/vocab.json", + "allenai/longformer-base-4096": "https://hf-mirror.com/allenai/longformer-base-4096/resolve/main/vocab.json", "allenai/longformer-large-4096": ( - "https://huggingface.co/allenai/longformer-large-4096/resolve/main/vocab.json" + "https://hf-mirror.com/allenai/longformer-large-4096/resolve/main/vocab.json" ), "allenai/longformer-large-4096-finetuned-triviaqa": ( - "https://huggingface.co/allenai/longformer-large-4096-finetuned-triviaqa/resolve/main/vocab.json" + "https://hf-mirror.com/allenai/longformer-large-4096-finetuned-triviaqa/resolve/main/vocab.json" ), "allenai/longformer-base-4096-extra.pos.embd.only": ( - "https://huggingface.co/allenai/longformer-base-4096-extra.pos.embd.only/resolve/main/vocab.json" + "https://hf-mirror.com/allenai/longformer-base-4096-extra.pos.embd.only/resolve/main/vocab.json" ), "allenai/longformer-large-4096-extra.pos.embd.only": ( - "https://huggingface.co/allenai/longformer-large-4096-extra.pos.embd.only/resolve/main/vocab.json" + "https://hf-mirror.com/allenai/longformer-large-4096-extra.pos.embd.only/resolve/main/vocab.json" ), }, "merges_file": { - "allenai/longformer-base-4096": "https://huggingface.co/allenai/longformer-base-4096/resolve/main/merges.txt", + "allenai/longformer-base-4096": "https://hf-mirror.com/allenai/longformer-base-4096/resolve/main/merges.txt", "allenai/longformer-large-4096": ( - "https://huggingface.co/allenai/longformer-large-4096/resolve/main/merges.txt" + "https://hf-mirror.com/allenai/longformer-large-4096/resolve/main/merges.txt" ), "allenai/longformer-large-4096-finetuned-triviaqa": ( - "https://huggingface.co/allenai/longformer-large-4096-finetuned-triviaqa/resolve/main/merges.txt" + "https://hf-mirror.com/allenai/longformer-large-4096-finetuned-triviaqa/resolve/main/merges.txt" ), "allenai/longformer-base-4096-extra.pos.embd.only": ( - "https://huggingface.co/allenai/longformer-base-4096-extra.pos.embd.only/resolve/main/merges.txt" + "https://hf-mirror.com/allenai/longformer-base-4096-extra.pos.embd.only/resolve/main/merges.txt" ), "allenai/longformer-large-4096-extra.pos.embd.only": ( - "https://huggingface.co/allenai/longformer-large-4096-extra.pos.embd.only/resolve/main/merges.txt" + "https://hf-mirror.com/allenai/longformer-large-4096-extra.pos.embd.only/resolve/main/merges.txt" ), }, } diff --git a/mindnlp/transformers/models/longformer/tokenization_longformer_fast.py b/mindnlp/transformers/models/longformer/tokenization_longformer_fast.py index 158acb1fa..c2aec2f87 100644 --- a/mindnlp/transformers/models/longformer/tokenization_longformer_fast.py +++ b/mindnlp/transformers/models/longformer/tokenization_longformer_fast.py @@ -31,50 +31,50 @@ PRETRAINED_VOCAB_FILES_MAP = { "vocab_file": { - "allenai/longformer-base-4096": "https://huggingface.co/allenai/longformer-base-4096/resolve/main/vocab.json", + "allenai/longformer-base-4096": "https://hf-mirror.com/allenai/longformer-base-4096/resolve/main/vocab.json", "allenai/longformer-large-4096": ( - "https://huggingface.co/allenai/longformer-large-4096/resolve/main/vocab.json" + "https://hf-mirror.com/allenai/longformer-large-4096/resolve/main/vocab.json" ), "allenai/longformer-large-4096-finetuned-triviaqa": ( - "https://huggingface.co/allenai/longformer-large-4096-finetuned-triviaqa/resolve/main/vocab.json" + "https://hf-mirror.com/allenai/longformer-large-4096-finetuned-triviaqa/resolve/main/vocab.json" ), "allenai/longformer-base-4096-extra.pos.embd.only": ( - "https://huggingface.co/allenai/longformer-base-4096-extra.pos.embd.only/resolve/main/vocab.json" + "https://hf-mirror.com/allenai/longformer-base-4096-extra.pos.embd.only/resolve/main/vocab.json" ), "allenai/longformer-large-4096-extra.pos.embd.only": ( - "https://huggingface.co/allenai/longformer-large-4096-extra.pos.embd.only/resolve/main/vocab.json" + "https://hf-mirror.com/allenai/longformer-large-4096-extra.pos.embd.only/resolve/main/vocab.json" ), }, "merges_file": { - "allenai/longformer-base-4096": "https://huggingface.co/allenai/longformer-base-4096/resolve/main/merges.txt", + "allenai/longformer-base-4096": "https://hf-mirror.com/allenai/longformer-base-4096/resolve/main/merges.txt", "allenai/longformer-large-4096": ( - "https://huggingface.co/allenai/longformer-large-4096/resolve/main/merges.txt" + "https://hf-mirror.com/allenai/longformer-large-4096/resolve/main/merges.txt" ), "allenai/longformer-large-4096-finetuned-triviaqa": ( - "https://huggingface.co/allenai/longformer-large-4096-finetuned-triviaqa/resolve/main/merges.txt" + "https://hf-mirror.com/allenai/longformer-large-4096-finetuned-triviaqa/resolve/main/merges.txt" ), "allenai/longformer-base-4096-extra.pos.embd.only": ( - "https://huggingface.co/allenai/longformer-base-4096-extra.pos.embd.only/resolve/main/merges.txt" + "https://hf-mirror.com/allenai/longformer-base-4096-extra.pos.embd.only/resolve/main/merges.txt" ), "allenai/longformer-large-4096-extra.pos.embd.only": ( - "https://huggingface.co/allenai/longformer-large-4096-extra.pos.embd.only/resolve/main/merges.txt" + "https://hf-mirror.com/allenai/longformer-large-4096-extra.pos.embd.only/resolve/main/merges.txt" ), }, "tokenizer_file": { "allenai/longformer-base-4096": ( - "https://huggingface.co/allenai/longformer-base-4096/resolve/main/tokenizer.json" + "https://hf-mirror.com/allenai/longformer-base-4096/resolve/main/tokenizer.json" ), "allenai/longformer-large-4096": ( - "https://huggingface.co/allenai/longformer-large-4096/resolve/main/tokenizer.json" + "https://hf-mirror.com/allenai/longformer-large-4096/resolve/main/tokenizer.json" ), "allenai/longformer-large-4096-finetuned-triviaqa": ( - "https://huggingface.co/allenai/longformer-large-4096-finetuned-triviaqa/resolve/main/tokenizer.json" + "https://hf-mirror.com/allenai/longformer-large-4096-finetuned-triviaqa/resolve/main/tokenizer.json" ), "allenai/longformer-base-4096-extra.pos.embd.only": ( - "https://huggingface.co/allenai/longformer-base-4096-extra.pos.embd.only/resolve/main/tokenizer.json" + "https://hf-mirror.com/allenai/longformer-base-4096-extra.pos.embd.only/resolve/main/tokenizer.json" ), "allenai/longformer-large-4096-extra.pos.embd.only": ( - "https://huggingface.co/allenai/longformer-large-4096-extra.pos.embd.only/resolve/main/tokenizer.json" + "https://hf-mirror.com/allenai/longformer-large-4096-extra.pos.embd.only/resolve/main/tokenizer.json" ), }, } diff --git a/mindnlp/transformers/models/longt5/configuration_longt5.py b/mindnlp/transformers/models/longt5/configuration_longt5.py index 308cb96d9..e2b05bac5 100644 --- a/mindnlp/transformers/models/longt5/configuration_longt5.py +++ b/mindnlp/transformers/models/longt5/configuration_longt5.py @@ -22,10 +22,10 @@ logger = logging.get_logger(__name__) LongT5_PRETRAINED_CONFIG_ARCHIVE_MAP = { - "google/long-t5-local-base": "https://huggingface.co/google/long-t5-local-base/blob/main/config.json", - "google/long-t5-local-large": "https://huggingface.co/google/long-t5-local-large/blob/main/config.json", - "google/long-t5-tglobal-base": "https://huggingface.co/google/long-t5-tglobal-base/blob/main/config.json", - "google/long-t5-tglobal-large": "https://huggingface.co/google/long-t5-tglobal-large/blob/main/config.json", + "google/long-t5-local-base": "https://hf-mirror.com/google/long-t5-local-base/blob/main/config.json", + "google/long-t5-local-large": "https://hf-mirror.com/google/long-t5-local-large/blob/main/config.json", + "google/long-t5-tglobal-base": "https://hf-mirror.com/google/long-t5-tglobal-base/blob/main/config.json", + "google/long-t5-tglobal-large": "https://hf-mirror.com/google/long-t5-tglobal-large/blob/main/config.json", } class LongT5Config(PretrainedConfig): @@ -33,7 +33,7 @@ class LongT5Config(PretrainedConfig): This is the configuration class to store the configuration of a [`LongT5Model`] or a [`FlaxLongT5Model`]. It is used to instantiate a LongT5 model according to the specified arguments, defining the model architecture. Instantiating a configuration with the defaults will yield a similar configuration to that of the LongT5 - [google/long-t5-local-base](https://huggingface.co/google/long-t5-local-base) architecture. + [google/long-t5-local-base](https://hf-mirror.com/google/long-t5-local-base) architecture. Configuration objects inherit from [`PretrainedConfig`] and can be used to control the model outputs. Read the documentation from [`PretrainedConfig`] for more information. diff --git a/mindnlp/transformers/models/longt5/tokenization_longt5.py b/mindnlp/transformers/models/longt5/tokenization_longt5.py index 6d7847d40..8561f3460 100644 --- a/mindnlp/transformers/models/longt5/tokenization_longt5.py +++ b/mindnlp/transformers/models/longt5/tokenization_longt5.py @@ -42,10 +42,10 @@ PRETRAINED_VOCAB_FILES_MAP = { "vocab_file": { - "google/long-t5-local-base": "https://huggingface.co/google/long-t5-local-base/blob/main/config.json", - "google/long-t5-local-large": "https://huggingface.co/google/long-t5-local-large/blob/main/config.json", - "google/long-t5-tglobal-base": "https://huggingface.co/google/long-t5-tglobal-base/blob/main/config.json", - "google/long-t5-tglobal-large": "https://huggingface.co/google/long-t5-tglobal-large/blob/main/config.json", + "google/long-t5-local-base": "https://hf-mirror.com/google/long-t5-local-base/blob/main/config.json", + "google/long-t5-local-large": "https://hf-mirror.com/google/long-t5-local-large/blob/main/config.json", + "google/long-t5-tglobal-base": "https://hf-mirror.com/google/long-t5-tglobal-base/blob/main/config.json", + "google/long-t5-tglobal-large": "https://hf-mirror.com/google/long-t5-tglobal-large/blob/main/config.json", } } diff --git a/mindnlp/transformers/models/luke/tokenization_luke.py b/mindnlp/transformers/models/luke/tokenization_luke.py index 9003e4e2f..f793ab723 100644 --- a/mindnlp/transformers/models/luke/tokenization_luke.py +++ b/mindnlp/transformers/models/luke/tokenization_luke.py @@ -54,16 +54,16 @@ PRETRAINED_VOCAB_FILES_MAP = { "vocab_file": { - "studio-ousia/luke-base": "https://huggingface.co/studio-ousia/luke-base/resolve/main/vocab.json", - "studio-ousia/luke-large": "https://huggingface.co/studio-ousia/luke-large/resolve/main/vocab.json", + "studio-ousia/luke-base": "https://hf-mirror.com/studio-ousia/luke-base/resolve/main/vocab.json", + "studio-ousia/luke-large": "https://hf-mirror.com/studio-ousia/luke-large/resolve/main/vocab.json", }, "merges_file": { - "studio-ousia/luke-base": "https://huggingface.co/studio-ousia/luke-base/resolve/main/merges.txt", - "studio-ousia/luke-large": "https://huggingface.co/studio-ousia/luke-large/resolve/main/merges.txt", + "studio-ousia/luke-base": "https://hf-mirror.com/studio-ousia/luke-base/resolve/main/merges.txt", + "studio-ousia/luke-large": "https://hf-mirror.com/studio-ousia/luke-large/resolve/main/merges.txt", }, "entity_vocab_file": { - "studio-ousia/luke-base": "https://huggingface.co/studio-ousia/luke-base/resolve/main/entity_vocab.json", - "studio-ousia/luke-large": "https://huggingface.co/studio-ousia/luke-large/resolve/main/entity_vocab.json", + "studio-ousia/luke-base": "https://hf-mirror.com/studio-ousia/luke-base/resolve/main/entity_vocab.json", + "studio-ousia/luke-large": "https://hf-mirror.com/studio-ousia/luke-large/resolve/main/entity_vocab.json", }, } diff --git a/mindnlp/transformers/models/mamba/configuration_mamba.py b/mindnlp/transformers/models/mamba/configuration_mamba.py index c3d959cdd..7972b4a5a 100644 --- a/mindnlp/transformers/models/mamba/configuration_mamba.py +++ b/mindnlp/transformers/models/mamba/configuration_mamba.py @@ -24,7 +24,7 @@ logger = logging.get_logger(__name__) MAMBA_PRETRAINED_CONFIG_ARCHIVE_MAP = { - "state-spaces/mamba-2.8b": "https://huggingface.co/state-spaces/mamba-2.8b/resolve/main/config.json", + "state-spaces/mamba-2.8b": "https://hf-mirror.com/state-spaces/mamba-2.8b/resolve/main/config.json", } @@ -33,7 +33,7 @@ class MambaConfig(PretrainedConfig): This is the configuration class to store the configuration of a [`MambaModel`]. It is used to instantiate a MAMBA model according to the specified arguments, defining the model architecture. Instantiating a configuration with the defaults will yield a similar configuration to that of the MAMBA - [state-spaces/mamba-2.8b](https://huggingface.co/state-spaces/mamba-2.8b) architecture. + [state-spaces/mamba-2.8b](https://hf-mirror.com/state-spaces/mamba-2.8b) architecture. Configuration objects inherit from [`PretrainedConfig`] and can be used to control the model outputs. Read the documentation from [`PretrainedConfig`] for more information. diff --git a/mindnlp/transformers/models/mamba/modeling_graph_mamba.py b/mindnlp/transformers/models/mamba/modeling_graph_mamba.py index 5474e5e28..7d056e109 100644 --- a/mindnlp/transformers/models/mamba/modeling_graph_mamba.py +++ b/mindnlp/transformers/models/mamba/modeling_graph_mamba.py @@ -38,7 +38,7 @@ _CHECKPOINT_FOR_DOC = "state-spaces/mamba-130m-hf" _CONFIG_FOR_DOC = "MambaConfig" -MAMBA_PRETRAINED_MODEL_ARCHIVE_LIST = [] # See all MSMamba models at https://huggingface.co/models?filter=mamba +MAMBA_PRETRAINED_MODEL_ARCHIVE_LIST = [] # See all MSMamba models at https://hf-mirror.com/models?filter=mamba class MambaDense(nn.Dense): def construct(self, x): diff --git a/mindnlp/transformers/models/mamba/modeling_mamba.py b/mindnlp/transformers/models/mamba/modeling_mamba.py index b07a62225..6d0b5f81c 100644 --- a/mindnlp/transformers/models/mamba/modeling_mamba.py +++ b/mindnlp/transformers/models/mamba/modeling_mamba.py @@ -38,7 +38,7 @@ _CHECKPOINT_FOR_DOC = "state-spaces/mamba-130m-hf" _CONFIG_FOR_DOC = "MambaConfig" -MAMBA_PRETRAINED_MODEL_ARCHIVE_LIST = [] # See all Mamba models at https://huggingface.co/models?filter=mamba +MAMBA_PRETRAINED_MODEL_ARCHIVE_LIST = [] # See all Mamba models at https://hf-mirror.com/models?filter=mamba class MambaMixer(nn.Cell): diff --git a/mindnlp/transformers/models/mbart/configuration_mbart.py b/mindnlp/transformers/models/mbart/configuration_mbart.py index c03177982..9291d3ce9 100644 --- a/mindnlp/transformers/models/mbart/configuration_mbart.py +++ b/mindnlp/transformers/models/mbart/configuration_mbart.py @@ -21,8 +21,8 @@ logger = logging.get_logger(__name__) MBART_PRETRAINED_CONFIG_ARCHIVE_MAP = { - "facebook/mbart-large-cc25": "https://huggingface.co/facebook/mbart-large-cc25/resolve/main/config.json", - # See all MBART models at https://huggingface.co/models?filter=mbart + "facebook/mbart-large-cc25": "https://hf-mirror.com/facebook/mbart-large-cc25/resolve/main/config.json", + # See all MBART models at https://hf-mirror.com/models?filter=mbart } diff --git a/mindnlp/transformers/models/mbart/modeling_mbart.py b/mindnlp/transformers/models/mbart/modeling_mbart.py index 547b071e7..750d6a873 100644 --- a/mindnlp/transformers/models/mbart/modeling_mbart.py +++ b/mindnlp/transformers/models/mbart/modeling_mbart.py @@ -43,7 +43,7 @@ MBART_PRETRAINED_MODEL_ARCHIVE_LIST = [ "facebook/mbart-large-cc25", - # See all MBART models at https://huggingface.co/models?filter=mbart + # See all MBART models at https://hf-mirror.com/models?filter=mbart ] diff --git a/mindnlp/transformers/models/mbart/tokenization_mbart.py b/mindnlp/transformers/models/mbart/tokenization_mbart.py index 03e27e253..1b2169796 100644 --- a/mindnlp/transformers/models/mbart/tokenization_mbart.py +++ b/mindnlp/transformers/models/mbart/tokenization_mbart.py @@ -34,10 +34,10 @@ PRETRAINED_VOCAB_FILES_MAP = { "vocab_file": { "facebook/mbart-large-en-ro": ( - "https://huggingface.co/facebook/mbart-large-en-ro/resolve/main/sentencepiece.bpe.model" + "https://hf-mirror.com/facebook/mbart-large-en-ro/resolve/main/sentencepiece.bpe.model" ), "facebook/mbart-large-cc25": ( - "https://huggingface.co/facebook/mbart-large-cc25/resolve/main/sentencepiece.bpe.model" + "https://hf-mirror.com/facebook/mbart-large-cc25/resolve/main/sentencepiece.bpe.model" ), } } diff --git a/mindnlp/transformers/models/mbart/tokenization_mbart_fast.py b/mindnlp/transformers/models/mbart/tokenization_mbart_fast.py index 4ff39d496..4249695e4 100644 --- a/mindnlp/transformers/models/mbart/tokenization_mbart_fast.py +++ b/mindnlp/transformers/models/mbart/tokenization_mbart_fast.py @@ -37,15 +37,15 @@ PRETRAINED_VOCAB_FILES_MAP = { "vocab_file": { "facebook/mbart-large-en-ro": ( - "https://huggingface.co/facebook/mbart-large-en-ro/resolve/main/sentencepiece.bpe.model" + "https://hf-mirror.com/facebook/mbart-large-en-ro/resolve/main/sentencepiece.bpe.model" ), "facebook/mbart-large-cc25": ( - "https://huggingface.co/facebook/mbart-large-cc25/resolve/main/sentencepiece.bpe.model" + "https://hf-mirror.com/facebook/mbart-large-cc25/resolve/main/sentencepiece.bpe.model" ), }, "tokenizer_file": { - "facebook/mbart-large-en-ro": "https://huggingface.co/facebook/mbart-large-en-ro/resolve/main/tokenizer.json", - "facebook/mbart-large-cc25": "https://huggingface.co/facebook/mbart-large-cc25/resolve/main/tokenizer.json", + "facebook/mbart-large-en-ro": "https://hf-mirror.com/facebook/mbart-large-en-ro/resolve/main/tokenizer.json", + "facebook/mbart-large-cc25": "https://hf-mirror.com/facebook/mbart-large-cc25/resolve/main/tokenizer.json", }, } @@ -62,7 +62,7 @@ class MBartTokenizerFast(PreTrainedTokenizerFast): """ Construct a "fast" MBART tokenizer (backed by HuggingFace's *tokenizers* library). Based on - [BPE](https://huggingface.co/docs/tokenizers/python/latest/components.html?highlight=BPE#models). + [BPE](https://hf-mirror.com/docs/tokenizers/python/latest/components.html?highlight=BPE#models). This tokenizer inherits from [`PreTrainedTokenizerFast`] which contains most of the main methods. Users should refer to this superclass for more information regarding those methods. diff --git a/mindnlp/transformers/models/megatron_bert/configuration_megatron_bert.py b/mindnlp/transformers/models/megatron_bert/configuration_megatron_bert.py index df30efe15..9c4fe8157 100644 --- a/mindnlp/transformers/models/megatron_bert/configuration_megatron_bert.py +++ b/mindnlp/transformers/models/megatron_bert/configuration_megatron_bert.py @@ -21,7 +21,7 @@ logger = logging.get_logger(__name__) MEGATRON_BERT_PRETRAINED_CONFIG_ARCHIVE_MAP = { - # See all MEGATRON_BERT models at https://huggingface.co/models?filter=bert + # See all MEGATRON_BERT models at https://hf-mirror.com/models?filter=bert } @@ -30,7 +30,7 @@ class MegatronBertConfig(PretrainedConfig): This is the configuration class to store the configuration of a [`MegatronBertModel`]. It is used to instantiate a MEGATRON_BERT model according to the specified arguments, defining the model architecture. Instantiating a configuration with the defaults will yield a similar configuration to that of the MEGATRON_BERT - [nvidia/megatron-bert-uncased-345m](https://huggingface.co/nvidia/megatron-bert-uncased-345m) architecture. + [nvidia/megatron-bert-uncased-345m](https://hf-mirror.com/nvidia/megatron-bert-uncased-345m) architecture. Configuration objects inherit from [`PretrainedConfig`] and can be used to control the model outputs. Read the documentation from [`PretrainedConfig`] for more information. diff --git a/mindnlp/transformers/models/megatron_bert/modeling_megatron_bert.py b/mindnlp/transformers/models/megatron_bert/modeling_megatron_bert.py index 69a22901a..26af7be61 100644 --- a/mindnlp/transformers/models/megatron_bert/modeling_megatron_bert.py +++ b/mindnlp/transformers/models/megatron_bert/modeling_megatron_bert.py @@ -54,7 +54,7 @@ MEGATRON_BERT_PRETRAINED_MODEL_ARCHIVE_LIST = [ "nvidia/megatron-bert-cased-345m", - # See all MegatronBERT models at https://huggingface.co/models?filter=megatron_bert + # See all MegatronBERT models at https://hf-mirror.com/models?filter=megatron_bert ] diff --git a/mindnlp/transformers/models/minicpm/configuration_minicpm.py b/mindnlp/transformers/models/minicpm/configuration_minicpm.py index cd296677c..130b5b50b 100644 --- a/mindnlp/transformers/models/minicpm/configuration_minicpm.py +++ b/mindnlp/transformers/models/minicpm/configuration_minicpm.py @@ -79,7 +79,7 @@ class MiniCPMConfig(PretrainedConfig): End of stream token id. pretraining_tp (`int`, *optional*, defaults to 1): Experimental feature. Tensor parallelism rank used during pretraining. Please refer to [this - document](https://huggingface.co/docs/transformers/parallelism) to understand more about it. This value is + document](https://hf-mirror.com/docs/transformers/parallelism) to understand more about it. This value is necessary to ensure exact reproducibility of the pretraining results. Please refer to [this issue](https://github.com/pytorch/pytorch/issues/76232). tie_word_embeddings (`bool`, *optional*, defaults to `False`): diff --git a/mindnlp/transformers/models/mistral/configuration_mistral.py b/mindnlp/transformers/models/mistral/configuration_mistral.py index c0a748330..d1b265396 100644 --- a/mindnlp/transformers/models/mistral/configuration_mistral.py +++ b/mindnlp/transformers/models/mistral/configuration_mistral.py @@ -21,8 +21,8 @@ logger = logging.get_logger(__name__) MISTRAL_PRETRAINED_CONFIG_ARCHIVE_MAP = { - "mistralai/Mistral-7B-v0.1": "https://huggingface.co/mistralai/Mistral-7B-v0.1/resolve/main/config.json", - "mistralai/Mistral-7B-Instruct-v0.1": "https://huggingface.co/mistralai/Mistral-7B-Instruct-v0.1/resolve/main/config.json", + "mistralai/Mistral-7B-v0.1": "https://hf-mirror.com/mistralai/Mistral-7B-v0.1/resolve/main/config.json", + "mistralai/Mistral-7B-Instruct-v0.1": "https://hf-mirror.com/mistralai/Mistral-7B-Instruct-v0.1/resolve/main/config.json", } @@ -32,8 +32,8 @@ class MistralConfig(PretrainedConfig): Mistral model according to the specified arguments, defining the model architecture. Instantiating a configuration with the defaults will yield a similar configuration to that of the Mistral-7B-v0.1 or Mistral-7B-Instruct-v0.1. - [mistralai/Mistral-7B-v0.1](https://huggingface.co/mistralai/Mistral-7B-v0.1) - [mistralai/Mistral-7B-Instruct-v0.1](https://huggingface.co/mistralai/Mistral-7B-Instruct-v0.1) + [mistralai/Mistral-7B-v0.1](https://hf-mirror.com/mistralai/Mistral-7B-v0.1) + [mistralai/Mistral-7B-Instruct-v0.1](https://hf-mirror.com/mistralai/Mistral-7B-Instruct-v0.1) Configuration objects inherit from [`PretrainedConfig`] and can be used to control the model outputs. Read the documentation from [`PretrainedConfig`] for more information. diff --git a/mindnlp/transformers/models/mixtral/configuration_mixtral.py b/mindnlp/transformers/models/mixtral/configuration_mixtral.py index ae0cc247c..b74b46883 100644 --- a/mindnlp/transformers/models/mixtral/configuration_mixtral.py +++ b/mindnlp/transformers/models/mixtral/configuration_mixtral.py @@ -22,7 +22,7 @@ logger = logging.get_logger(__name__) MIXTRAL_PRETRAINED_CONFIG_ARCHIVE_MAP = { - "mistral-ai/Mixtral-8x7B": "https://huggingface.co/mistral-ai/Mixtral-8x7B/resolve/main/config.json", + "mistral-ai/Mixtral-8x7B": "https://hf-mirror.com/mistral-ai/Mixtral-8x7B/resolve/main/config.json", } @@ -32,8 +32,8 @@ class MixtralConfig(PretrainedConfig): Mixtral model according to the specified arguments, defining the model architecture. Instantiating a configuration with the defaults will yield a similar configuration to that of the Mixtral-7B-v0.1 or Mixtral-7B-Instruct-v0.1. - [mixtralai/Mixtral-8x7B](https://huggingface.co/mixtralai/Mixtral-8x7B) - [mixtralai/Mixtral-7B-Instruct-v0.1](https://huggingface.co/mixtralai/Mixtral-7B-Instruct-v0.1) + [mixtralai/Mixtral-8x7B](https://hf-mirror.com/mixtralai/Mixtral-8x7B) + [mixtralai/Mixtral-7B-Instruct-v0.1](https://hf-mirror.com/mixtralai/Mixtral-7B-Instruct-v0.1) Configuration objects inherit from [`PretrainedConfig`] and can be used to control the model outputs. Read the documentation from [`PretrainedConfig`] for more information. diff --git a/mindnlp/transformers/models/mt5/configuration_mt5.py b/mindnlp/transformers/models/mt5/configuration_mt5.py index 5375165ac..0e326ab79 100644 --- a/mindnlp/transformers/models/mt5/configuration_mt5.py +++ b/mindnlp/transformers/models/mt5/configuration_mt5.py @@ -25,7 +25,7 @@ class MT5Config(PretrainedConfig): This is the configuration class to store the configuration of a [`MT5Model`] or a [`TFMT5Model`]. It is used to instantiate a mT5 model according to the specified arguments, defining the model architecture. Instantiating a configuration with the defaults will yield a similar configuration to that of the mT5 - [google/mt5-small](https://huggingface.co/google/mt5-small) architecture. + [google/mt5-small](https://hf-mirror.com/google/mt5-small) architecture. Configuration objects inherit from [`PretrainedConfig`] and can be used to control the model outputs. Read the documentation from [`PretrainedConfig`] for more information. diff --git a/mindnlp/transformers/models/musicgen/configuration_musicgen.py b/mindnlp/transformers/models/musicgen/configuration_musicgen.py index 817faf64e..eec04d4a6 100644 --- a/mindnlp/transformers/models/musicgen/configuration_musicgen.py +++ b/mindnlp/transformers/models/musicgen/configuration_musicgen.py @@ -27,7 +27,7 @@ class MusicgenDecoderConfig(PretrainedConfig): This is the configuration class to store the configuration of an [`MusicgenDecoder`]. It is used to instantiate a MusicGen decoder according to the specified arguments, defining the model architecture. Instantiating a configuration with the defaults will yield a similar configuration to that of the MusicGen - [facebook/musicgen-small](https://huggingface.co/facebook/musicgen-small) architecture. + [facebook/musicgen-small](https://hf-mirror.com/facebook/musicgen-small) architecture. Configuration objects inherit from [`PretrainedConfig`] and can be used to control the model outputs. Read the documentation from [`PretrainedConfig`] for more information. diff --git a/mindnlp/transformers/models/musicgen/modeling_musicgen.py b/mindnlp/transformers/models/musicgen/modeling_musicgen.py index d782ea4d3..93ef009ab 100644 --- a/mindnlp/transformers/models/musicgen/modeling_musicgen.py +++ b/mindnlp/transformers/models/musicgen/modeling_musicgen.py @@ -1044,7 +1044,7 @@ def generate( f"Both `max_new_tokens` (={generation_config.max_new_tokens}) and `max_length`(=" f"{generation_config.max_length}) seem to have been set. `max_new_tokens` will take precedence. " "Please refer to the documentation for more information. " - "(https://huggingface.co/docs/transformers/main/en/main_classes/text_generation)" + "(https://hf-mirror.com/docs/transformers/main/en/main_classes/text_generation)" ) generation_config.max_length = generation_config.max_new_tokens + input_ids_seq_length @@ -1347,21 +1347,21 @@ def from_sub_models_pretrained( text_encoder_pretrained_model_name_or_path (`str`, *optional*): Information necessary to initiate the text encoder. Can be either: - - A string, the *model id* of a pretrained model hosted inside a model repo on huggingface.co. + - A string, the *model id* of a pretrained model hosted inside a model repo on hf-mirror.com. - A path to a *directory* containing model weights saved using [`~PreTrainedModel.save_pretrained`], e.g., `./my_model_directory/`. audio_encoder_pretrained_model_name_or_path (`str`, *optional*): Information necessary to initiate the audio encoder. Can be either: - - A string, the *model id* of a pretrained model hosted inside a model repo on huggingface.co. + - A string, the *model id* of a pretrained model hosted inside a model repo on hf-mirror.com. - A path to a *directory* containing model weights saved using [`~PreTrainedModel.save_pretrained`], e.g., `./my_model_directory/`. decoder_pretrained_model_name_or_path (`str`, *optional*, defaults to `None`): Information necessary to initiate the decoder. Can be either: - - A string, the *model id* of a pretrained model hosted inside a model repo on huggingface.co. + - A string, the *model id* of a pretrained model hosted inside a model repo on hf-mirror.com. - A path to a *directory* containing model weights saved using [`~PreTrainedModel.save_pretrained`], e.g., `./my_model_directory/`. @@ -2097,7 +2097,7 @@ def generate( f"Both `max_new_tokens` (={generation_config.max_new_tokens}) and `max_length`(=" f"{generation_config.max_length}) seem to have been set. `max_new_tokens` will take precedence. " "Please refer to the documentation for more information. " - "(https://huggingface.co/docs/transformers/main/en/main_classes/text_generation)" + "(https://hf-mirror.com/docs/transformers/main/en/main_classes/text_generation)" ) generation_config.max_length = generation_config.max_new_tokens + input_ids_seq_length diff --git a/mindnlp/transformers/models/opt/configuration_opt.py b/mindnlp/transformers/models/opt/configuration_opt.py index addf2baa8..f35cddc37 100644 --- a/mindnlp/transformers/models/opt/configuration_opt.py +++ b/mindnlp/transformers/models/opt/configuration_opt.py @@ -21,12 +21,12 @@ logger = logging.get_logger(__name__) OPT_PRETRAINED_CONFIG_ARCHIVE_MAP = { - "facebook/opt-125m": "https://huggingface.co/facebook/opt-125m/blob/main/config.json", - "facebook/opt-350m": "https://huggingface.co/facebook/opt-350m/blob/main/config.json", - "facebook/opt-1.3b": "https://huggingface.co/facebook/opt-1.3b/blob/main/config.json", - "facebook/opt-2.7b": "https://huggingface.co/facebook/opt-2.7b/blob/main/config.json", - "facebook/opt-6.7b": "https://huggingface.co/facebook/opt-6.7b/blob/main/config.json", - "facebook/opt-13b": "https://huggingface.co/facebook/opt-13b/blob/main/config.json", + "facebook/opt-125m": "https://hf-mirror.com/facebook/opt-125m/blob/main/config.json", + "facebook/opt-350m": "https://hf-mirror.com/facebook/opt-350m/blob/main/config.json", + "facebook/opt-1.3b": "https://hf-mirror.com/facebook/opt-1.3b/blob/main/config.json", + "facebook/opt-2.7b": "https://hf-mirror.com/facebook/opt-2.7b/blob/main/config.json", + "facebook/opt-6.7b": "https://hf-mirror.com/facebook/opt-6.7b/blob/main/config.json", + "facebook/opt-13b": "https://hf-mirror.com/facebook/opt-13b/blob/main/config.json", } @@ -35,7 +35,7 @@ class OPTConfig(PretrainedConfig): This is the configuration class to store the configuration of a [`OPTModel`]. It is used to instantiate a OPT model according to the specified arguments, defining the model architecture. Instantiating a configuration with the defaults will yield a similar configuration to that of the OPT - [facebook/opt-350m](https://huggingface.co/facebook/opt-350m) architecture. + [facebook/opt-350m](https://hf-mirror.com/facebook/opt-350m) architecture. Configuration objects inherit from [`PretrainedConfig`] and can be used to control the model outputs. Read the documentation from [`PretrainedConfig`] for more information. diff --git a/mindnlp/transformers/models/opt/modeling_opt.py b/mindnlp/transformers/models/opt/modeling_opt.py index 88f18ec3b..dac2f5db5 100644 --- a/mindnlp/transformers/models/opt/modeling_opt.py +++ b/mindnlp/transformers/models/opt/modeling_opt.py @@ -46,7 +46,7 @@ "facebook/opt-6.7b", "facebook/opt-13b", "facebook/opt-30b", - # See all OPT models at https://huggingface.co/models?filter=opt + # See all OPT models at https://hf-mirror.com/models?filter=opt ] diff --git a/mindnlp/transformers/models/pegasus/tokenization_pegasus_fast.py b/mindnlp/transformers/models/pegasus/tokenization_pegasus_fast.py index 482faef45..b3280e576 100644 --- a/mindnlp/transformers/models/pegasus/tokenization_pegasus_fast.py +++ b/mindnlp/transformers/models/pegasus/tokenization_pegasus_fast.py @@ -40,7 +40,7 @@ class PegasusTokenizerFast(PreTrainedTokenizerFast): r""" Construct a "fast" PEGASUS tokenizer (backed by HuggingFace's *tokenizers* library). Based on - [Unigram](https://huggingface.co/docs/tokenizers/python/latest/components.html?highlight=unigram#models). + [Unigram](https://hf-mirror.com/docs/tokenizers/python/latest/components.html?highlight=unigram#models). This tokenizer inherits from [`PreTrainedTokenizerFast`] which contains most of the main methods. Users should refer to this superclass for more information regarding those methods. diff --git a/mindnlp/transformers/models/phi/configuration_phi.py b/mindnlp/transformers/models/phi/configuration_phi.py index 00869a63b..476a28200 100644 --- a/mindnlp/transformers/models/phi/configuration_phi.py +++ b/mindnlp/transformers/models/phi/configuration_phi.py @@ -23,7 +23,7 @@ logger = logging.get_logger(__name__) PHI_PRETRAINED_CONFIG_ARCHIVE_MAP = { - "microsoft/phi-2": "https://huggingface.co/microsoft/phi-2/resolve/main/config.json", + "microsoft/phi-2": "https://hf-mirror.com/microsoft/phi-2/resolve/main/config.json", } @@ -32,7 +32,7 @@ class PhiConfig(PretrainedConfig): This is the configuration class to store the configuration of a [`PhiModel`]. It is used to instantiate an Phi model according to the specified arguments, defining the model architecture. Instantiating a configuration with the defaults will yield a similar configuration to that of the Phi - [microsoft/phi-1](https://huggingface.co/microsoft/phi-1). + [microsoft/phi-1](https://hf-mirror.com/microsoft/phi-1). Configuration objects inherit from [`PretrainedConfig`] and can be used to control the model outputs. Read the documentation from [`PretrainedConfig`] for more information. diff --git a/mindnlp/transformers/models/phi/modeling_phi.py b/mindnlp/transformers/models/phi/modeling_phi.py index 03a1aa184..af95426ed 100644 --- a/mindnlp/transformers/models/phi/modeling_phi.py +++ b/mindnlp/transformers/models/phi/modeling_phi.py @@ -44,7 +44,7 @@ "microsoft/phi-1", "microsoft/phi-1_5", "microsoft/phi-2", - # See all Phi models at https://huggingface.co/models?filter=phi + # See all Phi models at https://hf-mirror.com/models?filter=phi ] diff --git a/mindnlp/transformers/models/pop2piano/configuration_pop2piano.py b/mindnlp/transformers/models/pop2piano/configuration_pop2piano.py index 692de25f8..d8cd040ce 100644 --- a/mindnlp/transformers/models/pop2piano/configuration_pop2piano.py +++ b/mindnlp/transformers/models/pop2piano/configuration_pop2piano.py @@ -23,7 +23,7 @@ logger = logging.get_logger(__name__) POP2PIANO_PRETRAINED_CONFIG_ARCHIVE_MAP = { - "sweetcocoa/pop2piano": "https://huggingface.co/sweetcocoa/pop2piano/blob/main/config.json" + "sweetcocoa/pop2piano": "https://hf-mirror.com/sweetcocoa/pop2piano/blob/main/config.json" } @@ -32,7 +32,7 @@ class Pop2PianoConfig(PretrainedConfig): This is the configuration class to store the configuration of a [`Pop2PianoForConditionalGeneration`]. It is used to instantiate a Pop2PianoForConditionalGeneration model according to the specified arguments, defining the model architecture. Instantiating a configuration with the defaults will yield a similar configuration to that of the - Pop2Piano [sweetcocoa/pop2piano](https://huggingface.co/sweetcocoa/pop2piano) architecture. + Pop2Piano [sweetcocoa/pop2piano](https://hf-mirror.com/sweetcocoa/pop2piano) architecture. Configuration objects inherit from [`PretrainedConfig`] and can be used to control the model outputs. Read the documentation from [`PretrainedConfig`] for more information. diff --git a/mindnlp/transformers/models/pop2piano/modeling_pop2piano.py b/mindnlp/transformers/models/pop2piano/modeling_pop2piano.py index b7ce80628..d1b83e925 100644 --- a/mindnlp/transformers/models/pop2piano/modeling_pop2piano.py +++ b/mindnlp/transformers/models/pop2piano/modeling_pop2piano.py @@ -43,7 +43,7 @@ POP2PIANO_PRETRAINED_MODEL_ARCHIVE_LIST = [ "sweetcocoa/pop2piano", - # See all Pop2Piano models at https://huggingface.co/models?filter=pop2piano + # See all Pop2Piano models at https://hf-mirror.com/models?filter=pop2piano ] # Copied from transformers.models.t5.modeling_t5.T5LayerNorm with T5->Pop2Piano @@ -1146,7 +1146,7 @@ def generate( This value is passed to `Pop2PianoConcatEmbeddingToMel` to generate different embeddings for each `"composer"`. Please make sure that the composet value is present in `composer_to_feature_token` in `generation_config`. For an example please see - https://huggingface.co/sweetcocoa/pop2piano/blob/main/generation_config.json . + https://hf-mirror.com/sweetcocoa/pop2piano/blob/main/generation_config.json . generation_config (`~generation.GenerationConfig`, *optional*): The generation configuration to be used as base parametrization for the generation call. `**kwargs` passed to generate matching the attributes of `generation_config` will override them. If @@ -1175,7 +1175,7 @@ def generate( if not hasattr(generation_config, "composer_to_feature_token"): raise ValueError( "`composer_to_feature_token` was not found! Please refer to " - "https://huggingface.co/sweetcocoa/pop2piano/blob/main/generation_config.json" + "https://hf-mirror.com/sweetcocoa/pop2piano/blob/main/generation_config.json" "and parse a dict like that." ) diff --git a/mindnlp/transformers/models/pop2piano/tokenization_pop2piano.py b/mindnlp/transformers/models/pop2piano/tokenization_pop2piano.py index 2a60e6e30..3d6aa3a27 100644 --- a/mindnlp/transformers/models/pop2piano/tokenization_pop2piano.py +++ b/mindnlp/transformers/models/pop2piano/tokenization_pop2piano.py @@ -38,7 +38,7 @@ PRETRAINED_VOCAB_FILES_MAP = { "vocab": { - "sweetcocoa/pop2piano": "https://huggingface.co/sweetcocoa/pop2piano/blob/main/vocab.json", + "sweetcocoa/pop2piano": "https://hf-mirror.com/sweetcocoa/pop2piano/blob/main/vocab.json", }, } diff --git a/mindnlp/transformers/models/qwen2/configuration_qwen2.py b/mindnlp/transformers/models/qwen2/configuration_qwen2.py index 3881a3754..591e01bc2 100644 --- a/mindnlp/transformers/models/qwen2/configuration_qwen2.py +++ b/mindnlp/transformers/models/qwen2/configuration_qwen2.py @@ -21,7 +21,7 @@ logger = logging.get_logger(__name__) QWEN2_PRETRAINED_CONFIG_ARCHIVE_MAP = { - "Qwen/Qwen2-7B-beta": "https://huggingface.co/Qwen/Qwen2-7B-beta/resolve/main/config.json", + "Qwen/Qwen2-7B-beta": "https://hf-mirror.com/Qwen/Qwen2-7B-beta/resolve/main/config.json", } @@ -30,7 +30,7 @@ class Qwen2Config(PretrainedConfig): This is the configuration class to store the configuration of a [`Qwen2Model`]. It is used to instantiate a Qwen2 model according to the specified arguments, defining the model architecture. Instantiating a configuration with the defaults will yield a similar configuration to that of - Qwen2-7B-beta [Qwen/Qwen2-7B-beta](https://huggingface.co/Qwen/Qwen2-7B-beta). + Qwen2-7B-beta [Qwen/Qwen2-7B-beta](https://hf-mirror.com/Qwen/Qwen2-7B-beta). Configuration objects inherit from [`PretrainedConfig`] and can be used to control the model outputs. Read the documentation from [`PretrainedConfig`] for more information. diff --git a/mindnlp/transformers/models/qwen2/modeling_qwen2.py b/mindnlp/transformers/models/qwen2/modeling_qwen2.py index 6b4383858..c840d43f3 100644 --- a/mindnlp/transformers/models/qwen2/modeling_qwen2.py +++ b/mindnlp/transformers/models/qwen2/modeling_qwen2.py @@ -44,7 +44,7 @@ QWEN2_PRETRAINED_MODEL_ARCHIVE_LIST = [ "Qwen/Qwen2-7B-beta", - # See all Qwen2 models at https://huggingface.co/models?filter=qwen2 + # See all Qwen2 models at https://hf-mirror.com/models?filter=qwen2 ] diff --git a/mindnlp/transformers/models/qwen2/tokenization_qwen2.py b/mindnlp/transformers/models/qwen2/tokenization_qwen2.py index cac7543fb..ab5ec5186 100644 --- a/mindnlp/transformers/models/qwen2/tokenization_qwen2.py +++ b/mindnlp/transformers/models/qwen2/tokenization_qwen2.py @@ -35,8 +35,8 @@ } PRETRAINED_VOCAB_FILES_MAP = { - "vocab_file": {"qwen/qwen-tokenizer": "https://huggingface.co/qwen/qwen-tokenizer/resolve/main/vocab.json"}, - "merges_file": {"qwen/qwen-tokenizer": "https://huggingface.co/qwen/qwen-tokenizer/resolve/main/merges.txt"}, + "vocab_file": {"qwen/qwen-tokenizer": "https://hf-mirror.com/qwen/qwen-tokenizer/resolve/main/vocab.json"}, + "merges_file": {"qwen/qwen-tokenizer": "https://hf-mirror.com/qwen/qwen-tokenizer/resolve/main/merges.txt"}, } MAX_MODEL_INPUT_SIZES = {"qwen/qwen-tokenizer": 32768} diff --git a/mindnlp/transformers/models/qwen2/tokenization_qwen2_fast.py b/mindnlp/transformers/models/qwen2/tokenization_qwen2_fast.py index 15e6b7ee7..2cfd7ee24 100644 --- a/mindnlp/transformers/models/qwen2/tokenization_qwen2_fast.py +++ b/mindnlp/transformers/models/qwen2/tokenization_qwen2_fast.py @@ -31,10 +31,10 @@ } PRETRAINED_VOCAB_FILES_MAP = { - "vocab_file": {"qwen/qwen-tokenizer": "https://huggingface.co/qwen/qwen-tokenizer/resolve/main/vocab.json"}, - "merges_file": {"qwen/qwen-tokenizer": "https://huggingface.co/qwen/qwen-tokenizer/resolve/main/merges.txt"}, + "vocab_file": {"qwen/qwen-tokenizer": "https://hf-mirror.com/qwen/qwen-tokenizer/resolve/main/vocab.json"}, + "merges_file": {"qwen/qwen-tokenizer": "https://hf-mirror.com/qwen/qwen-tokenizer/resolve/main/merges.txt"}, "tokenizer_file": { - "qwen/qwen-tokenizer": "https://huggingface.co/qwen/qwen-tokenizer/resolve/main/tokenizer.json" + "qwen/qwen-tokenizer": "https://hf-mirror.com/qwen/qwen-tokenizer/resolve/main/tokenizer.json" }, } diff --git a/mindnlp/transformers/models/reformer/configuration_reformer.py b/mindnlp/transformers/models/reformer/configuration_reformer.py index 254a6bd71..6f927ecfa 100644 --- a/mindnlp/transformers/models/reformer/configuration_reformer.py +++ b/mindnlp/transformers/models/reformer/configuration_reformer.py @@ -24,9 +24,9 @@ REFORMER_PRETRAINED_CONFIG_ARCHIVE_MAP = { "google/reformer-crime-and-punishment": ( - "https://huggingface.co/google/reformer-crime-and-punishment/resolve/main/config.json" + "https://hf-mirror.com/google/reformer-crime-and-punishment/resolve/main/config.json" ), - "google/reformer-enwik8": "https://huggingface.co/google/reformer-enwik8/resolve/main/config.json", + "google/reformer-enwik8": "https://hf-mirror.com/google/reformer-enwik8/resolve/main/config.json", } @@ -35,7 +35,7 @@ class ReformerConfig(PretrainedConfig): This is the configuration class to store the configuration of a [`ReformerModel`]. It is used to instantiate a Reformer model according to the specified arguments, defining the model architecture. Instantiating a configuration with the defaults will yield a similar configuration to that of the ReFormer - [google/reformer-crime-and-punishment](https://huggingface.co/google/reformer-crime-and-punishment) architecture. + [google/reformer-crime-and-punishment](https://hf-mirror.com/google/reformer-crime-and-punishment) architecture. Configuration objects inherit from [`PretrainedConfig`] and can be used to control the model outputs. Read the documentation from [`PretrainedConfig`] for more information. diff --git a/mindnlp/transformers/models/reformer/modeling_reformer.py b/mindnlp/transformers/models/reformer/modeling_reformer.py index 3f1c1a374..69f939a61 100644 --- a/mindnlp/transformers/models/reformer/modeling_reformer.py +++ b/mindnlp/transformers/models/reformer/modeling_reformer.py @@ -49,7 +49,7 @@ REFORMER_PRETRAINED_MODEL_ARCHIVE_LIST = [ "google/reformer-crime-and-punishment", "google/reformer-enwik8", - # See all Reformer models at https://huggingface.co/models?filter=reformer + # See all Reformer models at https://hf-mirror.com/models?filter=reformer ] diff --git a/mindnlp/transformers/models/reformer/tokenization_reformer.py b/mindnlp/transformers/models/reformer/tokenization_reformer.py index 90b68c698..5b127271e 100644 --- a/mindnlp/transformers/models/reformer/tokenization_reformer.py +++ b/mindnlp/transformers/models/reformer/tokenization_reformer.py @@ -36,7 +36,7 @@ PRETRAINED_VOCAB_FILES_MAP = { "vocab_file": { "google/reformer-crime-and-punishment": ( - "https://huggingface.co/google/reformer-crime-and-punishment/resolve/main/spiece.model" + "https://hf-mirror.com/google/reformer-crime-and-punishment/resolve/main/spiece.model" ) } } diff --git a/mindnlp/transformers/models/reformer/tokenization_reformer_fast.py b/mindnlp/transformers/models/reformer/tokenization_reformer_fast.py index 8dcc55eec..a90109cd7 100644 --- a/mindnlp/transformers/models/reformer/tokenization_reformer_fast.py +++ b/mindnlp/transformers/models/reformer/tokenization_reformer_fast.py @@ -40,12 +40,12 @@ PRETRAINED_VOCAB_FILES_MAP = { "vocab_file": { "google/reformer-crime-and-punishment": ( - "https://huggingface.co/google/reformer-crime-and-punishment/resolve/main/spiece.model" + "https://hf-mirror.com/google/reformer-crime-and-punishment/resolve/main/spiece.model" ) }, "tokenizer_file": { "google/reformer-crime-and-punishment": ( - "https://huggingface.co/google/reformer-crime-and-punishment/resolve/main/tokenizer.json" + "https://hf-mirror.com/google/reformer-crime-and-punishment/resolve/main/tokenizer.json" ) }, } @@ -58,7 +58,7 @@ class ReformerTokenizerFast(PreTrainedTokenizerFast): """ Construct a "fast" Reformer tokenizer (backed by HuggingFace's *tokenizers* library). Based on - [Unigram](https://huggingface.co/docs/tokenizers/python/latest/components.html?highlight=unigram#models). + [Unigram](https://hf-mirror.com/docs/tokenizers/python/latest/components.html?highlight=unigram#models). This tokenizer inherits from [`PreTrainedTokenizerFast`] which contains most of the main methods. Users should refer to this superclass for more information regarding those methods. diff --git a/mindnlp/transformers/models/roberta/tokenization_roberta.py b/mindnlp/transformers/models/roberta/tokenization_roberta.py index 8e9bcfd5a..a028042e0 100644 --- a/mindnlp/transformers/models/roberta/tokenization_roberta.py +++ b/mindnlp/transformers/models/roberta/tokenization_roberta.py @@ -34,23 +34,23 @@ PRETRAINED_VOCAB_FILES_MAP = { "vocab_file": { - "roberta-base": "https://huggingface.co/roberta-base/resolve/main/vocab.json", - "roberta-large": "https://huggingface.co/roberta-large/resolve/main/vocab.json", - "roberta-large-mnli": "https://huggingface.co/roberta-large-mnli/resolve/main/vocab.json", - "distilroberta-base": "https://huggingface.co/distilroberta-base/resolve/main/vocab.json", - "roberta-base-openai-detector": "https://huggingface.co/roberta-base-openai-detector/resolve/main/vocab.json", + "roberta-base": "https://hf-mirror.com/roberta-base/resolve/main/vocab.json", + "roberta-large": "https://hf-mirror.com/roberta-large/resolve/main/vocab.json", + "roberta-large-mnli": "https://hf-mirror.com/roberta-large-mnli/resolve/main/vocab.json", + "distilroberta-base": "https://hf-mirror.com/distilroberta-base/resolve/main/vocab.json", + "roberta-base-openai-detector": "https://hf-mirror.com/roberta-base-openai-detector/resolve/main/vocab.json", "roberta-large-openai-detector": ( - "https://huggingface.co/roberta-large-openai-detector/resolve/main/vocab.json" + "https://hf-mirror.com/roberta-large-openai-detector/resolve/main/vocab.json" ), }, "merges_file": { - "roberta-base": "https://huggingface.co/roberta-base/resolve/main/merges.txt", - "roberta-large": "https://huggingface.co/roberta-large/resolve/main/merges.txt", - "roberta-large-mnli": "https://huggingface.co/roberta-large-mnli/resolve/main/merges.txt", - "distilroberta-base": "https://huggingface.co/distilroberta-base/resolve/main/merges.txt", - "roberta-base-openai-detector": "https://huggingface.co/roberta-base-openai-detector/resolve/main/merges.txt", + "roberta-base": "https://hf-mirror.com/roberta-base/resolve/main/merges.txt", + "roberta-large": "https://hf-mirror.com/roberta-large/resolve/main/merges.txt", + "roberta-large-mnli": "https://hf-mirror.com/roberta-large-mnli/resolve/main/merges.txt", + "distilroberta-base": "https://hf-mirror.com/distilroberta-base/resolve/main/merges.txt", + "roberta-base-openai-detector": "https://hf-mirror.com/roberta-base-openai-detector/resolve/main/merges.txt", "roberta-large-openai-detector": ( - "https://huggingface.co/roberta-large-openai-detector/resolve/main/merges.txt" + "https://hf-mirror.com/roberta-large-openai-detector/resolve/main/merges.txt" ), }, } diff --git a/mindnlp/transformers/models/roberta/tokenization_roberta_fast.py b/mindnlp/transformers/models/roberta/tokenization_roberta_fast.py index 0e089ff65..14039e1e3 100644 --- a/mindnlp/transformers/models/roberta/tokenization_roberta_fast.py +++ b/mindnlp/transformers/models/roberta/tokenization_roberta_fast.py @@ -30,35 +30,35 @@ PRETRAINED_VOCAB_FILES_MAP = { "vocab_file": { - "roberta-base": "https://huggingface.co/roberta-base/resolve/main/vocab.json", - "roberta-large": "https://huggingface.co/roberta-large/resolve/main/vocab.json", - "roberta-large-mnli": "https://huggingface.co/roberta-large-mnli/resolve/main/vocab.json", - "distilroberta-base": "https://huggingface.co/distilroberta-base/resolve/main/vocab.json", - "roberta-base-openai-detector": "https://huggingface.co/roberta-base-openai-detector/resolve/main/vocab.json", + "roberta-base": "https://hf-mirror.com/roberta-base/resolve/main/vocab.json", + "roberta-large": "https://hf-mirror.com/roberta-large/resolve/main/vocab.json", + "roberta-large-mnli": "https://hf-mirror.com/roberta-large-mnli/resolve/main/vocab.json", + "distilroberta-base": "https://hf-mirror.com/distilroberta-base/resolve/main/vocab.json", + "roberta-base-openai-detector": "https://hf-mirror.com/roberta-base-openai-detector/resolve/main/vocab.json", "roberta-large-openai-detector": ( - "https://huggingface.co/roberta-large-openai-detector/resolve/main/vocab.json" + "https://hf-mirror.com/roberta-large-openai-detector/resolve/main/vocab.json" ), }, "merges_file": { - "roberta-base": "https://huggingface.co/roberta-base/resolve/main/merges.txt", - "roberta-large": "https://huggingface.co/roberta-large/resolve/main/merges.txt", - "roberta-large-mnli": "https://huggingface.co/roberta-large-mnli/resolve/main/merges.txt", - "distilroberta-base": "https://huggingface.co/distilroberta-base/resolve/main/merges.txt", - "roberta-base-openai-detector": "https://huggingface.co/roberta-base-openai-detector/resolve/main/merges.txt", + "roberta-base": "https://hf-mirror.com/roberta-base/resolve/main/merges.txt", + "roberta-large": "https://hf-mirror.com/roberta-large/resolve/main/merges.txt", + "roberta-large-mnli": "https://hf-mirror.com/roberta-large-mnli/resolve/main/merges.txt", + "distilroberta-base": "https://hf-mirror.com/distilroberta-base/resolve/main/merges.txt", + "roberta-base-openai-detector": "https://hf-mirror.com/roberta-base-openai-detector/resolve/main/merges.txt", "roberta-large-openai-detector": ( - "https://huggingface.co/roberta-large-openai-detector/resolve/main/merges.txt" + "https://hf-mirror.com/roberta-large-openai-detector/resolve/main/merges.txt" ), }, "tokenizer_file": { - "roberta-base": "https://huggingface.co/roberta-base/resolve/main/tokenizer.json", - "roberta-large": "https://huggingface.co/roberta-large/resolve/main/tokenizer.json", - "roberta-large-mnli": "https://huggingface.co/roberta-large-mnli/resolve/main/tokenizer.json", - "distilroberta-base": "https://huggingface.co/distilroberta-base/resolve/main/tokenizer.json", + "roberta-base": "https://hf-mirror.com/roberta-base/resolve/main/tokenizer.json", + "roberta-large": "https://hf-mirror.com/roberta-large/resolve/main/tokenizer.json", + "roberta-large-mnli": "https://hf-mirror.com/roberta-large-mnli/resolve/main/tokenizer.json", + "distilroberta-base": "https://hf-mirror.com/distilroberta-base/resolve/main/tokenizer.json", "roberta-base-openai-detector": ( - "https://huggingface.co/roberta-base-openai-detector/resolve/main/tokenizer.json" + "https://hf-mirror.com/roberta-base-openai-detector/resolve/main/tokenizer.json" ), "roberta-large-openai-detector": ( - "https://huggingface.co/roberta-large-openai-detector/resolve/main/tokenizer.json" + "https://hf-mirror.com/roberta-large-openai-detector/resolve/main/tokenizer.json" ), }, } diff --git a/mindnlp/transformers/models/rwkv/configuration_rwkv.py b/mindnlp/transformers/models/rwkv/configuration_rwkv.py index fa737fd3a..feaa2952e 100644 --- a/mindnlp/transformers/models/rwkv/configuration_rwkv.py +++ b/mindnlp/transformers/models/rwkv/configuration_rwkv.py @@ -22,16 +22,16 @@ RWKV_PRETRAINED_CONFIG_ARCHIVE_MAP = { - "RWKV/rwkv-4-169m-pile": "https://huggingface.co/RWKV/rwkv-4-169m-pile/resolve/main/config.json", - "RWKV/rwkv-4-430m-pile": "https://huggingface.co/RWKV/rwkv-4-430m-pile/resolve/main/config.json", - "RWKV/rwkv-4-1b5-pile": "https://huggingface.co/RWKV/rwkv-4-1b5-pile/resolve/main/config.json", - "RWKV/rwkv-4-3b-pile": "https://huggingface.co/RWKV/rwkv-4-3b-pile/resolve/main/config.json", - "RWKV/rwkv-4-7b-pile": "https://huggingface.co/RWKV/rwkv-4-7b-pile/resolve/main/config.json", - "RWKV/rwkv-4-14b-pile": "https://huggingface.co/RWKV/rwkv-4-14b-pile/resolve/main/config.json", - "RWKV/rwkv-raven-1b5": "https://huggingface.co/RWKV/rwkv-raven-1b5/resolve/main/config.json", - "RWKV/rwkv-raven-3b": "https://huggingface.co/RWKV/rwkv-raven-3b/resolve/main/config.json", - "RWKV/rwkv-raven-7b": "https://huggingface.co/RWKV/rwkv-raven-7b/resolve/main/config.json", - "RWKV/rwkv-raven-14b": "https://huggingface.co/RWKV/rwkv-raven-14b/resolve/main/config.json", + "RWKV/rwkv-4-169m-pile": "https://hf-mirror.com/RWKV/rwkv-4-169m-pile/resolve/main/config.json", + "RWKV/rwkv-4-430m-pile": "https://hf-mirror.com/RWKV/rwkv-4-430m-pile/resolve/main/config.json", + "RWKV/rwkv-4-1b5-pile": "https://hf-mirror.com/RWKV/rwkv-4-1b5-pile/resolve/main/config.json", + "RWKV/rwkv-4-3b-pile": "https://hf-mirror.com/RWKV/rwkv-4-3b-pile/resolve/main/config.json", + "RWKV/rwkv-4-7b-pile": "https://hf-mirror.com/RWKV/rwkv-4-7b-pile/resolve/main/config.json", + "RWKV/rwkv-4-14b-pile": "https://hf-mirror.com/RWKV/rwkv-4-14b-pile/resolve/main/config.json", + "RWKV/rwkv-raven-1b5": "https://hf-mirror.com/RWKV/rwkv-raven-1b5/resolve/main/config.json", + "RWKV/rwkv-raven-3b": "https://hf-mirror.com/RWKV/rwkv-raven-3b/resolve/main/config.json", + "RWKV/rwkv-raven-7b": "https://hf-mirror.com/RWKV/rwkv-raven-7b/resolve/main/config.json", + "RWKV/rwkv-raven-14b": "https://hf-mirror.com/RWKV/rwkv-raven-14b/resolve/main/config.json", } @@ -40,7 +40,7 @@ class RwkvConfig(PretrainedConfig): This is the configuration class to store the configuration of a [`RwkvModel`]. It is used to instantiate a RWKV model according to the specified arguments, defining the model architecture. Instantiating a configuration with the defaults will yield a similar configuration to that of the RWVK-4 - [RWKV/rwkv-4-169m-pile](https://huggingface.co/RWKV/rwkv-4-169m-pile) architecture. + [RWKV/rwkv-4-169m-pile](https://hf-mirror.com/RWKV/rwkv-4-169m-pile) architecture. Configuration objects inherit from [`PretrainedConfig`] and can be used to control the model outputs. Read the documentation from [`PretrainedConfig`] for more information. diff --git a/mindnlp/transformers/models/rwkv/modeling_rwkv.py b/mindnlp/transformers/models/rwkv/modeling_rwkv.py index 5f411e55e..1e91bbf22 100644 --- a/mindnlp/transformers/models/rwkv/modeling_rwkv.py +++ b/mindnlp/transformers/models/rwkv/modeling_rwkv.py @@ -43,7 +43,7 @@ "RWKV/rwkv-raven-3b", "RWKV/rwkv-raven-7b", "RWKV/rwkv-raven-14b", - # See all RWKV models at https://huggingface.co/models?filter=rwkv + # See all RWKV models at https://hf-mirror.com/models?filter=rwkv ] WKV_SHAPE_INFER = { diff --git a/mindnlp/transformers/models/seamless_m4t/configuration_seamless_m4t.py b/mindnlp/transformers/models/seamless_m4t/configuration_seamless_m4t.py index f9ce7b74a..3f7b7b2da 100644 --- a/mindnlp/transformers/models/seamless_m4t/configuration_seamless_m4t.py +++ b/mindnlp/transformers/models/seamless_m4t/configuration_seamless_m4t.py @@ -21,8 +21,8 @@ logger = logging.get_logger(__name__) SEAMLESS_M4T_PRETRAINED_CONFIG_ARCHIVE_MAP = { - "facebook/hf-seamless-m4t-medium": "https://huggingface.co/facebook/hf-seamless-m4t-medium/resolve/main/config.json", - # See all SeamlessM4T models at https://huggingface.co/models?filter=seamless_m4t + "facebook/hf-seamless-m4t-medium": "https://hf-mirror.com/facebook/hf-seamless-m4t-medium/resolve/main/config.json", + # See all SeamlessM4T models at https://hf-mirror.com/models?filter=seamless_m4t } @@ -31,7 +31,7 @@ class SeamlessM4TConfig(PretrainedConfig): This is the configuration class to store the configuration of a [`~SeamlessM4TModel`]. It is used to instantiate an SeamlessM4T model according to the specified arguments, defining the model architecture. Instantiating a configuration with the defaults will yield a similar configuration to that of the SeamlessM4T - ["facebook/hf-seamless-m4t-medium"](https://huggingface.co/"facebook/hf-seamless-m4t-medium") architecture. + ["facebook/hf-seamless-m4t-medium"](https://hf-mirror.com/"facebook/hf-seamless-m4t-medium") architecture. Configuration objects inherit from [`PretrainedConfig`] and can be used to control the model outputs. Read the documentation from [`PretrainedConfig`] for more information. diff --git a/mindnlp/transformers/models/seamless_m4t/modeling_seamless_m4t.py b/mindnlp/transformers/models/seamless_m4t/modeling_seamless_m4t.py index 87fadeabe..8f01a2d0e 100644 --- a/mindnlp/transformers/models/seamless_m4t/modeling_seamless_m4t.py +++ b/mindnlp/transformers/models/seamless_m4t/modeling_seamless_m4t.py @@ -42,11 +42,11 @@ SEAMLESS_M4T_PRETRAINED_MODEL_ARCHIVE_LIST = [ "facebook/hf-seamless-m4t-medium", - # See all SeamlessM4T models at https://huggingface.co/models?filter=seamless_m4t + # See all SeamlessM4T models at https://hf-mirror.com/models?filter=seamless_m4t ] SPEECHT5_PRETRAINED_HIFIGAN_CONFIG_ARCHIVE_MAP = { - "microsoft/speecht5_hifigan": "https://huggingface.co/microsoft/speecht5_hifigan/resolve/main/config.json", + "microsoft/speecht5_hifigan": "https://hf-mirror.com/microsoft/speecht5_hifigan/resolve/main/config.json", } diff --git a/mindnlp/transformers/models/seamless_m4t/tokenization_seamless_m4t.py b/mindnlp/transformers/models/seamless_m4t/tokenization_seamless_m4t.py index 374089373..ac231986a 100644 --- a/mindnlp/transformers/models/seamless_m4t/tokenization_seamless_m4t.py +++ b/mindnlp/transformers/models/seamless_m4t/tokenization_seamless_m4t.py @@ -35,7 +35,7 @@ PRETRAINED_VOCAB_FILES_MAP = { "vocab_file": { "facebook/hf-seamless-m4t-medium": ( - "https://huggingface.co/facebook/hf-seamless-m4t-medium/blob/main/sentencepiece.bpe.model" + "https://hf-mirror.com/facebook/hf-seamless-m4t-medium/blob/main/sentencepiece.bpe.model" ), } } diff --git a/mindnlp/transformers/models/seamless_m4t/tokenization_seamless_m4t_fast.py b/mindnlp/transformers/models/seamless_m4t/tokenization_seamless_m4t_fast.py index 10324c734..8499e938d 100644 --- a/mindnlp/transformers/models/seamless_m4t/tokenization_seamless_m4t_fast.py +++ b/mindnlp/transformers/models/seamless_m4t/tokenization_seamless_m4t_fast.py @@ -39,10 +39,10 @@ PRETRAINED_VOCAB_FILES_MAP = { "vocab_file": { - "facebook/hf-seamless-m4t-medium": "https://huggingface.co/facebook/hf-seamless-m4t-medium/resolve/main/vocab.txt", + "facebook/hf-seamless-m4t-medium": "https://hf-mirror.com/facebook/hf-seamless-m4t-medium/resolve/main/vocab.txt", }, "tokenizer_file": { - "facebook/hf-seamless-m4t-medium": "https://huggingface.co/facebook/hf-seamless-m4t-medium/resolve/main/tokenizer.json", + "facebook/hf-seamless-m4t-medium": "https://hf-mirror.com/facebook/hf-seamless-m4t-medium/resolve/main/tokenizer.json", }, } @@ -54,7 +54,7 @@ class SeamlessM4TTokenizerFast(PreTrainedTokenizerFast): """ Construct a "fast" SeamlessM4T tokenizer (backed by HuggingFace's *tokenizers* library). Based on - [BPE](https://huggingface.co/docs/tokenizers/python/latest/components.html?highlight=BPE#models). + [BPE](https://hf-mirror.com/docs/tokenizers/python/latest/components.html?highlight=BPE#models). This tokenizer inherits from [`PreTrainedTokenizerFast`] which contains most of the main methods. Users should refer to this superclass for more information regarding those methods. diff --git a/mindnlp/transformers/models/seamless_m4t_v2/configuration_seamless_m4t_v2.py b/mindnlp/transformers/models/seamless_m4t_v2/configuration_seamless_m4t_v2.py index 7ee598a3e..222d1db76 100644 --- a/mindnlp/transformers/models/seamless_m4t_v2/configuration_seamless_m4t_v2.py +++ b/mindnlp/transformers/models/seamless_m4t_v2/configuration_seamless_m4t_v2.py @@ -21,7 +21,7 @@ logger = logging.get_logger(__name__) SEAMLESS_M4T_V2_PRETRAINED_CONFIG_ARCHIVE_MAP = { - "": "https://huggingface.co//resolve/main/config.json", + "": "https://hf-mirror.com//resolve/main/config.json", } @@ -30,7 +30,7 @@ class SeamlessM4Tv2Config(PretrainedConfig): This is the configuration class to store the configuration of a [`~SeamlessM4Tv2Model`]. It is used to instantiate an SeamlessM4Tv2 model according to the specified arguments, defining the model architecture. Instantiating a configuration with the defaults will yield a similar configuration to that of the SeamlessM4Tv2 - [""](https://huggingface.co/"") architecture. + [""](https://hf-mirror.com/"") architecture. Configuration objects inherit from [`PretrainedConfig`] and can be used to control the model outputs. Read the documentation from [`PretrainedConfig`] for more information. diff --git a/mindnlp/transformers/models/seamless_m4t_v2/modeling_seamless_m4t_v2.py b/mindnlp/transformers/models/seamless_m4t_v2/modeling_seamless_m4t_v2.py index ff3d01993..053556ca9 100644 --- a/mindnlp/transformers/models/seamless_m4t_v2/modeling_seamless_m4t_v2.py +++ b/mindnlp/transformers/models/seamless_m4t_v2/modeling_seamless_m4t_v2.py @@ -44,12 +44,12 @@ SEAMLESS_M4T_V2_PRETRAINED_MODEL_ARCHIVE_LIST = [ "facebook/seamless-m4t-v2-large", - # See all SeamlessM4T-v2 models at https://huggingface.co/models?filter=seamless_m4t_v2 + # See all SeamlessM4T-v2 models at https://hf-mirror.com/models?filter=seamless_m4t_v2 ] SPEECHT5_PRETRAINED_HIFIGAN_CONFIG_ARCHIVE_MAP = { - "microsoft/speecht5_hifigan": "https://huggingface.co/microsoft/speecht5_hifigan/resolve/main/config.json", + "microsoft/speecht5_hifigan": "https://hf-mirror.com/microsoft/speecht5_hifigan/resolve/main/config.json", } diff --git a/mindnlp/transformers/models/starcoder2/configuration_starcoder2.py b/mindnlp/transformers/models/starcoder2/configuration_starcoder2.py index aab094242..850aa924c 100644 --- a/mindnlp/transformers/models/starcoder2/configuration_starcoder2.py +++ b/mindnlp/transformers/models/starcoder2/configuration_starcoder2.py @@ -27,7 +27,7 @@ class Starcoder2Config(PretrainedConfig): r""" This is the configuration class to store the configuration of a [`Starcoder2Model`]. It is used to instantiate a Starcoder2 model according to the specified arguments, defining the model architecture. Instantiating a configuration - with the defaults will yield a similar configuration to that of the [bigcode/starcoder2-7b_16k](https://huggingface.co/bigcode/starcoder2-7b_16k) model. + with the defaults will yield a similar configuration to that of the [bigcode/starcoder2-7b_16k](https://hf-mirror.com/bigcode/starcoder2-7b_16k) model. Configuration objects inherit from [`PretrainedConfig`] and can be used to control the model outputs. Read the diff --git a/mindnlp/transformers/models/t5/configuration_t5.py b/mindnlp/transformers/models/t5/configuration_t5.py index 3bd3a3695..707d587dc 100644 --- a/mindnlp/transformers/models/t5/configuration_t5.py +++ b/mindnlp/transformers/models/t5/configuration_t5.py @@ -22,11 +22,11 @@ logger = logging.get_logger(__name__) T5_PRETRAINED_CONFIG_ARCHIVE_MAP = { - "t5-small": "https://huggingface.co/t5-small/resolve/main/config.json", - "t5-base": "https://huggingface.co/t5-base/resolve/main/config.json", - "t5-large": "https://huggingface.co/t5-large/resolve/main/config.json", - "t5-3b": "https://huggingface.co/t5-3b/resolve/main/config.json", - "t5-11b": "https://huggingface.co/t5-11b/resolve/main/config.json", + "t5-small": "https://hf-mirror.com/t5-small/resolve/main/config.json", + "t5-base": "https://hf-mirror.com/t5-base/resolve/main/config.json", + "t5-large": "https://hf-mirror.com/t5-large/resolve/main/config.json", + "t5-3b": "https://hf-mirror.com/t5-3b/resolve/main/config.json", + "t5-11b": "https://hf-mirror.com/t5-11b/resolve/main/config.json", } @@ -35,7 +35,7 @@ class T5Config(PretrainedConfig): This is the configuration class to store the configuration of a [`T5Model`] or a [`TFT5Model`]. It is used to instantiate a T5 model according to the specified arguments, defining the model architecture. Instantiating a configuration with the defaults will yield a similar configuration to that of the T5 - [t5-small](https://huggingface.co/t5-small) architecture. + [t5-small](https://hf-mirror.com/t5-small) architecture. Configuration objects inherit from [`PretrainedConfig`] and can be used to control the model outputs. Read the documentation from [`PretrainedConfig`] for more information. diff --git a/mindnlp/transformers/models/t5/modeling_t5.py b/mindnlp/transformers/models/t5/modeling_t5.py index 4a8de5785..9daff8435 100644 --- a/mindnlp/transformers/models/t5/modeling_t5.py +++ b/mindnlp/transformers/models/t5/modeling_t5.py @@ -57,7 +57,7 @@ "t5-large", "t5-3b", "t5-11b", - # See all T5 models at https://huggingface.co/models?filter=t5 + # See all T5 models at https://hf-mirror.com/models?filter=t5 ] class T5LayerNorm(nn.Cell): diff --git a/mindnlp/transformers/models/t5/tokenization_t5.py b/mindnlp/transformers/models/t5/tokenization_t5.py index b31ff6373..2b47a0204 100644 --- a/mindnlp/transformers/models/t5/tokenization_t5.py +++ b/mindnlp/transformers/models/t5/tokenization_t5.py @@ -41,11 +41,11 @@ PRETRAINED_VOCAB_FILES_MAP = { "vocab_file": { - "t5-small": "https://huggingface.co/t5-small/resolve/main/spiece.model", - "t5-base": "https://huggingface.co/t5-base/resolve/main/spiece.model", - "t5-large": "https://huggingface.co/t5-large/resolve/main/spiece.model", - "t5-3b": "https://huggingface.co/t5-3b/resolve/main/spiece.model", - "t5-11b": "https://huggingface.co/t5-11b/resolve/main/spiece.model", + "t5-small": "https://hf-mirror.com/t5-small/resolve/main/spiece.model", + "t5-base": "https://hf-mirror.com/t5-base/resolve/main/spiece.model", + "t5-large": "https://hf-mirror.com/t5-large/resolve/main/spiece.model", + "t5-3b": "https://hf-mirror.com/t5-3b/resolve/main/spiece.model", + "t5-11b": "https://hf-mirror.com/t5-11b/resolve/main/spiece.model", } } diff --git a/mindnlp/transformers/models/t5/tokenization_t5_fast.py b/mindnlp/transformers/models/t5/tokenization_t5_fast.py index 93bf3cc82..3b1f105d0 100644 --- a/mindnlp/transformers/models/t5/tokenization_t5_fast.py +++ b/mindnlp/transformers/models/t5/tokenization_t5_fast.py @@ -39,18 +39,18 @@ PRETRAINED_VOCAB_FILES_MAP = { "vocab_file": { - "t5-small": "https://huggingface.co/t5-small/resolve/main/spiece.model", - "t5-base": "https://huggingface.co/t5-base/resolve/main/spiece.model", - "t5-large": "https://huggingface.co/t5-large/resolve/main/spiece.model", - "t5-3b": "https://huggingface.co/t5-3b/resolve/main/spiece.model", - "t5-11b": "https://huggingface.co/t5-11b/resolve/main/spiece.model", + "t5-small": "https://hf-mirror.com/t5-small/resolve/main/spiece.model", + "t5-base": "https://hf-mirror.com/t5-base/resolve/main/spiece.model", + "t5-large": "https://hf-mirror.com/t5-large/resolve/main/spiece.model", + "t5-3b": "https://hf-mirror.com/t5-3b/resolve/main/spiece.model", + "t5-11b": "https://hf-mirror.com/t5-11b/resolve/main/spiece.model", }, "tokenizer_file": { - "t5-small": "https://huggingface.co/t5-small/resolve/main/tokenizer.json", - "t5-base": "https://huggingface.co/t5-base/resolve/main/tokenizer.json", - "t5-large": "https://huggingface.co/t5-large/resolve/main/tokenizer.json", - "t5-3b": "https://huggingface.co/t5-3b/resolve/main/tokenizer.json", - "t5-11b": "https://huggingface.co/t5-11b/resolve/main/tokenizer.json", + "t5-small": "https://hf-mirror.com/t5-small/resolve/main/tokenizer.json", + "t5-base": "https://hf-mirror.com/t5-base/resolve/main/tokenizer.json", + "t5-large": "https://hf-mirror.com/t5-large/resolve/main/tokenizer.json", + "t5-3b": "https://hf-mirror.com/t5-3b/resolve/main/tokenizer.json", + "t5-11b": "https://hf-mirror.com/t5-11b/resolve/main/tokenizer.json", }, } @@ -68,7 +68,7 @@ class T5TokenizerFast(PreTrainedTokenizerFast): """ Construct a "fast" T5 tokenizer (backed by HuggingFace's *tokenizers* library). Based on - [Unigram](https://huggingface.co/docs/tokenizers/python/latest/components.html?highlight=unigram#models). + [Unigram](https://hf-mirror.com/docs/tokenizers/python/latest/components.html?highlight=unigram#models). This tokenizer inherits from [`PreTrainedTokenizerFast`] which contains most of the main methods. Users should refer to this superclass for more information regarding those methods. diff --git a/mindnlp/transformers/models/wav2vec2/configuration_wav2vec2.py b/mindnlp/transformers/models/wav2vec2/configuration_wav2vec2.py index 6fd8a8763..d56ed613c 100644 --- a/mindnlp/transformers/models/wav2vec2/configuration_wav2vec2.py +++ b/mindnlp/transformers/models/wav2vec2/configuration_wav2vec2.py @@ -28,8 +28,8 @@ logger = logging.get_logger(__name__) WAV_2_VEC_2_PRETRAINED_CONFIG_ARCHIVE_MAP = { - "facebook/wav2vec2-base-960h": "https://huggingface.co/facebook/wav2vec2-base-960h/resolve/main/config.json", - # See all Wav2Vec2 models at https://huggingface.co/models?filter=wav2vec2 + "facebook/wav2vec2-base-960h": "https://hf-mirror.com/facebook/wav2vec2-base-960h/resolve/main/config.json", + # See all Wav2Vec2 models at https://hf-mirror.com/models?filter=wav2vec2 } @@ -38,7 +38,7 @@ class Wav2Vec2Config(PretrainedConfig): This is the configuration class to store the configuration of a [`Wav2Vec2Model`]. It is used to instantiate an Wav2Vec2 model according to the specified arguments, defining the model architecture. Instantiating a configuration with the defaults will yield a similar configuration to that of the Wav2Vec2 - [facebook/wav2vec2-base-960h](https://huggingface.co/facebook/wav2vec2-base-960h) architecture. + [facebook/wav2vec2-base-960h](https://hf-mirror.com/facebook/wav2vec2-base-960h) architecture. Configuration objects inherit from [`PretrainedConfig`] and can be used to control the model outputs. Read the documentation from [`PretrainedConfig`] for more information. @@ -188,7 +188,7 @@ class Wav2Vec2Config(PretrainedConfig): True`. adapter_attn_dim (`int`, *optional*): Dimension of the attention adapter weights to be used in each attention block. An example of a model using - attention adapters is [facebook/mms-1b-all](https://huggingface.co/facebook/mms-1b-all). + attention adapters is [facebook/mms-1b-all](https://hf-mirror.com/facebook/mms-1b-all). output_hidden_size (`int`, *optional*): Dimensionality of the encoder output layer. If not defined, this defaults to *hidden-size*. Only relevant if `add_adapter is True`. diff --git a/mindnlp/transformers/models/wav2vec2/feature_extraction_wav2vec2.py b/mindnlp/transformers/models/wav2vec2/feature_extraction_wav2vec2.py index d09bb851b..1c64957ab 100644 --- a/mindnlp/transformers/models/wav2vec2/feature_extraction_wav2vec2.py +++ b/mindnlp/transformers/models/wav2vec2/feature_extraction_wav2vec2.py @@ -48,19 +48,19 @@ class Wav2Vec2FeatureExtractor(SequenceFeatureExtractor): do_normalize (`bool`, *optional*, defaults to `True`): Whether or not to zero-mean unit-variance normalize the input. Normalizing can help to significantly improve the performance for some models, *e.g.*, - [wav2vec2-lv60](https://huggingface.co/models?search=lv60). + [wav2vec2-lv60](https://hf-mirror.com/models?search=lv60). return_attention_mask (`bool`, *optional*, defaults to `False`): Whether or not [`~Wav2Vec2FeatureExtractor.__call__`] should return `attention_mask`. Wav2Vec2 models that have set `config.feat_extract_norm == "group"`, such as - [wav2vec2-base](https://huggingface.co/facebook/wav2vec2-base-960h), have **not** been trained using + [wav2vec2-base](https://hf-mirror.com/facebook/wav2vec2-base-960h), have **not** been trained using `attention_mask`. For such models, `input_values` should simply be padded with 0 and no `attention_mask` should be passed. For Wav2Vec2 models that have set `config.feat_extract_norm == "layer"`, such as - [wav2vec2-lv60](https://huggingface.co/facebook/wav2vec2-large-960h-lv60-self), `attention_mask` should be + [wav2vec2-lv60](https://hf-mirror.com/facebook/wav2vec2-large-960h-lv60-self), `attention_mask` should be passed for batched inference. """ @@ -150,12 +150,12 @@ def __call__( Wav2Vec2 models that have set `config.feat_extract_norm == "group"`, such as - [wav2vec2-base](https://huggingface.co/facebook/wav2vec2-base-960h), have **not** been trained using + [wav2vec2-base](https://hf-mirror.com/facebook/wav2vec2-base-960h), have **not** been trained using `attention_mask`. For such models, `input_values` should simply be padded with 0 and no `attention_mask` should be passed. For Wav2Vec2 models that have set `config.feat_extract_norm == "layer"`, such as - [wav2vec2-lv60](https://huggingface.co/facebook/wav2vec2-large-960h-lv60-self), `attention_mask` should + [wav2vec2-lv60](https://hf-mirror.com/facebook/wav2vec2-large-960h-lv60-self), `attention_mask` should be passed for batched inference. diff --git a/mindnlp/transformers/models/wav2vec2/modeling_wav2vec2.py b/mindnlp/transformers/models/wav2vec2/modeling_wav2vec2.py index 2ae0870e8..eb1610182 100644 --- a/mindnlp/transformers/models/wav2vec2/modeling_wav2vec2.py +++ b/mindnlp/transformers/models/wav2vec2/modeling_wav2vec2.py @@ -70,7 +70,7 @@ "facebook/wav2vec2-large-960h", "facebook/wav2vec2-large-960h-lv60", "facebook/wav2vec2-large-960h-lv60-self", - # See all Wav2Vec2 models at https://huggingface.co/models?filter=wav2vec2 + # See all Wav2Vec2 models at https://hf-mirror.com/models?filter=wav2vec2 ] @@ -1141,7 +1141,7 @@ def load_adapter(self, target_lang: str, force_load=True, **kwargs): the token generated when running `huggingface-cli login` (stored in `~/.huggingface`). revision (`str`, *optional*, defaults to `"main"`): The specific model version to use. It can be a branch name, a tag name, or a commit id, since we use a - git-based system for storing models and other artifacts on huggingface.co, so `revision` can be any + git-based system for storing models and other artifacts on hf-mirror.com, so `revision` can be any identifier allowed by git. @@ -1157,7 +1157,7 @@ def load_adapter(self, target_lang: str, force_load=True, **kwargs): - Activate the special ["offline-mode"](https://huggingface.co/transformers/installation.html#offline-mode) to + Activate the special ["offline-mode"](https://hf-mirror.com/transformers/installation.html#offline-mode) to use this method in a firewalled environment. @@ -1233,7 +1233,7 @@ def load_adapter(self, target_lang: str, force_load=True, **kwargs): if use_safetensors: raise EnvironmentError( f"Can't load the model for '{model_path_or_id}'. If you were trying to load it" - " from 'https://huggingface.co/models', make sure you don't have a local directory with the" + " from 'https://hf-mirror.com/models', make sure you don't have a local directory with the" f" same name. Otherwise, make sure '{model_path_or_id}' is the correct path to a" f" directory containing a file named {filepath}." ) from exc @@ -1269,7 +1269,7 @@ def load_adapter(self, target_lang: str, force_load=True, **kwargs): # For any other exception, we throw a generic error. raise EnvironmentError( f"Can't load the model for '{model_path_or_id}'. If you were trying to load it" - " from 'https://huggingface.co/models', make sure you don't have a local directory with the" + " from 'https://hf-mirror.com/models', make sure you don't have a local directory with the" f" same name. Otherwise, make sure '{model_path_or_id}' is the correct path to a" f" directory containing a file named {filepath}." ) from exc diff --git a/mindnlp/transformers/models/wav2vec2/tokenization_wav2vec2.py b/mindnlp/transformers/models/wav2vec2/tokenization_wav2vec2.py index 34efaa171..dab7107a2 100644 --- a/mindnlp/transformers/models/wav2vec2/tokenization_wav2vec2.py +++ b/mindnlp/transformers/models/wav2vec2/tokenization_wav2vec2.py @@ -49,11 +49,11 @@ PRETRAINED_VOCAB_FILES_MAP = { "vocab_file": { - "facebook/wav2vec2-base-960h": "https://huggingface.co/facebook/wav2vec2-base-960h/resolve/main/vocab.json", + "facebook/wav2vec2-base-960h": "https://hf-mirror.com/facebook/wav2vec2-base-960h/resolve/main/vocab.json", }, "tokenizer_config_file": { "facebook/wav2vec2-base-960h": ( - "https://huggingface.co/facebook/wav2vec2-base-960h/resolve/main/tokenizer_config.json" + "https://hf-mirror.com/facebook/wav2vec2-base-960h/resolve/main/tokenizer_config.json" ), }, } @@ -112,7 +112,7 @@ class Wav2Vec2CTCTokenizer(PreTrainedTokenizer): Whether or not to accept lowercase input and lowercase the output when decoding. target_lang (`str`, *optional*): A target language the tokenizer should set by default. `target_lang` has to be defined for multi-lingual, - nested vocabulary such as [facebook/mms-1b-all](https://huggingface.co/facebook/mms-1b-all). + nested vocabulary such as [facebook/mms-1b-all](https://hf-mirror.com/facebook/mms-1b-all). **kwargs Additional keyword arguments passed along to [`PreTrainedTokenizer`] @@ -589,7 +589,7 @@ def decode( ... for d in outputs.word_offsets ... ] >>> # compare word offsets with audio `en_train_0/common_voice_en_19121553.mp3` online on the dataset viewer: - >>> # https://huggingface.co/datasets/mozilla-foundation/common_voice_11_0/viewer/en + >>> # https://hf-mirror.com/datasets/mozilla-foundation/common_voice_11_0/viewer/en >>> word_offsets[:3] [{'word': 'THE', 'start_time': 0.7, 'end_time': 0.78}, {'word': 'TRICK', 'start_time': 0.88, 'end_time': 1.08}, {'word': 'APPEARS', 'start_time': 1.2, 'end_time': 1.64}] ```""" @@ -645,19 +645,19 @@ class Wav2Vec2Tokenizer(PreTrainedTokenizer): do_normalize (`bool`, *optional*, defaults to `False`): Whether or not to zero-mean unit-variance normalize the input. Normalizing can help to significantly improve the performance for some models, *e.g.*, - [wav2vec2-lv60](https://huggingface.co/models?search=lv60). + [wav2vec2-lv60](https://hf-mirror.com/models?search=lv60). return_attention_mask (`bool`, *optional*, defaults to `False`): Whether or not [`~Wav2Vec2Tokenizer.__call__`] should return `attention_mask`. Wav2Vec2 models that have set `config.feat_extract_norm == "group"`, such as - [wav2vec2-base](https://huggingface.co/facebook/wav2vec2-base-960h), have **not** been trained using + [wav2vec2-base](https://hf-mirror.com/facebook/wav2vec2-base-960h), have **not** been trained using `attention_mask`. For such models, `input_values` should simply be padded with 0 and no `attention_mask` should be passed. For Wav2Vec2 models that have set `config.feat_extract_norm == "layer"`, such as - [wav2vec2-lv60](https://huggingface.co/facebook/wav2vec2-large-960h-lv60-self), `attention_mask` should be + [wav2vec2-lv60](https://hf-mirror.com/facebook/wav2vec2-large-960h-lv60-self), `attention_mask` should be passed for batched inference. @@ -669,11 +669,11 @@ class Wav2Vec2Tokenizer(PreTrainedTokenizer): vocab_files_names = VOCAB_FILES_NAMES pretrained_vocab_files_map = { "vocab_file": { - "facebook/wav2vec2-base-960h": "https://huggingface.co/facebook/wav2vec2-base-960h/resolve/main/vocab.json" + "facebook/wav2vec2-base-960h": "https://hf-mirror.com/facebook/wav2vec2-base-960h/resolve/main/vocab.json" }, "tokenizer_config_file": { "facebook/wav2vec2-base-960h": ( - "https://huggingface.co/facebook/wav2vec2-base-960h/resolve/main/tokenizer.json" + "https://hf-mirror.com/facebook/wav2vec2-base-960h/resolve/main/tokenizer.json" ), }, } diff --git a/mindnlp/transformers/models/wav2vec2_with_lm/processing_wav2vec2_with_lm.py b/mindnlp/transformers/models/wav2vec2_with_lm/processing_wav2vec2_with_lm.py index bc613e748..bdaafcf25 100644 --- a/mindnlp/transformers/models/wav2vec2_with_lm/processing_wav2vec2_with_lm.py +++ b/mindnlp/transformers/models/wav2vec2_with_lm/processing_wav2vec2_with_lm.py @@ -132,7 +132,7 @@ def from_pretrained(cls, pretrained_model_name_or_path, **kwargs): This can be either: - a string, the *model id* of a pretrained feature_extractor hosted inside a model repo on - huggingface.co. + hf-mirror.com. - a path to a *directory* containing a feature extractor file saved using the [`~SequenceFeatureExtractor.save_pretrained`] method, e.g., `./my_model_directory/`. - a path or url to a saved feature extractor JSON *file*, e.g., @@ -560,7 +560,7 @@ def decode( ... for d in outputs.word_offsets ... ] >>> # compare word offsets with audio `en_train_0/common_voice_en_19121553.mp3` online on the dataset viewer: - >>> # https://huggingface.co/datasets/mozilla-foundation/common_voice_11_0/viewer/en + >>> # https://hf-mirror.com/datasets/mozilla-foundation/common_voice_11_0/viewer/en >>> word_offsets[:4] [{'word': 'THE', 'start_time': 0.68, 'end_time': 0.78}, {'word': 'TRACK', 'start_time': 0.88, 'end_time': 1.1}, diff --git a/mindnlp/transformers/models/whisper/configuration_whisper.py b/mindnlp/transformers/models/whisper/configuration_whisper.py index 4c6995f3b..94350231e 100644 --- a/mindnlp/transformers/models/whisper/configuration_whisper.py +++ b/mindnlp/transformers/models/whisper/configuration_whisper.py @@ -56,7 +56,7 @@ class WhisperConfig(PretrainedConfig): This is the configuration class to store the configuration of a [`WhisperModel`]. It is used to instantiate a Whisper model according to the specified arguments, defining the model architecture. Instantiating a configuration with the defaults will yield a similar configuration to that of the Whisper - [openai/whisper-tiny](https://huggingface.co/openai/whisper-tiny) architecture. + [openai/whisper-tiny](https://hf-mirror.com/openai/whisper-tiny) architecture. Configuration objects inherit from [`PretrainedConfig`] and can be used to control the model outputs. Read the documentation from [`PretrainedConfig`] for more information. diff --git a/mindnlp/transformers/models/whisper/modeling_whisper.py b/mindnlp/transformers/models/whisper/modeling_whisper.py index 52e9368f6..d3e5d1681 100644 --- a/mindnlp/transformers/models/whisper/modeling_whisper.py +++ b/mindnlp/transformers/models/whisper/modeling_whisper.py @@ -47,7 +47,7 @@ WHISPER_PRETRAINED_MODEL_ARCHIVE_LIST = [ "openai/whisper-base", - # See all Whisper models at https://huggingface.co/models?filter=whisper + # See all Whisper models at https://hf-mirror.com/models?filter=whisper ] diff --git a/mindnlp/transformers/models/whisper/tokenization_whisper.py b/mindnlp/transformers/models/whisper/tokenization_whisper.py index e67921a67..d184d816e 100644 --- a/mindnlp/transformers/models/whisper/tokenization_whisper.py +++ b/mindnlp/transformers/models/whisper/tokenization_whisper.py @@ -36,11 +36,11 @@ PRETRAINED_VOCAB_FILES_MAP = { "vocab_file": { - "openai/whisper-base": "https://huggingface.co/openai/whisper-base/resolve/main/vocab.json", + "openai/whisper-base": "https://hf-mirror.com/openai/whisper-base/resolve/main/vocab.json", }, - "merges_file": {"openai/whisper-base": "https://huggingface.co/openai/whisper-base/resolve/main/merges_file.txt"}, + "merges_file": {"openai/whisper-base": "https://hf-mirror.com/openai/whisper-base/resolve/main/merges_file.txt"}, "normalizer_file": { - "openai/whisper-base": "https://huggingface.co/openai/whisper-base/resolve/main/normalizer.json" + "openai/whisper-base": "https://hf-mirror.com/openai/whisper-base/resolve/main/normalizer.json" }, } @@ -800,7 +800,7 @@ def default_chat_template(self): "\nNo chat template is defined for this tokenizer - using the default template " f"for the {self.__class__.__name__} class. If the default is not appropriate for " "your model, please set `tokenizer.chat_template` to an appropriate template. " - "See https://huggingface.co/docs/transformers/main/chat_templating for more information.\n" + "See https://hf-mirror.com/docs/transformers/main/chat_templating for more information.\n" ) return "{% for message in messages %}" "{{ message.content }}{{ eos_token }}" "{% endfor %}" diff --git a/mindnlp/transformers/models/whisper/tokenization_whisper_fast.py b/mindnlp/transformers/models/whisper/tokenization_whisper_fast.py index 5e8609d69..aab847856 100644 --- a/mindnlp/transformers/models/whisper/tokenization_whisper_fast.py +++ b/mindnlp/transformers/models/whisper/tokenization_whisper_fast.py @@ -42,37 +42,37 @@ PRETRAINED_VOCAB_FILES_MAP = { "vocab_file": { - "openai/whisper-tiny": "https://huggingface.co/openai/whisper-tiny/resolve/main/vocab.json", - "openai/whisper-base": "https://huggingface.co/openai/whisper-base/resolve/main/vocab.json", - "openai/whisper-small": "https://huggingface.co/openai/whisper-small/resolve/main/vocab.json", - "openai/whisper-medium": "https://huggingface.co/openai/whisper-medium/resolve/main/vocab.json", - "openai/whisper-large": "https://huggingface.co/openai/whisper-large/resolve/main/vocab.json", - "openai/whisper-tiny.en": "https://huggingface.co/openai/whisper-tiny.en/resolve/main/vocab.json", - "openai/whisper-base.en": "https://huggingface.co/openai/whisper-base.en/resolve/main/vocab.json", - "openai/whisper-small.en": "https://huggingface.co/openai/whisper-small.en/resolve/main/vocab.json", - "openai/whisper-medium.en": "https://huggingface.co/openai/whisper-medium.en/resolve/main/vocab.json", + "openai/whisper-tiny": "https://hf-mirror.com/openai/whisper-tiny/resolve/main/vocab.json", + "openai/whisper-base": "https://hf-mirror.com/openai/whisper-base/resolve/main/vocab.json", + "openai/whisper-small": "https://hf-mirror.com/openai/whisper-small/resolve/main/vocab.json", + "openai/whisper-medium": "https://hf-mirror.com/openai/whisper-medium/resolve/main/vocab.json", + "openai/whisper-large": "https://hf-mirror.com/openai/whisper-large/resolve/main/vocab.json", + "openai/whisper-tiny.en": "https://hf-mirror.com/openai/whisper-tiny.en/resolve/main/vocab.json", + "openai/whisper-base.en": "https://hf-mirror.com/openai/whisper-base.en/resolve/main/vocab.json", + "openai/whisper-small.en": "https://hf-mirror.com/openai/whisper-small.en/resolve/main/vocab.json", + "openai/whisper-medium.en": "https://hf-mirror.com/openai/whisper-medium.en/resolve/main/vocab.json", }, "merges_file": { - "openai/whisper-tiny": "https://huggingface.co/openai/whisper-tiny/resolve/main/merges.txt", - "openai/whisper-base": "https://huggingface.co/openai/whisper-base/resolve/main/merges.txt", - "openai/whisper-small": "https://huggingface.co/openai/whisper-small/resolve/main/merges.txt", - "openai/whisper-medium": "https://huggingface.co/openai/whisper-medium/resolve/main/merges.txt", - "openai/whisper-large": "https://huggingface.co/openai/whisper-large/resolve/main/merges.txt", - "openai/whisper-tiny.en": "https://huggingface.co/openai/whisper-tiny.en/resolve/main/merges.txt", - "openai/whisper-base.en": "https://huggingface.co/openai/whisper-base.en/resolve/main/merges.txt", - "openai/whisper-small.en": "https://huggingface.co/openai/whisper-small.en/resolve/main/merges.txt", - "openai/whisper-medium.en": "https://huggingface.co/openai/whisper-medium.en/resolve/main/merges.txt", + "openai/whisper-tiny": "https://hf-mirror.com/openai/whisper-tiny/resolve/main/merges.txt", + "openai/whisper-base": "https://hf-mirror.com/openai/whisper-base/resolve/main/merges.txt", + "openai/whisper-small": "https://hf-mirror.com/openai/whisper-small/resolve/main/merges.txt", + "openai/whisper-medium": "https://hf-mirror.com/openai/whisper-medium/resolve/main/merges.txt", + "openai/whisper-large": "https://hf-mirror.com/openai/whisper-large/resolve/main/merges.txt", + "openai/whisper-tiny.en": "https://hf-mirror.com/openai/whisper-tiny.en/resolve/main/merges.txt", + "openai/whisper-base.en": "https://hf-mirror.com/openai/whisper-base.en/resolve/main/merges.txt", + "openai/whisper-small.en": "https://hf-mirror.com/openai/whisper-small.en/resolve/main/merges.txt", + "openai/whisper-medium.en": "https://hf-mirror.com/openai/whisper-medium.en/resolve/main/merges.txt", }, "tokenizer_file": { - "openai/whisper-tiny": "https://huggingface.co/openai/whisper-tiny/resolve/main/tokenizer.json", - "openai/whisper-base": "https://huggingface.co/openai/whisper-base/resolve/main/tokenizer.json", - "openai/whisper-small": "https://huggingface.co/openai/whisper-small/resolve/main/tokenizer.json", - "openai/whisper-medium": "https://huggingface.co/openai/whisper-medium/resolve/main/tokenizer.json", - "openai/whisper-large": "https://huggingface.co/openai/whisper-large/resolve/main/tokenizer.json", - "openai/whisper-tiny.en": "https://huggingface.co/openai/whisper-tiny.en/resolve/main/tokenizer.json", - "openai/whisper-base.en": "https://huggingface.co/openai/whisper-base.en/resolve/main/tokenizer.json", - "openai/whisper-small.en": "https://huggingface.co/openai/whisper-small.en/resolve/main/tokenizer.json", - "openai/whisper-medium.en": "https://huggingface.co/openai/whisper-medium.en/resolve/main/tokenizer.json", + "openai/whisper-tiny": "https://hf-mirror.com/openai/whisper-tiny/resolve/main/tokenizer.json", + "openai/whisper-base": "https://hf-mirror.com/openai/whisper-base/resolve/main/tokenizer.json", + "openai/whisper-small": "https://hf-mirror.com/openai/whisper-small/resolve/main/tokenizer.json", + "openai/whisper-medium": "https://hf-mirror.com/openai/whisper-medium/resolve/main/tokenizer.json", + "openai/whisper-large": "https://hf-mirror.com/openai/whisper-large/resolve/main/tokenizer.json", + "openai/whisper-tiny.en": "https://hf-mirror.com/openai/whisper-tiny.en/resolve/main/tokenizer.json", + "openai/whisper-base.en": "https://hf-mirror.com/openai/whisper-base.en/resolve/main/tokenizer.json", + "openai/whisper-small.en": "https://hf-mirror.com/openai/whisper-small.en/resolve/main/tokenizer.json", + "openai/whisper-medium.en": "https://hf-mirror.com/openai/whisper-medium.en/resolve/main/tokenizer.json", }, } @@ -598,7 +598,7 @@ def default_chat_template(self): "\nNo chat template is defined for this tokenizer - using the default template " f"for the {self.__class__.__name__} class. If the default is not appropriate for " "your model, please set `tokenizer.chat_template` to an appropriate template. " - "See https://huggingface.co/docs/transformers/main/chat_templating for more information.\n" + "See https://hf-mirror.com/docs/transformers/main/chat_templating for more information.\n" ) return "{% for message in messages %}" "{{ message.content }}{{ eos_token }}" "{% endfor %}" diff --git a/mindnlp/transformers/models/xlm/configuration_xlm.py b/mindnlp/transformers/models/xlm/configuration_xlm.py index 1ca4b11a6..3565c6649 100644 --- a/mindnlp/transformers/models/xlm/configuration_xlm.py +++ b/mindnlp/transformers/models/xlm/configuration_xlm.py @@ -20,16 +20,16 @@ logger = logging.get_logger(__name__) XLM_PRETRAINED_CONFIG_ARCHIVE_MAP = { - "xlm-mlm-en-2048": "https://huggingface.co/xlm-mlm-en-2048/resolve/main/config.json", - "xlm-mlm-ende-1024": "https://huggingface.co/xlm-mlm-ende-1024/resolve/main/config.json", - "xlm-mlm-enfr-1024": "https://huggingface.co/xlm-mlm-enfr-1024/resolve/main/config.json", - "xlm-mlm-enro-1024": "https://huggingface.co/xlm-mlm-enro-1024/resolve/main/config.json", - "xlm-mlm-tlm-xnli15-1024": "https://huggingface.co/xlm-mlm-tlm-xnli15-1024/resolve/main/config.json", - "xlm-mlm-xnli15-1024": "https://huggingface.co/xlm-mlm-xnli15-1024/resolve/main/config.json", - "xlm-clm-enfr-1024": "https://huggingface.co/xlm-clm-enfr-1024/resolve/main/config.json", - "xlm-clm-ende-1024": "https://huggingface.co/xlm-clm-ende-1024/resolve/main/config.json", - "xlm-mlm-17-1280": "https://huggingface.co/xlm-mlm-17-1280/resolve/main/config.json", - "xlm-mlm-100-1280": "https://huggingface.co/xlm-mlm-100-1280/resolve/main/config.json", + "xlm-mlm-en-2048": "https://hf-mirror.com/xlm-mlm-en-2048/resolve/main/config.json", + "xlm-mlm-ende-1024": "https://hf-mirror.com/xlm-mlm-ende-1024/resolve/main/config.json", + "xlm-mlm-enfr-1024": "https://hf-mirror.com/xlm-mlm-enfr-1024/resolve/main/config.json", + "xlm-mlm-enro-1024": "https://hf-mirror.com/xlm-mlm-enro-1024/resolve/main/config.json", + "xlm-mlm-tlm-xnli15-1024": "https://hf-mirror.com/xlm-mlm-tlm-xnli15-1024/resolve/main/config.json", + "xlm-mlm-xnli15-1024": "https://hf-mirror.com/xlm-mlm-xnli15-1024/resolve/main/config.json", + "xlm-clm-enfr-1024": "https://hf-mirror.com/xlm-clm-enfr-1024/resolve/main/config.json", + "xlm-clm-ende-1024": "https://hf-mirror.com/xlm-clm-ende-1024/resolve/main/config.json", + "xlm-mlm-17-1280": "https://hf-mirror.com/xlm-mlm-17-1280/resolve/main/config.json", + "xlm-mlm-100-1280": "https://hf-mirror.com/xlm-mlm-100-1280/resolve/main/config.json", } @@ -38,7 +38,7 @@ class XLMConfig(PretrainedConfig): This is the configuration class to store the configuration of a [`XLMModel`] or a [`TFXLMModel`]. It is used to instantiate a XLM model according to the specified arguments, defining the model architecture. Instantiating a configuration with the defaults will yield a similar configuration to that of the - [xlm-mlm-en-2048](https://huggingface.co/xlm-mlm-en-2048) architecture. + [xlm-mlm-en-2048](https://hf-mirror.com/xlm-mlm-en-2048) architecture. Configuration objects inherit from [`PretrainedConfig`] and can be used to control the model outputs. Read the documentation from [`PretrainedConfig`] for more information. @@ -71,7 +71,7 @@ class XLMConfig(PretrainedConfig): The number of languages the model handles. Set to 1 for monolingual models. use_lang_emb (`bool`, *optional*, defaults to `True`) Whether to use language embeddings. Some models use additional language embeddings, see [the multilingual - models page](http://huggingface.co/transformers/multilingual.html#xlm-language-embeddings) for information + models page](http://hf-mirror.com/transformers/multilingual.html#xlm-language-embeddings) for information on how to use them. max_position_embeddings (`int`, *optional*, defaults to 512): The maximum sequence length that this model might ever be used with. Typically set this to something large diff --git a/mindnlp/transformers/models/xlm/modeling_xlm.py b/mindnlp/transformers/models/xlm/modeling_xlm.py index c8c45f462..dcc36d10b 100644 --- a/mindnlp/transformers/models/xlm/modeling_xlm.py +++ b/mindnlp/transformers/models/xlm/modeling_xlm.py @@ -57,7 +57,7 @@ "xlm-clm-ende-1024", "xlm-mlm-17-1280", "xlm-mlm-100-1280", - # See all XLM models at https://huggingface.co/models?filter=xlm + # See all XLM models at https://hf-mirror.com/models?filter=xlm ] diff --git a/mindnlp/transformers/models/xlm/tokenization_xlm.py b/mindnlp/transformers/models/xlm/tokenization_xlm.py index 9f9e50fef..7bb9e38ab 100644 --- a/mindnlp/transformers/models/xlm/tokenization_xlm.py +++ b/mindnlp/transformers/models/xlm/tokenization_xlm.py @@ -35,28 +35,28 @@ PRETRAINED_VOCAB_FILES_MAP = { "vocab_file": { - "xlm-mlm-en-2048": "https://huggingface.co/xlm-mlm-en-2048/resolve/main/vocab.json", - "xlm-mlm-ende-1024": "https://huggingface.co/xlm-mlm-ende-1024/resolve/main/vocab.json", - "xlm-mlm-enfr-1024": "https://huggingface.co/xlm-mlm-enfr-1024/resolve/main/vocab.json", - "xlm-mlm-enro-1024": "https://huggingface.co/xlm-mlm-enro-1024/resolve/main/vocab.json", - "xlm-mlm-tlm-xnli15-1024": "https://huggingface.co/xlm-mlm-tlm-xnli15-1024/resolve/main/vocab.json", - "xlm-mlm-xnli15-1024": "https://huggingface.co/xlm-mlm-xnli15-1024/resolve/main/vocab.json", - "xlm-clm-enfr-1024": "https://huggingface.co/xlm-clm-enfr-1024/resolve/main/vocab.json", - "xlm-clm-ende-1024": "https://huggingface.co/xlm-clm-ende-1024/resolve/main/vocab.json", - "xlm-mlm-17-1280": "https://huggingface.co/xlm-mlm-17-1280/resolve/main/vocab.json", - "xlm-mlm-100-1280": "https://huggingface.co/xlm-mlm-100-1280/resolve/main/vocab.json", + "xlm-mlm-en-2048": "https://hf-mirror.com/xlm-mlm-en-2048/resolve/main/vocab.json", + "xlm-mlm-ende-1024": "https://hf-mirror.com/xlm-mlm-ende-1024/resolve/main/vocab.json", + "xlm-mlm-enfr-1024": "https://hf-mirror.com/xlm-mlm-enfr-1024/resolve/main/vocab.json", + "xlm-mlm-enro-1024": "https://hf-mirror.com/xlm-mlm-enro-1024/resolve/main/vocab.json", + "xlm-mlm-tlm-xnli15-1024": "https://hf-mirror.com/xlm-mlm-tlm-xnli15-1024/resolve/main/vocab.json", + "xlm-mlm-xnli15-1024": "https://hf-mirror.com/xlm-mlm-xnli15-1024/resolve/main/vocab.json", + "xlm-clm-enfr-1024": "https://hf-mirror.com/xlm-clm-enfr-1024/resolve/main/vocab.json", + "xlm-clm-ende-1024": "https://hf-mirror.com/xlm-clm-ende-1024/resolve/main/vocab.json", + "xlm-mlm-17-1280": "https://hf-mirror.com/xlm-mlm-17-1280/resolve/main/vocab.json", + "xlm-mlm-100-1280": "https://hf-mirror.com/xlm-mlm-100-1280/resolve/main/vocab.json", }, "merges_file": { - "xlm-mlm-en-2048": "https://huggingface.co/xlm-mlm-en-2048/resolve/main/merges.txt", - "xlm-mlm-ende-1024": "https://huggingface.co/xlm-mlm-ende-1024/resolve/main/merges.txt", - "xlm-mlm-enfr-1024": "https://huggingface.co/xlm-mlm-enfr-1024/resolve/main/merges.txt", - "xlm-mlm-enro-1024": "https://huggingface.co/xlm-mlm-enro-1024/resolve/main/merges.txt", - "xlm-mlm-tlm-xnli15-1024": "https://huggingface.co/xlm-mlm-tlm-xnli15-1024/resolve/main/merges.txt", - "xlm-mlm-xnli15-1024": "https://huggingface.co/xlm-mlm-xnli15-1024/resolve/main/merges.txt", - "xlm-clm-enfr-1024": "https://huggingface.co/xlm-clm-enfr-1024/resolve/main/merges.txt", - "xlm-clm-ende-1024": "https://huggingface.co/xlm-clm-ende-1024/resolve/main/merges.txt", - "xlm-mlm-17-1280": "https://huggingface.co/xlm-mlm-17-1280/resolve/main/merges.txt", - "xlm-mlm-100-1280": "https://huggingface.co/xlm-mlm-100-1280/resolve/main/merges.txt", + "xlm-mlm-en-2048": "https://hf-mirror.com/xlm-mlm-en-2048/resolve/main/merges.txt", + "xlm-mlm-ende-1024": "https://hf-mirror.com/xlm-mlm-ende-1024/resolve/main/merges.txt", + "xlm-mlm-enfr-1024": "https://hf-mirror.com/xlm-mlm-enfr-1024/resolve/main/merges.txt", + "xlm-mlm-enro-1024": "https://hf-mirror.com/xlm-mlm-enro-1024/resolve/main/merges.txt", + "xlm-mlm-tlm-xnli15-1024": "https://hf-mirror.com/xlm-mlm-tlm-xnli15-1024/resolve/main/merges.txt", + "xlm-mlm-xnli15-1024": "https://hf-mirror.com/xlm-mlm-xnli15-1024/resolve/main/merges.txt", + "xlm-clm-enfr-1024": "https://hf-mirror.com/xlm-clm-enfr-1024/resolve/main/merges.txt", + "xlm-clm-ende-1024": "https://hf-mirror.com/xlm-clm-ende-1024/resolve/main/merges.txt", + "xlm-mlm-17-1280": "https://hf-mirror.com/xlm-mlm-17-1280/resolve/main/merges.txt", + "xlm-mlm-100-1280": "https://hf-mirror.com/xlm-mlm-100-1280/resolve/main/merges.txt", }, } diff --git a/mindnlp/transformers/models/xlm_roberta/configuration_xlm_roberta.py b/mindnlp/transformers/models/xlm_roberta/configuration_xlm_roberta.py index beca2ce7e..c44316bf1 100644 --- a/mindnlp/transformers/models/xlm_roberta/configuration_xlm_roberta.py +++ b/mindnlp/transformers/models/xlm_roberta/configuration_xlm_roberta.py @@ -29,7 +29,7 @@ class XLMRobertaConfig(PretrainedConfig): This is the configuration class to store the configuration of a [`XLMRobertaModel`] or a [`TFXLMRobertaModel`]. It is used to instantiate a XLM-RoBERTa model according to the specified arguments, defining the model architecture. Instantiating a configuration with the defaults will yield a similar configuration to that of the XLMRoBERTa - [xlm-roberta-base](https://huggingface.co/xlm-roberta-base) architecture. + [xlm-roberta-base](https://hf-mirror.com/xlm-roberta-base) architecture. Configuration objects inherit from [`PretrainedConfig`] and can be used to control the model outputs. Read the documentation from [`PretrainedConfig`] for more information. diff --git a/mindnlp/transformers/models/xlm_roberta/tokenization_xlm_roberta.py b/mindnlp/transformers/models/xlm_roberta/tokenization_xlm_roberta.py index b30973cb2..a82a26705 100644 --- a/mindnlp/transformers/models/xlm_roberta/tokenization_xlm_roberta.py +++ b/mindnlp/transformers/models/xlm_roberta/tokenization_xlm_roberta.py @@ -34,19 +34,19 @@ PRETRAINED_VOCAB_FILES_MAP = { "vocab_file": { - "xlm-roberta-base": "https://huggingface.co/xlm-roberta-base/resolve/main/sentencepiece.bpe.model", - "xlm-roberta-large": "https://huggingface.co/xlm-roberta-large/resolve/main/sentencepiece.bpe.model", + "xlm-roberta-base": "https://hf-mirror.com/xlm-roberta-base/resolve/main/sentencepiece.bpe.model", + "xlm-roberta-large": "https://hf-mirror.com/xlm-roberta-large/resolve/main/sentencepiece.bpe.model", "xlm-roberta-large-finetuned-conll02-dutch": ( - "https://huggingface.co/xlm-roberta-large-finetuned-conll02-dutch/resolve/main/sentencepiece.bpe.model" + "https://hf-mirror.com/xlm-roberta-large-finetuned-conll02-dutch/resolve/main/sentencepiece.bpe.model" ), "xlm-roberta-large-finetuned-conll02-spanish": ( - "https://huggingface.co/xlm-roberta-large-finetuned-conll02-spanish/resolve/main/sentencepiece.bpe.model" + "https://hf-mirror.com/xlm-roberta-large-finetuned-conll02-spanish/resolve/main/sentencepiece.bpe.model" ), "xlm-roberta-large-finetuned-conll03-english": ( - "https://huggingface.co/xlm-roberta-large-finetuned-conll03-english/resolve/main/sentencepiece.bpe.model" + "https://hf-mirror.com/xlm-roberta-large-finetuned-conll03-english/resolve/main/sentencepiece.bpe.model" ), "xlm-roberta-large-finetuned-conll03-german": ( - "https://huggingface.co/xlm-roberta-large-finetuned-conll03-german/resolve/main/sentencepiece.bpe.model" + "https://hf-mirror.com/xlm-roberta-large-finetuned-conll03-german/resolve/main/sentencepiece.bpe.model" ), } } diff --git a/mindnlp/transformers/models/xlm_roberta/tokenization_xlm_roberta_fast.py b/mindnlp/transformers/models/xlm_roberta/tokenization_xlm_roberta_fast.py index 662139553..48de9de6f 100644 --- a/mindnlp/transformers/models/xlm_roberta/tokenization_xlm_roberta_fast.py +++ b/mindnlp/transformers/models/xlm_roberta/tokenization_xlm_roberta_fast.py @@ -35,35 +35,35 @@ PRETRAINED_VOCAB_FILES_MAP = { "vocab_file": { - "xlm-roberta-base": "https://huggingface.co/xlm-roberta-base/resolve/main/sentencepiece.bpe.model", - "xlm-roberta-large": "https://huggingface.co/xlm-roberta-large/resolve/main/sentencepiece.bpe.model", + "xlm-roberta-base": "https://hf-mirror.com/xlm-roberta-base/resolve/main/sentencepiece.bpe.model", + "xlm-roberta-large": "https://hf-mirror.com/xlm-roberta-large/resolve/main/sentencepiece.bpe.model", "xlm-roberta-large-finetuned-conll02-dutch": ( - "https://huggingface.co/xlm-roberta-large-finetuned-conll02-dutch/resolve/main/sentencepiece.bpe.model" + "https://hf-mirror.com/xlm-roberta-large-finetuned-conll02-dutch/resolve/main/sentencepiece.bpe.model" ), "xlm-roberta-large-finetuned-conll02-spanish": ( - "https://huggingface.co/xlm-roberta-large-finetuned-conll02-spanish/resolve/main/sentencepiece.bpe.model" + "https://hf-mirror.com/xlm-roberta-large-finetuned-conll02-spanish/resolve/main/sentencepiece.bpe.model" ), "xlm-roberta-large-finetuned-conll03-english": ( - "https://huggingface.co/xlm-roberta-large-finetuned-conll03-english/resolve/main/sentencepiece.bpe.model" + "https://hf-mirror.com/xlm-roberta-large-finetuned-conll03-english/resolve/main/sentencepiece.bpe.model" ), "xlm-roberta-large-finetuned-conll03-german": ( - "https://huggingface.co/xlm-roberta-large-finetuned-conll03-german/resolve/main/sentencepiece.bpe.model" + "https://hf-mirror.com/xlm-roberta-large-finetuned-conll03-german/resolve/main/sentencepiece.bpe.model" ), }, "tokenizer_file": { - "xlm-roberta-base": "https://huggingface.co/xlm-roberta-base/resolve/main/tokenizer.json", - "xlm-roberta-large": "https://huggingface.co/xlm-roberta-large/resolve/main/tokenizer.json", + "xlm-roberta-base": "https://hf-mirror.com/xlm-roberta-base/resolve/main/tokenizer.json", + "xlm-roberta-large": "https://hf-mirror.com/xlm-roberta-large/resolve/main/tokenizer.json", "xlm-roberta-large-finetuned-conll02-dutch": ( - "https://huggingface.co/xlm-roberta-large-finetuned-conll02-dutch/resolve/main/tokenizer.json" + "https://hf-mirror.com/xlm-roberta-large-finetuned-conll02-dutch/resolve/main/tokenizer.json" ), "xlm-roberta-large-finetuned-conll02-spanish": ( - "https://huggingface.co/xlm-roberta-large-finetuned-conll02-spanish/resolve/main/tokenizer.json" + "https://hf-mirror.com/xlm-roberta-large-finetuned-conll02-spanish/resolve/main/tokenizer.json" ), "xlm-roberta-large-finetuned-conll03-english": ( - "https://huggingface.co/xlm-roberta-large-finetuned-conll03-english/resolve/main/tokenizer.json" + "https://hf-mirror.com/xlm-roberta-large-finetuned-conll03-english/resolve/main/tokenizer.json" ), "xlm-roberta-large-finetuned-conll03-german": ( - "https://huggingface.co/xlm-roberta-large-finetuned-conll03-german/resolve/main/tokenizer.json" + "https://hf-mirror.com/xlm-roberta-large-finetuned-conll03-german/resolve/main/tokenizer.json" ), }, } @@ -82,7 +82,7 @@ class XLMRobertaTokenizerFast(PreTrainedTokenizerFast): """ Construct a "fast" XLM-RoBERTa tokenizer (backed by HuggingFace's *tokenizers* library). Adapted from [`RobertaTokenizer`] and [`XLNetTokenizer`]. Based on - [BPE](https://huggingface.co/docs/tokenizers/python/latest/components.html?highlight=BPE#models). + [BPE](https://hf-mirror.com/docs/tokenizers/python/latest/components.html?highlight=BPE#models). This tokenizer inherits from [`PreTrainedTokenizerFast`] which contains most of the main methods. Users should refer to this superclass for more information regarding those methods. diff --git a/mindnlp/transformers/pipelines/automatic_speech_recognition.py b/mindnlp/transformers/pipelines/automatic_speech_recognition.py index ee01403a3..0b2bc8d5d 100644 --- a/mindnlp/transformers/pipelines/automatic_speech_recognition.py +++ b/mindnlp/transformers/pipelines/automatic_speech_recognition.py @@ -140,7 +140,7 @@ class AutomaticSpeechRecognitionPipeline(ChunkPipeline): >>> from transformers import pipeline >>> transcriber = pipeline(model="openai/whisper-base") - >>> transcriber("https://huggingface.co/datasets/Narsil/asr_dummy/resolve/main/1.flac") + >>> transcriber("https://hf-mirror.com/datasets/Narsil/asr_dummy/resolve/main/1.flac") {'text': ' He hoped there would be stew for dinner, turnips and carrots and bruised potatoes and fat mutton pieces to be ladled out in thick, peppered flour-fatten sauce.'} ``` @@ -165,7 +165,7 @@ class AutomaticSpeechRecognitionPipeline(ChunkPipeline): For more information on how to effectively use `chunk_length_s`, please have a look at the [ASR chunking - blog post](https://huggingface.co/blog/asr-chunking). + blog post](https://hf-mirror.com/blog/asr-chunking). @@ -177,7 +177,7 @@ class AutomaticSpeechRecognitionPipeline(ChunkPipeline): For more information on how to effectively use `stride_length_s`, please have a look at the [ASR chunking - blog post](https://huggingface.co/blog/asr-chunking). + blog post](https://hf-mirror.com/blog/asr-chunking). @@ -271,7 +271,7 @@ def __call__( generate_kwargs (`dict`, *optional*): The dictionary of ad-hoc parametrization of `generate_config` to be used for the generation call. For a complete overview of generate, check the [following - guide](https://huggingface.co/docs/transformers/en/main_classes/text_generation). + guide](https://hf-mirror.com/docs/transformers/en/main_classes/text_generation). max_new_tokens (`int`, *optional*): The maximum numbers of tokens to generate, ignoring the number of tokens in the prompt. @@ -354,7 +354,7 @@ def preprocess(self, inputs, chunk_length_s=0, stride_length_s=None): if isinstance(inputs, str): if inputs.startswith("http://") or inputs.startswith("https://"): # We need to actually check for a real protocol, otherwise it's impossible to use a local file - # like http_huggingface_co.png + # like http_hf-mirror.com.png inputs = requests.get(inputs, timeout=3).content else: with open(inputs, "rb") as f: diff --git a/mindnlp/transformers/pipelines/document_question_answering.py b/mindnlp/transformers/pipelines/document_question_answering.py index 4f8d5ba17..4afa95dfd 100644 --- a/mindnlp/transformers/pipelines/document_question_answering.py +++ b/mindnlp/transformers/pipelines/document_question_answering.py @@ -11,14 +11,6 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. -# pylint: disable=missing-function-docstring -# pylint: disable=(missing-class-docstring -# pylint: disable=invalid-name -# pylint: disable=unbalanced-tuple-unpacking -# pylint: disable=unused-argument -# pylint: disable=unexpected-keyword-arg -# pylint: disable=arguments-renamed -# pylint: disable=import-error """ document-question-answering """ @@ -137,7 +129,7 @@ def decode_spans( idx = np.argpartition(-scores_flat, topk)[0:topk] idx_sort = idx[np.argsort(-scores_flat[idx])] - starts, ends = np.unravel_index(idx_sort, candidates.shape)[1:] + starts, ends = np.unravel_index(idx_sort, candidates.shape)[1:] # pylint: disable=unbalanced-tuple-unpacking desired_spans = np.isin(starts, undesired_tokens.nonzero()) & np.isin(ends, undesired_tokens.nonzero()) starts = starts[desired_spans] ends = ends[desired_spans] @@ -183,10 +175,10 @@ def select_starts_ends( end = np.where(undesired_tokens_mask, -10000.0, end) # Normalize logits and spans to retrieve the answer - start = np.exp(start - start.max(axis=-1, keepdims=True)) + start = np.exp(start - start.max(axis=-1, keepdims=True)) # pylint: disable=unexpected-keyword-arg start = start / start.sum() - end = np.exp(end - end.max(axis=-1, keepdims=True)) + end = np.exp(end - end.max(axis=-1, keepdims=True)) # pylint: disable=unexpected-keyword-arg end = end / end.sum() if handle_impossible_answer: @@ -209,7 +201,7 @@ class DocumentQuestionAnsweringPipeline(ChunkPipeline): >>> from transformers import pipeline >>> document_qa = pipeline(model="impira/layoutlm-document-qa") >>> document_qa( - ... image="https://huggingface.co/spaces/impira/docquery/resolve/2359223c1837a7587402bda0f2643382a6eefeab/invoice.png", + ... image="https://hf-mirror.com/spaces/impira/docquery/resolve/2359223c1837a7587402bda0f2643382a6eefeab/invoice.png", ... question="What is the invoice number?", ... ) [{'score': 0.425, 'answer': 'us-001', 'start': 16, 'end': 16}] @@ -219,7 +211,7 @@ class DocumentQuestionAnsweringPipeline(ChunkPipeline): identifier: `"document-question-answering"`. The models that this pipeline can use are models that have been fine-tuned on a document question answering task. See the up-to-date list of available models on - [huggingface.co/models](https://huggingface.co/models?filter=document-question-answering). + [hf-mirror.com/models](https://hf-mirror.com/models?filter=document-question-answering). """ def __init__(self, *args, **kwargs): @@ -416,7 +408,7 @@ def preprocess( if self.model_type == ModelType.VisionEncoderDecoder: task_prompt = f'{inputs["question"]}' - # Adapted from https://huggingface.co/spaces/nielsr/donut-docvqa/blob/main/app.py + # Adapted from https://hf-mirror.com/spaces/nielsr/donut-docvqa/blob/main/app.py encoding = { "inputs": image_features["pixel_values"], "decoder_input_ids": self.tokenizer( diff --git a/mindnlp/transformers/pipelines/question_answering.py b/mindnlp/transformers/pipelines/question_answering.py index 62f294aef..bbe87df20 100644 --- a/mindnlp/transformers/pipelines/question_answering.py +++ b/mindnlp/transformers/pipelines/question_answering.py @@ -229,7 +229,7 @@ class QuestionAnsweringPipeline(ChunkPipeline): The models that this pipeline can use are models that have been fine-tuned on a question answering task. See the up-to-date list of available models on - [huggingface.co/models](https://huggingface.co/models?filter=question-answering). + [hf-mirror.com/models](https://hf-mirror.com/models?filter=question-answering). """ default_input_names = "question,context" diff --git a/mindnlp/transformers/pipelines/text2text_generation.py b/mindnlp/transformers/pipelines/text2text_generation.py index 955a765a5..bd22059d3 100644 --- a/mindnlp/transformers/pipelines/text2text_generation.py +++ b/mindnlp/transformers/pipelines/text2text_generation.py @@ -54,9 +54,9 @@ class Text2TextGenerationPipeline(Pipeline): The models that this pipeline can use are models that have been fine-tuned on a translation task. See the up-to-date list of available models on - [huggingface.co/models](https://huggingface.co/models?filter=text2text-generation). For a list of available + [hf-mirror.com/models](https://hf-mirror.com/models?filter=text2text-generation). For a list of available parameters, see the [following - documentation](https://huggingface.co/docs/transformers/en/main_classes/text_generation#transformers.generation.GenerationMixin.generate) + documentation](https://hf-mirror.com/docs/transformers/en/main_classes/text_generation#transformers.generation.GenerationMixin.generate) Usage: @@ -229,9 +229,9 @@ class SummarizationPipeline(Text2TextGenerationPipeline): The models that this pipeline can use are models that have been fine-tuned on a summarization task, which is currently, '*bart-large-cnn*', '*google-t5/t5-small*', '*google-t5/t5-base*', '*google-t5/t5-large*', '*google-t5/t5-3b*', '*google-t5/t5-11b*'. See the up-to-date - list of available models on [huggingface.co/models](https://huggingface.co/models?filter=summarization). For a list + list of available models on [hf-mirror.com/models](https://hf-mirror.com/models?filter=summarization). For a list of available parameters, see the [following - documentation](https://huggingface.co/docs/transformers/en/main_classes/text_generation#transformers.generation.GenerationMixin.generate) + documentation](https://hf-mirror.com/docs/transformers/en/main_classes/text_generation#transformers.generation.GenerationMixin.generate) Usage: @@ -299,9 +299,9 @@ class TranslationPipeline(Text2TextGenerationPipeline): `"translation_xx_to_yy"`. The models that this pipeline can use are models that have been fine-tuned on a translation task. See the - up-to-date list of available models on [huggingface.co/models](https://huggingface.co/models?filter=translation). + up-to-date list of available models on [hf-mirror.com/models](https://hf-mirror.com/models?filter=translation). For a list of available parameters, see the [following - documentation](https://huggingface.co/docs/transformers/en/main_classes/text_generation#transformers.generation.GenerationMixin.generate) + documentation](https://hf-mirror.com/docs/transformers/en/main_classes/text_generation#transformers.generation.GenerationMixin.generate) Usage: diff --git a/mindnlp/transformers/pipelines/text_classification.py b/mindnlp/transformers/pipelines/text_classification.py index 56c2f286d..0d6d3546c 100644 --- a/mindnlp/transformers/pipelines/text_classification.py +++ b/mindnlp/transformers/pipelines/text_classification.py @@ -66,7 +66,7 @@ class TextClassificationPipeline(Pipeline): The models that this pipeline can use are models that have been fine-tuned on a sequence classification task. See the up-to-date list of available models on - [huggingface.co/models](https://huggingface.co/models?filter=text-classification). + [hf-mirror.com/models](https://hf-mirror.com/models?filter=text-classification). """ return_all_scores = False diff --git a/mindnlp/transformers/pipelines/text_generation.py b/mindnlp/transformers/pipelines/text_generation.py index 4487fac39..5a864cd38 100644 --- a/mindnlp/transformers/pipelines/text_generation.py +++ b/mindnlp/transformers/pipelines/text_generation.py @@ -53,7 +53,7 @@ class TextGenerationPipeline(Pipeline): The models that this pipeline can use are models that have been trained with an autoregressive language modeling objective, which includes the uni-directional models in the library (e.g. openai-community/gpt2). See the list of available models - on [huggingface.co/models](https://huggingface.co/models?filter=text-generation). + on [hf-mirror.com/models](https://hf-mirror.com/models?filter=text-generation). """ def __init__(self, *args, **kwargs): diff --git a/mindnlp/transformers/pipelines/zero_shot_classification.py b/mindnlp/transformers/pipelines/zero_shot_classification.py index a5947e741..15acf387d 100644 --- a/mindnlp/transformers/pipelines/zero_shot_classification.py +++ b/mindnlp/transformers/pipelines/zero_shot_classification.py @@ -98,7 +98,7 @@ class ZeroShotClassificationPipeline(ChunkPipeline): The models that this pipeline can use are models that have been fine-tuned on an NLI task. See the up-to-date list - of available models on [huggingface.co/models](https://huggingface.co/models?search=nli). + of available models on [hf-mirror.com/models](https://hf-mirror.com/models?search=nli). """ def __init__(self, *args, args_parser=ZeroShotClassificationArgumentHandler(), **kwargs): diff --git a/mindnlp/transformers/processing_utils.py b/mindnlp/transformers/processing_utils.py index 4c4047d2c..3a95a2edf 100644 --- a/mindnlp/transformers/processing_utils.py +++ b/mindnlp/transformers/processing_utils.py @@ -152,7 +152,7 @@ def from_pretrained( This can be either: - a string, the *model id* of a pretrained feature_extractor hosted inside a model repo on - huggingface.co. Valid model ids can be located at the root-level, like `bert-base-uncased`, or + hf-mirror.com. Valid model ids can be located at the root-level, like `bert-base-uncased`, or namespaced under a user or organization name, like `dbmdz/bert-base-german-cased`. - a path to a *directory* containing a feature extractor file saved using the [`~SequenceFeatureExtractor.save_pretrained`] method, e.g., `./my_model_directory/`. diff --git a/mindnlp/transformers/tokenization_utils_base.py b/mindnlp/transformers/tokenization_utils_base.py index 995edfddf..b7601eedf 100644 --- a/mindnlp/transformers/tokenization_utils_base.py +++ b/mindnlp/transformers/tokenization_utils_base.py @@ -1506,7 +1506,7 @@ def default_chat_template(self): "\nNo chat template is defined for this tokenizer - using a default chat template " "that implements the ChatML format. If the default is not appropriate for " "your model, please set `tokenizer.chat_template` to an appropriate template. " - "See https://huggingface.co/docs/transformers/main/chat_templating for more information.\n" + "See https://hf-mirror.com/docs/transformers/main/chat_templating for more information.\n" ) return ( "{% for message in messages %}" @@ -1536,7 +1536,7 @@ def from_pretrained( pretrained_model_name_or_path (`str` or `os.PathLike`): Can be either: - - A string, the *model id* of a predefined tokenizer hosted inside a model repo on huggingface.co. + - A string, the *model id* of a predefined tokenizer hosted inside a model repo on hf-mirror.com. Valid model ids can be located at the root-level, like `bert-base-uncased`, or namespaced under a user or organization name, like `dbmdz/bert-base-german-cased`. - A path to a *directory* containing vocabulary files required by the tokenizer, for instance saved @@ -1564,10 +1564,10 @@ def from_pretrained( Whether or not to only rely on local files and not to attempt to download any files. revision (`str`, *optional*, defaults to `"main"`): The specific model version to use. It can be a branch name, a tag name, or a commit id, since we use a - git-based system for storing models and other artifacts on huggingface.co, so `revision` can be any + git-based system for storing models and other artifacts on hf-mirror.com, so `revision` can be any identifier allowed by git. subfolder (`str`, *optional*): - In case the relevant files are located inside a subfolder of the model repo on huggingface.co (e.g. for + In case the relevant files are located inside a subfolder of the model repo on hf-mirror.com (e.g. for facebook/rag-token-base), specify it here. inputs (additional positional arguments, *optional*): Will be passed along to the Tokenizer `__init__` method. @@ -1586,10 +1586,10 @@ def from_pretrained( ```python # We can't instantiate directly the base class *PreTrainedTokenizerBase* so let's show our examples on a derived class: BertTokenizer - # Download vocabulary from huggingface.co and cache. + # Download vocabulary from hf-mirror.com and cache. tokenizer = BertTokenizer.from_pretrained("bert-base-uncased") - # Download vocabulary from huggingface.co (user-uploaded) and cache. + # Download vocabulary from hf-mirror.com (user-uploaded) and cache. tokenizer = BertTokenizer.from_pretrained("dbmdz/bert-base-german-cased") # If vocabulary files are in a directory (e.g. tokenizer was saved using *save_pretrained('./test/saved_model/')*) @@ -1703,7 +1703,7 @@ def from_pretrained( if all(full_file_name is None for full_file_name in resolved_vocab_files.values()): raise EnvironmentError( f"Can't load tokenizer for '{pretrained_model_name_or_path}'. If you were trying to load it from " - "'https://huggingface.co/models', make sure you don't have a local directory with the same name. " + "'https://hf-mirror.com/models', make sure you don't have a local directory with the same name. " f"Otherwise, make sure '{pretrained_model_name_or_path}' is the correct path to a directory " f"containing all relevant files for a {cls.__name__} tokenizer." ) diff --git a/mindnlp/utils/download.py b/mindnlp/utils/download.py index 5d163f118..d0d276df8 100644 --- a/mindnlp/utils/download.py +++ b/mindnlp/utils/download.py @@ -291,7 +291,7 @@ def get_file_from_repo( path_or_repo (`str` or `os.PathLike`): This can be either: - - a string, the *model id* of a model repo on huggingface.co. + - a string, the *model id* of a model repo on hf-mirror.com. - a path to a *directory* potentially containing the file. filename (`str`): The name of the file to locate in `path_or_repo`. @@ -311,12 +311,12 @@ def get_file_from_repo( when running `huggingface-cli login` (stored in `~/.huggingface`). revision (`str`, *optional*, defaults to `"main"`): The specific model version to use. It can be a branch name, a tag name, or a commit id, since we use a - git-based system for storing models and other artifacts on huggingface.co, so `revision` can be any + git-based system for storing models and other artifacts on hf-mirror.com, so `revision` can be any identifier allowed by git. local_files_only (`bool`, *optional*, defaults to `False`): If `True`, will only try to load the tokenizer configuration from local files. subfolder (`str`, *optional*, defaults to `""`): - In case the relevant files are located inside a subfolder of the model repo on huggingface.co, you can + In case the relevant files are located inside a subfolder of the model repo on hf-mirror.com, you can specify the folder name here. @@ -332,7 +332,7 @@ def get_file_from_repo( Examples: ```python - # Download a tokenizer configuration from huggingface.co and cache. + # Download a tokenizer configuration from hf-mirror.com and cache. tokenizer_config = get_file_from_repo("google-bert/bert-base-uncased", "tokenizer_config.json") # This model does not have a tokenizer config so the result will be None. tokenizer_config = get_file_from_repo("FacebookAI/xlm-roberta-base", "tokenizer_config.json") @@ -380,7 +380,7 @@ def cached_file( path_or_repo_id (`str` or `os.PathLike`): This can be either: - - a string, the *model id* of a model repo on huggingface.co. + - a string, the *model id* of a model repo on hf-mirror.com. - a path to a *directory* potentially containing the file. filename (`str`): The name of the file to locate in `path_or_repo`. @@ -401,7 +401,7 @@ def cached_file( local_files_only (`bool`, *optional*, defaults to `False`): If `True`, will only try to load the tokenizer configuration from local files. subfolder (`str`, *optional*, defaults to `""`): - In case the relevant files are located inside a subfolder of the model repo on huggingface.co, you can + In case the relevant files are located inside a subfolder of the model repo on hf-mirror.com, you can specify the folder name here. repo_type (`str`, *optional*): Specify the repo type (useful when downloading from a space for instance). @@ -485,7 +485,7 @@ def cached_file( return resolved_file raise EnvironmentError( "You are trying to access a gated repo.\nMake sure to have access to it at " - f"https://huggingface.co/{path_or_repo_id}.\n{str(e)}" + f"https://hf-mirror.com/{path_or_repo_id}.\n{str(e)}" ) from e except RepositoryNotFoundError as e: raise EnvironmentError( @@ -713,7 +713,7 @@ def try_to_load_from_cache( cache_dir (`str` or `os.PathLike`): The folder where the cached files lie. repo_id (`str`): - The ID of the repo on huggingface.co. + The ID of the repo on hf-mirror.com. filename (`str`): The filename to look for inside `repo_id`. revision (`str`, *optional*): diff --git a/mindnlp/utils/errors.py b/mindnlp/utils/errors.py index 3806d4b27..ed89b6502 100644 --- a/mindnlp/utils/errors.py +++ b/mindnlp/utils/errors.py @@ -110,9 +110,9 @@ class GatedRepoError(RepositoryNotFoundError): (...) huggingface_hub.utils._errors.GatedRepoError: 403 Client Error. (Request ID: ViT1Bf7O_026LGSQuVqfa) - Cannot access gated repo for url https://huggingface.co/api/models/ardent-figment/gated-model. + Cannot access gated repo for url https://hf-mirror.com/api/models/ardent-figment/gated-model. Access to model ardent-figment/gated-model is restricted and you are not in the authorized list. - Visit https://huggingface.co/ardent-figment/gated-model to ask for access. + Visit https://hf-mirror.com/ardent-figment/gated-model to ask for access. ``` """ @@ -129,7 +129,7 @@ class EntryNotFoundError(MSHTTPError): (...) huggingface_hub.utils._errors.EntryNotFoundError: 404 Client Error. (Request ID: 53pNl6M0MxsnG5Sw8JA6x) - Entry Not Found for url: https://huggingface.co/bert-base-cased/resolve/main/%3Cnon-existent-file%3E. + Entry Not Found for url: https://hf-mirror.com/bert-base-cased/resolve/main/%3Cnon-existent-file%3E. ``` """ diff --git a/mindnlp/utils/peft_utils.py b/mindnlp/utils/peft_utils.py index 588bcc230..efa954309 100644 --- a/mindnlp/utils/peft_utils.py +++ b/mindnlp/utils/peft_utils.py @@ -56,7 +56,7 @@ def find_adapter_config_file( when running `huggingface-cli login` (stored in `~/.huggingface`). revision (`str`, *optional*, defaults to `"main"`): The specific model version to use. It can be a branch name, a tag name, or a commit id, since we use a - git-based system for storing models and other artifacts on huggingface.co, so `revision` can be any + git-based system for storing models and other artifacts on hf-mirror.com, so `revision` can be any identifier allowed by git. @@ -68,7 +68,7 @@ def find_adapter_config_file( local_files_only (`bool`, *optional*, defaults to `False`): If `True`, will only try to load the tokenizer configuration from local files. subfolder (`str`, *optional*, defaults to `""`): - In case the relevant files are located inside a subfolder of the model repo on huggingface.co, you can + In case the relevant files are located inside a subfolder of the model repo on hf-mirror.com, you can specify the folder name here. """ adapter_cached_filename = None diff --git a/requirements/docs_requirements.txt b/requirements/docs_requirements.txt index ccf84366b..4f2653089 100644 --- a/requirements/docs_requirements.txt +++ b/requirements/docs_requirements.txt @@ -22,4 +22,4 @@ cython jieba pretty_midi git+https://github.com/mindspore-lab/mindnlp -https://huggingface.co/lvyufeng/mindspore-daily/resolve/main/mindspore-newest-cp37-cp37m-linux_x86_64.whl \ No newline at end of file +https://hf-mirror.com/lvyufeng/mindspore-daily/resolve/main/mindspore-newest-cp37-cp37m-linux_x86_64.whl \ No newline at end of file diff --git a/tests/ut/transformers/models/bloom/test_modeling_bloom.py b/tests/ut/transformers/models/bloom/test_modeling_bloom.py index b8a18ac68..9f9763feb 100644 --- a/tests/ut/transformers/models/bloom/test_modeling_bloom.py +++ b/tests/ut/transformers/models/bloom/test_modeling_bloom.py @@ -516,10 +516,10 @@ class BloomEmbeddingTest(unittest.TestCase): You need to install tokenizers following this readme: - - https://huggingface.co/bigscience-catalogue-data-dev/byte-level-bpe-tokenizer-no-norm-250k-whitespace-and-eos-regex-alpha-v3-dedup-lines-articles + - https://hf-mirror.com/bigscience-catalogue-data-dev/byte-level-bpe-tokenizer-no-norm-250k-whitespace-and-eos-regex-alpha-v3-dedup-lines-articles Tokenizer used during training: - - https://huggingface.co/bigscience-catalogue-data-dev/byte-level-bpe-tokenizer-no-norm-250k-whitespace-and-eos-regex-alpha-v3-dedup-lines-articles + - https://hf-mirror.com/bigscience-catalogue-data-dev/byte-level-bpe-tokenizer-no-norm-250k-whitespace-and-eos-regex-alpha-v3-dedup-lines-articles # TODO change the script (or just add skip) when building the env with tokenizers 0.12.0 """ diff --git a/tests/ut/transformers/models/layoutlm/test_modeling_layoutlm.py b/tests/ut/transformers/models/layoutlm/test_modeling_layoutlm.py index 8b9f17449..0ef7be73a 100644 --- a/tests/ut/transformers/models/layoutlm/test_modeling_layoutlm.py +++ b/tests/ut/transformers/models/layoutlm/test_modeling_layoutlm.py @@ -311,7 +311,7 @@ def prepare_layoutlm_batch_inputs(): class LayoutLMModelIntegrationTest(unittest.TestCase): @slow def test_forward_pass_no_head(self): - model = LayoutLMModel.from_pretrained("microsoft/layoutlm-base-uncased", from_pt=True) + model = LayoutLMForMaskedLM.from_pretrained("microsoft/layoutlm-base-uncased", from_pt=True).layoutlm input_ids, attention_mask, bbox, token_type_ids, labels = prepare_layoutlm_batch_inputs() @@ -323,6 +323,7 @@ def test_forward_pass_no_head(self): [[0.1785, -0.1947, -0.0425], [-0.3254, -0.2807, 0.2553], [-0.5391, -0.3322, 0.3364]], ) + print(outputs.last_hidden_state[0, :3, :3].asnumpy(), expected_slice.asnumpy()) self.assertTrue(np.allclose(outputs.last_hidden_state[0, :3, :3].asnumpy(), expected_slice.asnumpy(), atol=1e-3)) # test the pooled output on [1, :3] diff --git a/tests/ut/transformers/models/wav2vec2/test_tokenization_wav2vec2.py b/tests/ut/transformers/models/wav2vec2/test_tokenization_wav2vec2.py index 032603039..f97efe308 100644 --- a/tests/ut/transformers/models/wav2vec2/test_tokenization_wav2vec2.py +++ b/tests/ut/transformers/models/wav2vec2/test_tokenization_wav2vec2.py @@ -697,7 +697,7 @@ def test_offsets_integration(self): word_time_stamps_end = [round(w * time_offset_wav2vec2_base, 2) for w in word_offsets_end] # NOTE: you can verify the above results by checking out the dataset viewer - # on https://huggingface.co/datasets/common_voice/viewer/en/train and + # on https://hf-mirror.com/datasets/common_voice/viewer/en/train and # downloading / playing the sample `common_voice_en_100038.mp3`. As # you can hear the time-stamps match more or less diff --git a/tests/ut/transformers/pipelines/test_pipelines_document_question_answering.py b/tests/ut/transformers/pipelines/test_pipelines_document_question_answering.py index 32d65bcc5..682a2d826 100644 --- a/tests/ut/transformers/pipelines/test_pipelines_document_question_answering.py +++ b/tests/ut/transformers/pipelines/test_pipelines_document_question_answering.py @@ -44,7 +44,7 @@ def load_image(_): # This is a pinned image from a specific revision of a document question answering space, hosted by HuggingFace, # so we can expect it to be available. INVOICE_URL = ( - "https://huggingface.co/spaces/impira/docquery/resolve/2f6c96314dc84dfda62d40de9da55f2f5165d403/invoice.png" + "https://hf-mirror.com/spaces/impira/docquery/resolve/2f6c96314dc84dfda62d40de9da55f2f5165d403/invoice.png" ) @@ -96,7 +96,7 @@ def run_pipeline_test(self, dqa_pipeline, examples): @require_mindspore @require_pytesseract - def test_small_model_pt(self): + def test_small_model_ms(self): dqa_pipeline = pipeline("document-question-answering", model="hf-internal-testing/tiny-random-layoutlmv2") image = INVOICE_URL question = "How many cats are there?" @@ -106,6 +106,7 @@ def test_small_model_pt(self): {"score": 0.0001, "answer": "oy 2312/2019 DUE", "start": 38, "end": 40}, ] outputs = dqa_pipeline(image=image, question=question, top_k=2) + print(outputs) self.assertEqual(nested_simplify(outputs, decimals=4), expected_output) outputs = dqa_pipeline({"image": image, "question": question}, top_k=2) @@ -127,7 +128,7 @@ def test_small_model_pt(self): @slow @require_mindspore @require_pytesseract - def test_large_model_pt(self): + def test_large_model(self): dqa_pipeline = pipeline( "document-question-answering", model="tiennvcs/layoutlmv2-base-uncased-finetuned-docvqa", @@ -173,7 +174,7 @@ def test_large_model_pt(self): @slow @require_mindspore @require_pytesseract - def test_large_model_pt_chunk(self): + def test_large_model_chunk(self): dqa_pipeline = pipeline( "document-question-answering", model="tiennvcs/layoutlmv2-base-uncased-finetuned-docvqa", @@ -219,7 +220,7 @@ def test_large_model_pt_chunk(self): @require_mindspore @require_pytesseract @require_vision - def test_large_model_pt_layoutlm(self): + def test_large_model_layoutlm(self): tokenizer = AutoTokenizer.from_pretrained( "impira/layoutlm-document-qa", revision="3dc6de3", add_prefix_space=True ) @@ -280,7 +281,7 @@ def test_large_model_pt_layoutlm(self): @require_mindspore @require_pytesseract @require_vision - def test_large_model_pt_layoutlm_chunk(self): + def test_large_model_layoutlm_chunk(self): tokenizer = AutoTokenizer.from_pretrained( "impira/layoutlm-document-qa", revision="3dc6de3", add_prefix_space=True ) @@ -331,7 +332,7 @@ def test_large_model_pt_layoutlm_chunk(self): @slow @require_mindspore - def test_large_model_pt_donut(self): + def test_large_model_donut(self): dqa_pipeline = pipeline( "document-question-answering", model="naver-clova-ix/donut-base-finetuned-docvqa",