Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Colab, Github, starts
#1
Hi, I am very new to Python. When I try to run the below code in Colab, got the below error message. How to start with? Anybody?

! git clone https://github.com/llSourcell/Q-Learning...rading.git

Cloning into 'Q-Learning-for-Trading'...
remote: Enumerating objects: 25, done.
remote: Total 25 (delta 0), reused 0 (delta 0), pack-reused 25
Unpacking objects: 100% (25/25), done.

run.py

NameError Traceback (most recent call last)
<ipython-input-2-75e852f83f6c> in <module>()
----> 1 run.py

NameError: name 'run' is not defined
Reply
#2
Dear All experts,

Already got some improvement since my 1st post. But stuck here can't move forward. Any one can pick up from here? Appreciated a lot. The code from Colab will be look like this.

! git clone https://github.com/llSourcell/Q-Learning...rading.git

Cloning into 'Q-Learning-for-Trading'...
remote: Enumerating objects: 25, done.
remote: Total 25 (delta 0), reused 0 (delta 0), pack-reused 25
Unpacking objects: 100% (25/25), done.

cd /content/Q-Learning-for-Trading

/content/Q-Learning-for-Trading

!python run.py --mode train

2021-01-05 07:58:40.758674: I tensorflow/stream_executor/platform/default/dso_loader.cc:49] Successfully opened dynamic library libcudart.so.10.1
Traceback (most recent call last):
File "run.py", line 35, in <module>
env = TradingEnv(train_data, args.initial_invest)
File "/content/Q-Learning-for-Trading/envs.py", line 43, in __init__
self.observation_space = spaces.MultiDiscrete(stock_range + price_range + cash_in_hand_range)
File "/usr/local/lib/python3.6/dist-packages/gym/spaces/multi_discrete.py", line 30, in __init__
assert (np.array(nvec) > 0).all(), 'nvec (counts) have to be positive'
AssertionError: nvec (counts) have to be positive

or you may copy to the below link to access directly from Colab notebook.

https://colab.research.google.com/drive/...lrR3IJkTUU
Reply
#3
For Error :
File "/usr/local/lib/python3.6/dist-packages/gym/spaces/multi_discrete.py", line 30, in __init__
assert (np.array(nvec) > 0).all(), 'nvec (counts) have to be positive'
AssertionError: nvec (counts) have to be positive

----------------> I had the same issue, You can resolve it by downgrading Gym to 0.9.5 max
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  CoLab + GitHub constantin01 2 2,259 Apr-27-2020, 03:44 AM
Last Post: constantin01
  How come afer some iterations of gradient descent, the error starts growing? Corpac 0 1,594 Mar-20-2020, 05:20 PM
Last Post: Corpac
  Import Excel File that Starts with Number kiki1113 1 3,320 Dec-20-2018, 07:13 PM
Last Post: Larz60+

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020