Closed VinnyT456 closed 10 months ago
@VinnyT456
Thank you for using AlphaCube library.
The runtime error you're encountering is most likely due to an incomplete/interrupted download of the model file saved to ~/.cache/alphacube/small.zip
. I found several similar cases by googling with the final error message.
To resolve this, you need to delete the corrupted file and re-run the code. You will get a fresh copy, hopefully without interruption this time, allowing for proper functioning of the library.
Thank you so much it works now!
Also another question, how would I input the scramble if the format is stickers instead of moves.
Set the scramble
argument as the array representation of the stickers, with a flag format="stickers"
. You may learn the sticker arrangement at https://alphacube.dev/docs/api-reference/alphacube/env/index.html.
For example,
import numpy as np
# State after applying [U' R B U2 B' U' F U' B U F']
state = np.array([2, 0, 3, 5, 0, 0, 5, 0, 4, 2, 1, 1, 2, 1, 1, 2, 4, 4, 5, 5, 1, 2,
2, 3, 2, 2, 0, 3, 3, 0, 3, 3, 2, 1, 1, 0, 4, 4, 3, 4, 4, 4, 0, 0,
5, 5, 5, 4, 5, 5, 3, 1, 1, 3])
result = alphacube.solve(
scramble=state,
format="stickers",
beam_width=1024,
)
So when I try to run the following code
the output would give me these errors
Traceback (most recent call last): File "/Users/vincent/Rubik Cube Solver/main.py", line 4, in <module> alphacube.load(model_id="small") # the default model ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/alphacube/__init__.py", line 58, in load _solver.load(*args, **kwargs) File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/alphacube/solver.py", line 55, in load self.model = load_model(*args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/alphacube/model.py", line 55, in load_model state_dict = torch.load(model_path, map_location=torch.device("cpu")) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/torch/serialization.py", line 993, in load with _open_zipfile_reader(opened_file) as opened_zipfile: ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/torch/serialization.py", line 447, in __init__ super().__init__(torch._C.PyTorchFileReader(name_or_buffer)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ RuntimeError: PytorchStreamReader failed reading zip archive: failed finding central directory
I did pip install alphacube already