Help!settings is not Take effect
caixiongjiang opened this issue · 1 comments
I copied the parameter settings under the marker.settings file to the marker_config.py file, and the parameters under the surya.settings file to the surya_config.py file.
I changed the settings through the following code:
from marker.settings import settings as marker_Setting
from surya.settings import settings as surya_Setting
from marker.models import load_all_models
from config.config_manager import load_config #
if __name__ == '__main__':
load_config(marker_Setting, "config/marker_config.py")
load_config(surya_Setting, "config/surya_config.py")
model_lst = load_all_models()
results:
Loaded detection model vikp/surya_det3 on device mps with dtype torch.float16 # set in surya.settings file(use hf cache)
Loaded detection model ./model_hub/vikp/surya_layout3/ on device mps with dtype torch.float16 # set in marker.settings file
...
Why did the change of the load_all_models function take effect under the marker package, and the change of the setting under the surya package did not take effect? That is to say, the setting of the local model location in the marker takes effect, and the setting of the local model location in surya does not take effect.
I have sovled!
from marker.settings import settings as marker_Setting
from surya.settings import settings as surya_Setting
from config.config_manager import load_config
if __name__ == '__main__':
import transformers
transformers.utils.move_cache()
load_config(surya_Setting, "config/surya_config.py")
load_config(marker_Setting, "config/marker_config.py")
# Note that this import must be placed before load_config
from marker.models import load_all_models
model_lst = load_all_models()
The reason is that the surya package is imported in the marker package, and the settings in the surya package must be modified before loading the settings of the surya package inside the marker package.