1# Copyright (c) Meta Platforms, Inc. and affiliates. 2# All rights reserved. 3# 4# This source code is licensed under the BSD-style license found in the 5# LICENSE file in the root directory of this source tree. 6 7""" 8This removes the imported [examples] module from pip installing lm_eval due to 9colliding module name with ET package 10""" 11 12try: 13 # If the import fails, this means there's nothing to remove 14 import examples 15 16 try: 17 # If the import succeeds, this means it isn't using lm_eval's module 18 import examples.models 19 except: 20 print( 21 "Failed to import examples.models due to lm_eval conflict. Removing lm_eval examples module" 22 ) 23 import shutil 24 25 examples_path = examples.__path__[0] 26 shutil.rmtree(examples_path) 27 28except: 29 pass 30