CineAI commited on
Commit
462ea0e
1 Parent(s): 21f56d6

Update llm/apimodels/hf_model.py

Browse files
Files changed (1) hide show
  1. llm/apimodels/hf_model.py +0 -21
llm/apimodels/hf_model.py CHANGED
@@ -1,5 +1,4 @@
1
  import os
2
- import logging
3
 
4
  from abc import ABC
5
  from typing import Any
@@ -9,19 +8,6 @@ from llm.utils.config import config
9
 
10
  from langchain_community.llms import HuggingFaceEndpoint
11
 
12
- logger = logging.getLogger(__name__)
13
- logger.setLevel(logging.ERROR) # because if something went wrong in execution, application can't be work anyway
14
-
15
- file_handler = logging.FileHandler(
16
- "logs/chelsea_llm_huggingfacehub.log") # for all modules here template for logs file is "llm/logs/chelsea_{module_name}_{dir_name}.log"
17
- logger.setLevel(logging.INFO) # informed
18
-
19
- formatted = logging.Formatter("%(asctime)s - %(levelname)s - %(message)s")
20
- file_handler.setFormatter(formatted)
21
-
22
- logger.addHandler(file_handler)
23
- logger.info("Getting information from apimodel module")
24
-
25
  _api = os.environ.get("HUGGINGFACEHUB_API_TOKEN")
26
 
27
  class HF_Mistaril(HFInterface, ABC):
@@ -70,7 +56,6 @@ class HF_Mistaril(HFInterface, ABC):
70
  try:
71
  return self.llm # `invoke()`
72
  except Exception as e:
73
- logger.error("Something wrong with API or HuggingFaceEndpoint", exc_info=e)
74
  print(f"Something wrong with API or HuggingFaceEndpoint: {e}")
75
 
76
  def model_name(self):
@@ -148,7 +133,6 @@ class HF_TinyLlama(HFInterface, ABC):
148
  try:
149
  return self.llm
150
  except Exception as e:
151
- logger.error("Something wrong with API or HuggingFaceEndpoint", exc_info=e)
152
  print(f"Something wrong with API or HuggingFaceEndpoint: {e}")
153
 
154
  def model_name(self):
@@ -221,7 +205,6 @@ class HF_SmolLM135(HFInterface, ABC):
221
  try:
222
  return self.llm # `invoke()`
223
  except Exception as e:
224
- logger.error("Something wrong with API or HuggingFaceEndpoint", exc_info=e)
225
  print(f"Something wrong with API or HuggingFaceEndpoint: {e}")
226
 
227
  def model_name(self):
@@ -294,7 +277,6 @@ class HF_SmolLM360(HFInterface, ABC):
294
  try:
295
  return self.llm # `invoke()`
296
  except Exception as e:
297
- logger.error("Something wrong with API or HuggingFaceEndpoint", exc_info=e)
298
  print(f"Something wrong with API or HuggingFaceEndpoint: {e}")
299
 
300
  def model_name(self):
@@ -367,7 +349,6 @@ class HF_SmolLM(HFInterface, ABC):
367
  try:
368
  return self.llm # `invoke()`
369
  except Exception as e:
370
- logger.error("Something wrong with API or HuggingFaceEndpoint", exc_info=e)
371
  print(f"Something wrong with API or HuggingFaceEndpoint: {e}")
372
 
373
  def model_name(self):
@@ -440,7 +421,6 @@ class HF_Gemma2(HFInterface, ABC):
440
  try:
441
  return self.llm # `invoke()`
442
  except Exception as e:
443
- logger.error("Something wrong with API or HuggingFaceEndpoint", exc_info=e)
444
  print(f"Something wrong with API or HuggingFaceEndpoint: {e}")
445
 
446
  def model_name(self):
@@ -513,7 +493,6 @@ class HF_Qwen2(HFInterface, ABC):
513
  try:
514
  return self.llm # `invoke()`
515
  except Exception as e:
516
- logger.error("Something wrong with API or HuggingFaceEndpoint", exc_info=e)
517
  print(f"Something wrong with API or HuggingFaceEndpoint: {e}")
518
 
519
  def model_name(self):
 
1
  import os
 
2
 
3
  from abc import ABC
4
  from typing import Any
 
8
 
9
  from langchain_community.llms import HuggingFaceEndpoint
10
 
 
 
 
 
 
 
 
 
 
 
 
 
 
11
  _api = os.environ.get("HUGGINGFACEHUB_API_TOKEN")
12
 
13
  class HF_Mistaril(HFInterface, ABC):
 
56
  try:
57
  return self.llm # `invoke()`
58
  except Exception as e:
 
59
  print(f"Something wrong with API or HuggingFaceEndpoint: {e}")
60
 
61
  def model_name(self):
 
133
  try:
134
  return self.llm
135
  except Exception as e:
 
136
  print(f"Something wrong with API or HuggingFaceEndpoint: {e}")
137
 
138
  def model_name(self):
 
205
  try:
206
  return self.llm # `invoke()`
207
  except Exception as e:
 
208
  print(f"Something wrong with API or HuggingFaceEndpoint: {e}")
209
 
210
  def model_name(self):
 
277
  try:
278
  return self.llm # `invoke()`
279
  except Exception as e:
 
280
  print(f"Something wrong with API or HuggingFaceEndpoint: {e}")
281
 
282
  def model_name(self):
 
349
  try:
350
  return self.llm # `invoke()`
351
  except Exception as e:
 
352
  print(f"Something wrong with API or HuggingFaceEndpoint: {e}")
353
 
354
  def model_name(self):
 
421
  try:
422
  return self.llm # `invoke()`
423
  except Exception as e:
 
424
  print(f"Something wrong with API or HuggingFaceEndpoint: {e}")
425
 
426
  def model_name(self):
 
493
  try:
494
  return self.llm # `invoke()`
495
  except Exception as e:
 
496
  print(f"Something wrong with API or HuggingFaceEndpoint: {e}")
497
 
498
  def model_name(self):