System Info
env: transformers=4.35.2, torch = 1.12.1+cu113, Ubuntu 20.04.6 LTS python=3.10
when I write this sentence "from transformers import LlamaForCausalLM, LlamaTokenizer, AutoTokenizer, AutoModelForCausalLM", It tell me it cant find fx in torch. I inspect the doc of torch version and found there is fx module in this version. And when I use the console to import torch.fx, there is no fault happened. And the I add the import torch.fx before the "from transformers import LlamaForCausalLM, LlamaTokenizer, AutoTokenizer, AutoModelForCausalLM", the error misses.
Who can help?
No response
Information
Tasks
Reproduction
- install the llama according to its readme
- install the torch = 1.12.1+cu113
- write a footprint including following sentences
import argparse
import json
import os
import time
import pandas as pd
import tensor_parallel as tp
import torch
from tqdm import tqdm
from transformers import LlamaForCausalLM, LlamaTokenizer, AutoTokenizer, AutoModelForCausalLM
and then the error occur
from transformers import LlamaForCausalLM, LlamaTokenizer, AutoTokenizer, AutoModelForCausalLM
File "", line 1075, in _handle_fromlist
File "/miniconda3/envs/llama-7b/lib/python3.10/site-packages/transformers/utils/import_utils.py", line 1344, in getattr
value = getattr(module, name)
File "/miniconda3/envs/llama-7b/lib/python3.10/site-packages/transformers/utils/import_utils.py", line 1343, in getattr
module = self._get_module(self._class_to_module[name])
File "/miniconda3/envs/llama-7b/lib/python3.10/site-packages/transformers/utils/import_utils.py", line 1355, in _get_module
raise RuntimeError(
RuntimeError: Failed to import transformers.models.llama.modeling_llama because of the following error (look up to see its traceback):
module 'torch' has no attribute 'fx'
Expected behavior
no error occur
System Info
env: transformers=4.35.2, torch = 1.12.1+cu113, Ubuntu 20.04.6 LTS python=3.10
when I write this sentence "from transformers import LlamaForCausalLM, LlamaTokenizer, AutoTokenizer, AutoModelForCausalLM", It tell me it cant find fx in torch. I inspect the doc of torch version and found there is fx module in this version. And when I use the console to import torch.fx, there is no fault happened. And the I add the import torch.fx before the "from transformers import LlamaForCausalLM, LlamaTokenizer, AutoTokenizer, AutoModelForCausalLM", the error misses.
Who can help?
No response
Information
Tasks
examplesfolder (such as GLUE/SQuAD, ...)Reproduction
import argparse
import json
import os
import time
import pandas as pd
import tensor_parallel as tp
import torch
from tqdm import tqdm
from transformers import LlamaForCausalLM, LlamaTokenizer, AutoTokenizer, AutoModelForCausalLM
and then the error occur
from transformers import LlamaForCausalLM, LlamaTokenizer, AutoTokenizer, AutoModelForCausalLM
File "", line 1075, in _handle_fromlist
File "/miniconda3/envs/llama-7b/lib/python3.10/site-packages/transformers/utils/import_utils.py", line 1344, in getattr
value = getattr(module, name)
File "/miniconda3/envs/llama-7b/lib/python3.10/site-packages/transformers/utils/import_utils.py", line 1343, in getattr
module = self._get_module(self._class_to_module[name])
File "/miniconda3/envs/llama-7b/lib/python3.10/site-packages/transformers/utils/import_utils.py", line 1355, in _get_module
raise RuntimeError(
RuntimeError: Failed to import transformers.models.llama.modeling_llama because of the following error (look up to see its traceback):
module 'torch' has no attribute 'fx'
Expected behavior
no error occur