Questions tagged [generative-pretrained-transformer]

13 questions
5
votes
1 answer

What is the difference between Transformer encoder vs Transformer decoder vs Transformer encoder-decoder?

I know that GPT uses Transformer decoder, BERT uses Transformer encoder, and T5 uses Transformer encoder-decoder. But can someone help me understand why GPT only uses the decoder, BERT only uses encoder, and T5 uses both? What can you do with just…
3
votes
1 answer

How to prevent transformer generate function to produce certain words?

I have the following code: from transformers import T5Tokenizer, T5ForConditionalGeneration tokenizer = T5Tokenizer.from_pretrained("t5-small") model = T5ForConditionalGeneration.from_pretrained("t5-small") input_ids = tokenizer("The
2
votes
1 answer

How to use output from T5 model to replace masked tokens in input sequence

I'm working with the T5 model from the Hugging Face Transformers library and I have an input sequence with masked tokens that I want to replace with the output generated by the model. Here's the code. from transformers import T5Tokenizer,…
0
votes
0 answers

aiogram Telegram bot with webhook hosted on aws lambda goes to request-response loop with chatgpt requests

I have a simple aiogram Telegram bot (works with AWS Lambda) that redirects incoming chat messages to GPT-Turbo and returns its answer to the Telegram bot user's chat. The issue is that it goes into an infinite loop: the user sends a text message to…
0
votes
1 answer

Unsupervised fine-tuning on custom documents after the supervised fine tuning on general question-answers dataset. Will it be useful for GPT-2 model?

I know the formal way of training a GPT2 model on custom documents is to first do semi-supervised fine tuning on the text of the documents followed by supervised fine-tuning on question answers from the same documents. But the sole purpose of…
0
votes
1 answer

How to show the output from a request's response from a huggingface text to image API?

import requests from PIL import Image API_URL = "https://api-inference.huggingface.co/models/runwayml/stable-diffusion-v1-5" headers = {"Authorization": f"Bearer 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"} def query(payload): response =…
0
votes
0 answers

Upload multiple pdfs and ask questions about these pdfs

I know there are several services out there such as chatbase.co (https://www.chatbase.co/) What service do you use?
0
votes
1 answer

Openai API continue the output of the above content

How do you solve the problem of continuous output of the Openai API, such as letting the gpt api write an article. If the content is interrupted, you can continue to ask questions, so as to continue the output of the above content. This is very easy…
0
votes
1 answer

Translation with multi-lingual BERT model

I want to translate my dataframe using multi-lingual BERT. I have copied this code but in place of text, I want to use my own dataframe. from transformers import BertTokenizer, TFBertModel tokenizer =…
0
votes
0 answers

Force GPT-NEO to generate despite EOS token

I'm trying to use few-shot summarization on GPT-NEO, with custom eos_token_id = '###'. So when I generate the text, the generator has this parameter: model.generate(inputs, max_new_tokens = 80, eos_token_id = tokenizer.eos_token_id) The…
0
votes
0 answers

How to generate multiple patches of a single string in BERT model

I am using a BERT model for generating text embeddings. My strings are like There is pneumonia detected in the left corner. When I encode() and pass a batch of 20 strings and I print the model output, it returns [20 256], where 20 is the batch size…
-2
votes
1 answer

How to properly write CURL request in C++ inside system() function? (for OpenAI API calling)

I have a bit of a problem right now with sending a CURL request for OpenAI API from inside the system() function. I can't use additional libraries for this goal such as libcurl, so I am trying to do this with a console request. This is my code: int…