sergioska commited on
Commit
17075d5
1 Parent(s): c656ed6

first commit

Browse files
Files changed (1) hide show
  1. app.py +4 -6
app.py CHANGED
@@ -1,14 +1,12 @@
1
  import streamlit as st
2
- import torch
3
  # Load model directly
4
  from transformers import AutoTokenizer, AutoModelForCausalLM
5
 
6
- model_open_chat = AutoModelForCausalLM.from_pretrained("openchat/openchat_3.5",
7
- device_map="auto", temperature=0.1,torch_dtype=torch.bfloat16)
8
- tokenizer_open_chat = AutoTokenizer.from_pretrained("openchat/openchat_3.5")
9
  prompt = ""
10
- model_input = tokenizer_open_chat(prompt, return_tensors="pt").to("cuda")
11
- response = tokenizer_open_chat.decode(model_open_chat.generate(**model_input,temperature=0.1, max_length=5000)[0], skip_special_tokens=True)
12
 
13
  prompt = st.chat_input("Say something")
14
  if prompt:
 
1
  import streamlit as st
 
2
  # Load model directly
3
  from transformers import AutoTokenizer, AutoModelForCausalLM
4
 
5
+ tokenizer = AutoTokenizer.from_pretrained("openchat/openchat")
6
+ model = AutoModelForCausalLM.from_pretrained("openchat/openchat")
 
7
  prompt = ""
8
+ model_input = tokenizer(prompt, return_tensors="pt").to("cuda")
9
+ response = tokenizer.decode(model.generate(**model_input,temperature=0.1, max_length=5000)[0], skip_special_tokens=True)
10
 
11
  prompt = st.chat_input("Say something")
12
  if prompt: