1

I'm new to the AI playground and for this purpose I'm experimenting with the GPT-J (6b) model on an Amazon SageMaker notebook instance (g4dn.xlarge). So far, I've managed to register an endpoint and run the predictor but I'm sure I'm making the wrong questions or I haven't really understood how the model parameters work (which is probable).

This is my code:

# build the prompt
prompt = """
language: es
match: comida
topic: hoteles en la playa todo incluido
output: ¿Sabes cuáles son los mejores Hoteles Todo Incluido de España? Cada vez son 
más los que se suman a la moda del Todo Incluido para disfrutar de unas perfectas y 
completas vacaciones en familia, en pareja o con amigos. Y es que con nuestra oferta 
hoteles Todo Incluido podrás vivir unos días de auténtico relax y una estancia mucho 
más completa, ya que suelen incluir desde el desayuno, la comida y la cena, hasta 
cualquier snack y bebidas en las diferentes instalaciones del hotel. ¿Qué se puede 
pedir más para relajarse durante una perfecta escapada? A continuación, te 
presentamos los mejores hoteles Todo Incluido de España al mejor precio.

language: es
match: comida
topic: hoteles en la playa todo incluido
output:
"""

# set the maximum token length
maximum_token_length = 25

# set the sampling temperature
sampling_temperature = 0.6

# build the predictor arguments
predictor_arguments = {
    "inputs": prompt,
    "parameters": {
        "max_length": len(prompt) + maximum_token_length,
        "temperature": sampling_temperature
    }
}

# execute the predictor with the prompt as input
predictor_output = predictor.predict(predictor_arguments)

# retrieve the text output
text_output = predictor_output[0]["generated_text"]

# print the text output
print(f"text output: {text_output}")

My problem is I try to get a different response using the same parameters but I get nothing. It just repeats my inputs with an empty response so I'm definitely doing something wrong although the funny thing is I actually get a pretty understandable text output if I throw the same input with the same sampling temperature on the OpenAI playground (on text-davinci-003).

Can you give me a hint on what am I doing wrong? Oh, and another question is: How can I specify something like 'within the first 10 words' for a keyword match?

Julio María Meca Hansen
  • 1,303
  • 1
  • 17
  • 37
  • What do you mean when you refer to “AI playground”? Do you have a notebook url that you are using that you can share ? – Marc Karp Feb 18 '23 at 18:03
  • @MarcKarp I assume that the OP just means that he is a begginer – Rubén Mar 02 '23 at 00:01
  • ¡Hola Julio! I'm also new in the "AI playground". I just posted the following in Meta SO, maybe you found it interesting: [What tags might help me find questions about "prompt engineering"?)](https://meta.stackoverflow.com/q/423459/1595451) – Rubén Mar 02 '23 at 00:04
  • @MarcKarp like Rubén assumed, I mean I'm new to field of AI :P – Julio María Meca Hansen Mar 24 '23 at 12:00

0 Answers0