ss900371tw commited on
Commit
35ee0e7
·
verified ·
1 Parent(s): a22caef

Update src/streamlit_app.py

Browse files
Files changed (1) hide show
  1. src/streamlit_app.py +2 -30
src/streamlit_app.py CHANGED
@@ -1,31 +1,3 @@
1
- import transformers
2
- import torch
3
 
4
- model_id = "meta-llama/Meta-Llama-3-8B-Instruct"
5
-
6
- pipeline = transformers.pipeline(
7
- "text-generation",
8
- model=model_id,
9
- model_kwargs={"torch_dtype": torch.bfloat16},
10
- device_map="auto",
11
- )
12
-
13
- messages = [
14
- {"role": "system", "content": "You are a pirate chatbot who always responds in pirate speak!"},
15
- {"role": "user", "content": "Who are you?"},
16
- ]
17
-
18
- terminators = [
19
- pipeline.tokenizer.eos_token_id,
20
- pipeline.tokenizer.convert_tokens_to_ids("<|eot_id|>")
21
- ]
22
-
23
- outputs = pipeline(
24
- messages,
25
- max_new_tokens=256,
26
- eos_token_id=terminators,
27
- do_sample=True,
28
- temperature=0.6,
29
- top_p=0.9,
30
- )
31
- print(outputs[0]["generated_text"][-1])
 
1
+ import gradio as gr
 
2
 
3
+ gr.load("models/meta-llama/Meta-Llama-3-8B-Instruct").launch()