MallikaWy's picture
Add files using upload-large-folder tool
53c02a9 verified
Raw History Blame Contribute Delete
679 Bytes
import nvidia_smi
from lmdeploy import pipeline, TurbomindEngineConfig
from lmdeploy.vl import load_image
nvidia_smi.nvmlInit()
handle = nvidia_smi.nvmlDeviceGetHandleByIndex(0)
nvidia_smi.nvmlShutdown()
engine_config = TurbomindEngineConfig(cache_max_entry_count=0.1)
pipe = pipeline('internlm/internlm-xcomposer2d5-7b', backend_config=engine_config)
image = load_image('examples/dubai.png')
response = pipe(('describe this image', image))
print(response.text)
info = nvidia_smi.nvmlDeviceGetMemoryInfo(handle)
print("Total memory:", info.total / 1024 / 1024 / 1024)
print("Free memory:", info.free / 1024 / 1024 / 1024)
print("Used memory:", info.used / 1024 / 1024 / 1024)