“Contoh Pretrained Albert” Kode Jawaban

Contoh Pretrained Albert


from transformers import AlbertTokenizer, AlbertForQuestionAnswering
import torch

tokenizer = AlbertTokenizer.from_pretrained('albert-base-v2')
model = AlbertForQuestionAnswering.from_pretrained('albert-base-v2')
question, text = "Who was Jim Henson?", "Jim Henson was a nice puppet"
input_dict = tokenizer.encode_plus(question, text, return_tensors='pt')
start_scores, end_scores = model(**input_dict)
Successful Shrike

Contoh Pretrained Albert


from transformers import AlbertTokenizer, AlbertForQuestionAnswering
import torch

MODEL_PATH = 'ktrapeznikov/albert-xlarge-v2-squad-v2';

tokenizer = AlbertTokenizer.from_pretrained(MODEL_PATH)
model = AlbertForQuestionAnswering.from_pretrained(MODEL_PATH)

Modern Mongoose

Jawaban yang mirip dengan “Contoh Pretrained Albert”

Pertanyaan yang mirip dengan “Contoh Pretrained Albert”

Jelajahi jawaban kode populer menurut bahasa

Jelajahi bahasa kode lainnya