diff --git a/docs/source/en/_toctree.yml b/docs/source/en/_toctree.yml index d800e40ecbd69d..66bcf4f849c804 100644 --- a/docs/source/en/_toctree.yml +++ b/docs/source/en/_toctree.yml @@ -490,6 +490,8 @@ title: mLUKE - local: model_doc/mobilebert title: MobileBERT + - local: model_doc/moonshine + title: moonshine - local: model_doc/mpnet title: MPNet - local: model_doc/mpt diff --git a/docs/source/en/model_doc/moonshine.md b/docs/source/en/model_doc/moonshine.md new file mode 100644 index 00000000000000..bf5f1255f03c2d --- /dev/null +++ b/docs/source/en/model_doc/moonshine.md @@ -0,0 +1,108 @@ + + +# moonshine + +# moonshine + +## Overview + +The moonshine model was proposed in []() by . + + +The abstract from the paper is the following: + +** + +Tips: + + + +This model was contributed by [INSERT YOUR HF USERNAME HERE](https://huggingface.co/). +The original code can be found [here](). + + +## MoonshineConfig + +[[autodoc]] MoonshineConfig + +## MoonshineTokenizer + +[[autodoc]] MoonshineTokenizer + - set_prefix_tokens + - build_inputs_with_special_tokens + - get_special_tokens_mask + - create_token_type_ids_from_sequences + - save_vocabulary + - batch_decode + - decode + - basic_normalize + - normalize + +## MoonshineTokenizerFast + +[[autodoc]] MoonshineTokenizerFast + - set_prefix_tokens + - build_inputs_with_special_tokens + - get_special_tokens_mask + - create_token_type_ids_from_sequences + - save_vocabulary + - batch_decode + - decode + - basic_normalize + - normalize + +## MoonshineFeatureExtractor + +[[autodoc]] MoonshineFeatureExtractor + - __call__ + +## MoonshineProcessor + +[[autodoc]] MoonshineProcessor + - __call__ + - from_pretrained + - save_pretrained + - batch_decode + - decode + + + + +## MoonshineModel + +[[autodoc]] MoonshineModel + - forward + - _mask_input_features + +## MoonshineForConditionalGeneration + +[[autodoc]] MoonshineForConditionalGeneration + - forward + - generate + +## MoonshineForCausalLM + +[[autodoc]] MoonshineForCausalLM + - forward + +## MoonshineForAudioClassification + +[[autodoc]] MoonshineForAudioClassification + - forward + + + diff --git a/src/transformers/__init__.py b/src/transformers/__init__.py index 36cc4449aec4a2..b651840412023a 100755 --- a/src/transformers/__init__.py +++ b/src/transformers/__init__.py @@ -463,6 +463,7 @@ "models.gpt_bigcode": ["GPTBigCodeConfig"], "models.gpt_neo": ["GPTNeoConfig"], "models.gpt_neox": ["GPTNeoXConfig"], + "models.moonshine": ["MoonshineConfig"], "models.gpt_neox_japanese": ["GPTNeoXJapaneseConfig"], "models.gpt_sw3": [], "models.gptj": ["GPTJConfig"], @@ -1081,6 +1082,7 @@ _import_structure["models.gemma"].append("GemmaTokenizerFast") _import_structure["models.gpt2"].append("GPT2TokenizerFast") _import_structure["models.gpt_neox"].append("GPTNeoXTokenizerFast") + _import_structure["models.moonshine"].append("MoonshineTokenizer") _import_structure["models.gpt_neox_japanese"].append("GPTNeoXJapaneseTokenizer") _import_structure["models.herbert"].append("HerbertTokenizerFast") _import_structure["models.layoutlm"].append("LayoutLMTokenizerFast") @@ -2360,6 +2362,16 @@ "GPTNeoXPreTrainedModel", ] ) + _import_structure["models.moonshine"].extend( + [ + "MoonshineForCausalLM", + "MoonshineForQuestionAnswering", + "MoonshineForSequenceClassification", + "MoonshineForTokenClassification", + "MoonshineModel", + "MoonshinePreTrainedModel", + ] + ) _import_structure["models.gpt_neox_japanese"].extend( [ "GPTNeoXJapaneseForCausalLM", @@ -5339,6 +5351,7 @@ ) from .models.gpt_neo import GPTNeoConfig from .models.gpt_neox import GPTNeoXConfig + from .models.moonshine import MoonshineConfig from .models.gpt_neox_japanese import ( GPTNeoXJapaneseConfig, ) @@ -6009,6 +6022,7 @@ from .models.gemma import GemmaTokenizerFast from .models.gpt2 import GPT2TokenizerFast from .models.gpt_neox import GPTNeoXTokenizerFast + from .models.moonshine import MoonshineTokenizer from .models.gpt_neox_japanese import GPTNeoXJapaneseTokenizer from .models.herbert import HerbertTokenizerFast from .models.layoutlm import LayoutLMTokenizerFast @@ -7102,6 +7116,14 @@ GPTNeoXModel, GPTNeoXPreTrainedModel, ) + from .models.moonshine import ( + MoonshineForCausalLM, + MoonshineForQuestionAnswering, + MoonshineForSequenceClassification, + MoonshineForTokenClassification, + MoonshineModel, + MoonshinePreTrainedModel, + ) from .models.gpt_neox_japanese import ( GPTNeoXJapaneseForCausalLM, GPTNeoXJapaneseModel, diff --git a/src/transformers/models/__init__.py b/src/transformers/models/__init__.py index 0d4b9f2f94de9b..ded8e359e30443 100644 --- a/src/transformers/models/__init__.py +++ b/src/transformers/models/__init__.py @@ -103,6 +103,7 @@ gpt_bigcode, gpt_neo, gpt_neox, + moonshine, gpt_neox_japanese, gpt_sw3, gptj, diff --git a/src/transformers/models/auto/configuration_auto.py b/src/transformers/models/auto/configuration_auto.py index 7f0182b50085c5..2696bda883a628 100644 --- a/src/transformers/models/auto/configuration_auto.py +++ b/src/transformers/models/auto/configuration_auto.py @@ -121,6 +121,7 @@ ("gpt_bigcode", "GPTBigCodeConfig"), ("gpt_neo", "GPTNeoConfig"), ("gpt_neox", "GPTNeoXConfig"), + ("moonshine", "MoonshineConfig"), ("gpt_neox_japanese", "GPTNeoXJapaneseConfig"), ("gptj", "GPTJConfig"), ("gptsan-japanese", "GPTSanJapaneseConfig"), @@ -425,6 +426,7 @@ ("gpt_bigcode", "GPTBigCode"), ("gpt_neo", "GPT Neo"), ("gpt_neox", "GPT NeoX"), + ("moonshine", "moonshine"), ("gpt_neox_japanese", "GPT NeoX Japanese"), ("gptj", "GPT-J"), ("gptsan-japanese", "GPTSAN-japanese"), diff --git a/src/transformers/models/auto/modeling_auto.py b/src/transformers/models/auto/modeling_auto.py index 5206972b72efde..b8258f972ff4b4 100644 --- a/src/transformers/models/auto/modeling_auto.py +++ b/src/transformers/models/auto/modeling_auto.py @@ -118,6 +118,7 @@ ("gpt_bigcode", "GPTBigCodeModel"), ("gpt_neo", "GPTNeoModel"), ("gpt_neox", "GPTNeoXModel"), + ("moonshine", "MoonshineModel"), ("gpt_neox_japanese", "GPTNeoXJapaneseModel"), ("gptj", "GPTJModel"), ("gptsan-japanese", "GPTSanJapaneseForConditionalGeneration"), @@ -408,6 +409,7 @@ ("gpt_bigcode", "GPTBigCodeForCausalLM"), ("gpt_neo", "GPTNeoForCausalLM"), ("gpt_neox", "GPTNeoXForCausalLM"), + ("moonshine", "MoonshineForCausalLM"), ("gpt_neox_japanese", "GPTNeoXJapaneseForCausalLM"), ("gptj", "GPTJForCausalLM"), ("gptsan-japanese", "GPTSanJapaneseForConditionalGeneration"), @@ -494,6 +496,7 @@ ("gpt_bigcode", "GPTBigCodeForCausalLM"), ("gpt_neo", "GPTNeoForCausalLM"), ("gpt_neox", "GPTNeoXForCausalLM"), + ("moonshine", "MoonshineForCausalLM"), ("gpt_neox_japanese", "GPTNeoXJapaneseForCausalLM"), ("gptj", "GPTJForCausalLM"), ("granite", "GraniteForCausalLM"), @@ -951,6 +954,7 @@ ("gpt_bigcode", "GPTBigCodeForSequenceClassification"), ("gpt_neo", "GPTNeoForSequenceClassification"), ("gpt_neox", "GPTNeoXForSequenceClassification"), + ("moonshine", "MoonshineForSequenceClassification"), ("gptj", "GPTJForSequenceClassification"), ("ibert", "IBertForSequenceClassification"), ("jamba", "JambaForSequenceClassification"), @@ -1039,6 +1043,7 @@ ("gpt2", "GPT2ForQuestionAnswering"), ("gpt_neo", "GPTNeoForQuestionAnswering"), ("gpt_neox", "GPTNeoXForQuestionAnswering"), + ("moonshine", "MoonshineForQuestionAnswering"), ("gptj", "GPTJForQuestionAnswering"), ("ibert", "IBertForQuestionAnswering"), ("layoutlmv2", "LayoutLMv2ForQuestionAnswering"), @@ -1142,6 +1147,7 @@ ("gpt_bigcode", "GPTBigCodeForTokenClassification"), ("gpt_neo", "GPTNeoForTokenClassification"), ("gpt_neox", "GPTNeoXForTokenClassification"), + ("moonshine", "MoonshineForTokenClassification"), ("ibert", "IBertForTokenClassification"), ("layoutlm", "LayoutLMForTokenClassification"), ("layoutlmv2", "LayoutLMv2ForTokenClassification"), diff --git a/src/transformers/models/auto/tokenization_auto.py b/src/transformers/models/auto/tokenization_auto.py index 4ed67df0e84b52..ea51f0c1302ab7 100644 --- a/src/transformers/models/auto/tokenization_auto.py +++ b/src/transformers/models/auto/tokenization_auto.py @@ -311,6 +311,7 @@ ("mluke", ("MLukeTokenizer" if is_sentencepiece_available() else None, None)), ("mobilebert", ("MobileBertTokenizer", "MobileBertTokenizerFast" if is_tokenizers_available() else None)), ("moshi", (None, "PreTrainedTokenizerFast" if is_tokenizers_available() else None)), + ("moonshine", (None, "PreTrainedTokenizerFast" if is_tokenizers_available() else None)), ("mpnet", ("MPNetTokenizer", "MPNetTokenizerFast" if is_tokenizers_available() else None)), ("mpt", (None, "GPTNeoXTokenizerFast" if is_tokenizers_available() else None)), ("mra", ("RobertaTokenizer", "RobertaTokenizerFast" if is_tokenizers_available() else None)), diff --git a/src/transformers/models/moonshine/__init__.py b/src/transformers/models/moonshine/__init__.py index d1c88ad1b9cb72..b99acc9a22315f 100644 --- a/src/transformers/models/moonshine/__init__.py +++ b/src/transformers/models/moonshine/__init__.py @@ -30,9 +30,13 @@ except OptionalDependencyNotAvailable: pass else: - _import_structure["modeling_gemma2"] = [ + _import_structure["modeling_moonshine"] = [ + "MoonshineForConditionalGeneration", + "MoonshineModel", + "MoonshinePreTrainedModel", ] + if TYPE_CHECKING: from .configuration_moonshine import MoonshineConfig @@ -42,7 +46,12 @@ except OptionalDependencyNotAvailable: pass else: - pass + from .modeling_moonshine import ( + MoonshineForConditionalGeneration, + MoonshineModel, + MoonshinePreTrainedModel, + ) + else: import sys diff --git a/tests/models/moonshine/__init__.py b/tests/models/moonshine/__init__.py new file mode 100644 index 00000000000000..e69de29bb2d1d6