translators-will commited on
Commit
9901183
·
verified ·
1 Parent(s): 5371947

Update data_clean_final.py

Browse files
Files changed (1) hide show
  1. data_clean_final.py +6 -5
data_clean_final.py CHANGED
@@ -2,17 +2,18 @@
2
 
3
  import pandas as pd
4
  import streamlit as st
5
- from transformers import AutoTokenizer, AutoModelForCausalLM, pipeline
 
6
  import torch
7
 
8
  # Load local TinyLlama model
9
- model_name = "TinyLlama/TinyLlama-1.1B-Chat-v1.0"
10
  tokenizer = AutoTokenizer.from_pretrained(model_name)
11
  model = AutoModelForCausalLM.from_pretrained(
12
  model_name,
13
- device_map='auto',
14
- load_in_4bit=True,
15
- torch_dtype='auto'
16
  )
17
  generator = pipeline("text-generation", model=model, tokenizer=tokenizer, device=0 if torch.cuda.is_available() else -1)
18
 
 
2
 
3
  import pandas as pd
4
  import streamlit as st
5
+ from transformers import AutoTokenizer, pipeline
6
+ from ctransformers import AutoModelforCausalLM
7
  import torch
8
 
9
  # Load local TinyLlama model
10
+ model_name = "TheBloke/TinyLlama-1.1B-Chat-v1.0-GGUF"
11
  tokenizer = AutoTokenizer.from_pretrained(model_name)
12
  model = AutoModelForCausalLM.from_pretrained(
13
  model_name,
14
+ model_file = "tinyllama-1.1b-chat-v1.0.Q4_K_M.gguf",
15
+ model_type = "llama",
16
+ local_files_only = True
17
  )
18
  generator = pipeline("text-generation", model=model, tokenizer=tokenizer, device=0 if torch.cuda.is_available() else -1)
19