FlawedLLM commited on
Commit
29e0d2d
·
verified ·
1 Parent(s): 2d90ba4

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +12 -2
app.py CHANGED
@@ -62,7 +62,17 @@ from transformers import AutoTokenizer, AutoModelForCausalLM, BitsAndBytesConfig
62
  # Load model directly
63
 
64
  tokenizer = AutoTokenizer.from_pretrained("FlawedLLM/Bhashini_00")
65
- model = AutoModelForCausalLM.from_pretrained("FlawedLLM/Bhashini_00", load_in_4bit=True)
 
 
 
 
 
 
 
 
 
 
66
 
67
  @spaces.GPU(duration=300)
68
  def chunk_it(input_command, item_list):
@@ -77,7 +87,7 @@ def chunk_it(input_command, item_list):
77
  ### Response:
78
  {}"""
79
  if item_list is not None:
80
- item_list = f"The ItemName should be STRICTLY chosen from the given list of ItemNames, : {item_list} , except when adding item. Try to be as strict as possible, if item name not available, then write null."
81
  inputs = tokenizer(
82
  [
83
  alpaca_prompt.format(
 
62
  # Load model directly
63
 
64
  tokenizer = AutoTokenizer.from_pretrained("FlawedLLM/Bhashini_00")
65
+ quantization_config = BitsAndBytesConfig(
66
+ load_in_4bit=True,
67
+ bnb_4bit_use_double_quant=True,
68
+ bnb_4bit_quant_type="nf4",
69
+ bnb_4bit_compute_dtype=torch.float16)
70
+ model = AutoModelForCausalLM.from_pretrained("FlawedLLM/Bhashini_00",
71
+ device_map="auto",
72
+ quantization_config=quantization_config,
73
+ torch_dtype =torch.float16,
74
+ low_cpu_mem_usage=True,
75
+ use_safetensors=True,)
76
 
77
  @spaces.GPU(duration=300)
78
  def chunk_it(input_command, item_list):
 
87
  ### Response:
88
  {}"""
89
  if item_list is not None:
90
+ item_list = f'''The ItemName should be STRICTLY chosen from the given list : {item_list} , except when adding item. Try to be as strict as possible, if ItemName does not find anything similar in the list, then the ItemName should be "Null" '''
91
  inputs = tokenizer(
92
  [
93
  alpaca_prompt.format(