amfiteatr_rl

Crates.ioamfiteatr_rl
lib.rsamfiteatr_rl
version0.11.0
created_at2024-01-15 18:14:09.782972+00
updated_at2025-06-06 13:39:14.183208+00
descriptionExtensions providing reinforcement learning implementations for `amfiteatr`
homepage
repositoryhttps://github.com/moroviintaas/amfiteatr
max_upload_size
id1100577
size321,320
(moroviintaas)

documentation

README

AmfiRL

Framework library for reinforcement learning using data model from amfi crate. Crate contains traits and generic implementation.

Torch dependency

This crate depends on tch which requires that you have Torch installed. Use guide provided by that crate.

For me the procedure looks like this:

  1. Unpacking compiled torchlib for C++/Java; You will get structure like this:
/path/to/libtorch
                | -- bin
                | -- include
                | -- lib
                | ...
  1. Set your environment variables:
export LIBTORCH=/path/to/torch
export LD_LIBRARY_PATH=/path/to/libtorch/lib

CUDA support

This crate tries to support CUDA backed tensor operations. It might be necessary to add following code in build.rs script in your crate:

fn main() {
    let os = std::env::var("CARGO_CFG_TARGET_OS").expect("Unable to get TARGET_OS");
    match os.as_str() {
        "linux" | "windows" => {
            if let Some(lib_path) = std::env::var_os("DEP_TCH_LIBTORCH_LIB") {
                println!("cargo:rustc-link-arg=-Wl,-rpath={}", lib_path.to_string_lossy());
            }
            println!("cargo:rustc-link-arg=-Wl,--no-as-needed");
            println!("cargo:rustc-link-arg=-Wl,--copy-dt-needed-entries");
            println!("cargo:rustc-link-arg=-ltorch");
        }
        _ => {}
    }
}

It solved CUDA backend problem for me link to source.

Examples

Examples are presented in separate crate - amfiteatr_examples

Licence: MIT

Commit count: 192

cargo fmt