Skip to content

Pseudo-random generator prevents lineapy from capturing all relevant code #885

@VolodymyrOrlov

Description

@VolodymyrOrlov

python version:
what python version are you using?
3.8
lineapy version
what version of lineapy are you using or which commit if installed from source?
0.2.3

Your code:
What code did you try to run with lineapy?

# Cell 1
import random

my_init_value = 3
my_var = None
if random.random() <= 0.5:
    my_var = my_init_value
else:
    my_var = 1
print(my_var)
# Cell 2
lineapy.save(my_var, "my_var")
# Cell 3
print(lineapy.get("my_var").get_code())

**Issue:
What went wrong when trying to run this code?
The last cell prints code that has been captured by lineapy:

import random

if random.random() <= 0.5:
    my_var = my_init_value
else:
    my_var = 1

This code is not self sufficient. What will happen if my_init_value is a complex function or a very important hyper parameter that has a great influence on model result?

import random

my_init_value = 3
my_var = None
if random.random() <= 0.5:
    my_var = my_init_value
else:
    my_var = 1

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions