Spaces:
Build error
Build error
Update app.py
Browse files
app.py
CHANGED
@@ -27,6 +27,7 @@ if torch.cuda.is_available():
|
|
27 |
model = AutoModelForCausalLM.from_pretrained(model_id, torch_dtype=torch.bfloat16, device_map="auto")
|
28 |
tokenizer = AutoTokenizer.from_pretrained(model_id)
|
29 |
tokenizer.use_default_system_prompt = False
|
|
|
30 |
|
31 |
|
32 |
@spaces.GPU
|
@@ -38,7 +39,7 @@ def generate(
|
|
38 |
temperature: float = 0.6,
|
39 |
top_p: float = 0.9,
|
40 |
top_k: int = 50,
|
41 |
-
repetition_penalty: float = 1
|
42 |
) -> Iterator[str]:
|
43 |
global total_count
|
44 |
total_count += 1
|
@@ -63,10 +64,9 @@ def generate(
|
|
63 |
{"input_ids": input_ids},
|
64 |
streamer=streamer,
|
65 |
max_new_tokens=max_new_tokens,
|
66 |
-
do_sample=
|
67 |
top_p=top_p,
|
68 |
top_k=top_k,
|
69 |
-
temperature=temperature,
|
70 |
num_beams=1,
|
71 |
repetition_penalty=repetition_penalty,
|
72 |
eos_token_id=32021
|
|
|
27 |
model = AutoModelForCausalLM.from_pretrained(model_id, torch_dtype=torch.bfloat16, device_map="auto")
|
28 |
tokenizer = AutoTokenizer.from_pretrained(model_id)
|
29 |
tokenizer.use_default_system_prompt = False
|
30 |
+
|
31 |
|
32 |
|
33 |
@spaces.GPU
|
|
|
39 |
temperature: float = 0.6,
|
40 |
top_p: float = 0.9,
|
41 |
top_k: int = 50,
|
42 |
+
repetition_penalty: float = 1,
|
43 |
) -> Iterator[str]:
|
44 |
global total_count
|
45 |
total_count += 1
|
|
|
64 |
{"input_ids": input_ids},
|
65 |
streamer=streamer,
|
66 |
max_new_tokens=max_new_tokens,
|
67 |
+
do_sample=False,
|
68 |
top_p=top_p,
|
69 |
top_k=top_k,
|
|
|
70 |
num_beams=1,
|
71 |
repetition_penalty=repetition_penalty,
|
72 |
eos_token_id=32021
|