-
Notifications
You must be signed in to change notification settings - Fork 965
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Documentation fixes and improvements #2289
base: main
Are you sure you want to change the base?
Documentation fixes and improvements #2289
Conversation
@@ -134,7 +134,7 @@ fn from_raw_data<T: super::GgmlType + Send + Sync + 'static>( | |||
super::QTensor::new(data, dims) | |||
} | |||
|
|||
/// Creates a [Tensor] from a raw GGML tensor. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
137 | /// Creates a [Tensor] from a raw GGML tensor.
| ^^^^^^ no item named `Tensor` in scope
|
= help: to escape `[` and `]` characters, add '\' before them like `\[` or `\]`
= note: `#[warn(rustdoc::broken_intra_doc_links)]` on by default
@@ -1,6 +1,6 @@ | |||
//! Support for the GGUF file format. | |||
//! | |||
//! Spec: https://github.com/philpax/ggml/blob/gguf-spec/docs/gguf.md |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
|
3 | //! Spec: https://github.com/philpax/ggml/blob/gguf-spec/docs/gguf.md
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use an automatic link instead: `<https://github.com/philpax/ggml/blob/gguf-spec/docs/gguf.md>`
|
= note: bare URLs are not automatically turned into clickable links
= note: `#[warn(rustdoc::bare_urls)]` on by default
@@ -19,6 +19,7 @@ | |||
//! ``` | |||
use candle::{Result, Tensor}; | |||
|
|||
/// See the documentation for [`mod@super::linear`] for more information. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@@ -76,6 +77,7 @@ pub fn linear_no_bias(in_dim: usize, out_dim: usize, vb: crate::VarBuilder) -> R | |||
Ok(Linear::new(ws, None)) | |||
} | |||
|
|||
/// Create or initialize a new linear layer, bias depending on the argument. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This function was the only one in the module without a line of documentation. THe function just switches between the other two based on the bias
boolean, so I just added this.
/// of categories. This is expected to contain log probabilities. | ||
/// * [target]: The ground truth labels as a tensor of u32 of dimension `N`. | ||
/// * `target`: The ground truth labels as a tensor of u32 of dimension `N`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These were all unresolved links:
warning: unresolved link to `target`
--> /home/ivor/Documents/Code/rust/playground_candle/candle/candle-nn/src/loss.rs:36:8
|
36 | /// * [target]: The ground truth labels as a tensor of u32 of dimension `N`.
| ^^^^^^ no item named `target` in scope
|
= help: to escape `[` and `]` characters, add '\' before them like `\[` or `\]`
There is no current official way to document function arguments, I followed rust-lang/rust#57525.
Rendered:
@@ -497,7 +497,7 @@ impl<'a> VarBuilder<'a> { | |||
/// | |||
/// # Safety | |||
/// | |||
/// The unsafe is inherited from [`memmap2::MmapOptions`]. | |||
/// The unsafe is inherited from [`candle::safetensors::MmapedSafetensors::multi`]. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
--> /home/ivor/Documents/Code/rust/playground_candle/candle/candle-nn/src/var_builder.rs:500:40
|
500 | /// The unsafe is inherited from [`memmap2::MmapOptions`].
| ^^^^^^^^^^^^^^^^^^^^ no item named `memmap2` in scope
|
= note: `#[warn(rustdoc::broken_intra_doc_links)]` on by default
Presumably a copy paste from the documentation of multi itself, changed to point at the reason why this function is unsafe.
I ended up on the documentation page for Linear which surprisingly didn't have any documentation on what that layer does. Only after reading the code did I see that the documentation lives in the module itself.
To test my newly added link, I ended up building the documentation, which showed several other warnings that I address in this PR as well, I'll comment why changes were warranted throughout my PR after I file it.
Edit: Forgot to say, but with these changes the documentation builds cleanly.