asterixix commited on
Commit
234e653
1 Parent(s): 800cd8e

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -2
app.py CHANGED
@@ -3,7 +3,7 @@ from langchain_core.prompts import ChatPromptTemplate, HumanMessagePromptTemplat
3
  from langchain.schema import SystemMessage
4
  import streamlit as st
5
  import torch
6
- from transformers import AutoModelForCausalLM, AutoTokenizer, pipeline
7
  from langchain_community.llms.huggingface_pipeline import HuggingFacePipeline
8
  import nltk
9
  import json
@@ -46,7 +46,7 @@ if dataset_file:
46
  df = pd.read_csv(dataset_file)
47
 
48
  # Initialize tokenizer and model
49
- tokenizer = AutoTokenizer.from_pretrained(model_name, use_fast=True)
50
  model = AutoModelForCausalLM.from_pretrained(model_name)
51
  pipe = pipeline("text-generation", model=model, tokenizer=tokenizer, return_full_text=True)
52
  llm = HuggingFacePipeline(pipeline=pipe)
 
3
  from langchain.schema import SystemMessage
4
  import streamlit as st
5
  import torch
6
+ from transformers import AutoModelForCausalLM, AutoTokenizer, pipeline, LlamaTokenizer
7
  from langchain_community.llms.huggingface_pipeline import HuggingFacePipeline
8
  import nltk
9
  import json
 
46
  df = pd.read_csv(dataset_file)
47
 
48
  # Initialize tokenizer and model
49
+ tokenizer = AutoTokenizer.from_pretrained(model_name, use_fast=True) or LlamaTokenizer.from_pretrained(model_name)
50
  model = AutoModelForCausalLM.from_pretrained(model_name)
51
  pipe = pipeline("text-generation", model=model, tokenizer=tokenizer, return_full_text=True)
52
  llm = HuggingFacePipeline(pipeline=pipe)