Comments (3)
@mrcmoresi can you pls use 23.08
version of the repos? you can use our docker image which is recommended.. nvcr.io/nvidia/merlin/merlin-pytorch:23.08
you can then rerun the example. if you still have any issue you can share here.
from transformers4rec.
Hi @rnyak thanks for your answer. I installed Transformers4Rec and NVtabular 23.08 and now I'm getting a different error
when I'm trying to run the following cell
start_time_window_index = start_window_index
final_time_window_index = final_window_index
#Iterating over days of one week
for time_index in range(start_time_window_index, final_time_window_index):
# Set data
time_index_train = time_index
time_index_eval = time_index + 1
train_paths = glob.glob(os.path.join(OUTPUT_DIR, f"{time_index_train}/train.parquet"))
eval_paths = glob.glob(os.path.join(OUTPUT_DIR, f"{time_index_eval}/valid.parquet"))
print(train_paths)
# Train on day related to time_index
print('*'*20)
print("Launch training for day %s are:" %time_index)
print('*'*20 + '\n')
trainer.train_dataset_or_path = train_paths
trainer.reset_lr_scheduler()
trainer.train()
trainer.state.global_step +=1
print('finished')
# Evaluate on the following day
trainer.eval_dataset_or_path = eval_paths
train_metrics = trainer.evaluate(metric_key_prefix='eval')
print('*'*20)
print("Eval results for day %s are:\t" %time_index_eval)
print('\n' + '*'*20 + '\n')
for key in sorted(train_metrics.keys()):
print(" %s = %s" % (key, str(train_metrics[key])))
wipe_memory()
I'm getting the following error
--------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
File /anaconda/envs/t4rec/lib/python3.10/site-packages/transformers4rec/torch/trainer.py:398, in Trainer._use_cuda_amp(self)
397 try:
--> 398 return self.use_cuda_amp
399 except AttributeError:
AttributeError: 'Trainer' object has no attribute 'use_cuda_amp'
During handling of the above exception, another exception occurred:
AttributeError Traceback (most recent call last)
Cell In[14], line 24
22 # Evaluate on the following day
23 trainer.eval_dataset_or_path = eval_paths
---> 24 train_metrics = trainer.evaluate(metric_key_prefix='eval')
25 print('*'*20)
26 print(\"Eval results for day %s are:\\t\" %time_index_eval)
File /anaconda/envs/t4rec/lib/python3.10/site-packages/transformers/trainer.py:3085, in Trainer.evaluate(self, eval_dataset, ignore_keys, metric_key_prefix)
3082 start_time = time.time()
3084 eval_loop = self.prediction_loop if self.args.use_legacy_prediction_loop else self.evaluation_loop
-> 3085 output = eval_loop(
3086 eval_dataloader,
3087 description=\"Evaluation\",
3088 # No point gathering the predictions if there are no metrics, otherwise we defer to
3089 # self.args.prediction_loss_only
3090 prediction_loss_only=True if self.compute_metrics is None else None,
3091 ignore_keys=ignore_keys,
3092 metric_key_prefix=metric_key_prefix,
3093 )
3095 total_batch_size = self.args.eval_batch_size * self.args.world_size
3096 if f\"{metric_key_prefix}_jit_compilation_time\" in output.metrics:
File /anaconda/envs/t4rec/lib/python3.10/site-packages/transformers4rec/torch/trainer.py:502, in Trainer.evaluation_loop(self, dataloader, description, prediction_loss_only, ignore_keys, metric_key_prefix)
495 if (
496 metric_key_prefix == \"train\"
497 and self.args.eval_steps_on_train_set > 0
498 and step + 1 > self.args.eval_steps_on_train_set
499 ):
500 break
--> 502 loss, preds, labels, outputs = self.prediction_step(
503 model,
504 inputs,
505 prediction_loss_only,
506 ignore_keys=ignore_keys,
507 testing=testing,
508 )
510 # Updates metrics
511 # TODO: compute metrics each N eval_steps to speedup evaluation
512 metrics_results_detailed = None
File /anaconda/envs/t4rec/lib/python3.10/site-packages/transformers4rec/torch/trainer.py:363, in Trainer.prediction_step(self, model, inputs, prediction_loss_only, ignore_keys, training, testing)
361 inputs, targets = inputs
362 with torch.no_grad():
--> 363 if self._use_cuda_amp:
364 with autocast():
365 outputs = model(inputs, targets=targets, training=training, testing=testing)
File /anaconda/envs/t4rec/lib/python3.10/site-packages/transformers4rec/torch/trainer.py:400, in Trainer._use_cuda_amp(self)
398 return self.use_cuda_amp
399 except AttributeError:
--> 400 return self.use_amp
AttributeError: 'Trainer' object has no attribute 'use_amp'"
from transformers4rec.
this might be related to Transformers version. Please check all the requirements and install the libs accordingly.
from transformers4rec.
Related Issues (20)
- [BUG] conda env import error cudf HOT 2
- [FEA] Feature to extract attention values from transformer heads
- [BUG] Incorrect scores for evaluation
- [FEA] Multi-task prediction support with Next-Item-Prediction HOT 1
- How to use Transformers4Rec with pandas HOT 2
- [QST] ValueError: For masking a categorical_module is required including an item_id.
- [QST] Projecting inputs of NextItemPredictionTask to'64' As weight tying requires the input dimension '320' to be equal to the item-id embedding dimension '64' HOT 4
- [QST] Cross-entropy and pairwise losses are supported in Next Item Prediction
- [QST] How to print metrics while training?
- RuntimeError: CUDF failure at: /__w/cudf/cudf/cpp/src/io/parquet/reader_impl_helpers.cpp:379: Invalid rowgroup index[BUG] HOT 10
- Génerating predictions HOT 5
- [BUG] Inconsistent inference and evaluation results of the XLNET-CLM even on the training set! HOT 2
- [BUG] CausalLanguageModeling masking error on last item only condition HOT 1
- [QST] Help with creating two tower model with transformers. HOT 1
- [FEA] Post context fusion using T4rec api HOT 1
- [BUG] CausalLanguageModeling do not mask last input item HOT 3
- [QST] Extracting User Representation Vectors from Pre-trained Next Item Prediction Model
- Model is not generating accurate recommandations [QST]
- [BUG] RuntimeError: PyTorch execute failure: Expected Tensor but got GenericList
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 transformers4rec.