Luodian / Otter

🦦 Otter, a multi-modal model based on OpenFlamingo (open-sourced version of DeepMind's Flamingo), trained on MIMIC-IT and showcasing improved instruction-following and in-context learning ability.
https://otter-ntu.github.io/
MIT License
3.52k stars 241 forks source link

Import error with otter_ai in demo script #322

Closed Andrew-Zhang closed 7 months ago

Andrew-Zhang commented 7 months ago

Hello! I am trying to run demo otter_image.ipynb. In the first cell, I get the following error:

ModuleNotFoundError                       Traceback (most recent call last)
Cell In[2], [line 8](vscode-notebook-cell:?execution_count=2&line=8)
      [5](vscode-notebook-cell:?execution_count=2&line=5) import sys
      [7](vscode-notebook-cell:?execution_count=2&line=7) sys.path.append("../../src")
----> [8](vscode-notebook-cell:?execution_count=2&line=8) from otter_ai import OtterForConditionalGeneration
     [10](vscode-notebook-cell:?execution_count=2&line=10) model = OtterForConditionalGeneration.from_pretrained("luodian/OTTER-9B-LA-InContext", device_map="auto")
     [11](vscode-notebook-cell:?execution_count=2&line=11) tokenizer = model.text_tokenizer

File [~/miniforge3/envs/otter2/lib/python3.9/site-packages/otter_ai/__init__.py:2](https://vscode-remote+ssh-002dremote-002btinkercliffs2.vscode-resource.vscode-cdn.net/home/azhang42/models/Otter/pipeline/demos/interactive/~/miniforge3/envs/otter2/lib/python3.9/site-packages/otter_ai/__init__.py:2)
      [1](https://vscode-remote+ssh-002dremote-002btinkercliffs2.vscode-resource.vscode-cdn.net/home/azhang42/models/Otter/pipeline/demos/interactive/~/miniforge3/envs/otter2/lib/python3.9/site-packages/otter_ai/__init__.py:1) from . import models
----> [2](https://vscode-remote+ssh-002dremote-002btinkercliffs2.vscode-resource.vscode-cdn.net/home/azhang42/models/Otter/pipeline/demos/interactive/~/miniforge3/envs/otter2/lib/python3.9/site-packages/otter_ai/__init__.py:2) from .models.otter.modeling_otter import OtterForConditionalGeneration
      [3](https://vscode-remote+ssh-002dremote-002btinkercliffs2.vscode-resource.vscode-cdn.net/home/azhang42/models/Otter/pipeline/demos/interactive/~/miniforge3/envs/otter2/lib/python3.9/site-packages/otter_ai/__init__.py:3) from .models.flamingo.modeling_flamingo import FlamingoForConditionalGeneration

File [~/miniforge3/envs/otter2/lib/python3.9/site-packages/otter_ai/models/otter/modeling_otter.py:17](https://vscode-remote+ssh-002dremote-002btinkercliffs2.vscode-resource.vscode-cdn.net/home/azhang42/models/Otter/pipeline/demos/interactive/~/miniforge3/envs/otter2/lib/python3.9/site-packages/otter_ai/models/otter/modeling_otter.py:17)
     [14](https://vscode-remote+ssh-002dremote-002btinkercliffs2.vscode-resource.vscode-cdn.net/home/azhang42/models/Otter/pipeline/demos/interactive/~/miniforge3/envs/otter2/lib/python3.9/site-packages/otter_ai/models/otter/modeling_otter.py:14) from transformers.modeling_utils import PreTrainedModel
     [15](https://vscode-remote+ssh-002dremote-002btinkercliffs2.vscode-resource.vscode-cdn.net/home/azhang42/models/Otter/pipeline/demos/interactive/~/miniforge3/envs/otter2/lib/python3.9/site-packages/otter_ai/models/otter/modeling_otter.py:15) from transformers.models.auto import AutoModel, AutoModelForCausalLM, AutoTokenizer
---> [17](https://vscode-remote+ssh-002dremote-002btinkercliffs2.vscode-resource.vscode-cdn.net/home/azhang42/models/Otter/pipeline/demos/interactive/~/miniforge3/envs/otter2/lib/python3.9/site-packages/otter_ai/models/otter/modeling_otter.py:17) from pipeline.utils.modeling_value_head import AutoModelForCausalLMWithValueHead
     [19](https://vscode-remote+ssh-002dremote-002btinkercliffs2.vscode-resource.vscode-cdn.net/home/azhang42/models/Otter/pipeline/demos/interactive/~/miniforge3/envs/otter2/lib/python3.9/site-packages/otter_ai/models/otter/modeling_otter.py:19) from ..falcon.modelling_RW import RWForCausalLM
     [20](https://vscode-remote+ssh-002dremote-002btinkercliffs2.vscode-resource.vscode-cdn.net/home/azhang42/models/Otter/pipeline/demos/interactive/~/miniforge3/envs/otter2/lib/python3.9/site-packages/otter_ai/models/otter/modeling_otter.py:20) from ..mpt.modeling_mpt import MPTForCausalLM

ModuleNotFoundError: No module named 'pipeline'

Does anyone know how to fix this?

Andrew-Zhang commented 7 months ago

Nevermind. I needed to add this line to the script:

sys.path.append("/home/azhang42/models/Otter")