-
Notifications
You must be signed in to change notification settings - Fork 771
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Code is unreachable message for reachable and running code #2476
Comments
Please provide a minimal self-contained sample in code form that exhibits the problem. It's not really possible to diagnose problems like this from screen shots of partial code. |
Hi @erictraut,
You can check the code by just running it, it prints the last print statement. |
Thanks, that's very helpful. I'm able to repro the problem, and I'll take a look. |
The issue here is that the influxdb code contains some unusual exception handling code to handle the case where |
Great, thanks a lot |
This issue has been fixed in version 2022.3.2, which we've just released. You can find the changelog here: CHANGELOG.md |
I have the same issue using the from dataclasses import dataclass, field
from fastai.collab import *
import pandas as pd
@dataclass
class DataSplits():
is_wide_format: bool = field(init=True, repr=False)
train_X: pd.DataFrame = None
val_y: pd.DataFrame = None
test_y: pd.DataFrame = None
def combine_data(train_df: pd.DataFrame, val_df: pd.DataFrame) -> Tuple[pd.DataFrame, float]:
"""Helper function to combine training and validation data in long-format. The
training and validation data will be mixed up in CF training as the sample
embeddings have to be trained for all samples. The returned frac can be used to have
the same number of (non-missing) validation samples as before.
Parameters
----------
train_df : pd.DataFrame
Consecutive training data in long-format, each row having (unit, feature, value)
val_df : pd.DataFrame
Consecutive training data in long-format, each row having (unit, feature, value)
Returns
-------
Tuple[pd.DataFrame, List[list, list]]
Pandas DataFrame of concatenated samples of training and validation data.
Fraction of samples originally in validation data.
"""
X = train_df.append(val_df).reset_index()
frac = len(val_df) / (len(train_df)+len(val_df))
return X, frac
class CollabAnalysis():
def __init__(self,
datasplits: DataSplits,
sample_column='Sample ID',
item_column='peptide',
target_column='intensity',
model_kwargs=dict(),
batch_size=64):
self.X, self.frac = combine_data(datasplits.train_X,
datasplits.val_y)
self.batch_size = batch_size
# if I comment out the next block ("self.dls") the lines after are reached.
self.dls = CollabDataLoaders.from_df(self.X, valid_pct=self.frac,
seed=42,
user_name=sample_column,
item_name=item_column,
rating_name=target_column,
bs=self.batch_size)
# not reachable
user_name=sample_column
item_name=item_column
rating_name=target_column
# here it continues, but maybe not so interesting... At runtime everything works as expected. |
@enryH, I'm unable to repro this. Can you please file a new issue? |
@debonte I cannot reproduce it either when I load the environment in a codespace. So might be due to Windows and an old python/fastai version... I'll see if I re-create the environment if the issue pertains and in that case open a new issue. |
Environment data
Expected behaviour
Using influxdb==5.3.1 (https://github.com/influxdata/influxdb-python)
When I declare an instance of class
influxdb.DataFrameClient
, Pylance declares the code below declaration as unreachable, but on running the file; the code actually works. Similar thing also happens when using jupyter Notebook in vscode.Actual behaviour
Since the code runs, it should be visible as reachable section.
The text was updated successfully, but these errors were encountered: