Skip to content

Four fixes for RASP Tutorial (#391)#458

Closed
MisterTea wants to merge 1 commit intofacebookresearch:masterfrom
MisterTea:export-D27842451
Closed

Four fixes for RASP Tutorial (#391)#458
MisterTea wants to merge 1 commit intofacebookresearch:masterfrom
MisterTea:export-D27842451

Conversation

@MisterTea
Copy link
Contributor

Summary:
When trying to follow the tutorial there are a few things that need fixing:

  1. When running the script serving/scripts/rasp_to_model.py I came across this error
python serving/scripts/rasp_to_model.py /tmp/rasp_logging/log.txt /tmp/input_df.pkl

Traceback (most recent call last):
  File "serving/scripts/rasp_to_model.py", line 13, in <module>
    logger.setLevel(logging.info)
  File "/usr/local/anaconda3/envs/reagent/lib/python3.7/logging/__init__.py", line 1353, in setLevel
    self.level = _checkLevel(level)
  File "/usr/local/anaconda3/envs/reagent/lib/python3.7/logging/__init__.py", line 195, in _checkLevel
    raise TypeError("Level not an integer or a valid string: %r" % level)
TypeError: Level not an integer or a valid string: <function info at 0x7fb8000d73b0>

Luckily it is an easy fix to pass an actual loglevel.

  1. This config file probably is outdated: serving/examples/ecommerce/training/contextual_bandit.yaml
  • changed indentation level
  • changed key name
  1. There is an init.py file missing in the gym tests therefore leading to an error

  2. The path to the SPARK_JAR was not resolving correctly.

Pull Request resolved: #391

Test Plan:
Imported from GitHub, without a Test Plan: line.
...but without running open source tests.

Reviewed By: czxttkl

Differential Revision: D27842451

Pulled By: MisterTea

Summary:
When trying to follow the [tutorial](https://reagent.ai/rasp_tutorial.html) there are a few things that need fixing:

1. When running the script serving/scripts/rasp_to_model.py I came across this error

```
python serving/scripts/rasp_to_model.py /tmp/rasp_logging/log.txt /tmp/input_df.pkl

Traceback (most recent call last):
  File "serving/scripts/rasp_to_model.py", line 13, in <module>
    logger.setLevel(logging.info)
  File "/usr/local/anaconda3/envs/reagent/lib/python3.7/logging/__init__.py", line 1353, in setLevel
    self.level = _checkLevel(level)
  File "/usr/local/anaconda3/envs/reagent/lib/python3.7/logging/__init__.py", line 195, in _checkLevel
    raise TypeError("Level not an integer or a valid string: %r" % level)
TypeError: Level not an integer or a valid string: <function info at 0x7fb8000d73b0>
```

Luckily it is an easy fix to pass an actual loglevel.

2. This config file probably is outdated: serving/examples/ecommerce/training/contextual_bandit.yaml
- changed indentation level
- changed key name

3. There is an __init__.py file missing in the gym tests therefore leading to an error

4. The path to the SPARK_JAR was not resolving correctly.

Pull Request resolved: facebookresearch#391

Test Plan:
Imported from GitHub, without a `Test Plan:` line.
...but without running open source tests.

Reviewed By: czxttkl

Differential Revision: D27842451

Pulled By: MisterTea

fbshipit-source-id: 1531981ae918c05c9d5e844928eed8d12002ea1d
@facebook-github-bot
Copy link

This pull request was exported from Phabricator. Differential Revision: D27842451

@facebook-github-bot
Copy link

@MisterTea merged this pull request in 322a542.

@ebraheemf
Copy link

Hello @MisterTea,

When I try to run the contextual bandit section of the demo:
python serving/examples/ecommerce/customer_simulator.py contextual_bandit.json

The RASP server is throwing the following error:
[F PytorchActionValueScorer.cpp:74] TORCH ERROR: forward() Expected a value of type '__torch__.reagent.core.types.ServingFeatureData' for argument 'state' but instead found type 'Tuple[Tensor, Tensor]'.

so I believe there are more changes needed to the format the data from the /api/request endpoint into the model?

xuruiyang pushed a commit that referenced this pull request Sep 20, 2025
Summary:
Pull Request resolved: #458

When trying to follow the [tutorial](https://reagent.ai/rasp_tutorial.html) there are a few things that need fixing:

1. When running the script serving/scripts/rasp_to_model.py I came across this error

```
python serving/scripts/rasp_to_model.py /tmp/rasp_logging/log.txt /tmp/input_df.pkl

Traceback (most recent call last):
  File "serving/scripts/rasp_to_model.py", line 13, in <module>
    logger.setLevel(logging.info)
  File "/usr/local/anaconda3/envs/reagent/lib/python3.7/logging/__init__.py", line 1353, in setLevel
    self.level = _checkLevel(level)
  File "/usr/local/anaconda3/envs/reagent/lib/python3.7/logging/__init__.py", line 195, in _checkLevel
    raise TypeError("Level not an integer or a valid string: %r" % level)
TypeError: Level not an integer or a valid string: <function info at 0x7fb8000d73b0>
```

Luckily it is an easy fix to pass an actual loglevel.

2. This config file probably is outdated: serving/examples/ecommerce/training/contextual_bandit.yaml
- changed indentation level
- changed key name

3. There is an __init__.py file missing in the gym tests therefore leading to an error

4. The path to the SPARK_JAR was not resolving correctly.

Pull Request resolved: #391

Test Plan:
Imported from GitHub, without a `Test Plan:` line.
...but without running open source tests.

Reviewed By: czxttkl

Differential Revision: D27842451

Pulled By: MisterTea

fbshipit-source-id: 2175296c6b60db4dc4b22804a74c2259b14fee7e
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants