jw2yang commited on
Commit
11b0633
1 Parent(s): d957a30

Update tasks/ref_in_gpt3.py

Browse files
Files changed (1) hide show
  1. tasks/ref_in_gpt3.py +23 -8
tasks/ref_in_gpt3.py CHANGED
@@ -39,19 +39,34 @@ prompts.append("change the red apple to a green one, task: (referring editing),
39
  prompts.append("replace the dog with a cat, task: (referring editing), source: [dot], target: <cat>;")
40
  prompts.append("replace the red apple with a green one, task: (referring editing), source: [red apple], target: <green apple>;")
41
 
 
 
 
42
  openai.api_key = os.environ["OPENAI_API_KEY"]
43
 
44
  def get_gpt3_response(prompt):
 
 
 
 
 
 
 
 
 
 
45
  response = openai.Completion.create(
46
- model="text-davinci-003",
47
- prompt=prompt,
48
- temperature=0.7,
49
- max_tokens=128,
50
- top_p=1,
51
- frequency_penalty=0,
52
- presence_penalty=0
 
 
53
  )
54
-
55
  return response
56
 
57
  def referring_inpainting_gpt3(model, image, instruction, *args, **kwargs):
 
39
  prompts.append("replace the dog with a cat, task: (referring editing), source: [dot], target: <cat>;")
40
  prompts.append("replace the red apple with a green one, task: (referring editing), source: [red apple], target: <green apple>;")
41
 
42
+ openai.api_type = "azure"
43
+ openai.api_base = "https://xdecoder.openai.azure.com/"
44
+ openai.api_version = "2022-12-01"
45
  openai.api_key = os.environ["OPENAI_API_KEY"]
46
 
47
  def get_gpt3_response(prompt):
48
+ # response = openai.Completion.create(
49
+ # model="text-davinci-003",
50
+ # prompt=prompt,
51
+ # temperature=0.7,
52
+ # max_tokens=128,
53
+ # top_p=1,
54
+ # frequency_penalty=0,
55
+ # presence_penalty=0
56
+ # )
57
+
58
  response = openai.Completion.create(
59
+ engine="text001",
60
+ prompt=prompt,
61
+ temperature=1,
62
+ max_tokens=100,
63
+ top_p=0.5,
64
+ frequency_penalty=0,
65
+ presence_penalty=0,
66
+ best_of=1,
67
+ stop=None
68
  )
69
+
70
  return response
71
 
72
  def referring_inpainting_gpt3(model, image, instruction, *args, **kwargs):