Skip to content

Instantly share code, notes, and snippets.

Avatar

Paco Nathan ceteri

View GitHub Profile
@ceteri
ceteri / words.py
Created May 6, 2022
anagram words
View words.py
import pathlib
import sys
from icecream import ic
import requests
term = "weather"
words = set([])
@ceteri
ceteri / p.py
Last active Jan 22, 2022
pytextrank#196 DE lang model
View p.py
import spacy
import pytextrank
# example text
text = "Compatibility of systems of linear constraints over the set of natural numbers. Criteria of compatibility of a system of linear Diophantine equations, strict inequations, and nonstrict inequations are considered. Upper bounds for components of a minimal set of solutions and algorithms of construction of minimal generating sets of solutions for all types of systems are given. These criteria and the corresponding algorithms for constructing a minimal supporting set of solutions can be used in solving all the considered types systems and systems of mixed types."
# load a spaCy model, depending on language, scale, etc.
nlp = spacy.load("de_core_news_sm")
# add PyTextRank to the spaCy pipeline
View rl28.txt
1 reward 0.00/ 0.02/ 1.00 len 7.83 saved tmp/ppo/froz/checkpoint_1/checkpoint-1
2 reward 0.00/ 0.02/ 1.00 len 7.40 saved tmp/ppo/froz/checkpoint_2/checkpoint-2
3 reward 0.00/ 0.02/ 1.00 len 7.21 saved tmp/ppo/froz/checkpoint_3/checkpoint-3
4 reward 0.00/ 0.03/ 1.00 len 7.36 saved tmp/ppo/froz/checkpoint_4/checkpoint-4
5 reward 0.00/ 0.03/ 1.00 len 7.26 saved tmp/ppo/froz/checkpoint_5/checkpoint-5
6 reward 0.00/ 0.05/ 1.00 len 7.57 saved tmp/ppo/froz/checkpoint_6/checkpoint-6
7 reward 0.00/ 0.05/ 1.00 len 7.82 saved tmp/ppo/froz/checkpoint_7/checkpoint-7
8 reward 0.00/ 0.07/ 1.00 len 7.42 saved tmp/ppo/froz/checkpoint_8/checkpoint-8
9 reward 0.00/ 0.07/ 1.00 len 7.87 saved tmp/ppo/froz/checkpoint_9/checkpoint-9
10 reward 0.00/ 0.09/ 1.00 len 8.84 saved tmp/ppo/froz/checkpoint_10/checkpoint-10
View rl27.txt
1 reward -902.00/-751.75/-345.00 len 194.80 saved tmp/ppo/taxi/checkpoint_1/checkpoint-1
2 reward -902.00/-751.85/-345.00 len 193.70 saved tmp/ppo/taxi/checkpoint_2/checkpoint-2
3 reward -902.00/-725.72/-340.00 len 193.00 saved tmp/ppo/taxi/checkpoint_3/checkpoint-3
4 reward -902.00/-705.04/-151.00 len 192.59 saved tmp/ppo/taxi/checkpoint_4/checkpoint-4
5 reward -902.00/-682.85/-151.00 len 192.62 saved tmp/ppo/taxi/checkpoint_5/checkpoint-5
6 reward -902.00/-643.69/-128.00 len 190.27 saved tmp/ppo/taxi/checkpoint_6/checkpoint-6
7 reward -902.00/-585.58/-78.00 len 185.95 saved tmp/ppo/taxi/checkpoint_7/checkpoint-7
8 reward -794.00/-524.43/-21.00 len 176.76 saved tmp/ppo/taxi/checkpoint_8/checkpoint-8
9 reward -794.00/-482.32/-21.00 len 172.15 saved tmp/ppo/taxi/checkpoint_9/checkpoint-9
10 reward -713.00/-443.42/-21.00 len 166.61 saved tmp/ppo/taxi/checkpoint_10/checkpoint-10
View rl26.txt
1 reward -200.00/-200.00/-200.00 len 200.00 saved tmp/ppo/moun/checkpoint_1/checkpoint-1
2 reward -200.00/-200.00/-200.00 len 200.00 saved tmp/ppo/moun/checkpoint_2/checkpoint-2
3 reward -200.00/-200.00/-200.00 len 200.00 saved tmp/ppo/moun/checkpoint_3/checkpoint-3
4 reward -200.00/-200.00/-200.00 len 200.00 saved tmp/ppo/moun/checkpoint_4/checkpoint-4
5 reward -200.00/-200.00/-200.00 len 200.00 saved tmp/ppo/moun/checkpoint_5/checkpoint-5
6 reward -200.00/-200.00/-200.00 len 200.00 saved tmp/ppo/moun/checkpoint_6/checkpoint-6
7 reward -200.00/-200.00/-200.00 len 200.00 saved tmp/ppo/moun/checkpoint_7/checkpoint-7
8 reward -200.00/-200.00/-200.00 len 200.00 saved tmp/ppo/moun/checkpoint_8/checkpoint-8
9 reward -200.00/-200.00/-200.00 len 200.00 saved tmp/ppo/moun/checkpoint_9/checkpoint-9
View rl25.txt
1 reward 9.00/ 22.65/ 63.00 len 22.65 saved tmp/ppo/cart/checkpoint_1/checkpoint-1
2 reward 12.00/ 42.72/151.00 len 42.72 saved tmp/ppo/cart/checkpoint_2/checkpoint-2
3 reward 12.00/ 68.17/322.00 len 68.17 saved tmp/ppo/cart/checkpoint_3/checkpoint-3
4 reward 13.00/ 97.87/408.00 len 97.87 saved tmp/ppo/cart/checkpoint_4/checkpoint-4
5 reward 13.00/131.53/500.00 len 131.53 saved tmp/ppo/cart/checkpoint_5/checkpoint-5
6 reward 13.00/165.24/500.00 len 165.24 saved tmp/ppo/cart/checkpoint_6/checkpoint-6
7 reward 13.00/202.48/500.00 len 202.48 saved tmp/ppo/cart/checkpoint_7/checkpoint-7
8 reward 22.00/233.83/500.00 len 233.83 saved tmp/ppo/cart/checkpoint_8/checkpoint-8
9 reward 22.00/271.82/500.00 len 271.82 saved tmp/ppo/cart/checkpoint_9/checkpoint-9
10 reward 22.00/302.99/500.00 len 302.99 saved tmp/ppo/cart/checkpoint_10/checkpoint-10
View rl24.sh
rllib rollout \
 tmp/ppo/moun/checkpoint_40/checkpoint-40 \
 - config "{\"env\": \"MountainCar-v0\"}" \
 - run PPO \
 - steps 2000
View rl23.txt
_____________________________________________________________________________
Layer (type) Output Shape Param # Connected to
=============================================================================
observations (InputLayer) [(None, 2)] 0 
_____________________________________________________________________________
fc_1 (Dense) (None, 256) 768 observations[0][0]
_____________________________________________________________________________
fc_value_1 (Dense) (None, 256) 768 observations[0][0]
_____________________________________________________________________________
fc_2 (Dense) (None, 256) 65792 fc_1[0][0] 
View rl22.py
SELECT_ENV = "MountainCar-v0"
config = ppo.DEFAULT_CONFIG.copy()
config["log_level"] = "WARN"
config["num_workers"] = 4 # default = 2
config["train_batch_size"] = 10000 # default = 4000
config["sgd_minibatch_size"] = 256 # default = 128
config["evaluation_num_episodes"] = 50 # default = 10
View rl21.py
CHECKPOINT_ROOT = "tmp/ppo/moun"
shutil.rmtree(CHECKPOINT_ROOT, ignore_errors=True, onerror=None)
ray_results = os.getenv("HOME") + "/ray_results/"
shutil.rmtree(ray_results, ignore_errors=True, onerror=None)