简体   繁体   English

如何在没有预训练 model 的情况下使用 T5 架构(拥抱脸)

[英]How to use architecture of T5 without pretrained model (Hugging face)

I would like to study the effect of pre-trained model, so I want to test t5 model with and without pre-trained weights.我想研究预训练的 model 的效果,所以我想在有和没有预训练权重的情况下测试 t5 model。 Using pre-trained weights is straight forward, but I cannot figure out how to use the architecture of T5 from hugging face without the weights.使用预先训练的权重是直截了当的,但我无法弄清楚如何在没有权重的情况下使用 T5 的架构。 I am using Hugging face with pytorch but open for different solution.我正在使用带有 pytorch 的拥抱脸,但对不同的解决方案开放。

https://huggingface.co/docs/transformers/model_doc/t5#transformers.T5Model https://huggingface.co/docs/transformers/model_doc/t5#transformers.T5Model

"Initializing with a config file does not load the weights associated with the model, only the configuration." “使用配置文件初始化不会加载与 model 相关的权重,只会加载配置。”

for without weights create a T5Model with config file对于没有权重的情况,使用配置文件创建 T5Model

from transformers import AutoConfig    
from transformers import T5Tokenizer, T5Model    
model_name = "t5-small"    
config = AutoConfig.from_pretrained(model_name)    
tokenizer = T5Tokenizer.from_pretrained(model_name)    
model = T5Model.from_pretrained(model_name)    
model_raw = T5Model(config)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何下载拥抱脸情绪分析管道以离线使用? - How to download hugging face sentiment-analysis pipeline to use it offline? 如何将所有标准特殊标记添加到我的拥抱脸标记器和 model? - How to add all standard special tokens to my hugging face tokenizer and model? 拥抱脸:RuntimeError:model_init 应该有 0 或 1 个参数 - Hugging face: RuntimeError: model_init should have 0 or 1 argument 如何优化预训练的 tensorflow CNN model 以减少过拟合并提高假人脸检测的整体准确度 - How to optimize pretrained tensorflow CNN model in order to reduce overfitting and improve overall accuracy for fake face detection transformer (t5) 上的 f.netune 如何工作? - How does the finetune on transformer (t5) work? Tensorflow:使用预训练的初始模型 - Tensorflow: use pretrained inception model 如何使用 model 的预训练权重在下一次迭代中初始化权重? - How to use pretrained weights of a model for initializing the weights in next iteration? 通过HuggingFace确定T5 model生成序列的概率 - Determining the probability of a sequence generated by T5 model by HuggingFace 如何更改预训练模型中的输入 - how to change input in a pretrained model 我不能使用来自fastai.text的pretrained_model = URLs.WT103 - i can't use pretrained_model=URLs.WT103 from fastai.text
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM