Sean-Case commited on
Commit
82b1ab1
1 Parent(s): 4cfed8e

removed cpu_config as causing problems

Browse files
Files changed (1) hide show
  1. funcs/representation_model.py +4 -25
funcs/representation_model.py CHANGED
@@ -100,7 +100,7 @@ class LLamacppInitConfigGpu(BaseModel):
100
  def update_gpu(self, new_value: int):
101
  self.n_gpu_layers = new_value
102
 
103
- gpu_config = LLamacppInitConfigGpu(last_n_tokens_size=last_n_tokens_size,
104
  seed=seed,
105
  n_threads=n_threads,
106
  n_batch=n_batch,
@@ -116,36 +116,15 @@ gpu_config = LLamacppInitConfigGpu(last_n_tokens_size=last_n_tokens_size,
116
  stop=chosen_start_tag,
117
  trust_remote_code=trust_remote_code)
118
 
119
- cpu_config = gpu_config.model_copy()
120
- cpu_config.update_gpu(0)
121
-
122
- class LLamacppGenerateConfig(BaseModel):
123
- temperature: float
124
- top_k: int
125
- top_p: float
126
- repeat_penalty: float
127
- max_tokens: int
128
- reset: bool
129
- stream: bool
130
-
131
- gen_config = LLamacppGenerateConfig(
132
- temperature=temperature,
133
- top_k=top_k,
134
- top_p=top_p,
135
- repeat_penalty=repeat_penalty,
136
- max_tokens=max_tokens,
137
- reset=reset,
138
- stream=stream)
139
-
140
  ## Create representation model parameters ##
141
  # KeyBERT
142
  keybert = KeyBERTInspired()
143
 
144
- def create_representation_model(create_llm_topic_labels, gpu_config, found_file, chosen_start_tag):
145
 
146
  if create_llm_topic_labels == "Yes":
147
  # Use llama.cpp to load in model
148
- llm = Llama(model_path=found_file, stop=chosen_start_tag, n_gpu_layers=gpu_config.n_gpu_layers, n_ctx=gpu_config.n_ctx) #**gpu_config.model_dump())#
149
  #print(llm.n_gpu_layers)
150
  llm_model = LlamaCPP(llm, prompt=chosen_prompt)#, **gen_config.model_dump())
151
 
@@ -159,7 +138,7 @@ def create_representation_model(create_llm_topic_labels, gpu_config, found_file,
159
  representation_model = {"KeyBERT": keybert}
160
 
161
  # Deprecated example using CTransformers. This package is not really used anymore
162
- #model = AutoModelForCausalLM.from_pretrained('NousResearch/Nous-Capybara-7B-V1.9-GGUF', model_type='mistral', model_file='Capybara-7B-V1.9-Q5_K_M.gguf', hf=True, **vars(gpu_config))
163
  #tokenizer = AutoTokenizer.from_pretrained("NousResearch/Nous-Capybara-7B-V1.9")
164
  #generator = pipeline(task="text-generation", model=model, tokenizer=tokenizer)
165
 
 
100
  def update_gpu(self, new_value: int):
101
  self.n_gpu_layers = new_value
102
 
103
+ llm_config = LLamacppInitConfigGpu(last_n_tokens_size=last_n_tokens_size,
104
  seed=seed,
105
  n_threads=n_threads,
106
  n_batch=n_batch,
 
116
  stop=chosen_start_tag,
117
  trust_remote_code=trust_remote_code)
118
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
119
  ## Create representation model parameters ##
120
  # KeyBERT
121
  keybert = KeyBERTInspired()
122
 
123
+ def create_representation_model(create_llm_topic_labels, llm_config, found_file, chosen_start_tag):
124
 
125
  if create_llm_topic_labels == "Yes":
126
  # Use llama.cpp to load in model
127
+ llm = Llama(model_path=found_file, stop=chosen_start_tag, n_gpu_layers=llm_config.n_gpu_layers, n_ctx=llm_config.n_ctx) #**llm_config.model_dump())#
128
  #print(llm.n_gpu_layers)
129
  llm_model = LlamaCPP(llm, prompt=chosen_prompt)#, **gen_config.model_dump())
130
 
 
138
  representation_model = {"KeyBERT": keybert}
139
 
140
  # Deprecated example using CTransformers. This package is not really used anymore
141
+ #model = AutoModelForCausalLM.from_pretrained('NousResearch/Nous-Capybara-7B-V1.9-GGUF', model_type='mistral', model_file='Capybara-7B-V1.9-Q5_K_M.gguf', hf=True, **vars(llm_config))
142
  #tokenizer = AutoTokenizer.from_pretrained("NousResearch/Nous-Capybara-7B-V1.9")
143
  #generator = pipeline(task="text-generation", model=model, tokenizer=tokenizer)
144