Make Transformers use cache files when hf.co is down (#16362)
* Make Transformers use cache files when hf.co is down * Fix tests * Was there a random circleCI failure? * Isolate patches * Style * Comment out the failure since it doesn't fail anymore * Better comment
This commit is contained in:
@@ -59,10 +59,10 @@ socket.socket = offline_socket
|
||||
# next emulate no network
|
||||
cmd = [sys.executable, "-c", "\n".join([load, mock, run])]
|
||||
|
||||
# should normally fail as it will fail to lookup the model files w/o the network
|
||||
env["TRANSFORMERS_OFFLINE"] = "0"
|
||||
result = subprocess.run(cmd, env=env, check=False, capture_output=True)
|
||||
self.assertEqual(result.returncode, 1, result.stderr)
|
||||
# Doesn't fail anymore since the model is in the cache due to other tests, so commenting this.
|
||||
# env["TRANSFORMERS_OFFLINE"] = "0"
|
||||
# result = subprocess.run(cmd, env=env, check=False, capture_output=True)
|
||||
# self.assertEqual(result.returncode, 1, result.stderr)
|
||||
|
||||
# should succeed as TRANSFORMERS_OFFLINE=1 tells it to use local files
|
||||
env["TRANSFORMERS_OFFLINE"] = "1"
|
||||
|
||||
Reference in New Issue
Block a user