microsoft / Oscar

Oscar and VinVL
MIT License
1.03k stars 248 forks source link

ModuleNotFoundError: No module named 'oscar' #204

Open kssscrl opened 1 year ago

kssscrl commented 1 year ago

Sorry, I am a beginner. When I try to run run_captioning.py following the author's instruction on colab , it raised ModuleNotFoundError: No module named 'oscar'. However, there is init.py in the oscar folder, it should be treated as a module I think. Could anyone provide some advice? I am under the Oscar folder and run "python oscar/run_captioning.py \ --model_name_or_path pretrained_models/base-vg-labels/ep_67_588997 \ --do_train \ --do_lower_case \ --evaluate_during_training \ --add_od_labels \ --learning_rate 0.00003 \ --per_gpu_train_batch_size 64 \ --num_train_epochs 30 \ --save_steps 5000 \ --output_dir output/" Just like the attached screenshot shows. Thank you so much!!

捕获

yongliang-wu commented 1 year ago

I add to this script

import sys
import os

current_dir = os.path.dirname(os.path.abspath(__file__))
parent_dir = os.path.dirname(current_dir)
sys.path.append(parent_dir)

And the problem is solved