-
Notifications
You must be signed in to change notification settings - Fork 94
Local references fail in lambda functions #25
Copy link
Copy link
Closed
Project-MONAI/MONAI
#4377Description
Describe the bug
Local references using @ fail when used in a lambda function and executed using "$". Here are examples that I have encountered:
the python object are defined like this in the top level of json:
"data_dir": "/dataset/pathology/images/",
"patch_size": [
224,
224
]and used like this in train and validate sections:
"transform": {
"_target_": "Lambdad",
"keys": "image",
"func": "$lambda x: os.path.join(@data_dir, 'training/images', x + '.tif')"
}
"transform": {
"_target_": "Lambdad",
"keys": "label",
"func": "$lambda x: x.reshape((1, *@patch_size))"
}The error that I get is
NameError: name '__local_refs' is not defined
Environment
================================
Printing MONAI config...
================================
MONAI version: 0.5.1+933.g1cfec685
Numpy version: 1.22.3
Pytorch version: 1.12.0a0+2c916ef
MONAI flags: HAS_EXT = False, USE_COMPILED = False
MONAI rev id: 1cfec6855cbcfc3f0a80886a0a6bdd06c4662a6c
MONAI __file__: /Users/bhashemian/workspace/MONAI/monai/__init__.py
Optional dependencies:
Pytorch Ignite version: 0.4.8
Nibabel version: 3.2.2
scikit-image version: 0.19.2
Pillow version: 9.0.0
Tensorboard version: 2.8.0
gdown version: 4.4.0
TorchVision version: 0.13.0a0
tqdm version: 4.63.0
lmdb version: 1.3.0
psutil version: 5.9.0
pandas version: 1.3.5
einops version: 0.4.1
transformers version: 4.18.0
mlflow version: 1.25.1
pynrrd version: NOT INSTALLED or UNKNOWN VERSION.
For details about installing the optional dependencies, please visit:
https://docs.monai.io/en/latest/installation.html#installing-the-recommended-dependencies
================================
Printing system config...
================================
System: Linux
Linux version: Ubuntu 20.04.4 LTS
Platform: Linux-5.10.104-linuxkit-x86_64-with-glibc2.10
Processor: x86_64
Machine: x86_64
Python version: 3.8.12
Process name: python
Command: ['python', '-c', 'import monai; monai.config.print_debug_info()']
Open files: []
Num physical CPUs: 8
Num logical CPUs: 8
Num usable CPUs: 8
CPU usage (%): [11.0, 36.4, 19.2, 8.2, 7.0, 17.9, 7.3, 38.0]
CPU freq. (MHz): 2300
Load avg. in last 1, 5, 15 mins (%): [8.9, 3.5, 4.6]
Disk usage (%): 46.5
Avg. sensor temp. (Celsius): UNKNOWN for given OS
Total physical memory (GB): 7.8
Available memory (GB): 2.9
Used memory (GB): 4.4
================================
Printing GPU config...
================================
Num GPUs: 0
Has CUDA: False
cuDNN enabled: True
cuDNN version: 8303
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels