-
-
Notifications
You must be signed in to change notification settings - Fork 120
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
34 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
[package] | ||
name = "chatgpt-pytorch" | ||
version = "0.1.0" | ||
edition = "2021" | ||
|
||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html | ||
|
||
[dependencies] | ||
tch = "0.11.0" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
# Use the official Rust image as the base image | ||
FROM rust:1.67 | ||
|
||
# Set the working directory | ||
WORKDIR /app | ||
|
||
# Install system dependencies required by PyTorch and tch-rs | ||
RUN apt-get update && \ | ||
apt-get install -y build-essential python3-dev python3-pip libopenblas-dev libopencv-dev | ||
|
||
# Copy the Rust project into the container | ||
COPY . . | ||
|
||
# Build the Rust project | ||
RUN cargo build --release | ||
|
||
# Set the command to run the binary | ||
CMD ["./target/release/chatgpt_pytorch"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
use tch::{Tensor, Kind}; | ||
|
||
fn main() { | ||
let tensor = Tensor::of_slice(&[1, 2, 3, 4]).reshape(&[2, 2]).to_kind(Kind::Float); | ||
println!("Tensor: {:?}", tensor); | ||
} |