Skip to content

Update the requirement list for text_classification example #2100

Open
@agunapal

Description

@agunapal

🐛 Describe the bug

This example depends on torchdata.

https://github.com/pytorch/serve/tree/master/examples/text_classification

The run__script fails without torchdata installation

Error logs

Traceback (most recent call last):
File "/home/ubuntu/serve/examples/text_classification/train.py", line 120, in
train_iter = DATASETS[args.dataset](root='.data', split='train')
File "/home/ubuntu/anaconda3/envs/serve/lib/python3.9/site-packages/torchtext/data/datasets_utils.py", line 193, in wrapper
return fn(root=new_root, *args, **kwargs)
File "/home/ubuntu/anaconda3/envs/serve/lib/python3.9/site-packages/torchtext/data/datasets_utils.py", line 155, in new_fn
result.append(fn(root, item, **kwargs))
File "/home/ubuntu/anaconda3/envs/serve/lib/python3.9/site-packages/torchtext/datasets/ag_news.py", line 67, in AG_NEWS
raise ModuleNotFoundError(
ModuleNotFoundError: Package torchdata not found. Please install following instructions at https://github.com/pytorch/data
Traceback (most recent call last):
File "/home/ubuntu/serve/examples/text_classification/run_script.py", line 7, in
subprocess.run(cmd, shell=True,check=True)
File "/home/ubuntu/anaconda3/envs/serve/lib/python3.9/subprocess.py", line 528, in run
raise CalledProcessError(retcode, process.args,
subprocess.CalledProcessError: Command 'python train.py AG_NEWS --device cpu --save-model-path model.pt --dictionary source_vocab.pt' returned non-zero exit status 1.

Installation instructions

pip install

Model Packaing

NA

config.properties

No response

Versions


Environment headers

Torchserve branch:

torchserve==0.7.0
torch-model-archiver==0.7.0

Python version: 3.9 (64-bit runtime)
Python executable: /home/ubuntu/anaconda3/envs/serve/bin/python

Versions of relevant python libraries:
captum==0.6.0
numpy==1.24.1
nvgpu==0.9.0
psutil==5.9.4
requests==2.28.2
torch==1.13.1+cpu
torch-model-archiver==0.7.0
torch-workflow-archiver==0.2.6
torchaudio==0.13.1+cpu
torchdata==0.5.1
torchserve==0.7.0
torchtext==0.14.1
torchvision==0.14.1+cpu
wheel==0.38.4
torch==1.13.1+cpu
torchtext==0.14.1
torchvision==0.14.1+cpu
torchaudio==0.13.1+cpu

Java Version:

OS: Ubuntu 20.04.5 LTS
GCC version: (Ubuntu 9.4.0-1ubuntu1~20.04.1) 9.4.0
Clang version: N/A
CMake version: N/A

Repro instructions

python run_script.py in https://github.com/pytorch/serve/tree/master/examples/text_classification

Possible Solution

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingexampletriagedIssue has been reviewed and triaged

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions