isayahc commited on
Commit
463e62a
·
1 Parent(s): 7961699

changing model as a test

Browse files
Files changed (1) hide show
  1. app.py +7 -6
app.py CHANGED
@@ -28,12 +28,13 @@ DEFAULT_MAX_NEW_TOKENS = 1024
28
  MAX_INPUT_TOKEN_LENGTH = int(os.getenv("MAX_INPUT_TOKEN_LENGTH", "4096"))
29
 
30
 
31
- text_splitter = RecursiveCharacterTextSplitter(chunk_size=350, chunk_overlap=10)
32
- # model_id = HuggingFaceHub(repo_id="HuggingFaceH4/zephyr-7b-beta", model_kwargs={"temperature":0.1, "max_new_tokens":300})
33
  embeddings = HuggingFaceHubEmbeddings()
34
 
35
- model_id = "HuggingFaceH4/zephyr-7b-beta"
36
- # model = AutoModelForCausalLM.from_pretrained(model_id, torch_dtype=torch.float16, device_map="auto")
 
37
  model = AutoModelForCausalLM.from_pretrained(
38
  model_id,
39
  device_map="auto",
@@ -41,9 +42,9 @@ model = AutoModelForCausalLM.from_pretrained(
41
  )
42
 
43
  print( "initalized model")
44
- # model_id = "gpt2"
45
  tokenizer = AutoTokenizer.from_pretrained(model_id)
46
- # model = AutoModelForCausalLM.from_pretrained(model_id)
47
  pipe = pipeline("text-generation", model=model, tokenizer=tokenizer, max_new_tokens=10)
48
  hf = HuggingFacePipeline(pipeline=pipe)
49
 
 
28
  MAX_INPUT_TOKEN_LENGTH = int(os.getenv("MAX_INPUT_TOKEN_LENGTH", "4096"))
29
 
30
 
31
+ # text_splitter = RecursiveCharacterTextSplitter(chunk_size=350, chunk_overlap=10)
32
+
33
  embeddings = HuggingFaceHubEmbeddings()
34
 
35
+ # model_id = "HuggingFaceH4/zephyr-7b-beta"
36
+ model_id = "meta-llama/Llama-2-7b-chat-hf"
37
+
38
  model = AutoModelForCausalLM.from_pretrained(
39
  model_id,
40
  device_map="auto",
 
42
  )
43
 
44
  print( "initalized model")
45
+
46
  tokenizer = AutoTokenizer.from_pretrained(model_id)
47
+
48
  pipe = pipeline("text-generation", model=model, tokenizer=tokenizer, max_new_tokens=10)
49
  hf = HuggingFacePipeline(pipeline=pipe)
50