Is it not possible to `load` transformer model on cpu only
@maxteneff đang làm issue này rồi.
Từ ngày 17/10/2026.
Đánh giá
- Độ khó
- 3/5
- Thời gian dự kiến
- 1-2 ngày
- Mức phù hợp với người mới
- 35/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Đặc tả rõ ràng
- Mức độ hoạt động
- Đình trệ
- Lĩnh vực
- backend, machine-learning
Hướng nghiên cứu
Start in rectools/models/nn/transformers/base.py at __setstate__ around line 596, where loading fails on a CPU-only machine. Read the model serialization and loading path to see how device mapping is handled, then check the related transformer model tests. Done means a fitted model can be loaded for CPU inference when CUDA is unavailable.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
What happened?
I need to run inference of BERT4Rec on a CPU-only instance, but I can't.
When I try to load the fitted model, I get a PyTorch error.
RuntimeError: Attempting to deserialize object on a CUDA device but torch.cuda.is_available() is False. If you are running on a CPU-only machine, please use torch.load with map_location=torch.device('cpu') to map your storages to the CPU.
This occurs in __setstate__ at rectools/models/nn/transformers/base.py:596, and it’s currently impossible to pass the map_location parameter when loading the model.
Is exists some workaround there?
Expected behavior
No response
Relevant logs and/or screenshots
No response
Operating System
ubuntu
Python Version
3.11
RecTools version
0.13.0
- Ngôn ngữ chính
- Python
- Star
- 457
- Fork
- 55
- Chỉ số merge pull request
- Không có pull request nào được merge trong 30 ngày
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của MTSWebServices/RecTools
-
good first issue
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
MTSWebServices/RecTools#330 ·
-
bug good first issue
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 35/100
MTSWebServices/RecTools#269 · 4 bình luận ·
-
enhancement
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 25/100
MTSWebServices/RecTools#249 ·
-
enhancement
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 25/100
MTSWebServices/RecTools#243 ·
-
enhancement
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 25/100
MTSWebServices/RecTools#242 ·
Tất cả issue của MTSWebServices/RecTools
Issue tương tự
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 83/100
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 87/100
Maintainer thường phản hồi trong vòng 7 ngày
-
S9.7: Methodology pageĐang mởarea: web priority: P1 story
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
nfiasco/Quant-Time-Machine#151 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
autowarefoundation/autoware_carla_scenario#2019 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Broken links found in docsĐang mởdocs pydanty:is-working
Độ khó 1/5 1-3 giờ Mức phù hợp với người mới 85/100
pydantic/pydantic-ai#12892 ·
Maintainer thường phản hồi trong vòng 1 ngày