Skip to content

UnsupportedOperation: fileno error what could be the issue mam? #2

@kalamochi933

Description

@kalamochi933

from tqdm import tqdm
from torch import torch
from vit import vit
from spacy import spacy
from vit.formatter_base import FormatterBase
from vit import util
from going_modular.going_modular import engine

Setup the optimizer to optimize our ViT model parameters using hyperparameters from the ViT paper

optimizer = torch.optim.Adam(params=vit.parameters(),
lr=3e-3, # Base LR from Table 3 for ViT-* ImageNet-1k
betas=(0.9, 0.999), # default values but also mentioned in ViT paper section 4.1 (Training & Fine-tuning)
weight_decay=0.3) # from the ViT paper section 4.1 (Training & Fine-tuning) and Table 3 for ViT-* ImageNet-1k

Setup the loss function for multi-class classification

loss_fn = torch.nn.CrossEntropyLoss()

Set the seeds

set_seeds()

Train the model and save the training results to a dictionary

results = engine.train(model=vit,
train_dataloader=train_dataloader,
test_dataloader=test_dataloader,
optimizer=optimizer,
loss_fn=loss_fn,
epochs=10,
device=device)

OUTPUT___________________________________________________________________________________________________

UnsupportedOperation Traceback (most recent call last)
Cell In[1], line 3
1 from tqdm import tqdm
2 from torch import torch
----> 3 from vit import vit
4 from spacy import spacy
5 from vit.formatter_base import FormatterBase

File ~\AppData\Local\Programs\Python\Python39\lib\site-packages\vit_init_.py:2
1 from .option_parser import parse_options
----> 2 from .application import Application
4 from .formatter import (
5 Formatter,
6 DateTime,
(...)
11 String
12 )

File ~\AppData\Local\Programs\Python\Python39\lib\site-packages\vit\application.py:20
18 from vit import version
19 from vit.exception import VitException
---> 20 from vit.formatter_base import FormatterBase
21 from vit import event
22 from vit.loader import Loader

File ~\AppData\Local\Programs\Python\Python39\lib\site-packages\vit\formatter_base.py:8
5 except ImportError:
6 from backports.zoneinfo import ZoneInfo
----> 8 from vit import util
9 from vit import uda
10 from vit.util import unicode_len

File ~\AppData\Local\Programs\Python\Python39\lib\site-packages\vit\util.py:8
4 import shlex
6 from urwid.util import calc_width
----> 8 curses.setupterm()
9 e3_seq = curses.tigetstr('E3') or b''
10 clear_screen_seq = curses.tigetstr('clear') or b''

File ~\AppData\Local\Programs\Python\Python39\lib\site-packages\ipykernel\iostream.py:372, in OutStream.fileno(self)
370 else:
371 msg = "fileno"
--> 372 raise io.UnsupportedOperation(msg)

UnsupportedOperation: fileno

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions