`Trainer.fit` stopped: `max_steps=1` reached - pytorch

My Pytorch model training stops after some minutes and it says that max_steps=1 reached. Even though I have configured this parameter to 100. Here is how it looks in my terminal:
C:\Users\r.charij\AppData\Local\Programs\Python\Python37\lib\site-packages\pytorch_lightning\utilities\warnings.py:54: LightningDeprecationWarning: pytorch_lightning.utilities.warnings.rank_zero_deprecation has been deprecated in v1.6 and will be removed in v1.8. Use the equivalent function from the pytorch_lightning.utilities.rank_zero module instead.
"pytorch_lightning.utilities.warnings.rank_zero_deprecation has been deprecated in v1.6"
C:\Users\r.charij\AppData\Local\Programs\Python\Python37\lib\site-packages\pytorch_lightning\utilities\warnings.py:58: LightningDeprecationWarning: The `pytorch_lightning.loggers.base.rank_zero_experiment` is deprecated in v1.7 and will be removed in v1.9. Please use `pytorch_lightning.loggers.logger.rank_zero_experiment` instead.
return new_rank_zero_deprecation(*args, **kwargs)
C:\Users\r.charij\AppData\Local\Programs\Python\Python37\lib\site-packages\pytorch_lightning\utilities\warnings.py:54: LightningDeprecationWarning: pytorch_lightning.utilities.warnings.rank_zero_deprecation has been deprecated in v1.6 and will be removed in v1.8. Use the equivalent function from the pytorch_lightning.utilities.rank_zero module instead.
"pytorch_lightning.utilities.warnings.rank_zero_deprecation has been deprecated in v1.6"
C:\Users\r.charij\AppData\Local\Programs\Python\Python37\lib\site-packages\pytorch_lightning\utilities\warnings.py:58: LightningDeprecationWarning: The `pytorch_lightning.loggers.base.rank_zero_experiment` is deprecated in v1.7 and will be removed in v1.9. Please use `pytorch_lightning.loggers.logger.rank_zero_experiment` instead.
return new_rank_zero_deprecation(*args, **kwargs)
C:\Users\r.charij\AppData\Local\Programs\Python\Python37\lib\site-packages\pytorch_lightning\utilities\warnings.py:54: LightningDeprecationWarning: pytorch_lightning.utilities.warnings.rank_zero_deprecation has been deprecated in v1.6 and will be removed in v1.8. Use the equivalent function from the pytorch_lightning.utilities.rank_zero module instead.
"pytorch_lightning.utilities.warnings.rank_zero_deprecation has been deprecated in v1.6"
C:\Users\r.charij\AppData\Local\Programs\Python\Python37\lib\site-packages\pytorch_lightning\utilities\warnings.py:58: LightningDeprecationWarning: The `pytorch_lightning.loggers.base.rank_zero_experiment` is deprecated in v1.7 and will be removed in v1.9. Please use `pytorch_lightning.loggers.logger.rank_zero_experiment` instead.
return new_rank_zero_deprecation(*args, **kwargs)
C:\Users\r.charij\AppData\Local\Programs\Python\Python37\lib\site-packages\pytorch_lightning\utilities\warnings.py:54: LightningDeprecationWarning: pytorch_lightning.utilities.warnings.rank_zero_deprecation has been deprecated in v1.6 and will be removed in v1.8. Use the equivalent function from the pytorch_lightning.utilities.rank_zero module instead.
"pytorch_lightning.utilities.warnings.rank_zero_deprecation has been deprecated in v1.6"
C:\Users\r.charij\AppData\Local\Programs\Python\Python37\lib\site-packages\pytorch_lightning\utilities\warnings.py:58: LightningDeprecationWarning: The `pytorch_lightning.loggers.base.rank_zero_experiment` is deprecated in v1.7 and will be removed in v1.9. Please use `pytorch_lightning.loggers.logger.rank_zero_experiment` instead.
return new_rank_zero_deprecation(*args, **kwargs)
C:\Users\r.charij\AppData\Local\Programs\Python\Python37\lib\site-packages\pytorch_lightning\utilities\warnings.py:54: LightningDeprecationWarning: pytorch_lightning.utilities.warnings.rank_zero_deprecation has been deprecated in v1.6 and will be removed in v1.8. Use the equivalent function from the pytorch_lightning.utilities.rank_zero module instead.
"pytorch_lightning.utilities.warnings.rank_zero_deprecation has been deprecated in v1.6"
C:\Users\r.charij\AppData\Local\Programs\Python\Python37\lib\site-packages\pytorch_lightning\utilities\warnings.py:58: LightningDeprecationWarning: The `pytorch_lightning.loggers.base.rank_zero_experiment` is deprecated in v1.7 and will be removed in v1.9. Please use `pytorch_lightning.loggers.logger.rank_zero_experiment` instead.
return new_rank_zero_deprecation(*args, **kwargs)
C:\Users\r.charij\AppData\Local\Programs\Python\Python37\lib\site-packages\pytorch_lightning\utilities\warnings.py:54: LightningDeprecationWarning: pytorch_lightning.utilities.warnings.rank_zero_deprecation has been deprecated in v1.6 and will be removed in v1.8. Use the equivalent function from the pytorch_lightning.utilities.rank_zero module instead.
"pytorch_lightning.utilities.warnings.rank_zero_deprecation has been deprecated in v1.6"
C:\Users\r.charij\AppData\Local\Programs\Python\Python37\lib\site-packages\pytorch_lightning\utilities\warnings.py:58: LightningDeprecationWarning: The `pytorch_lightning.loggers.base.rank_zero_experiment` is deprecated in v1.7 and will be removed in v1.9. Please use `pytorch_lightning.loggers.logger.rank_zero_experiment` instead.
return new_rank_zero_deprecation(*args, **kwargs)
Epoch 0: 100%|█████████| 2/2 [01:02<00:00, 31.11s/it, loss=0.123, v_num=, train/loss_step=0.123, train/angle_error_step=10.80, train/lr=0.100, val/loss=3.300, val/angle_error=88.00, train/loss_epoch=0.123, train/angle_error_epoch=10.80]`Trainer.fit` stopped: `max_steps=1` reached.
Epoch 0: 100%|█████████| 2/2 [01:02<00:00, 31.11s/it, loss=0.123, v_num=, train/loss_step=0.123, train/angle_error_step=10.80, train/lr=0.100, val/loss=3.300, val/angle_error=88.00, train/loss_epoch=0.123, train/angle_error_epoch=10.80]
Can anyone help?

Related

asyncio-nats-client-0.11.5 is this compatible with python 3.10.8?

Seeing the following traceback, while doing natsclient.connect with python 3.10.8.
File "/opt/optima/pce_dispatcher/pce_dispatcher.py", line 4213, in run
await self.nc.connect(
File "/usr/lib/python3.10/site-packages/nats/aio/client.py", line 310, in connect
self._flush_queue = asyncio.Queue(
File "/usr/lib/python3.10/asyncio/queues.py", line 34, in __init__
super().__init__(loop=loop)
File "/usr/lib/python3.10/asyncio/mixins.py", line 17, in __init__
raise TypeError(
TypeError: As of 3.10, the *loop* parameter was removed from Queue() since it is no longer necessary
Any suggestions on how to resolve this? Using Alpine 3.16 which is packaged with 3.10.8.
Appears like asyncio-nats-client-0.11.5 that got published back in Nov 2021.
No idea on how to resolve this unless there is a new version published for 3.10.8 as asyncio have taken some changes related to passing event loop parameter.
It has already been fixed in the GitHub repo:
Passing explicit loops to many asyncio apis is deprecated, and
it is discouraged in general. [...]
...but they seem to have changed the name of the PyPI package. Try pip install nats-py for the new version.

AttributeError: module 'dill._dill' has no attribute 'stack'

Use this colab
https://colab.research.google.com/drive/12LjJazBl7Gam0XBPy_y0CTOJZeZ34c2v?usp=sharing
my CUDA Version: 11.2
when do this
train_dataset = train_dataset.map(
process_data_to_model_inputs,
batched=True,
batch_size=batch_size,
remove_columns=["article", "abstract", "section_names"],
)
AttributeError: module 'dill._dill' has no attribute 'stack'
I have try this
pip install dill==0.3.4
but not work
How to solve this problems, Thinks!
I'm the dill author. dill._dill.stack is not part of the public interface, and can't be guaranteed to be there. It was removed in 0.3.5 (and above). It is available in 0.3.4. If you have already installed 0.3.5.1 or something larger than 0.3.4, you will need to pip uninstall or force-reinstall the specific package version.
See: Installing specific package version with pip

AttributeError: module 'tensorflow._api.v2.train' has no attribute 'string_input_producer'

I tried to run the https://github.com/4Catalyzer/cyclegan.git
I have error like
AttributeError: module 'tensorflow._api.v2.train' has no attribute 'string_input_producer'
I use python 3.8.5 and tensorflow 2.4.1
tf.compat.v1.train.string_input_producer is deprecated in. It will be removed in a future version. Instructions for updating: Queue-based input pipelines have been replaced by tf.data.
Use tf.data.Dataset.from_tensor_slices(string_tensor).
shuffle(tf.shape(input_tensor, out_type=tf.int64)[0]).repeat(num_epochs). If shuffle=False, omit the .shuffle(...)

Gensim v3.6.0 Word2Vec DeprecationWarning: Call to deprecated `wv` (Attribute will be removed in 4.0.0, use self instead)

I was using Gensim 3.6.0 for loading a pre-trained Word2Vec and it showed the following error while calling model.wv.
/anaconda/envs/python36/lib/python3.6/site-packages/ipykernel_launcher.py:1: DeprecationWarning: Call to deprecated `wv` (Attribute will be removed in 4.0.0, use self instead).
"""Entry point for launching an IPython kernel.
Here is my code sample
import gensim
model = gensim.models.KeyedVectors.load_word2vec_format('/path/to/file/my-vec-300d-v2', binary=False)
print(model.wv['hello'].shape)
print(model.wv['hello'])
The error message actually tells us using the object itself i.e. model rather than model.wv.
print(model['hello'].shape) # instead of model.wv['hello'].shape which is deprecated
print(model['hello']) # instead of model.wv['hello'] which is deprecated

TensorFlow Estimator save in web format (tfjs)

I have a linar estimator in TF 2.2 and currently save it in following way
linear_est = tf.estimator.LinearClassifier(feature_columns=feature_columns)
...
serving_input_fn = tf.estimator.export.build_parsing_serving_input_receiver_fn(
tf.feature_column.make_parse_example_spec(feature_columns))
export_path = linear_est.export_saved_model(
"./model/", serving_input_fn)
With this I get a .pb file and a variables folder, but I need to run the prediction in tfjs, because python tf 2.2 is too big for AWS Lambda.
Is there a possiblity to save it directly from python to web format?
I already tried to convert it with this tutorial
https://www.tensorflow.org/js/tutorials/conversion/import_saved_model
but it is not working. I'm also not sure what is --output_node_names
I created the model with Python 3.8 and now I'm using 3.6.8 in the venv for the converter, because converter is not running with 3.8
(venv) PS C:\predict\web> tensorflowjs_converter --input_format=tf_saved_model --saved_model_tags=serve sold/model/1588619275 sold_web
2020-05-06 22:17:35.434178: I tensorflow/core/platform/cpu_feature_guard.cc:142] Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX2
WARNING:tensorflow:From c:\predict\web\venv\lib\site-packages\tensorflow_core\python\ops\resource_variable_ops.py:1786: calling BaseResourceVariable.__init__ (from tensorflow.python.ops.resource_variable_ops) with constraint is deprecated and will be removed in a future version.
Instructions for updating:
If using Keras pass *_constraint arguments to layers.
WARNING:tensorflow:Issue encountered when serializing global_step.
Type is unsupported, or the types of the items don't match field type in CollectionDef. Note this is a warning and probably safe to ignore.
to_proto not supported in EAGER mode.
WARNING:tensorflow:Issue encountered when serializing variables.
Type is unsupported, or the types of the items don't match field type in CollectionDef. Note this is a warning and probably safe to ignore.
to_proto not supported in EAGER mode.
WARNING:tensorflow:Issue encountered when serializing trainable_variables.
Type is unsupported, or the types of the items don't match field type in CollectionDef. Note this is a warning and probably safe to ignore.
to_proto not supported in EAGER mode.
2020-05-06 22:17:36.264215: I tensorflow/core/grappler/devices.cc:60] Number of eligible GPUs (core count >= 8, compute capability >= 0.0): 0 (Note: TensorFlow was not compiled with CUDA support)
2020-05-06 22:17:36.283583: I tensorflow/core/grappler/clusters/single_machine.cc:356] Starting new session
2020-05-06 22:17:36.296771: E tensorflow/core/grappler/grappler_item_builder.cc:656] Init node linear/linear_model/linear/linear_model/linear/linear_model/category_id/category_id_lookup/hash_table/table_init/LookupTableImportV2 doesn't exist in graph
WARNING:tensorflow:From c:\predict\web\venv\lib\site-packages\tensorflowjs\converters\tf_saved_model_conversion_v2.py:313: load (from tensorflow.python.saved_model.loader_impl) is deprecated and will be removed in a future version.
Instructions for updating:
This function will only be available through the v1 compatibility library as tf.compat.v1.saved_model.loader.load or tf.compat.v1.saved_model.load. There will be a new function for importing SavedModels in Tensorflow 2.0.
WARNING:tensorflow:From c:\predict\web\venv\lib\site-packages\tensorflowjs\converters\tf_saved_model_conversion_v2.py:315: convert_variables_to_constants (from tensorflow.python.framework.graph_util_impl) is deprecated and will be removed in a future version.
Instructions for updating:
Use `tf.compat.v1.graph_util.convert_variables_to_constants`
WARNING:tensorflow:From c:\predict\web\venv\lib\site-packages\tensorflow_core\python\framework\graph_util_impl.py:277: extract_sub_graph (from tensorflow.python.framework.graph_util_impl) is deprecated and will be removed in a future version.
Instructions for updating:
Use `tf.compat.v1.graph_util.extract_sub_graph`
Traceback (most recent call last):
File "c:\users\nibur\appdata\local\programs\python\python36\lib\runpy.py", line 193, in _run_module_as_main
"__main__", mod_spec)
File "c:\users\nibur\appdata\local\programs\python\python36\lib\runpy.py", line 85, in _run_code
exec(code, run_globals)
File "C:\predict\web\venv\Scripts\tensorflowjs_converter.exe\__main__.py", line 7, in <module>
File "c:\predict\web\venv\lib\site-packages\tensorflowjs\converters\converter.py", line 671, in pip_main
main([' '.join(sys.argv[1:])])
File "c:\predict\web\venv\lib\site-packages\tensorflowjs\converters\converter.py", line 675, in main
convert(argv[0].split(' '))
File "c:\predict\web\venv\lib\site-packages\tensorflowjs\converters\converter.py", line 618, in convert
weight_shard_size_bytes=weight_shard_size_bytes)
File "c:\predict\web\venv\lib\site-packages\tensorflowjs\converters\tf_saved_model_conversion_v2.py", line 462, in convert_tf_saved_model
weight_shard_size_bytes=weight_shard_size_bytes)
File "c:\predict\web\venv\lib\site-packages\tensorflowjs\converters\tf_saved_model_conversion_v2.py", line 142, in optimize_graph
', '.join(unsupported))
ValueError: Unsupported Ops in the model before optimization
SparseFillEmptyRows, Unique, LookupTableFindV2, ParseExampleV2, HashTableV2, SparseSegmentSum, AsString, SparseReshape
Thanks
So it seems you are using ops that are not supported in the browser implementation of TensorFlow.js (this does not apply to Node.js which can execute savedModels without conversion).
TensorFlow.js supports a few hundred or so ops from the original TensorFlow implementation for the browser based implementation, so the only way for this to run in the browser right now is to:
Implement the ops in JS - contribute to the open source code on
Github for the ops that are missing.
Change the ops you are using to use supported ops.
You can see the supported ops here: https://github.com/tensorflow/tfjs-converter/blob/master/tfjs-converter/docs/supported_ops.md

Categories

Resources