search_with_lepton icon indicating copy to clipboard operation
search_with_lepton copied to clipboard

几个问题!huggingface要代理。local执行有bug

Open makelove opened this issue 3 months ago • 2 comments

按照https://www.lepton.ai/docs/overview/quickstart 执行

  • huggingface要代理
(.py3) play@mini ~ % lep photon create --name mygpt2 --model hf:gpt2
Failed to create photon: (MaxRetryError("HTTPSConnectionPool(host='huggingface.co', port=443): Max retries 
exceeded with url: /api/models/gpt2 (Caused by NewConnectionError('<urllib3.connection.VerifiedHTTPSConnection 
object at 0x107463940>: Failed to establish a new connection: [Errno 60] Operation timed out'))"), '(Request ID: 
b800e4d0-35dc-49e4-9ec0-ef41b721a4b6)')

打开代理软件后,执行成功

(.py3) play@mini ~ % lep photon create --name mygpt2 --model hf:gpt2
Photon mygpt2 created.

然后 local执行有bug

(.py3) play@mini ~ % lep photon run --name mygpt2 --local           
Launching photon on port: 8080
2024-03-25 16:47:02.089 | INFO     | leptonai.photon.hf.hf:pipeline:213 - Creating pipeline for text-generation(model=gpt2, revision=607a30d7).
HuggingFace download might take a while, please be patient...
2024-03-25 16:47:02.089 | INFO     | leptonai.photon.hf.hf:pipeline:218 - Note: HuggingFace caches the downloaded models in ~/.cache/huggingface/ (or C:\Users\<username>\.cache\huggingface\ on Windows). If you have already downloaded the model before, the download should be much faster. If you run out of disk space, you can delete the cache folder.
While loading and launching photon, some modules are not found. Details:

Traceback (most recent call last):
  File "/Users/play/.py3/lib/python3.9/site-packages/leptonai/cli/photon.py", line 785, in run
    photon.launch(port=port)
  File "/Users/play/.py3/lib/python3.9/site-packages/leptonai/photon/photon.py", line 897, in launch
    self._call_init_once()
  File "/Users/play/.py3/lib/python3.9/site-packages/leptonai/photon/photon.py", line 614, in _call_init_once
    self._init_res = self.init()
  File "/Users/play/.py3/lib/python3.9/site-packages/leptonai/photon/hf/hf.py", line 254, in init
    self.pipeline
  File "/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.9/lib/python3.9/functools.py", line 969, in __get__
    val = self.func(instance)
  File "/Users/play/.py3/lib/python3.9/site-packages/leptonai/photon/hf/hf.py", line 247, in pipeline
    raise e
  File "/Users/play/.py3/lib/python3.9/site-packages/leptonai/photon/hf/hf.py", line 225, in pipeline
    pipeline = pipeline_creator(
  File "/Users/play/.py3/lib/python3.9/site-packages/leptonai/photon/hf/hf_utils.py", line 279, in create_transformers_pipeline
    return _create_hf_transformers_pipeline(task, model, revision)
  File "/Users/play/.py3/lib/python3.9/site-packages/leptonai/photon/hf/hf_utils.py", line 186, in _create_hf_transformers_pipeline
    from transformers import pipeline, AutoTokenizer, AutoConfig, AutoModelForCausalLM
ModuleNotFoundError: No module named 'transformers'

It seems that you are missing some dependencies. This is not a bug of LeptonAI library, and is due to the 
underlying photon requiring dependencies. When running photons locally, we intentionally refrain from installing 
these dependencies for you, in order to not mess with your local environment. You can manually install the 
missing dependencies by looking at the exception above.

According to the photon's metadata, dependencies can be installed via:
        pip install ctransformers
Kindly install the dependencies and try again.

2个问题

  • HuggingFace 没有下载模型
(.py3) play@mini ~ % ls ~/.cache/huggingface/
ls: /Users/play/.cache/huggingface/: No such file or directory
  • ctransformers 已经安装,仍然提示没安装
(.py3) play@mini ~ % pip freeze |grep ctransformers
ctransformers==0.2.27

怎么解决?

pip安装的 代码有问题?

makelove avatar Mar 25 '24 08:03 makelove

Windows 平台没问题 是MacOS 出问题?

makelove avatar Mar 28 '24 03:03 makelove

RuntimeError: Directory 'ui' does not exist ,windows 执行报没有UI 源码里面确实没有ui目录。

mqd273 avatar Apr 04 '24 04:04 mqd273