@@ -1161,14 +1161,18 @@ def fit(
11611161
11621162 >>> import cebra
11631163 >>> import numpy as np
1164+ >>> import tempfile
1165+ >>> from pathlib import Path
1166+ >>> tmp_file = Path(tempfile.gettempdir(), 'cebra.pt')
11641167 >>> dataset = np.random.uniform(0, 1, (1000, 20))
11651168 >>> dataset2 = np.random.uniform(0, 1, (1000, 40))
11661169 >>> cebra_model = cebra.CEBRA(max_iterations=10)
11671170 >>> cebra_model.fit(dataset)
11681171 CEBRA(max_iterations=10)
1169- >>> cebra_model.save('/tmp/foo.pt' )
1172+ >>> cebra_model.save(tmp_file )
11701173 >>> cebra_model.fit(dataset2, adapt=True)
11711174 CEBRA(max_iterations=10)
1175+ >>> tmp_file.unlink()
11721176 """
11731177 if adapt and sklearn_utils .check_fitted (self ):
11741178 self ._adapt_fit (X ,
@@ -1332,11 +1336,15 @@ def save(self,
13321336
13331337 >>> import cebra
13341338 >>> import numpy as np
1339+ >>> import tempfile
1340+ >>> from pathlib import Path
1341+ >>> tmp_file = Path(tempfile.gettempdir(), 'test.jl')
13351342 >>> dataset = np.random.uniform(0, 1, (1000, 30))
13361343 >>> cebra_model = cebra.CEBRA(max_iterations=10)
13371344 >>> cebra_model.fit(dataset)
13381345 CEBRA(max_iterations=10)
1339- >>> cebra_model.save('/tmp/foo.pt')
1346+ >>> cebra_model.save(tmp_file)
1347+ >>> tmp_file.unlink()
13401348
13411349 """
13421350 if sklearn_utils .check_fitted (self ):
@@ -1394,10 +1402,18 @@ def load(cls,
13941402 Example:
13951403
13961404 >>> import cebra
1397- >>> import numpy as np
1405+ >>> import numpy as np
1406+ >>> import tempfile
1407+ >>> from pathlib import Path
1408+ >>> tmp_file = Path(tempfile.gettempdir(), 'cebra.pt')
13981409 >>> dataset = np.random.uniform(0, 1, (1000, 20))
1399- >>> loaded_model = cebra.CEBRA.load('/tmp/foo.pt')
1410+ >>> cebra_model = cebra.CEBRA(max_iterations=10)
1411+ >>> cebra_model.fit(dataset)
1412+ CEBRA(max_iterations=10)
1413+ >>> cebra_model.save(tmp_file)
1414+ >>> loaded_model = cebra.CEBRA.load(tmp_file)
14001415 >>> embedding = loaded_model.transform(dataset)
1416+ >>> tmp_file.unlink()
14011417
14021418 """
14031419
0 commit comments