bstraehle commited on
Commit
3684d73
·
1 Parent(s): 6cb526c

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +10 -6
app.py CHANGED
@@ -9,8 +9,12 @@ project = os.environ["PROJECT"]
9
  wandb_api_key = os.environ["WANDB_API_KEY"]
10
 
11
  config = {
 
12
  #"model": "text-bison@001",
13
  "model": "gemini-pro",
 
 
 
14
  }
15
 
16
  wandb.login(key = wandb_api_key)
@@ -30,14 +34,14 @@ vertexai.init(project = project,
30
  credentials = credentials
31
  )
32
 
33
- #from vertexai.language_models import TextGenerationModel
34
- #generation_model = TextGenerationModel.from_pretrained(config.model)
35
- from vertexai.preview.generative_models import GenerativeModel
36
- generation_model = GenerativeModel(config.model)
37
 
38
  def invoke(prompt):
39
- #completion = generation_model.predict(prompt = prompt).text
40
- completion = generation_model.generate_content(prompt).text
41
  wandb.log({"prompt": prompt, "completion": completion})
42
  return completion
43
  #return "Execution is commented out, but you can view the code at https://huggingface.co/spaces/bstraehle/google-vertex-ai-llm/tree/main."
 
9
  wandb_api_key = os.environ["WANDB_API_KEY"]
10
 
11
  config = {
12
+ "max_output_tokens": 800,
13
  #"model": "text-bison@001",
14
  "model": "gemini-pro",
15
+ "temperature": 0,
16
+ "top_k": 250,
17
+ "top_p": 0.999,
18
  }
19
 
20
  wandb.login(key = wandb_api_key)
 
34
  credentials = credentials
35
  )
36
 
37
+ from vertexai.language_models import TextGenerationModel
38
+ generation_model = TextGenerationModel.from_pretrained(config.model)
39
+ #from vertexai.preview.generative_models import GenerativeModel
40
+ #generation_model = GenerativeModel(config.model)
41
 
42
  def invoke(prompt):
43
+ completion = generation_model.predict(prompt = prompt).text
44
+ #completion = generation_model.generate_content(prompt).text
45
  wandb.log({"prompt": prompt, "completion": completion})
46
  return completion
47
  #return "Execution is commented out, but you can view the code at https://huggingface.co/spaces/bstraehle/google-vertex-ai-llm/tree/main."