conceptofmind / toolformer

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

No pytorch_model.bin

YerongLi opened this issue · comments

I tried to run the example in the readme with from_tf enabled, while I found there huggingface does not have pytorch_model.bin. How I can fix this?

# Example does not work
import torch
from transformers import AutoTokenizer, AutoModelForCausalLM, pipeline

tokenizer = AutoTokenizer.from_pretrained(r"dmayhem93/toolformer_v0_epoch2")
model = AutoModelForCausalLM.from_pretrained(
    r"dmayhem93/toolformer_v0_epoch2",
    torch_dtype=torch.float16,
    low_cpu_mem_usage=True,
    from_tf=True,
).cuda()
generator = pipeline(
    "text-generation", model=model, tokenizer=tokenizer, device=0
) 
Traceback (most recent call last):
  File "/scratch/yerong/ctoolformer/example.py", line 5, in <module>
    model = AutoModelForCausalLM.from_pretrained(
  File "/scratch/yerong/.conda/envs/tool/lib/python3.9/site-packages/transformers/models/auto/auto_factory.py", line 471, in from_pretrained
    return model_class.from_pretrained(
  File "/scratch/yerong/.conda/envs/tool/lib/python3.9/site-packages/transformers/modeling_utils.py", line 2511, in from_pretrained
    raise EnvironmentError(
OSError: dmayhem93/toolformer_v0_epoch2 does not appear to have a file named pytorch_model.bin, tf_model.h5, model.ckpt or flax_model.msgpack.

Loading from local snapshot works.