debisoft commited on
Commit
828b5e8
1 Parent(s): a34933e
Files changed (1) hide show
  1. app.py +16 -18
app.py CHANGED
@@ -26,24 +26,22 @@ def get_completion(prompt, model="dolly-v0-70m"):
26
  )
27
 
28
  # Examples from https://www.databricks.com/blog/2023/03/24/hello-dolly-democratizing-magic-chatgpt-open-models.html
29
- instructions = [
30
- prompt
31
- ]
32
-
33
- # set some additional pipeline args
34
- pipeline_kwargs = {'torch_dtype': "auto"}
35
- #if gpu_family == "v100":
36
- #pipeline_kwargs['torch_dtype'] = "float16"
37
- #elif gpu_family == "a10" or gpu_family == "a100":
38
- #pipeline_kwargs['torch_dtype'] = "bfloat16"
39
-
40
- pipeline_kwargs['max_new_tokens'] = 300
41
-
42
- # Use the model to generate responses for each of the instructions above.
43
- for instruction in instructions:
44
- response = generate_response(instruction, model=model, tokenizer=tokenizer, **pipeline_kwargs)
45
- if response:
46
- print(f"Instruction: {instruction}\n\n{response}\n\n-----------\n")
47
 
48
  return response
49
 
 
26
  )
27
 
28
  # Examples from https://www.databricks.com/blog/2023/03/24/hello-dolly-democratizing-magic-chatgpt-open-models.html
29
+ instructions = [prompt]
30
+
31
+ # set some additional pipeline args
32
+ pipeline_kwargs = {'torch_dtype': "auto"}
33
+ #if gpu_family == "v100":
34
+ #pipeline_kwargs['torch_dtype'] = "float16"
35
+ #elif gpu_family == "a10" or gpu_family == "a100":
36
+ #pipeline_kwargs['torch_dtype'] = "bfloat16"
37
+
38
+ pipeline_kwargs['max_new_tokens'] = 300
39
+
40
+ # Use the model to generate responses for each of the instructions above.
41
+ for instruction in instructions:
42
+ response = generate_response(instruction, model=model, tokenizer=tokenizer, **pipeline_kwargs)
43
+ if response:
44
+ print(f"Instruction: {instruction}\n\n{response}\n\n-----------\n")
 
 
45
 
46
  return response
47