Audio-Text-to-Text
Transformers
English
Chinese
transformer
multimodal
vqa
text
audio
Eval Results (legacy)
Run this model with HF Jobs
Run zeroMN/SHMT on Hugging Face's managed compute, monitor its progress, and retrieve the results when it's done.
Paste one of these prompts into your coding agent:
Fine-tune on my dataset
Use HF Jobs to fine-tune https://huggingface.co/zeroMN/SHMT. Ask me which dataset to train on, then push the fine-tuned model to a new model repo. Run `hf jobs --help` first to learn the CLI.
Run batch inference
Use HF Jobs to run batch inference with https://huggingface.co/zeroMN/SHMT on the inputs in a mounted HF Bucket. Ask me which Bucket to use, then write the outputs back to it and keep each input ID. Run `hf jobs --help` first to learn the CLI.
Instructions to use zeroMN/SHMT with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use zeroMN/SHMT with Transformers:
# pip install -U transformers accelerate # Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("zeroMN/SHMT", device_map="auto") - Notebooks
- Google Colab
- Kaggle
Update README.md
Browse files68 unmodified lines69707172737415 unmodified lines909192939468 unmodified lines### Direct Use```pythongit clone https://huggingface.co/zeroMN/SHMT.git```### Downstream Use15 unmodified lines## How to Get Started with the Model```pythongit clone https://huggingface.co/zeroMN/SHMT.git```68 unmodified lines697071727374757615 unmodified lines929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416568 unmodified lines### Direct Use```pythongit lfs installgit clone https://huggingface.co/zeroMN/SHMT.git```### Downstream Use15 unmodified lines## How to Get Started with the Model```pythonimport osimport torchimport torch.nn as nnimport numpy as npimport randomfrom transformers import (BartForConditionalGeneration,AutoModelForCausalLM,BertModel,Wav2Vec2Model,CLIPModel,AutoTokenizer)class MultiModalModel(nn.Module):def __init__(self):super(MultiModalModel, self).__init__()# 初始化子模型self.text_generator = BartForConditionalGeneration.from_pretrained('facebook/bart-base')self.code_generator = AutoModelForCausalLM.from_pretrained('gpt2')self.nlp_encoder = BertModel.from_pretrained('bert-base-uncased')self.speech_encoder = Wav2Vec2Model.from_pretrained('facebook/wav2vec2-base-960h')self.vision_encoder = CLIPModel.from_pretrained('openai/clip-vit-base-patch32')# 初始化分词器和处理器self.text_tokenizer = AutoTokenizer.from_pretrained('facebook/bart-base')self.code_tokenizer = AutoTokenizer.from_pretrained('gpt2')self.nlp_tokenizer = AutoTokenizer.from_pretrained('bert-base-uncased')self.speech_processor = AutoTokenizer.from_pretrained('facebook/wav2vec2-base-960h')self.vision_processor = AutoTokenizer.from_pretrained('openai/clip-vit-base-patch32')def forward(self, task, inputs):if task == 'text_generation':attention_mask = inputs.get('attention_mask')outputs = self.text_generator.generate(inputs['input_ids'],max_new_tokens=100,pad_token_id=self.text_tokenizer.eos_token_id,attention_mask=attention_mask,top_p=0.9,top_k=50,temperature=0.8,do_sample=True)return self.text_tokenizer.decode(outputs[0], skip_special_tokens=True)elif task == 'code_generation':attention_mask = inputs.get('attention_mask')outputs = self.code_generator.generate(inputs['input_ids'],max_new_tokens=50,pad_token_id=self.code_tokenizer.eos_token_id,attention_mask=attention_mask,top_p=0.95,top_k=50,temperature=1.2,do_sample=True)return self.code_tokenizer.decode(outputs[0], skip_special_tokens=True)# 添加其他任务的逻辑...# 计算模型参数数量的函数def count_parameters(model):return sum(p.numel() for p in model.parameters() if p.requires_grad)# 初始化模型model = MultiModalModel()# 计算并打印模型参数数量total_params = count_parameters(model)print(f"模型总参数数量: {total_params}")```
README.md+72-1