Bahaedev commited on
Commit
14c7a7e
·
verified ·
1 Parent(s): 56aefa1

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +20 -20
app.py CHANGED
@@ -1,5 +1,5 @@
1
  import os
2
- from transformers import pipeline, AutoTokenizer
3
  import gradio as gr
4
  from fastapi import FastAPI
5
  from pydantic import BaseModel
@@ -15,32 +15,32 @@ SYSTEM_PROMPT = os.environ.get(
15
  "You are a placeholder Sovereign. No secrets found in environment."
16
  )
17
 
18
- MODEL_ID = "tiiuae/Falcon3-3B-Instruct"
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
19
 
20
- tokenizer = AutoTokenizer.from_pretrained(MODEL_ID)
21
- # =======================
22
- # Initialize Falcon-3B
23
- # =======================
24
  pipe = pipeline(
25
  "text-generation",
26
  model="tiiuae/Falcon3-3B-Instruct",
27
- tokenizer=tokenizer,
28
  device_map="auto",
29
- return_full_text=False,
30
- max_new_tokens=256,
31
- do_sample=True,
32
- temperature=0.8,
33
- top_p=0.9,
34
- eos_token_id=tokenizer.eos_token_id
35
  )
36
 
37
- # pipe = pipeline(
38
- # "text-generation",
39
- # model=,
40
- # torch_dtype="auto",
41
- # device_map="auto",
42
- # )
43
-
44
  # =======================
45
  # Core Chat Function
46
  # =======================
 
1
  import os
2
+ from transformers import pipeline
3
  import gradio as gr
4
  from fastapi import FastAPI
5
  from pydantic import BaseModel
 
15
  "You are a placeholder Sovereign. No secrets found in environment."
16
  )
17
 
18
+ # MODEL_ID = "tiiuae/Falcon3-3B-Instruct"
19
+
20
+ # tokenizer = AutoTokenizer.from_pretrained(MODEL_ID)
21
+ # # =======================
22
+ # # Initialize Falcon-3B
23
+ # # =======================
24
+ # pipe = pipeline(
25
+ # "text-generation",
26
+ # model="tiiuae/Falcon3-3B-Instruct",
27
+ # tokenizer=tokenizer,
28
+ # device_map="auto",
29
+ # return_full_text=False,
30
+ # max_new_tokens=256,
31
+ # do_sample=True,
32
+ # temperature=0.8,
33
+ # top_p=0.9,
34
+ # eos_token_id=tokenizer.eos_token_id
35
+ # )
36
 
 
 
 
 
37
  pipe = pipeline(
38
  "text-generation",
39
  model="tiiuae/Falcon3-3B-Instruct",
40
+ torch_dtype="auto",
41
  device_map="auto",
 
 
 
 
 
 
42
  )
43
 
 
 
 
 
 
 
 
44
  # =======================
45
  # Core Chat Function
46
  # =======================