Open bupianlizhugui opened 1 month ago
from uform import get_model, Modality import torch.nn as nn
encoders, processors = get_model('unum-cloud/uform-vl-multilingual-v2',backend='torch')
model_text = models[Modality.TEXT_ENCODER] model_image = models[Modality.IMAGE_ENCODER] processor_text = processors[Modality.TEXT_ENCODER] processor_image = processors[Modality.IMAGE_ENCODER]
model_text.return_features = False model_image.return_features = False model_text_parallel = nn.DataParallel(model_text) model_image_parallel = nn.DataParallel(model_image)
error:
AttributeError Traceback (most recent call last) Cell In[41], line 4 1 from uform import get_model, Modality 2 import torch.nn as nn ----> 4 encoders, processors = get_model('unum-cloud/uform-vl-multilingual-v2',backend='torch') 6 model_text = models[Modality.TEXT_ENCODER] 7 model_image = models[Modality.IMAGE_ENCODER]
File /opt/conda/envs/uform/lib/python3.10/site-packages/uform/init.py:189, in get_model(model_name, device, backend, modalities, token) 187 return get_model_onnx(model_name, device=device, token=token, modalities=modalities) 188 elif backend == "torch": --> 189 return get_model_torch(model_name, device=device, token=token, modalities=modalities) 190 else: 191 raise ValueError(f"Unknown backend: {backend}")
File /opt/conda/envs/uform/lib/python3.10/site-packages/uform/init.py:113, in get_model_torch(model_name, token, device, modalities) 111 if Modality.TEXT_ENCODER in modalities: 112 processor = TextProcessor(config_path, tokenizer_path) --> 113 encoder = TextEncoder.from_pretrained(config_path, modality_paths.get(Modality.TEXT_ENCODER)) 114 encoder = encoder.eval().to(device) 115 result_processors[Modality.TEXT_ENCODER] = processor
AttributeError: 'str' object has no attribute 'get'
from uform import get_model, Modality import torch.nn as nn
encoders, processors = get_model('unum-cloud/uform-vl-multilingual-v2',backend='torch')
model_text = models[Modality.TEXT_ENCODER] model_image = models[Modality.IMAGE_ENCODER] processor_text = processors[Modality.TEXT_ENCODER] processor_image = processors[Modality.IMAGE_ENCODER]
model_text.return_features = False model_image.return_features = False model_text_parallel = nn.DataParallel(model_text) model_image_parallel = nn.DataParallel(model_image)
error:
AttributeError Traceback (most recent call last) Cell In[41], line 4 1 from uform import get_model, Modality 2 import torch.nn as nn ----> 4 encoders, processors = get_model('unum-cloud/uform-vl-multilingual-v2',backend='torch') 6 model_text = models[Modality.TEXT_ENCODER] 7 model_image = models[Modality.IMAGE_ENCODER]
File /opt/conda/envs/uform/lib/python3.10/site-packages/uform/init.py:189, in get_model(model_name, device, backend, modalities, token) 187 return get_model_onnx(model_name, device=device, token=token, modalities=modalities) 188 elif backend == "torch": --> 189 return get_model_torch(model_name, device=device, token=token, modalities=modalities) 190 else: 191 raise ValueError(f"Unknown backend: {backend}")
File /opt/conda/envs/uform/lib/python3.10/site-packages/uform/init.py:113, in get_model_torch(model_name, token, device, modalities) 111 if Modality.TEXT_ENCODER in modalities: 112 processor = TextProcessor(config_path, tokenizer_path) --> 113 encoder = TextEncoder.from_pretrained(config_path, modality_paths.get(Modality.TEXT_ENCODER)) 114 encoder = encoder.eval().to(device) 115 result_processors[Modality.TEXT_ENCODER] = processor
AttributeError: 'str' object has no attribute 'get'