Model availability
Hey everybody! Great work the model looks really promising!
However, your example of how to run the code sadly does not work. Always running into this problem while loading the model.
Encountered exception while importing starvector: No module named 'starvector'
Traceback (most recent call last):
File "/home/steven/Uni/semester2/Graph_Analytics/Data/test.py", line 8, in
starvector = AutoModelForCausalLM.from_pretrained(model_name, torch_dtype=torch.float16, trust_remote_code=True)
File "/home/steven/Uni/semester2/Graph_Analytics/sgc_venv/lib/python3.10/site-packages/transformers/models/auto/auto_factory.py", line 526, in from_pretrained
config, kwargs = AutoConfig.from_pretrained(
File "/home/steven/Uni/semester2/Graph_Analytics/sgc_venv/lib/python3.10/site-packages/transformers/models/auto/configuration_auto.py", line 1030, in from_pretrained
config_class = get_class_from_dynamic_module(
File "/home/steven/Uni/semester2/Graph_Analytics/sgc_venv/lib/python3.10/site-packages/transformers/dynamic_module_utils.py", line 541, in get_class_from_dynamic_module
final_module = get_cached_module_file(
File "/home/steven/Uni/semester2/Graph_Analytics/sgc_venv/lib/python3.10/site-packages/transformers/dynamic_module_utils.py", line 366, in get_cached_module_file
modules_needed = check_imports(resolved_module_file)
File "/home/steven/Uni/semester2/Graph_Analytics/sgc_venv/lib/python3.10/site-packages/transformers/dynamic_module_utils.py", line 198, in check_imports
raise ImportError(
ImportError: This modeling file requires the following packages that were not found in your environment: starvector. Run pip install starvector
I strictly used the model card code:
from PIL import Image
from transformers import AutoModelForCausalLM, AutoTokenizer, AutoProcessor
from starvector.data.util import process_and_rasterize_svg
import torch
model_name = "starvector/starvector-8b-im2svg"
starvector = AutoModelForCausalLM.from_pretrained(model_name, torch_dtype=torch.float16, trust_remote_code=True)
processor = starvector.model.processor
tokenizer = starvector.model.svg_transformer.tokenizer
starvector.cuda()
starvector.eval()
image_pil = Image.open('assets/examples/sample-18.png')
image = processor(image_pil, return_tensors="pt")['pixel_values'].cuda()
if not image.shape[0] == 1:
image = image.squeeze(0)
batch = {"image": image}
raw_svg = starvector.generate_im2svg(batch, max_length=4000)[0]
svg, raster_image = process_and_rasterize_svg(raw_svg)
Because star vector is not available on pip this effectively forces the user to clone the github repo to run the hugging face models, doesn't it? Could you include the whole setup in the example?