Git Product home page Git Product logo

Comments (2)

Zhikaiiii avatar Zhikaiiii commented on May 31, 2024

你好,在运行demo时出现了这个错误:--------------------------------------------------------------------------- ValueError Traceback (most recent call last) Cell In[11], line 17 5 model_name = 'modelscope-agent-7b' 6 model_cfg = { 7 'modelscope-agent-7b':{ 8 'type': 'modelscope', (...) 13 } 14 } ---> 17 llm = LLMFactory.build_llm(model_name, model_cfg)

File ~/Downloads/modelscope-agent/demo/../modelscope_agent/llm/llm_factory.py:22, in LLMFactory.build_llm(model_name, cfg) 20 llm_cls = get_llm_cls(llm_type) 21 llm_cfg = cfg[model_name] ---> 22 return llm_cls(cfg=llm_cfg)

File ~/Downloads/modelscope-agent/demo/../modelscope_agent/llm/modelscope_llm.py:43, in ModelScopeLLM.init(self, cfg) 40 self.end_token = self.cfg.get('end_token', '<|endofthink|>') 41 self.include_end = self.cfg.get('include_end', True) ---> 43 self.setup()

File ~/Downloads/modelscope-agent/demo/../modelscope_agent/llm/modelscope_llm.py:49, in ModelScopeLLM.setup(self) 46 model_cls = self.model_cls 47 tokenizer_cls = self.tokenizer_cls ---> 49 self.model = model_cls.from_pretrained( 50 self.model_dir, 51 device_map=self.device_map, 52 # device='cuda:0', 53 torch_dtype=torch.float16, 54 trust_remote_code=True) 55 self.tokenizer = tokenizer_cls.from_pretrained( 56 self.model_dir, trust_remote_code=True) 57 self.model = self.model.eval()

File ~/anaconda3/lib/python3.10/site-packages/transformers/models/auto/auto_factory.py:558, in _BaseAutoModelClass.from_pretrained(cls, pretrained_model_name_or_path, *model_args, **kwargs) 556 else: 557 cls.register(config.class, model_class, exist_ok=True) --> 558 return model_class.from_pretrained( 559 pretrained_model_name_or_path, *model_args, config=config, **hub_kwargs, **kwargs 560 ) 561 elif type(config) in cls._model_mapping.keys(): 562 model_class = _get_model_class(config, cls._model_mapping)

File ~/anaconda3/lib/python3.10/site-packages/modelscope/utils/hf_util.py:72, in patch_model_base..from_pretrained(cls, pretrained_model_name_or_path, *model_args, **kwargs) 70 else: 71 model_dir = pretrained_model_name_or_path ---> 72 return ori_from_pretrained(cls, model_dir, *model_args, **kwargs)

File ~/anaconda3/lib/python3.10/site-packages/transformers/modeling_utils.py:3187, in PreTrainedModel.from_pretrained(cls, pretrained_model_name_or_path, config, cache_dir, ignore_mismatched_sizes, force_download, local_files_only, token, revision, use_safetensors, *model_args, **kwargs) 3177 if dtype_orig is not None: 3178 torch.set_default_dtype(dtype_orig) 3180 ( 3181 model, 3182 missing_keys, 3183 unexpected_keys, 3184 mismatched_keys, 3185 offload_index, 3186 error_msgs, -> 3187 ) = cls._load_pretrained_model( 3188 model, 3189 state_dict, 3190 loaded_state_dict_keys, # XXX: rename? 3191 resolved_archive_file, 3192 pretrained_model_name_or_path, 3193 ignore_mismatched_sizes=ignore_mismatched_sizes, 3194 sharded_metadata=sharded_metadata, 3195 _fast_init=_fast_init, 3196 low_cpu_mem_usage=low_cpu_mem_usage, 3197 device_map=device_map, 3198 offload_folder=offload_folder, 3199 offload_state_dict=offload_state_dict, 3200 dtype=torch_dtype, 3201 is_quantized=(getattr(model, "quantization_method", None) == QuantizationMethod.BITS_AND_BYTES), 3202 keep_in_fp32_modules=keep_in_fp32_modules, 3203 ) 3205 model.is_loaded_in_4bit = load_in_4bit 3206 model.is_loaded_in_8bit = load_in_8bit

File ~/anaconda3/lib/python3.10/site-packages/transformers/modeling_utils.py:3308, in PreTrainedModel._load_pretrained_model(cls, model, state_dict, loaded_keys, resolved_archive_file, pretrained_model_name_or_path, ignore_mismatched_sizes, sharded_metadata, _fast_init, low_cpu_mem_usage, device_map, offload_folder, offload_state_dict, dtype, is_quantized, keep_in_fp32_modules) 3306 is_safetensors = archive_file.endswith(".safetensors") 3307 if offload_folder is None and not is_safetensors: -> 3308 raise ValueError( 3309 "The current device_map had weights offloaded to the disk. Please provide an offload_folder" 3310 " for them. Alternatively, make sure you have safetensors installed if the model you are using" 3311 " offers the weights in this format." 3312 ) 3313 if offload_folder is not None: 3314 os.makedirs(offload_folder, exist_ok=True)

ValueError: The current device_map had weights offloaded to the disk. Please provide an offload_folder for them. Alternatively, make sure you have safetensors installed if the model you are using offers the weights in this format.

方便的话可以提供一下modelscope版本和运行环境吗(如显存)等,我这边运行可以正常导入模型。

from modelscope-agent.

zzhangpurdue avatar zzhangpurdue commented on May 31, 2024

版本已经更新,建议通过api调用qwen-max进行agent任务推进。关闭

from modelscope-agent.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.