Comments (7)
Yes, that's something I thought of. This might be a good replacement for flash packages, but in lightning we sometimes also have in-code dependencies on these variables, meaning that I would define them again no-matter if we replaced them globally.
I don't know yet, if that's the case for flash as well (it could be for example if the supported models depend on that). So in general I like the idea, in lightning it won't make sense to use this and in flash it depends on the condition I just mentioned :)
from lightning-flash.
not sure if that really helps, since otherwise we may have to mock them with None in some cases.
from lightning-flash.
@justusschock Thank you for your feedback. Do you mean like this in pytorch_lightning/loggers/wandb
?
except ImportError:
wandb, Run = None, None
It will still be possible in that case, too, by:
if not cm.is_successful():
wandb, Run = None, None
from lightning-flash.
I like it. We could call it OptionalImport
.
Some questions:
- Can you do more than one import inside the context manager? What if they all fail?
- How do you plan to pass the
install it with 'pip install lightning-flash[image]'
message?
from lightning-flash.
Hi @akihironitta, do you want to give it a try?
from lightning-flash.
Sorry for the delay, I missed your message.
Can you do more than one import inside the context manager? What if they all fail?
Yes, but in case of multiple packages like the below case, if import kornia
fails, import transformers
will be skipped, so we need to split the import statements per individual package:
with try_import() as _import:
import kornia # if kornia not found
import transformers # this line will be skipped
# so, it needs to be divided
with try_import() as _import_kornia:
import kornia
with try_import() as _import_transformers:
import transformers
How do you plan to pass the
install it with 'pip install lightning-flash[image]'
message?
Currently, I came up with nothing except for hard-coding in flash/utils/imports.py
as below. I thought of parsing requirements/*.txt
, but packages can have different names than their pypi names. e.g. PIL
for Pillow
.
_extras = {
"image": ["torchvision", "PIL", "kornia", ...],
...
}
I was thinking about this issue again, and I'm now not sure if my suggestion is reasonable enough because my suggestion itself cannot handle version checks...
from lightning-flash.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
from lightning-flash.
Related Issues (20)
- Instance Segmentation Example Broken HOT 3
- Issue with `ImageClassificationData.from_dataset` HOT 1
- Remove or replace the active learning loop example
- `SemanticSegmentationData` - zero-size array to reduction operation maximum which has no identity HOT 1
- Support for files stored on Google drives.
- Support generation kwargs within Seq2SeqTasks
- Error when importing flash.video in v0.8.1 HOT 2
- `ObjectDetectionData.from_coco`: `transform_kwargs` and `image_size error` HOT 2
- Getting error while using backbones and head code HOT 1
- Object detection example broken HOT 6
- `ObjectDetectionData.from_images` raise an error
- ImportError: cannot import name 'Labels' from 'flash.core.classification' HOT 1
- ModuleNotFoundError with lightning-flash[image] and ImageEmbedder HOT 8
- apply_func has been moved, need to update import HOT 5
- Protobuf requirements too strict HOT 5
- `ImageClassificationDataFrameInput` object has no attribute `target_formatter` HOT 1
- Flash Trainer not working - No module named 'pytorch_lightning.utilities.apply_func' HOT 1
- `download_data` from `flash.core.data.utils` connects to the internet before checking if a file exists HOT 1
- No module named 'pytorch_lightning.utilities.apply_func' HOT 4
- SemanticSegmentation has no available heads or backbones in FlashRegistry
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from lightning-flash.