suwonpabby commited on
Commit
d1bdc32
1 Parent(s): 09ffae8
Files changed (1) hide show
  1. app.py +6 -3
app.py CHANGED
@@ -11,7 +11,7 @@ import uvicorn
11
  import time
12
  import numpy as np
13
  import subprocess
14
- import pkg_resources
15
 
16
  # 모듈 설치 명령
17
  subprocess.run(["pip", "install", "transformers"], check=True)
@@ -24,8 +24,11 @@ subprocess.run(["pip", "install", "numpy==1.26.0"], check=True)
24
  modules = ['transformers', 'accelerate', 'peft', 'FlagEmbedding']
25
 
26
  for module in modules:
27
- version = pkg_resources.get_distribution(module).version
28
- print(f"{module} version: {version}")
 
 
 
29
 
30
  #fmt: off
31
  from transformers import AutoModelForCausalLM, AutoTokenizer
 
11
  import time
12
  import numpy as np
13
  import subprocess
14
+ import importlib.metadata
15
 
16
  # 모듈 설치 명령
17
  subprocess.run(["pip", "install", "transformers"], check=True)
 
24
  modules = ['transformers', 'accelerate', 'peft', 'FlagEmbedding']
25
 
26
  for module in modules:
27
+ try:
28
+ version = importlib.metadata.version(module)
29
+ print(f"{module} version: {version}")
30
+ except importlib.metadata.PackageNotFoundError:
31
+ print(f"{module} is not installed")
32
 
33
  #fmt: off
34
  from transformers import AutoModelForCausalLM, AutoTokenizer